Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scripts/aggregate-manifests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readFileSync, writeFileSync } from "fs";
import { glob } from "glob";
import yaml from "js-yaml";
import { load, dump } from "js-yaml";
import path from "path";
import { fileURLToPath } from "url";

Expand Down Expand Up @@ -64,7 +64,7 @@ async function main() {
for (const file of manifestFiles.sort()) {
const fullPath = path.join(SAMPLES, file);
const content = readFileSync(fullPath, "utf-8");
const manifest = yaml.load(content) as FrameworkManifest;
const manifest = load(content) as FrameworkManifest;

frameworks[manifest.framework] = {
label: manifest.label,
Expand Down Expand Up @@ -110,10 +110,10 @@ async function main() {
);

const output = { frameworks: orderedFrameworks, scenarios };
const yamlStr = yaml.dump(output, {
const yamlStr = dump(output, {
lineWidth: 120,
noRefs: true,
quotingType: '"',
quoteStyle: "double",
});
const outputPath = path.join(ROOT, "snippet-manifest.yaml");
writeFileSync(
Expand Down
24 changes: 15 additions & 9 deletions scripts/extract-snippets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readdirSync, readFileSync, writeFileSync } from "fs";
import { glob } from "glob";
import yaml from "js-yaml";
import { load } from "js-yaml";
import path from "path";
import { fileURLToPath } from "url";

Expand Down Expand Up @@ -62,7 +62,7 @@ function getPlaceholderMap(): PlaceholderMap {
path.join(ROOT, "placeholder-map.yaml"),
"utf-8",
);
return yaml.load(content) as PlaceholderMap;
return load(content) as PlaceholderMap;
}

function applyPlaceholders(
Expand All @@ -84,7 +84,7 @@ function getLibVersion(
manifestDir: string,
libOverride?: string,
): string {
const manifest = yaml.load(
const manifest = load(
readFileSync(path.join(manifestDir, "manifest.yaml"), "utf-8"),
) as FrameworkManifest;
const lib = libOverride ?? manifest.lib;
Expand Down Expand Up @@ -135,7 +135,7 @@ function getLibVersion(

// Flutter — pubspec.yaml dependencies
try {
const pubspec = yaml.load(
const pubspec = load(
readFileSync(path.join(scenarioDir, "pubspec.yaml"), "utf-8"),
) as { dependencies?: Record<string, unknown> };
const dep = pubspec?.dependencies?.[lib];
Expand Down Expand Up @@ -223,9 +223,11 @@ function getLibVersion(
// lives inside *.xcworkspace/, which is typically gitignored, so CI checkouts
// can't see it; project.yml is the committed source of truth for SPM pins.
try {
const projectYml = yaml.load(
const projectYml = load(
readFileSync(path.join(scenarioDir, "project.yml"), "utf-8"),
) as { packages?: Record<string, { url?: string; from?: string | number }> };
) as {
packages?: Record<string, { url?: string; from?: string | number }>;
};
const libLower = lib.toLowerCase();
for (const [name, pkg] of Object.entries(projectYml?.packages ?? {})) {
const url = (pkg?.url || "").toLowerCase();
Expand Down Expand Up @@ -291,7 +293,9 @@ function getLibVersion(
if (module === libLower) {
// Extract version.ref or version from this entry
const entry = libMatch[0];
const versionRefMatch = entry.match(/version\.ref\s*=\s*["']([^"']+)["']/);
const versionRefMatch = entry.match(
/version\.ref\s*=\s*["']([^"']+)["']/,
);
if (versionRefMatch) {
const ref = versionRefMatch[1];
const versionLineRegex = new RegExp(
Expand All @@ -301,7 +305,9 @@ function getLibVersion(
const vMatch = versionsBlock.match(versionLineRegex);
if (vMatch) return vMatch[1];
}
const versionMatch = entry.match(/version\s*=\s*["']([0-9][^"']+)["']/);
const versionMatch = entry.match(
/version\s*=\s*["']([0-9][^"']+)["']/,
);
if (versionMatch) return versionMatch[1];
}
}
Expand Down Expand Up @@ -439,7 +445,7 @@ async function main() {
for (const manifestFile of manifestFiles.sort()) {
const frameworkDir = path.join(SAMPLES, path.dirname(manifestFile));
const content = readFileSync(path.join(SAMPLES, manifestFile), "utf-8");
const manifest = yaml.load(content) as FrameworkManifest;
const manifest = load(content) as FrameworkManifest;
const fw = manifest.framework;
const lang = manifest.lang;

Expand Down
3 changes: 1 addition & 2 deletions scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
},
"dependencies": {
"glob": "13.0.6",
"js-yaml": "4.2.0",
"js-yaml": "5.1.0",
"tsx": "4.22.4"
},
"devDependencies": {
"@types/js-yaml": "4.0.9",
"@types/node": "26.0.1",
"typescript": "6.0.3"
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/validate-structure.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { existsSync, readFileSync } from "fs";
import { glob } from "glob";
import yaml from "js-yaml";
import { load } from "js-yaml";
import path from "path";
import { fileURLToPath } from "url";

Expand Down Expand Up @@ -41,7 +41,7 @@ async function main() {
for (const manifestFile of manifestFiles) {
const frameworkDir = path.join(SAMPLES, path.dirname(manifestFile));
const content = readFileSync(path.join(SAMPLES, manifestFile), "utf-8");
const manifest = yaml.load(content) as FrameworkManifest;
const manifest = load(content) as FrameworkManifest;

for (const scenarioId of Object.keys(manifest.scenarios)) {
const dirName = scenarioId.replace(/^[^_]+_/, "").replaceAll("_", "-");
Expand Down
20 changes: 6 additions & 14 deletions scripts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ __metadata:
version: 0.0.0-use.local
resolution: "@ciam-quickstart/scripts@workspace:."
dependencies:
"@types/js-yaml": "npm:4.0.9"
"@types/node": "npm:26.0.1"
glob: "npm:13.0.6"
js-yaml: "npm:4.2.0"
js-yaml: "npm:5.1.0"
tsx: "npm:4.22.4"
typescript: "npm:6.0.3"
languageName: unknown
Expand Down Expand Up @@ -245,13 +244,6 @@ __metadata:
languageName: node
linkType: hard

"@types/js-yaml@npm:4.0.9":
version: 4.0.9
resolution: "@types/js-yaml@npm:4.0.9"
checksum: 10c0/24de857aa8d61526bbfbbaa383aa538283ad17363fcd5bb5148e2c7f604547db36646440e739d78241ed008702a8920665d1add5618687b6743858fae00da211
languageName: node
linkType: hard

"@types/node@npm:26.0.1":
version: 26.0.1
resolution: "@types/node@npm:26.0.1"
Expand Down Expand Up @@ -546,14 +538,14 @@ __metadata:
languageName: node
linkType: hard

"js-yaml@npm:4.2.0":
version: 4.2.0
resolution: "js-yaml@npm:4.2.0"
"js-yaml@npm:5.1.0":
version: 5.1.0
resolution: "js-yaml@npm:5.1.0"
dependencies:
argparse: "npm:^2.0.1"
bin:
js-yaml: bin/js-yaml.js
checksum: 10c0/1916456c118746603b067d74bbcbb0445d9a1d5e474ad4ae775e7b20525bed902e01d9d97dd0c81fcd8d4f596162309d0eb057f4aa38f3e9647f14075e9dea45
js-yaml: bin/js-yaml.mjs
checksum: 10c0/a21c3817fb736ab3215c9d1ffb0a94823d02ecb51b481e88ab4bf0f9522baccbe9168bdf265bc315124d5087e2261de93e56176c2a7cd589d8275a18d7b3316e
languageName: node
linkType: hard

Expand Down