@webiny/cli-core 0.0.0-unstable.7c2def32a7 → 0.0.0-unstable.9609e4e0c9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/DepsSync/DependencyTree.js","sources":["../../../src/features/DepsSync/DependencyTree.ts"],"sourcesContent":["import semver from \"semver\";\nimport type {\n IDependency,\n IDependencyTree,\n IDependencyTreePushParams,\n IReference\n} from \"./types.js\";\nimport { PackageType } from \"./types.js\";\n\nconst keys = [\n PackageType.dependencies,\n PackageType.devDependencies,\n PackageType.peerDependencies,\n PackageType.resolutions\n];\n\ninterface IAddReferenceParams {\n name: string;\n version: string;\n file: string;\n type: PackageType;\n}\n\ninterface ISortItem {\n name: string;\n}\n\nconst sortByName = (a: ISortItem, b: ISortItem) => {\n return a.name.localeCompare(b.name);\n};\n\nexport class DependencyTree implements IDependencyTree {\n private readonly packages: Record<(typeof keys)[number], IDependency[]> = {\n resolutions: [],\n dependencies: [],\n devDependencies: [],\n peerDependencies: []\n };\n public readonly references: IReference[] = [];\n\n public get dependencies(): IDependency[] {\n return this.packages.dependencies.sort(sortByName);\n }\n\n public get devDependencies(): IDependency[] {\n return this.packages.devDependencies.sort(sortByName);\n }\n\n public get peerDependencies(): IDependency[] {\n return this.packages.peerDependencies.sort(sortByName);\n }\n\n public get resolutions(): IDependency[] {\n return this.packages.resolutions.sort(sortByName);\n }\n\n public get duplicates(): IReference[] {\n return this.references\n .filter(reference => {\n return reference.versions.length > 1;\n })\n .sort(sortByName);\n }\n\n public push(params: IDependencyTreePushParams): void {\n const { file, json, ignore } = params;\n for (const key of keys) {\n const dependencies = json[key];\n if (!dependencies) {\n continue;\n }\n\n for (const name in dependencies) {\n if (ignore && name.match(ignore) !== null) {\n continue;\n }\n let version = dependencies[name];\n if (!version) {\n continue;\n }\n\n const semverVersion =\n semver.validRange(version) || version === \"beta\" ? version : null;\n if (!semverVersion) {\n process.env.DEBUG === \"true\" &&\n console.debug(\n `${version} is not a valid SemVer value in ${file}, package ${name}.`\n );\n continue;\n }\n /**\n * Let's skip if version starts with >= or <=, as those are not exact versions and we can't be sure which version is actually used.\n */\n if (version.startsWith(\">=\") || version.startsWith(\"<=\")) {\n process.env.DEBUG === \"true\" &&\n console.debug(\n `${version} is not an exact version in ${file}, package ${name}. Skipping.`\n );\n continue;\n }\n\n version = version\n .replace(/\\^/g, \"\")\n .replace(/~/g, \"\")\n .replace(/>/g, \"\")\n .replace(/</g, \"\")\n .replace(/=/g, \"\");\n const existing = this.packages[key].find(item => {\n return item.name === name && item.version === version;\n });\n if (existing) {\n existing.files.push(file);\n this.addReference({\n name,\n version,\n file,\n type: key\n });\n continue;\n }\n\n this.packages[key].push({\n name,\n version,\n files: [file]\n });\n this.addReference({\n name,\n version,\n file,\n type: key\n });\n }\n }\n }\n\n private addReference(ref: IAddReferenceParams): void {\n const existing = this.references.find(item => {\n return item.name === ref.name;\n });\n const types = [ref.type];\n if (!existing) {\n this.references.push({\n name: ref.name,\n versions: [\n {\n version: ref.version,\n files: [\n {\n file: ref.file,\n types\n }\n ]\n }\n ]\n });\n return;\n }\n const existingVersion = existing.versions.find(item => {\n return item.version === ref.version;\n });\n if (!existingVersion) {\n existing.versions.push({\n version: ref.version,\n files: [\n {\n file: ref.file,\n types\n }\n ]\n });\n return;\n }\n const existingFile = existingVersion.files.find(item => {\n return item.file === ref.file;\n });\n if (!existingFile) {\n existingVersion.files.push({\n file: ref.file,\n types\n });\n return;\n } else if (existingFile.types.includes(ref.type)) {\n return;\n }\n existingFile.types.push(ref.type);\n }\n}\n"],"names":["keys","PackageType","sortByName","a","b","DependencyTree","reference","params","file","json","ignore","key","dependencies","name","version","semverVersion","semver","process","console","existing","item","ref","types","existingVersion","existingFile"],"mappings":";;AASA,MAAMA,OAAO;IACTC,YAAY,YAAY;IACxBA,YAAY,eAAe;IAC3BA,YAAY,gBAAgB;IAC5BA,YAAY,WAAW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AO,KAAKC,IAAI,OAAO;QAEvC,IAAI,CAACE,iBAAiB,YAClBJ,SAAS,QAAQ,CAAC,IAAI,CAAC;YACnB,SAASE,IAAI,OAAO;YACpB,OAAO;gBACH;oBACI,MAAMA,IAAI,IAAI;oBACdC;gBACJ;aACH;QACL;QAGJ,MAAME,eAAeD,gBAAgB,KAAK,CAAC,IAAI,CAACH,CAAAA,OACrCA,KAAK,IAAI,KAAKC,IAAI,IAAI;QAEjC,IAAI,CAACG,cAAc,YACfD,gBAAgB,KAAK,CAAC,IAAI,CAAC;YACvB,MAAMF,IAAI,IAAI;YACdC;QACJ;
|
|
1
|
+
{"version":3,"file":"features/DepsSync/DependencyTree.js","sources":["../../../src/features/DepsSync/DependencyTree.ts"],"sourcesContent":["import semver from \"semver\";\nimport type {\n IDependency,\n IDependencyTree,\n IDependencyTreePushParams,\n IReference\n} from \"./types.js\";\nimport { PackageType } from \"./types.js\";\n\nconst keys = [\n PackageType.dependencies,\n PackageType.devDependencies,\n PackageType.peerDependencies,\n PackageType.resolutions\n];\n\ninterface IAddReferenceParams {\n name: string;\n version: string;\n file: string;\n type: PackageType;\n}\n\ninterface ISortItem {\n name: string;\n}\n\nconst sortByName = (a: ISortItem, b: ISortItem) => {\n return a.name.localeCompare(b.name);\n};\n\nexport class DependencyTree implements IDependencyTree {\n private readonly packages: Record<(typeof keys)[number], IDependency[]> = {\n resolutions: [],\n dependencies: [],\n devDependencies: [],\n peerDependencies: []\n };\n public readonly references: IReference[] = [];\n\n public get dependencies(): IDependency[] {\n return this.packages.dependencies.sort(sortByName);\n }\n\n public get devDependencies(): IDependency[] {\n return this.packages.devDependencies.sort(sortByName);\n }\n\n public get peerDependencies(): IDependency[] {\n return this.packages.peerDependencies.sort(sortByName);\n }\n\n public get resolutions(): IDependency[] {\n return this.packages.resolutions.sort(sortByName);\n }\n\n public get duplicates(): IReference[] {\n return this.references\n .filter(reference => {\n return reference.versions.length > 1;\n })\n .sort(sortByName);\n }\n\n public push(params: IDependencyTreePushParams): void {\n const { file, json, ignore } = params;\n for (const key of keys) {\n const dependencies = json[key];\n if (!dependencies) {\n continue;\n }\n\n for (const name in dependencies) {\n if (ignore && name.match(ignore) !== null) {\n continue;\n }\n let version = dependencies[name];\n if (!version) {\n continue;\n }\n\n const semverVersion =\n semver.validRange(version) || version === \"beta\" ? version : null;\n if (!semverVersion) {\n process.env.DEBUG === \"true\" &&\n console.debug(\n `${version} is not a valid SemVer value in ${file}, package ${name}.`\n );\n continue;\n }\n /**\n * Let's skip if version starts with >= or <=, as those are not exact versions and we can't be sure which version is actually used.\n */\n if (version.startsWith(\">=\") || version.startsWith(\"<=\")) {\n process.env.DEBUG === \"true\" &&\n console.debug(\n `${version} is not an exact version in ${file}, package ${name}. Skipping.`\n );\n continue;\n }\n\n version = version\n .replace(/\\^/g, \"\")\n .replace(/~/g, \"\")\n .replace(/>/g, \"\")\n .replace(/</g, \"\")\n .replace(/=/g, \"\");\n const existing = this.packages[key].find(item => {\n return item.name === name && item.version === version;\n });\n if (existing) {\n existing.files.push(file);\n this.addReference({\n name,\n version,\n file,\n type: key\n });\n continue;\n }\n\n this.packages[key].push({\n name,\n version,\n files: [file]\n });\n this.addReference({\n name,\n version,\n file,\n type: key\n });\n }\n }\n }\n\n private addReference(ref: IAddReferenceParams): void {\n const existing = this.references.find(item => {\n return item.name === ref.name;\n });\n const types = [ref.type];\n if (!existing) {\n this.references.push({\n name: ref.name,\n versions: [\n {\n version: ref.version,\n files: [\n {\n file: ref.file,\n types\n }\n ]\n }\n ]\n });\n return;\n }\n const existingVersion = existing.versions.find(item => {\n return item.version === ref.version;\n });\n if (!existingVersion) {\n existing.versions.push({\n version: ref.version,\n files: [\n {\n file: ref.file,\n types\n }\n ]\n });\n return;\n }\n const existingFile = existingVersion.files.find(item => {\n return item.file === ref.file;\n });\n if (!existingFile) {\n existingVersion.files.push({\n file: ref.file,\n types\n });\n return;\n } else if (existingFile.types.includes(ref.type)) {\n return;\n }\n existingFile.types.push(ref.type);\n }\n}\n"],"names":["keys","PackageType","sortByName","a","b","DependencyTree","reference","params","file","json","ignore","key","dependencies","name","version","semverVersion","semver","process","console","existing","item","ref","types","existingVersion","existingFile"],"mappings":";;AASA,MAAMA,OAAO;IACTC,YAAY,YAAY;IACxBA,YAAY,eAAe;IAC3BA,YAAY,gBAAgB;IAC5BA,YAAY,WAAW;CAC1B;AAaD,MAAMC,aAAa,CAACC,GAAcC,IACvBD,EAAE,IAAI,CAAC,aAAa,CAACC,EAAE,IAAI;AAG/B,MAAMC;IAST,IAAW,eAA8B;QACrC,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAACH;IAC3C;IAEA,IAAW,kBAAiC;QACxC,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAACA;IAC9C;IAEA,IAAW,mBAAkC;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAACA;IAC/C;IAEA,IAAW,cAA6B;QACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAACA;IAC1C;IAEA,IAAW,aAA2B;QAClC,OAAO,IAAI,CAAC,UAAU,CACjB,MAAM,CAACI,CAAAA,YACGA,UAAU,QAAQ,CAAC,MAAM,GAAG,GAEtC,IAAI,CAACJ;IACd;IAEO,KAAKK,MAAiC,EAAQ;QACjD,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,EAAE,GAAGH;QAC/B,KAAK,MAAMI,OAAOX,KAAM;YACpB,MAAMY,eAAeH,IAAI,CAACE,IAAI;YAC9B,IAAKC,cAIL,IAAK,MAAMC,QAAQD,aAAc;gBAC7B,IAAIF,UAAUG,AAAuB,SAAvBA,KAAK,KAAK,CAACH,SACrB;gBAEJ,IAAII,UAAUF,YAAY,CAACC,KAAK;gBAChC,IAAI,CAACC,SACD;gBAGJ,MAAMC,gBACFC,OAAO,UAAU,CAACF,YAAYA,AAAY,WAAZA,UAAqBA,UAAU;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B,MAAME,IAAI,IAAI;YACd,UAAU;gBACN;oBACI,SAASA,IAAI,OAAO;oBACpB,OAAO;wBACH;4BACI,MAAMA,IAAI,IAAI;4BACdC;wBACJ;qBACH;gBACL;aACH;QACL;QAGJ,MAAMC,kBAAkBJ,SAAS,QAAQ,CAAC,IAAI,CAACC,CAAAA,OACpCA,KAAK,OAAO,KAAKC,IAAI,OAAO;QAEvC,IAAI,CAACE,iBAAiB,YAClBJ,SAAS,QAAQ,CAAC,IAAI,CAAC;YACnB,SAASE,IAAI,OAAO;YACpB,OAAO;gBACH;oBACI,MAAMA,IAAI,IAAI;oBACdC;gBACJ;aACH;QACL;QAGJ,MAAME,eAAeD,gBAAgB,KAAK,CAAC,IAAI,CAACH,CAAAA,OACrCA,KAAK,IAAI,KAAKC,IAAI,IAAI;QAEjC,IAAI,CAACG,cAAc,YACfD,gBAAgB,KAAK,CAAC,IAAI,CAAC;YACvB,MAAMF,IAAI,IAAI;YACdC;QACJ;aAEG,IAAIE,aAAa,KAAK,CAAC,QAAQ,CAACH,IAAI,IAAI,GAC3C;QAEJG,aAAa,KAAK,CAAC,IAAI,CAACH,IAAI,IAAI;IACpC;;aA1JiB,QAAQ,GAAiD;YACtE,aAAa,EAAE;YACf,cAAc,EAAE;YAChB,iBAAiB,EAAE;YACnB,kBAAkB,EAAE;QACxB;aACgB,UAAU,GAAiB,EAAE;;AAqJjD"}
|
|
@@ -60,7 +60,7 @@ class VerifyDepsCommand {
|
|
|
60
60
|
if (fs.existsSync(duplicatesFile)) {
|
|
61
61
|
const json = loadJsonFileSync(duplicatesFile);
|
|
62
62
|
if (JSON.stringify(tree.duplicates) !== JSON.stringify(json)) throw new Error("Duplicates are not in sync. Please run `yarn webiny sync-dependencies` command.");
|
|
63
|
-
if (Array.isArray(json) && json.length > 0) throw new Error("There are still duplicates in the project. Please sort them out and run `yarn webiny sync-dependencies` command to regenerate files.");
|
|
63
|
+
else if (Array.isArray(json) && json.length > 0) throw new Error("There are still duplicates in the project. Please sort them out and run `yarn webiny sync-dependencies` command to regenerate files.");
|
|
64
64
|
} else throw new Error("Duplicates file does not exist. Please run `yarn webiny sync-dependencies` command.");
|
|
65
65
|
ui.info("✅ All package reference files are in sync.");
|
|
66
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/DepsSync/commands/VerifyDepsCommand.js","sources":["../../../../src/features/DepsSync/commands/VerifyDepsCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { CliCommandFactory, GetProjectSdkService, UiService } from \"~/abstractions/index.js\";\nimport { loadJsonFileSync } from \"load-json-file\";\nimport { getDuplicatesFilePath, getReferencesFilePath } from \"../paths.js\";\nimport fs from \"fs\";\nimport { createDependencyTree } from \"../createDependencyTree.js\";\nimport type { IDependencyCollection } from \"~/features/DepsSync/types.js\";\n\nexport class VerifyDepsCommand implements CliCommandFactory.Interface<unknown> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute() {\n return {\n name: \"verify-dependencies\",\n description: \"Verify dependencies for all packages.\",\n examples: [\"$0 verify-dependencies\"],\n handler: async () => {\n const ui = this.uiService;\n const projectSdk = await this.getProjectSdkService.execute();\n const project = projectSdk.getProject();\n const referencesFile = getReferencesFilePath(project);\n const duplicatesFile = getDuplicatesFilePath(project);\n\n const tree = await createDependencyTree(project);\n\n const references: IDependencyCollection = {\n dependencies: tree.dependencies,\n devDependencies: tree.devDependencies,\n peerDependencies: tree.peerDependencies,\n resolutions: tree.resolutions,\n references: tree.references\n };\n\n ui.info(\"Checking references file...\");\n\n if (fs.existsSync(referencesFile)) {\n const json = loadJsonFileSync<IDependencyCollection>(referencesFile)!;\n if (JSON.stringify(references) !== JSON.stringify(json)) {\n for (const type in references) {\n const refDependencies = references[type as keyof typeof references];\n const fileDependencies = json[type as keyof typeof json];\n for (const dep in refDependencies) {\n const refDep = refDependencies[dep];\n const fileDep = fileDependencies[dep];\n if (!fileDep) {\n console.log(\"Missing dependency:\", refDep.name, \"in\", type);\n continue;\n }\n if (JSON.stringify(refDep) !== JSON.stringify(fileDep)) {\n console.log(\"Mismatch in dependency:\", refDep.name, \"in\", type);\n console.log({\n refDep: JSON.stringify(refDep),\n fileDep: JSON.stringify(fileDep)\n });\n }\n }\n }\n throw new Error(\n \"References are not in sync. Please run `yarn webiny sync-dependencies` command.\"\n );\n }\n } else {\n throw new Error(\n \"References file does not exist. Please run `yarn webiny sync-dependencies` command.\"\n );\n }\n\n ui.info(\"Checking duplicates file...\");\n\n if (fs.existsSync(duplicatesFile)) {\n const json = loadJsonFileSync(duplicatesFile);\n if (JSON.stringify(tree.duplicates) !== JSON.stringify(json)) {\n throw new Error(\n \"Duplicates are not in sync. Please run `yarn webiny sync-dependencies` command.\"\n );\n } else if (Array.isArray(json) && json.length > 0) {\n throw new Error(\n \"There are still duplicates in the project. Please sort them out and run `yarn webiny sync-dependencies` command to regenerate files.\"\n );\n }\n } else {\n throw new Error(\n \"Duplicates file does not exist. Please run `yarn webiny sync-dependencies` command.\"\n );\n }\n\n ui.info(\"✅ All package reference files are in sync.\");\n }\n };\n }\n}\n\nexport const verifyDepsCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: VerifyDepsCommand,\n dependencies: [GetProjectSdkService, UiService]\n});\n"],"names":["VerifyDepsCommand","getProjectSdkService","uiService","ui","projectSdk","project","referencesFile","getReferencesFilePath","duplicatesFile","getDuplicatesFilePath","tree","createDependencyTree","references","fs","json","loadJsonFileSync","JSON","type","refDependencies","fileDependencies","dep","refDep","fileDep","console","Error","Array","verifyDepsCommand","createImplementation","CliCommandFactory","GetProjectSdkService","UiService"],"mappings":";;;;;;AAQO,MAAMA;IACT,YACYC,oBAAoD,EACpDC,SAA8B,CACxC;aAFUD,oBAAoB,GAApBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAAU;QACZ,OAAO;YACH,MAAM;YACN,aAAa;YACb,UAAU;gBAAC;aAAyB;YACpC,SAAS;gB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AAG,IAAI,CAAC;gBAER,IAAIU,GAAG,UAAU,CAACL,iBAAiB;oBAC/B,MAAMM,OAAOC,iBAAiBP;oBAC9B,IAAIQ,KAAK,SAAS,CAACN,KAAK,UAAU,MAAMM,KAAK,SAAS,CAACF,OACnD,MAAM,IAAIU,MACN;
|
|
1
|
+
{"version":3,"file":"features/DepsSync/commands/VerifyDepsCommand.js","sources":["../../../../src/features/DepsSync/commands/VerifyDepsCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { CliCommandFactory, GetProjectSdkService, UiService } from \"~/abstractions/index.js\";\nimport { loadJsonFileSync } from \"load-json-file\";\nimport { getDuplicatesFilePath, getReferencesFilePath } from \"../paths.js\";\nimport fs from \"fs\";\nimport { createDependencyTree } from \"../createDependencyTree.js\";\nimport type { IDependencyCollection } from \"~/features/DepsSync/types.js\";\n\nexport class VerifyDepsCommand implements CliCommandFactory.Interface<unknown> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute() {\n return {\n name: \"verify-dependencies\",\n description: \"Verify dependencies for all packages.\",\n examples: [\"$0 verify-dependencies\"],\n handler: async () => {\n const ui = this.uiService;\n const projectSdk = await this.getProjectSdkService.execute();\n const project = projectSdk.getProject();\n const referencesFile = getReferencesFilePath(project);\n const duplicatesFile = getDuplicatesFilePath(project);\n\n const tree = await createDependencyTree(project);\n\n const references: IDependencyCollection = {\n dependencies: tree.dependencies,\n devDependencies: tree.devDependencies,\n peerDependencies: tree.peerDependencies,\n resolutions: tree.resolutions,\n references: tree.references\n };\n\n ui.info(\"Checking references file...\");\n\n if (fs.existsSync(referencesFile)) {\n const json = loadJsonFileSync<IDependencyCollection>(referencesFile)!;\n if (JSON.stringify(references) !== JSON.stringify(json)) {\n for (const type in references) {\n const refDependencies = references[type as keyof typeof references];\n const fileDependencies = json[type as keyof typeof json];\n for (const dep in refDependencies) {\n const refDep = refDependencies[dep];\n const fileDep = fileDependencies[dep];\n if (!fileDep) {\n console.log(\"Missing dependency:\", refDep.name, \"in\", type);\n continue;\n }\n if (JSON.stringify(refDep) !== JSON.stringify(fileDep)) {\n console.log(\"Mismatch in dependency:\", refDep.name, \"in\", type);\n console.log({\n refDep: JSON.stringify(refDep),\n fileDep: JSON.stringify(fileDep)\n });\n }\n }\n }\n throw new Error(\n \"References are not in sync. Please run `yarn webiny sync-dependencies` command.\"\n );\n }\n } else {\n throw new Error(\n \"References file does not exist. Please run `yarn webiny sync-dependencies` command.\"\n );\n }\n\n ui.info(\"Checking duplicates file...\");\n\n if (fs.existsSync(duplicatesFile)) {\n const json = loadJsonFileSync(duplicatesFile);\n if (JSON.stringify(tree.duplicates) !== JSON.stringify(json)) {\n throw new Error(\n \"Duplicates are not in sync. Please run `yarn webiny sync-dependencies` command.\"\n );\n } else if (Array.isArray(json) && json.length > 0) {\n throw new Error(\n \"There are still duplicates in the project. Please sort them out and run `yarn webiny sync-dependencies` command to regenerate files.\"\n );\n }\n } else {\n throw new Error(\n \"Duplicates file does not exist. Please run `yarn webiny sync-dependencies` command.\"\n );\n }\n\n ui.info(\"✅ All package reference files are in sync.\");\n }\n };\n }\n}\n\nexport const verifyDepsCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: VerifyDepsCommand,\n dependencies: [GetProjectSdkService, UiService]\n});\n"],"names":["VerifyDepsCommand","getProjectSdkService","uiService","ui","projectSdk","project","referencesFile","getReferencesFilePath","duplicatesFile","getDuplicatesFilePath","tree","createDependencyTree","references","fs","json","loadJsonFileSync","JSON","type","refDependencies","fileDependencies","dep","refDep","fileDep","console","Error","Array","verifyDepsCommand","createImplementation","CliCommandFactory","GetProjectSdkService","UiService"],"mappings":";;;;;;AAQO,MAAMA;IACT,YACYC,oBAAoD,EACpDC,SAA8B,CACxC;aAFUD,oBAAoB,GAApBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAAU;QACZ,OAAO;YACH,MAAM;YACN,aAAa;YACb,UAAU;gBAAC;aAAyB;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ACN;gBAIRrB,GAAG,IAAI,CAAC;gBAER,IAAIU,GAAG,UAAU,CAACL,iBAAiB;oBAC/B,MAAMM,OAAOC,iBAAiBP;oBAC9B,IAAIQ,KAAK,SAAS,CAACN,KAAK,UAAU,MAAMM,KAAK,SAAS,CAACF,OACnD,MAAM,IAAIU,MACN;yBAED,IAAIC,MAAM,OAAO,CAACX,SAASA,KAAK,MAAM,GAAG,GAC5C,MAAM,IAAIU,MACN;gBAGZ,OACI,MAAM,IAAIA,MACN;gBAIRrB,GAAG,IAAI,CAAC;YACZ;QACJ;IACJ;AACJ;AAEO,MAAMuB,oBAAoBC,qBAAqB;IAClD,aAAaC;IACb,gBAAgB5B;IAChB,cAAc;QAAC6B;QAAsBC;KAAU;AACnD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/cli-core",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.9609e4e0c9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -14,36 +14,36 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@webiny/di": "2.0.0",
|
|
17
|
-
"@webiny/feature": "0.0.0-unstable.
|
|
18
|
-
"@webiny/project": "0.0.0-unstable.
|
|
17
|
+
"@webiny/feature": "0.0.0-unstable.9609e4e0c9",
|
|
18
|
+
"@webiny/project": "0.0.0-unstable.9609e4e0c9",
|
|
19
19
|
"@webiny/stdlib": "0.0.21",
|
|
20
|
-
"@webiny/telemetry": "0.0.0-unstable.
|
|
21
|
-
"chalk": "6.0.
|
|
20
|
+
"@webiny/telemetry": "0.0.0-unstable.9609e4e0c9",
|
|
21
|
+
"chalk": "6.0.1",
|
|
22
22
|
"ci-info": "4.4.0",
|
|
23
|
-
"execa": "10.
|
|
23
|
+
"execa": "10.2.1",
|
|
24
24
|
"fast-glob": "3.3.3",
|
|
25
25
|
"find-up": "8.0.0",
|
|
26
|
-
"humanize-duration": "3.
|
|
27
|
-
"inquirer": "14.
|
|
26
|
+
"humanize-duration": "3.35.0",
|
|
27
|
+
"inquirer": "14.2.5",
|
|
28
28
|
"load-json-file": "7.0.1",
|
|
29
|
-
"open": "11.0.
|
|
29
|
+
"open": "11.0.4",
|
|
30
30
|
"ora": "9.4.1",
|
|
31
|
-
"pino": "10.
|
|
32
|
-
"pino-pretty": "13.
|
|
31
|
+
"pino": "10.4.0",
|
|
32
|
+
"pino-pretty": "13.2.0",
|
|
33
33
|
"semver": "7.8.5",
|
|
34
|
-
"type-fest": "5.
|
|
35
|
-
"wrap-ansi": "
|
|
34
|
+
"type-fest": "5.10.0",
|
|
35
|
+
"wrap-ansi": "10.0.2",
|
|
36
36
|
"write-json-file": "7.0.0",
|
|
37
|
-
"yargs": "18.
|
|
38
|
-
"zod": "4.
|
|
37
|
+
"yargs": "18.2.0",
|
|
38
|
+
"zod": "4.6.7"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/lodash": "4.17.
|
|
42
|
-
"@webiny/build-tools": "0.0.0-unstable.
|
|
41
|
+
"@types/lodash": "4.17.27",
|
|
42
|
+
"@webiny/build-tools": "0.0.0-unstable.9609e4e0c9",
|
|
43
43
|
"rimraf": "6.1.3",
|
|
44
44
|
"strip-ansi": "7.2.0",
|
|
45
45
|
"typescript": "7.0.2",
|
|
46
|
-
"vitest": "
|
|
46
|
+
"vitest": "5.0.5"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|