11import { readdirSync , readFileSync , writeFileSync } from "fs" ;
22import { glob } from "glob" ;
3- import yaml from "js-yaml" ;
3+ import { load } from "js-yaml" ;
44import path from "path" ;
55import { fileURLToPath } from "url" ;
66
@@ -62,7 +62,7 @@ function getPlaceholderMap(): PlaceholderMap {
6262 path . join ( ROOT , "placeholder-map.yaml" ) ,
6363 "utf-8" ,
6464 ) ;
65- return yaml . load ( content ) as PlaceholderMap ;
65+ return load ( content ) as PlaceholderMap ;
6666}
6767
6868function applyPlaceholders (
@@ -84,7 +84,7 @@ function getLibVersion(
8484 manifestDir : string ,
8585 libOverride ?: string ,
8686) : string {
87- const manifest = yaml . load (
87+ const manifest = load (
8888 readFileSync ( path . join ( manifestDir , "manifest.yaml" ) , "utf-8" ) ,
8989 ) as FrameworkManifest ;
9090 const lib = libOverride ?? manifest . lib ;
@@ -135,7 +135,7 @@ function getLibVersion(
135135
136136 // Flutter — pubspec.yaml dependencies
137137 try {
138- const pubspec = yaml . load (
138+ const pubspec = load (
139139 readFileSync ( path . join ( scenarioDir , "pubspec.yaml" ) , "utf-8" ) ,
140140 ) as { dependencies ?: Record < string , unknown > } ;
141141 const dep = pubspec ?. dependencies ?. [ lib ] ;
@@ -223,9 +223,11 @@ function getLibVersion(
223223 // lives inside *.xcworkspace/, which is typically gitignored, so CI checkouts
224224 // can't see it; project.yml is the committed source of truth for SPM pins.
225225 try {
226- const projectYml = yaml . load (
226+ const projectYml = load (
227227 readFileSync ( path . join ( scenarioDir , "project.yml" ) , "utf-8" ) ,
228- ) as { packages ?: Record < string , { url ?: string ; from ?: string | number } > } ;
228+ ) as {
229+ packages ?: Record < string , { url ?: string ; from ?: string | number } > ;
230+ } ;
229231 const libLower = lib . toLowerCase ( ) ;
230232 for ( const [ name , pkg ] of Object . entries ( projectYml ?. packages ?? { } ) ) {
231233 const url = ( pkg ?. url || "" ) . toLowerCase ( ) ;
@@ -291,7 +293,9 @@ function getLibVersion(
291293 if ( module === libLower ) {
292294 // Extract version.ref or version from this entry
293295 const entry = libMatch [ 0 ] ;
294- const versionRefMatch = entry . match ( / v e r s i o n \. r e f \s * = \s * [ " ' ] ( [ ^ " ' ] + ) [ " ' ] / ) ;
296+ const versionRefMatch = entry . match (
297+ / v e r s i o n \. r e f \s * = \s * [ " ' ] ( [ ^ " ' ] + ) [ " ' ] / ,
298+ ) ;
295299 if ( versionRefMatch ) {
296300 const ref = versionRefMatch [ 1 ] ;
297301 const versionLineRegex = new RegExp (
@@ -301,7 +305,9 @@ function getLibVersion(
301305 const vMatch = versionsBlock . match ( versionLineRegex ) ;
302306 if ( vMatch ) return vMatch [ 1 ] ;
303307 }
304- const versionMatch = entry . match ( / v e r s i o n \s * = \s * [ " ' ] ( [ 0 - 9 ] [ ^ " ' ] + ) [ " ' ] / ) ;
308+ const versionMatch = entry . match (
309+ / v e r s i o n \s * = \s * [ " ' ] ( [ 0 - 9 ] [ ^ " ' ] + ) [ " ' ] / ,
310+ ) ;
305311 if ( versionMatch ) return versionMatch [ 1 ] ;
306312 }
307313 }
@@ -439,7 +445,7 @@ async function main() {
439445 for ( const manifestFile of manifestFiles . sort ( ) ) {
440446 const frameworkDir = path . join ( SAMPLES , path . dirname ( manifestFile ) ) ;
441447 const content = readFileSync ( path . join ( SAMPLES , manifestFile ) , "utf-8" ) ;
442- const manifest = yaml . load ( content ) as FrameworkManifest ;
448+ const manifest = load ( content ) as FrameworkManifest ;
443449 const fw = manifest . framework ;
444450 const lang = manifest . lang ;
445451
0 commit comments