@ms-cloudpack/cli 0.39.14 → 0.39.16
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.
- package/lib/commands/bundle/index.d.ts.map +1 -1
- package/lib/commands/bundle/index.js +1 -2
- package/lib/commands/bundle/index.js.map +1 -1
- package/lib/commands/init/findImports.js +1 -1
- package/lib/commands/init/findImports.js.map +1 -1
- package/lib/commands/init/index.d.ts +1 -0
- package/lib/commands/init/index.d.ts.map +1 -1
- package/lib/commands/init/index.js +2 -41
- package/lib/commands/init/index.js.map +1 -1
- package/lib/commands/init/init.d.ts +6 -1
- package/lib/commands/init/init.d.ts.map +1 -1
- package/lib/commands/init/init.js +44 -3
- package/lib/commands/init/init.js.map +1 -1
- package/lib/commands/start/openBrowser.d.ts +6 -4
- package/lib/commands/start/openBrowser.d.ts.map +1 -1
- package/lib/commands/start/openBrowser.js +13 -4
- package/lib/commands/start/openBrowser.js.map +1 -1
- package/lib/commands/start/start.d.ts.map +1 -1
- package/lib/commands/start/start.js +0 -3
- package/lib/commands/start/start.js.map +1 -1
- package/lib/index.d.ts +8 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +26 -18
- package/lib/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,eAAO,MAAM,IAAI,EAAE,eAOlB,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { bundle } from './bundle.js';
|
|
2
1
|
export const init = (command, context) => {
|
|
3
2
|
command
|
|
4
3
|
.command('bundle')
|
|
5
4
|
.option('--bundler <name>', 'Forces use of a specific bundler.')
|
|
6
5
|
.option('--outdir <path>', 'Path to drop the bundle output, relative to current path.')
|
|
7
6
|
.description('Bundles a package.')
|
|
8
|
-
.action((bundleOptions) => bundle(bundleOptions, context));
|
|
7
|
+
.action(async (bundleOptions) => (await import('./bundle.js')).bundle(bundleOptions, context));
|
|
9
8
|
};
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IACxD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,MAAM,CAAC,kBAAkB,EAAE,mCAAmC,CAAC;SAC/D,MAAM,CAAC,iBAAiB,EAAE,2DAA2D,CAAC;SACtF,WAAW,CAAC,oBAAoB,CAAC;SACjC,MAAM,CAAC,KAAK,EAAE,aAA4B,EAAE,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;AAClH,CAAC,CAAC","sourcesContent":["import type { BundleOptions } from './types/BundleOptions.js';\nimport type { CommandFunction } from '../../types/CommandFunction.js';\n\nexport const init: CommandFunction = (command, context) => {\n command\n .command('bundle')\n .option('--bundler <name>', 'Forces use of a specific bundler.')\n .option('--outdir <path>', 'Path to drop the bundle output, relative to current path.')\n .description('Bundles a package.')\n .action(async (bundleOptions: BundleOptions) => (await import('./bundle.js')).bundle(bundleOptions, context));\n};\n"]}
|
|
@@ -16,7 +16,7 @@ export async function findImports(filePaths) {
|
|
|
16
16
|
const pathsToParse = [...filePaths];
|
|
17
17
|
while (pathsToParse.length) {
|
|
18
18
|
const filePath = pathsToParse.shift();
|
|
19
|
-
// Ignore any non-JS/TS files such as SVGs
|
|
19
|
+
// Ignore any non-JS/TS files such as SVGs and sourcemaps
|
|
20
20
|
if (!filePath || !allSourceExtensions.includes(path.extname(filePath))) {
|
|
21
21
|
continue;
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findImports.js","sourceRoot":"","sources":["../../../src/commands/init/findImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAA2B,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,6DAA6D;AAC7D,MAAM,mBAAmB,GAAG,CAAC,GAAG,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,SAAmB;IACnD,MAAM,eAAe,GAAgC,EAAE,CAAC;IACxD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,YAAY,GAAa,CAAC,GAAG,SAAS,CAAC,CAAC;IAE9C,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;QACtC,
|
|
1
|
+
{"version":3,"file":"findImports.js","sourceRoot":"","sources":["../../../src/commands/init/findImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAA2B,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,gBAAgB,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E;YACF,0EAA0E;YAC1E,6EAA6E;YAC7E,yEAAyE;YACzE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;gBACR,OAAO,CAAC,KAAK,CACX,4DAA4D,QAAQ,gBAAgB,MAAM,CAAC,KAAK,CAC9F,CAAC,CAAC,CAAC,EACH,CAAC,CAAC,CAAC,CACJ,EAAE,CACJ,CAAC;gBACF,OAAO,SAAS,CAAC;aAClB;YAED,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,CAAC,CAAC;aACD,MAAM,CAAC,OAAO,CAAyB,CAAC;QAE3C,KAAK,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,OAAO,EAAE;YACjD,IAAI,WAAW,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE;gBAChC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC;gBAEtF,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;oBAChC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;oBAC5B,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBAC9B;aACF;iBAAM,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;gBACnG,eAAe,CAAC,WAAW,MAA3B,eAAe,CAAC,WAAW,IAAM,IAAI,GAAG,EAAE,EAAC;gBAC3C,eAAe,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC;aACrD;SACF;KACF;IAED,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import { parse } from 'es-module-lexer';\nimport fsPromises from 'fs/promises';\nimport path from 'path';\nimport { parseImportString, type ImportStringResult } from '@ms-cloudpack/path-string-parsing';\nimport { sourceExtensions } from '@ms-cloudpack/path-utilities';\nimport { builtinModules } from 'module';\n\n/** Treat files with no extension as JS for purposes below */\nconst allSourceExtensions = [...sourceExtensions, ''];\n\n/**\n * Returns a dictionary where key is the package name and value is a set of required paths.\n * Eg. `{ '@fluentui/react': new Set([ '.', './lib/Button' ]) }`\n */\nexport async function findImports(filePaths: string[]): Promise<Record<string, Set<string>>> {\n const requiredExports: Record<string, Set<string>> = {};\n const visitedPaths = new Set(filePaths);\n const pathsToParse: string[] = [...filePaths];\n\n while (pathsToParse.length) {\n const filePath = pathsToParse.shift();\n // Ignore any non-JS/TS files such as SVGs and sourcemaps\n if (!filePath || !allSourceExtensions.includes(path.extname(filePath))) {\n continue;\n }\n\n const source = await fsPromises.readFile(filePath, 'utf-8');\n let rawImports: ReturnType<typeof parse>[0];\n try {\n [rawImports] = parse(source);\n } catch (err) {\n // This could happen if the source file isn't valid JS\n // (unlikely after adding the check above to only attempt parsing JS/TS files)\n console.warn(`Failed to parse ${filePath}:`, err);\n continue;\n }\n const imports = Array.from(new Set(rawImports))\n .map((i) => {\n // The es-module-lexer returns entries where the \"n\" property equals the import source.\n // This includes the package name and path. For example, in this case:\n //\n // import { Button } from '@fluentui/react/lib/Button';\n //\n // The \"n\" property would be \"@fluentui/react/lib/Button\".\n // The \"s\" and \"e\" properties represent the start/end character positions of\n // the import source. The \"ss\" and \"se\" properties represent the start/end\n // character positions of the import specifier starting with \"import\". This\n // may be useful for determining if the import is sync or async.\n //\n // Currently when the import source is a backtick string, the \"n\" property\n // is undefined. This is a bug in es-module-lexer. We may need to handle this\n // at the javascript layer and expand it into multiple potential imports.\n if (!i.n) {\n console.debug(\n `Found an import that didn't parse correctly:\\nFilename:\\n${filePath}\\n\\nImport:\\n${source.slice(\n i.s,\n i.e,\n )}`,\n );\n return undefined;\n }\n\n return parseImportString(i.n);\n })\n .filter(Boolean) as ImportStringResult[];\n\n for (const { packageName, importPath } of imports) {\n if (packageName?.startsWith('.')) {\n const localPath = path.resolve(path.dirname(filePath), packageName, importPath || '');\n\n if (!visitedPaths.has(localPath)) {\n visitedPaths.add(localPath);\n pathsToParse.push(localPath);\n }\n } else if (packageName && !packageName.startsWith('node:') && !builtinModules.includes(packageName)) {\n requiredExports[packageName] ||= new Set();\n requiredExports[packageName].add(importPath || '.');\n }\n }\n }\n\n return requiredExports;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,eAUlB,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { configFileName } from '@ms-cloudpack/config';
|
|
3
|
-
import { stopTelemetry } from '../../initTelemetry.js';
|
|
4
|
-
/* Defines the "init" verb. */
|
|
1
|
+
/** Defines the "init" verb. */
|
|
5
2
|
export const init = (command, context) => {
|
|
6
3
|
command
|
|
7
4
|
.command('init')
|
|
@@ -9,42 +6,6 @@ export const init = (command, context) => {
|
|
|
9
6
|
.option('--fix', 'Applies fixes to all identified issues in internal packages.')
|
|
10
7
|
.option('--reset', 'Ignores existing overrides when determining all entries.')
|
|
11
8
|
.option('--check', 'Fails if any package exports are missing.')
|
|
12
|
-
.action(async (options) =>
|
|
13
|
-
const { reporter } = context;
|
|
14
|
-
const { init } = await import('./init.js');
|
|
15
|
-
let completeReason;
|
|
16
|
-
let hasErrors = false;
|
|
17
|
-
let hasWarnings = false;
|
|
18
|
-
try {
|
|
19
|
-
const { changeCount, errorPkgCount, warningPkgCount, successPkgCount } = await init(options, context);
|
|
20
|
-
hasErrors = errorPkgCount > 0;
|
|
21
|
-
hasWarnings = warningPkgCount > 0;
|
|
22
|
-
const totalCount = errorPkgCount + warningPkgCount + successPkgCount;
|
|
23
|
-
if (hasErrors || hasWarnings) {
|
|
24
|
-
const successPct = ((successPkgCount / totalCount) * 100).toFixed(1);
|
|
25
|
-
completeReason =
|
|
26
|
-
[
|
|
27
|
-
`${successPkgCount}/${totalCount} (${successPct}%) packages bundled successfully`,
|
|
28
|
-
hasErrors && `${errorPkgCount} packages with errors`,
|
|
29
|
-
hasWarnings && `${warningPkgCount} packages with warnings`,
|
|
30
|
-
]
|
|
31
|
-
.filter(Boolean)
|
|
32
|
-
.join('\n') + '\n';
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
completeReason = `All ${totalCount} packages bundled successfully`;
|
|
36
|
-
}
|
|
37
|
-
if (changeCount) {
|
|
38
|
-
completeReason += `\n\nUpdated "${configFileName}" with ${plural(changeCount, 'change')}.`;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
hasErrors = true;
|
|
43
|
-
completeReason = `Unexpected error: ${error.stack || error}`;
|
|
44
|
-
}
|
|
45
|
-
await stopTelemetry();
|
|
46
|
-
reporter.complete(hasErrors ? red(completeReason) : hasWarnings ? yellow(completeReason) : completeReason);
|
|
47
|
-
process.exit(hasErrors ? 1 : 0);
|
|
48
|
-
});
|
|
9
|
+
.action(async (options) => (await import('./init.js')).init(options, context));
|
|
49
10
|
};
|
|
50
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAGA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;IACxD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CACV,sIAAsI,CACvI;SACA,MAAM,CAAC,OAAO,EAAE,8DAA8D,CAAC;SAC/E,MAAM,CAAC,SAAS,EAAE,0DAA0D,CAAC;SAC7E,MAAM,CAAC,SAAS,EAAE,2CAA2C,CAAC;SAC9D,MAAM,CAAC,KAAK,EAAE,OAAoB,EAAE,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAChG,CAAC,CAAC","sourcesContent":["import type { InitOptions } from './types/InitOptions.js';\nimport type { CommandFunction } from '../../types/CommandFunction.js';\n\n/** Defines the \"init\" verb. */\nexport const init: CommandFunction = (command, context) => {\n command\n .command('init')\n .description(\n 'Initializes a given app project and defines the necessary configuration overrides to make an existing app compatible with Cloudpack.',\n )\n .option('--fix', 'Applies fixes to all identified issues in internal packages.')\n .option('--reset', 'Ignores existing overrides when determining all entries.')\n .option('--check', 'Fails if any package exports are missing.')\n .action(async (options: InitOptions) => (await import('./init.js')).init(options, context));\n};\n"]}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { InitOptions } from './types/InitOptions.js';
|
|
2
2
|
import type { TaskContext } from '../../types/TaskContext.js';
|
|
3
3
|
/** Given the path, updates the Cloudpack config with overrides and project settings. */
|
|
4
|
-
export declare function init(options: InitOptions, context: TaskContext): Promise<
|
|
4
|
+
export declare function init(options: InitOptions, context: TaskContext): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Actual init operation (minus the completion logging).
|
|
7
|
+
* Exported for testing only.
|
|
8
|
+
*/
|
|
9
|
+
export declare function initInternal(options: InitOptions, context: TaskContext): Promise<{
|
|
5
10
|
changeCount: number;
|
|
6
11
|
errorPkgCount: number;
|
|
7
12
|
warningPkgCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,wFAAwF;AACxF,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAwCpF;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC,CA8GD"}
|
|
@@ -1,13 +1,54 @@
|
|
|
1
|
-
import { generatedConfigFileName, readConfig, writeGeneratedConfig } from '@ms-cloudpack/config';
|
|
1
|
+
import { configFileName, generatedConfigFileName, readConfig, writeGeneratedConfig, } from '@ms-cloudpack/config';
|
|
2
2
|
import { PackageDefinitions } from '@ms-cloudpack/package-utilities';
|
|
3
|
+
import { plural, red, yellow } from '@ms-cloudpack/task-reporter';
|
|
3
4
|
import { createPackageOverrideTransform } from '../../common/createPackageOverrideTransform.js';
|
|
4
|
-
import { rootSpan } from '../../initTelemetry.js';
|
|
5
|
+
import { rootSpan, stopTelemetry } from '../../initTelemetry.js';
|
|
5
6
|
import { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';
|
|
6
7
|
import { evaluateImportsForOverrides } from './evaluateImportsForOverrides.js';
|
|
7
8
|
import { bundleAndGetImports } from './bundleAndGetImports.js';
|
|
8
9
|
import { patchAllInternalPackageExports } from './patchAllInternalPackageExports.js';
|
|
9
10
|
/** Given the path, updates the Cloudpack config with overrides and project settings. */
|
|
10
11
|
export async function init(options, context) {
|
|
12
|
+
const { reporter } = context;
|
|
13
|
+
let completeReason;
|
|
14
|
+
let hasErrors = false;
|
|
15
|
+
let hasWarnings = false;
|
|
16
|
+
try {
|
|
17
|
+
const { changeCount, errorPkgCount, warningPkgCount, successPkgCount } = await initInternal(options, context);
|
|
18
|
+
hasErrors = errorPkgCount > 0;
|
|
19
|
+
hasWarnings = warningPkgCount > 0;
|
|
20
|
+
const totalCount = errorPkgCount + warningPkgCount + successPkgCount;
|
|
21
|
+
if (hasErrors || hasWarnings) {
|
|
22
|
+
const successPct = ((successPkgCount / totalCount) * 100).toFixed(1);
|
|
23
|
+
completeReason =
|
|
24
|
+
[
|
|
25
|
+
`${successPkgCount}/${totalCount} (${successPct}%) packages bundled successfully`,
|
|
26
|
+
hasErrors && `${errorPkgCount} packages with errors`,
|
|
27
|
+
hasWarnings && `${warningPkgCount} packages with warnings`,
|
|
28
|
+
]
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join('\n') + '\n';
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
completeReason = `All ${totalCount} packages bundled successfully`;
|
|
34
|
+
}
|
|
35
|
+
if (changeCount) {
|
|
36
|
+
completeReason += `\n\nUpdated "${configFileName}" with ${plural(changeCount, 'change')}.`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
hasErrors = true;
|
|
41
|
+
completeReason = `Unexpected error: ${error.stack || error}`;
|
|
42
|
+
}
|
|
43
|
+
await stopTelemetry();
|
|
44
|
+
reporter.complete(hasErrors ? red(completeReason) : hasWarnings ? yellow(completeReason) : completeReason);
|
|
45
|
+
process.exit(hasErrors ? 1 : 0);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Actual init operation (minus the completion logging).
|
|
49
|
+
* Exported for testing only.
|
|
50
|
+
*/
|
|
51
|
+
export async function initInternal(options, context) {
|
|
11
52
|
const { appPath } = context;
|
|
12
53
|
if (options.check && options.fix) {
|
|
13
54
|
throw Error('Cannot use --check and --fix together.');
|
|
@@ -44,7 +85,7 @@ export async function init(options, context) {
|
|
|
44
85
|
}
|
|
45
86
|
// Bundle the package and find the imports it depends on.
|
|
46
87
|
const bundleResult = await bundleAndGetImports({ packagePath, definition, packages, reporter: context.reporter });
|
|
47
|
-
if (!bundleResult.imports) {
|
|
88
|
+
if (!bundleResult.imports?.size) {
|
|
48
89
|
// This is expected if the package just doesn't import anything else.
|
|
49
90
|
console.info(`${packagePath} has no additional imports to evaluate.`);
|
|
50
91
|
bundleResult.hasErrors ? errorPkgCount++ : bundleResult.hasWarnings ? warningPkgCount++ : successPkgCount++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAIrF,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,OAAoB,EACpB,OAAoB;IAOpB,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAE5B,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,EAAE;QAChC,MAAM,KAAK,CAAC,wCAAwC,CAAC,CAAC;KACvD;IAED,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE;QAClC,MAAM,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C,WAAW,CAAC;QAE3C,YAAY,CAAC,SAAS,IAAI,eAAe,CAAC,MAAM,CAAC,MAAM;YACrD,CAAC,CAAC,aAAa,EAAE;YACjB,CAAC,CAAC,YAAY,CAAC,WAAW;gBAC1B,CAAC,CAAC,eAAe,EAAE;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;KACvB;IAED,IAAI,OAAO,CAAC,GAAG,EAAE;QACf,MAAM,8BAA8B,CAAC,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,CAAC;KACxE;IAED,IAAI,WAAW,EAAE;QACf,6BAA6B;QAC7B,OAAO,CAAC,GAAG,CACT,uBAAuB,uBAAuB,8EAA8E,CAC7H,CAAC;QAEF,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC3B,MAAM,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;SAC3D;KACF;IAED,OAAO;QACL,WAAW;QACX,aAAa;QACb,eAAe;QACf,eAAe;KAChB,CAAC;AACJ,CAAC","sourcesContent":["import type { PackageOverride } from '@ms-cloudpack/config';\nimport { generatedConfigFileName, readConfig, writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { PackageDefinitions } from '@ms-cloudpack/package-utilities';\nimport { createPackageOverrideTransform } from '../../common/createPackageOverrideTransform.js';\nimport { rootSpan } from '../../initTelemetry.js';\nimport { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';\nimport { evaluateImportsForOverrides } from './evaluateImportsForOverrides.js';\nimport { bundleAndGetImports } from './bundleAndGetImports.js';\nimport { patchAllInternalPackageExports } from './patchAllInternalPackageExports.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { TaskContext } from '../../types/TaskContext.js';\n\n/** Given the path, updates the Cloudpack config with overrides and project settings. */\nexport async function init(\n options: InitOptions,\n context: TaskContext,\n): Promise<{\n changeCount: number;\n errorPkgCount: number;\n warningPkgCount: number;\n successPkgCount: number;\n}> {\n const { appPath } = context;\n\n if (options.check && options.fix) {\n throw Error('Cannot use --check and --fix together.');\n }\n\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n const config = await readConfig(appPath);\n const packageOverrides: PackageOverride[] = (!options.reset && config.packageOverrides) || [];\n const packages = new PackageDefinitions();\n\n packages.registerTransform(createPackageOverrideTransform({ packageOverrides }));\n\n // Try to resolve dependencies.\n const resolveMap = await resolveDependenciesTask({ packages }, context);\n\n const packagePathsToEvaluate = new Set<string>([appPath]);\n const evaluatedPackages = new Set<string>();\n let changeCount = 0;\n let errorPkgCount = 0;\n let warningPkgCount = 0;\n let successPkgCount = 0;\n\n while (packagePathsToEvaluate.size) {\n const packagePath = packagePathsToEvaluate.values().next().value as string;\n\n packagePathsToEvaluate.delete(packagePath);\n\n // Skip already-visited packages.\n if (!packagePath || evaluatedPackages.has(packagePath)) {\n continue;\n }\n\n evaluatedPackages.add(packagePath);\n\n const definition = await packages.get(packagePath, { refresh: true });\n\n if (!definition) {\n // This is very weird and probably won't happen.\n console.error(`Skipping ${packagePath} evaluation because the package.json was not found or not readable.`);\n errorPkgCount++;\n continue;\n }\n\n // Bundle the package and find the imports it depends on.\n const bundleResult = await bundleAndGetImports({ packagePath, definition, packages, reporter: context.reporter });\n\n if (!bundleResult.imports) {\n // This is expected if the package just doesn't import anything else.\n console.info(`${packagePath} has no additional imports to evaluate.`);\n bundleResult.hasErrors ? errorPkgCount++ : bundleResult.hasWarnings ? warningPkgCount++ : successPkgCount++;\n continue;\n }\n\n // Given the package imports, find the missing exports maps and update packageOverrides.\n const overridesResult = await evaluateImportsForOverrides({\n definition,\n packages,\n packagePathsToEvaluate,\n evaluatedPackages,\n imports: bundleResult.imports,\n packageOverrides,\n resolveMap,\n });\n\n if (options.check && (overridesResult.changeCount || overridesResult.errors.length)) {\n rootSpan?.addEvent('INIT_CHECK_FAILED', {\n reason: overridesResult.changeCount ? 'Config needs to be updated.' : overridesResult.errors,\n });\n throw Error(\n overridesResult.changeCount\n ? 'Run \"cloudpack init --reset\" to update the config.'\n : overridesResult.errors.map((e) => e).join('\\n'),\n );\n }\n\n changeCount += overridesResult.changeCount;\n\n bundleResult.hasErrors || overridesResult.errors.length\n ? errorPkgCount++\n : bundleResult.hasWarnings\n ? warningPkgCount++\n : successPkgCount++;\n }\n\n if (options.fix) {\n await patchAllInternalPackageExports({ resolveMap, packageOverrides });\n }\n\n if (changeCount) {\n // Log the results to a file.\n console.log(\n `Writing updates to \"${generatedConfigFileName}\". If you're in a git repo, this file should be committed with your project.`,\n );\n\n if (packageOverrides.length) {\n await writeGeneratedConfig({ packageOverrides }, appPath);\n }\n }\n\n return {\n changeCount,\n errorPkgCount,\n warningPkgCount,\n successPkgCount,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,uBAAuB,EACvB,UAAU,EACV,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAIrF,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAoB,EAAE,OAAoB;IACnE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE7B,IAAI,cAAkC,CAAC;IACvC,IAAI,S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Ae,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;YACnF,QAAQ,EAAE,QAAQ,CAAC,mBAAmB,EAAE;gBACtC,MAAM,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM;aAC7F,CAAC,CAAC;YACH,MAAM,KAAK,CACT,eAAe,CAAC,WAAW;gBACzB,CAAC,CAAC,oDAAoD;gBACtD,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACpD,CAAC;SACH;QAED,WAAW,IAAI,eAAe,CAAC,WAAW,CAAC;QAE3C,YAAY,CAAC,SAAS,IAAI,eAAe,CAAC,MAAM,CAAC,MAAM;YACrD,CAAC,CAAC,aAAa,EAAE;YACjB,CAAC,CAAC,YAAY,CAAC,WAAW;gBAC1B,CAAC,CAAC,eAAe,EAAE;gBACnB,CAAC,CAAC,eAAe,EAAE,CAAC;KACvB;IAED,IAAI,OAAO,CAAC,GAAG,EAAE;QACf,MAAM,8BAA8B,CAAC,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,CAAC;KACxE;IAED,IAAI,WAAW,EAAE;QACf,6BAA6B;QAC7B,OAAO,CAAC,GAAG,CACT,uBAAuB,uBAAuB,8EAA8E,CAC7H,CAAC;QAEF,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC3B,MAAM,oBAAoB,CAAC,EAAE,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;SAC3D;KACF;IAED,OAAO;QACL,WAAW;QACX,aAAa;QACb,eAAe;QACf,eAAe;KAChB,CAAC;AACJ,CAAC","sourcesContent":["import {\n type PackageOverride,\n configFileName,\n generatedConfigFileName,\n readConfig,\n writeGeneratedConfig,\n} from '@ms-cloudpack/config';\nimport { PackageDefinitions } from '@ms-cloudpack/package-utilities';\nimport { plural, red, yellow } from '@ms-cloudpack/task-reporter';\nimport { createPackageOverrideTransform } from '../../common/createPackageOverrideTransform.js';\nimport { rootSpan, stopTelemetry } from '../../initTelemetry.js';\nimport { resolveDependenciesTask } from '../../tasks/resolveDependenciesTask.js';\nimport { evaluateImportsForOverrides } from './evaluateImportsForOverrides.js';\nimport { bundleAndGetImports } from './bundleAndGetImports.js';\nimport { patchAllInternalPackageExports } from './patchAllInternalPackageExports.js';\nimport type { InitOptions } from './types/InitOptions.js';\nimport type { TaskContext } from '../../types/TaskContext.js';\n\n/** Given the path, updates the Cloudpack config with overrides and project settings. */\nexport async function init(options: InitOptions, context: TaskContext): Promise<void> {\n const { reporter } = context;\n\n let completeReason: string | undefined;\n let hasErrors = false;\n let hasWarnings = false;\n try {\n const { changeCount, errorPkgCount, warningPkgCount, successPkgCount } = await initInternal(options, context);\n\n hasErrors = errorPkgCount > 0;\n hasWarnings = warningPkgCount > 0;\n\n const totalCount = errorPkgCount + warningPkgCount + successPkgCount;\n\n if (hasErrors || hasWarnings) {\n const successPct = ((successPkgCount / totalCount) * 100).toFixed(1);\n completeReason =\n [\n `${successPkgCount}/${totalCount} (${successPct}%) packages bundled successfully`,\n hasErrors && `${errorPkgCount} packages with errors`,\n hasWarnings && `${warningPkgCount} packages with warnings`,\n ]\n .filter(Boolean)\n .join('\\n') + '\\n';\n } else {\n completeReason = `All ${totalCount} packages bundled successfully`;\n }\n\n if (changeCount) {\n completeReason += `\\n\\nUpdated \"${configFileName}\" with ${plural(changeCount, 'change')}.`;\n }\n } catch (error) {\n hasErrors = true;\n completeReason = `Unexpected error: ${(error as Error).stack || error}`;\n }\n\n await stopTelemetry();\n reporter.complete(hasErrors ? red(completeReason) : hasWarnings ? yellow(completeReason) : completeReason);\n\n process.exit(hasErrors ? 1 : 0);\n}\n\n/**\n * Actual init operation (minus the completion logging).\n * Exported for testing only.\n */\nexport async function initInternal(\n options: InitOptions,\n context: TaskContext,\n): Promise<{\n changeCount: number;\n errorPkgCount: number;\n warningPkgCount: number;\n successPkgCount: number;\n}> {\n const { appPath } = context;\n\n if (options.check && options.fix) {\n throw Error('Cannot use --check and --fix together.');\n }\n\n if (options.check && options.reset) {\n throw Error('Cannot use --check and --reset together.');\n }\n\n const config = await readConfig(appPath);\n const packageOverrides: PackageOverride[] = (!options.reset && config.packageOverrides) || [];\n const packages = new PackageDefinitions();\n\n packages.registerTransform(createPackageOverrideTransform({ packageOverrides }));\n\n // Try to resolve dependencies.\n const resolveMap = await resolveDependenciesTask({ packages }, context);\n\n const packagePathsToEvaluate = new Set<string>([appPath]);\n const evaluatedPackages = new Set<string>();\n let changeCount = 0;\n let errorPkgCount = 0;\n let warningPkgCount = 0;\n let successPkgCount = 0;\n\n while (packagePathsToEvaluate.size) {\n const packagePath = packagePathsToEvaluate.values().next().value as string;\n\n packagePathsToEvaluate.delete(packagePath);\n\n // Skip already-visited packages.\n if (!packagePath || evaluatedPackages.has(packagePath)) {\n continue;\n }\n\n evaluatedPackages.add(packagePath);\n\n const definition = await packages.get(packagePath, { refresh: true });\n\n if (!definition) {\n // This is very weird and probably won't happen.\n console.error(`Skipping ${packagePath} evaluation because the package.json was not found or not readable.`);\n errorPkgCount++;\n continue;\n }\n\n // Bundle the package and find the imports it depends on.\n const bundleResult = await bundleAndGetImports({ packagePath, definition, packages, reporter: context.reporter });\n\n if (!bundleResult.imports?.size) {\n // This is expected if the package just doesn't import anything else.\n console.info(`${packagePath} has no additional imports to evaluate.`);\n bundleResult.hasErrors ? errorPkgCount++ : bundleResult.hasWarnings ? warningPkgCount++ : successPkgCount++;\n continue;\n }\n\n // Given the package imports, find the missing exports maps and update packageOverrides.\n const overridesResult = await evaluateImportsForOverrides({\n definition,\n packages,\n packagePathsToEvaluate,\n evaluatedPackages,\n imports: bundleResult.imports,\n packageOverrides,\n resolveMap,\n });\n\n if (options.check && (overridesResult.changeCount || overridesResult.errors.length)) {\n rootSpan?.addEvent('INIT_CHECK_FAILED', {\n reason: overridesResult.changeCount ? 'Config needs to be updated.' : overridesResult.errors,\n });\n throw Error(\n overridesResult.changeCount\n ? 'Run \"cloudpack init --reset\" to update the config.'\n : overridesResult.errors.map((e) => e).join('\\n'),\n );\n }\n\n changeCount += overridesResult.changeCount;\n\n bundleResult.hasErrors || overridesResult.errors.length\n ? errorPkgCount++\n : bundleResult.hasWarnings\n ? warningPkgCount++\n : successPkgCount++;\n }\n\n if (options.fix) {\n await patchAllInternalPackageExports({ resolveMap, packageOverrides });\n }\n\n if (changeCount) {\n // Log the results to a file.\n console.log(\n `Writing updates to \"${generatedConfigFileName}\". If you're in a git repo, this file should be committed with your project.`,\n );\n\n if (packageOverrides.length) {\n await writeGeneratedConfig({ packageOverrides }, appPath);\n }\n }\n\n return {\n changeCount,\n errorPkgCount,\n warningPkgCount,\n successPkgCount,\n };\n}\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export declare function
|
|
1
|
+
/** Open the browser. */
|
|
2
|
+
export declare function openBrowser(url: string): Promise<void>;
|
|
3
|
+
/** Disable opening the browser (for tests) */
|
|
4
|
+
export declare function disableOpenBrowser(): void;
|
|
5
|
+
/** Get the most recently opened URL (for tests) */
|
|
6
|
+
export declare function getLastOpenedUrl(): string | undefined;
|
|
5
7
|
//# sourceMappingURL=openBrowser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openBrowser.d.ts","sourceRoot":"","sources":["../../../src/commands/start/openBrowser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openBrowser.d.ts","sourceRoot":"","sources":["../../../src/commands/start/openBrowser.ts"],"names":[],"mappings":"AAKA,wBAAwB;AACxB,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,iBAK5C;AAED,8CAA8C;AAC9C,wBAAgB,kBAAkB,SAEjC;AAED,mDAAmD;AACnD,wBAAgB,gBAAgB,uBAE/B"}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import open from 'open';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
2
|
+
let openBrowserEnabled = true;
|
|
3
|
+
let lastOpenedUrl;
|
|
4
|
+
/** Open the browser. */
|
|
5
5
|
export async function openBrowser(url) {
|
|
6
|
-
|
|
6
|
+
lastOpenedUrl = url;
|
|
7
|
+
if (openBrowserEnabled) {
|
|
7
8
|
await open(url, { newInstance: false });
|
|
8
9
|
}
|
|
9
10
|
}
|
|
11
|
+
/** Disable opening the browser (for tests) */
|
|
12
|
+
export function disableOpenBrowser() {
|
|
13
|
+
openBrowserEnabled = false;
|
|
14
|
+
}
|
|
15
|
+
/** Get the most recently opened URL (for tests) */
|
|
16
|
+
export function getLastOpenedUrl() {
|
|
17
|
+
return lastOpenedUrl;
|
|
18
|
+
}
|
|
10
19
|
//# sourceMappingURL=openBrowser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openBrowser.js","sourceRoot":"","sources":["../../../src/commands/start/openBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB
|
|
1
|
+
{"version":3,"file":"openBrowser.js","sourceRoot":"","sources":["../../../src/commands/start/openBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,IAAI,kBAAkB,GAAG,IAAI,CAAC;AAC9B,IAAI,aAAiC,CAAC;AAEtC,wBAAwB;AACxB,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW;IAC3C,aAAa,GAAG,GAAG,CAAC;IACpB,IAAI,kBAAkB,EAAE;QACtB,MAAM,IAAI,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;KACzC;AACH,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,kBAAkB;IAChC,kBAAkB,GAAG,KAAK,CAAC;AAC7B,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,gBAAgB;IAC9B,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import open from 'open';\n\nlet openBrowserEnabled = true;\nlet lastOpenedUrl: string | undefined;\n\n/** Open the browser. */\nexport async function openBrowser(url: string) {\n lastOpenedUrl = url;\n if (openBrowserEnabled) {\n await open(url, { newInstance: false });\n }\n}\n\n/** Disable opening the browser (for tests) */\nexport function disableOpenBrowser() {\n openBrowserEnabled = false;\n}\n\n/** Get the most recently opened URL (for tests) */\nexport function getLastOpenedUrl() {\n return lastOpenedUrl;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAQ5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAgB9D;;GAEG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,iBAoH5F"}
|
|
@@ -4,7 +4,6 @@ import path from 'path';
|
|
|
4
4
|
import { createPackageOverrideTransform } from '../../common/createPackageOverrideTransform.js';
|
|
5
5
|
import { createSession } from './createSession.js';
|
|
6
6
|
import { openBrowser } from './openBrowser.js';
|
|
7
|
-
import { readConfig } from '@ms-cloudpack/config';
|
|
8
7
|
import { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';
|
|
9
8
|
import { setSharedTelemetryAttribute, stopTelemetry, rootSpan } from '../../initTelemetry.js';
|
|
10
9
|
import { createBundleRequestForPackage } from './createBundleRequestForPackage.js';
|
|
@@ -27,8 +26,6 @@ async function createAppBundleTask(session, packageName, features) {
|
|
|
27
26
|
*/
|
|
28
27
|
export async function start(options, { reporter, appPath, config }) {
|
|
29
28
|
try {
|
|
30
|
-
// Parse config if it exists.
|
|
31
|
-
const config = await readConfig(appPath);
|
|
32
29
|
// Merge in any additional features from the command line.
|
|
33
30
|
config.features = mergeFeatures({
|
|
34
31
|
configFeatures: config.features,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBA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,CAAC;QAE1B,WAAW,CAAC,OAAO,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;QACpE,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YAC7B,sEAAsE;YACtE,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC","sourcesContent":["import { writeJson } from '@ms-cloudpack/json-utilities';\nimport { PackageDefinitions, findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport path from 'path';\nimport { createPackageOverrideTransform } from '../../common/createPackageOverrideTransform.js';\nimport { createSession } from './createSession.js';\nimport { openBrowser } from './openBrowser.js';\nimport type { Session } from '@ms-cloudpack/api-server';\nimport type { StartOptions } from './types/StartOptions.js';\nimport type { Features } from '@ms-cloudpack/config';\nimport { PerfMarkerCliEntry, PerfMeasurementOpenBrowser } from '../../performance/markers.js';\nimport { setSharedTelemetryAttribute, stopTelemetry, rootSpan } from '../../initTelemetry.js';\nimport { createBundleRequestForPackage } from './createBundleRequestForPackage.js';\nimport { createBundleTask } from './createBundleTask.js';\nimport { mergeFeatures } from './mergeFeatures.js';\nimport { yellow } from '@ms-cloudpack/task-reporter';\nimport type { TaskContext } from '../../types/TaskContext.js';\n\nasync function createAppBundleTask(session: Session, packageName: string, features?: Features) {\n const packageEntry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${packageName} in the resolve map.`);\n }\n const bundleRequest = await createBundleRequestForPackage(packageEntry, features);\n\n return createBundleTask(bundleRequest);\n}\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport async function start(options: StartOptions, { reporter, appPath, config }: TaskContext) {\n try {\n // Merge in any additional features from the command line.\n config.features = mergeFeatures({\n configFeatures: config.features,\n commandLineFeatures: options.features,\n });\n\n const featureNames = Object.keys(config.features);\n\n if (featureNames.length) {\n console.log(`Enabled features: ${featureNames.map((f) => yellow(f)).join(', ')}`);\n }\n\n // Initialize package overrides.\n PackageDefinitions.getInstance().registerTransform(createPackageOverrideTransform(config));\n\n // Make sure the package has a valid definition.\n const definition = await PackageDefinitions.getInstance().get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // Initialize session definition.\n const session = await createSession({ config, reporter, appPath });\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n setSharedTelemetryAttribute('sessionId', session.id);\n\n if (options.logResolveMap) {\n // Write the resolve map to disk.\n await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n const apiServer = await startApiServer({\n session,\n rootSpan,\n reporter,\n appPath,\n });\n\n // Kick off bundling app package as soon as api server is ready.\n void apiServer.addTask(await createAppBundleTask(session, definition.name, config.features));\n\n // Then start bundle and app servers for hosting the app.\n const { startBundleServer } = await import('./startBundleServer.js');\n const bundleServer = await startBundleServer({ session, apiServer, reporter });\n\n const { startAppServer } = await import('./appServer/startAppServer.js');\n const appServer = await startAppServer({\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n reporter,\n });\n\n const cleanup = async () => {\n for (const [name, server] of [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ]) {\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server.close();\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }\n\n // Complete the reporting and list pending tasks as aborted.\n reporter.complete();\n\n // Flush and close telemetry.\n await stopTelemetry();\n };\n\n // Setup cleanup and close things on completion.\n let sigintCount = 0;\n\n process.on('SIGINT', () => {\n sigintCount++;\n if (sigintCount > 1) {\n console.debug('Forcing exit');\n process.exit(1);\n }\n\n cleanup().finally(() => {\n process.exit(0);\n });\n });\n\n // Open the browser.\n const url = appServer.url;\n\n performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n openBrowser(url).catch((err) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n console.warn('Error opening browser:', err?.stack || err);\n console.warn('Please open the browser manually to:', url);\n });\n } catch (err) {\n console.error(err);\n reporter.complete();\n process.exit(1);\n }\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
|
+
import { Command } from 'commander';
|
|
1
3
|
/**
|
|
2
4
|
* Entry point for the cloudpack CLI.
|
|
3
5
|
* Resolves all commands defined within the "./commands" folder.
|
|
4
6
|
*/
|
|
5
|
-
export declare function main(
|
|
7
|
+
export declare function main(testOptions?: {
|
|
8
|
+
appPath: string;
|
|
9
|
+
argv: string[];
|
|
10
|
+
reporter: TaskReporter;
|
|
11
|
+
preParseOverrides?: (program: Command) => void;
|
|
12
|
+
}): Promise<void>;
|
|
6
13
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EAKb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC;;;GAGG;AACH,wBAAsB,IAAI,CAAC,WAAW,CAAC,EAAE;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,iBA8EA"}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PackageDefinitions, getVersion } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import { TaskReporter, bold, debugLoggingConfig, defaultLoggingConfig,
|
|
2
|
+
import { TaskReporter, bold, debugLoggingConfig, defaultLoggingConfig, verboseLoggingConfig, } from '@ms-cloudpack/task-reporter';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import glob from 'glob';
|
|
5
5
|
import path from 'path';
|
|
@@ -7,29 +7,30 @@ import { fileURLToPath, pathToFileURL } from 'url';
|
|
|
7
7
|
import { initTelemetry, setSharedTelemetryAttributes } from './initTelemetry.js';
|
|
8
8
|
import { PerfMarkerCliEntry } from './performance/markers.js';
|
|
9
9
|
import { readConfig } from '@ms-cloudpack/config';
|
|
10
|
-
const
|
|
10
|
+
const filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const dirname = path.dirname(filename);
|
|
11
12
|
/**
|
|
12
13
|
* Entry point for the cloudpack CLI.
|
|
13
14
|
* Resolves all commands defined within the "./commands" folder.
|
|
14
15
|
*/
|
|
15
|
-
export async function main() {
|
|
16
|
+
export async function main(testOptions) {
|
|
16
17
|
performance.mark(PerfMarkerCliEntry);
|
|
18
|
+
const argv = testOptions?.argv || process.argv;
|
|
19
|
+
const appPath = testOptions?.appPath || process.cwd();
|
|
20
|
+
const reporter = testOptions?.reporter || new TaskReporter();
|
|
21
|
+
const config = await readConfig(appPath);
|
|
17
22
|
const program = new Command();
|
|
18
|
-
const plainTextMode =
|
|
23
|
+
const plainTextMode = argv.includes('--no-color') || argv.includes('-n');
|
|
19
24
|
const version = getVersion(import.meta.url);
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
program.name(productName).version(version).usage('<command> [options]');
|
|
25
|
-
const appPath = process.cwd();
|
|
26
|
-
const config = await readConfig(appPath);
|
|
27
|
-
const reporter = new TaskReporter();
|
|
25
|
+
const useDebugLogging = argv.includes('--debug') || argv.includes('-d');
|
|
26
|
+
const verb = argv[2];
|
|
27
|
+
const useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';
|
|
28
|
+
program.name('cloudpack').version(version).usage('<command> [options]');
|
|
28
29
|
reporter.setOptions({
|
|
29
|
-
productName,
|
|
30
|
+
productName: 'Cloudpack',
|
|
30
31
|
version,
|
|
31
32
|
plainTextMode,
|
|
32
|
-
description: `Running "${bold(
|
|
33
|
+
description: () => `Running "${bold(argv.slice(2).join(' '))}"`,
|
|
33
34
|
helpMessage: config.helpMessage,
|
|
34
35
|
...defaultLoggingConfig,
|
|
35
36
|
...(useVerboseLogging && verboseLoggingConfig),
|
|
@@ -47,19 +48,26 @@ export async function main() {
|
|
|
47
48
|
}
|
|
48
49
|
setSharedTelemetryAttributes({
|
|
49
50
|
verb,
|
|
50
|
-
arguments:
|
|
51
|
+
arguments: argv.slice(3).join(' '),
|
|
51
52
|
environment: process.env.CI || process.env.TF_BUILD ? 'ci' : 'local',
|
|
52
53
|
appName: definition.name || '<unkown>',
|
|
53
54
|
});
|
|
54
|
-
|
|
55
|
+
// Ensure the glob works in tests
|
|
56
|
+
const commandsGlob = `commands/*/index${path.extname(filename)}`;
|
|
57
|
+
const commands = glob.sync(commandsGlob, { cwd: dirname });
|
|
58
|
+
if (!commands.length) {
|
|
59
|
+
// There was an issue with the glob above not working in tests, so make sure that doesn't happen again
|
|
60
|
+
throw new Error(`No commands found under "${dirname}".`);
|
|
61
|
+
}
|
|
55
62
|
for (const commandPath of commands) {
|
|
56
|
-
const commandFunction = (await import(pathToFileURL(path.
|
|
63
|
+
const commandFunction = (await import(pathToFileURL(path.join(dirname, commandPath)).toString()));
|
|
57
64
|
commandFunction.init(program, { reporter, appPath, config });
|
|
58
65
|
}
|
|
59
66
|
program.option('-v, --verbose', 'Show additional details about the running tasks. (default: false)');
|
|
60
67
|
program.option('-d, --debug', 'Show debug information (superset of --verbose). (default: false)');
|
|
61
68
|
program.option('-n, --no-color', 'Disable colors in the output. (default: false)');
|
|
62
|
-
program
|
|
69
|
+
testOptions?.preParseOverrides?.(program);
|
|
70
|
+
await program.parseAsync(argv);
|
|
63
71
|
if (program.args.length === 0) {
|
|
64
72
|
program.help();
|
|
65
73
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB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,EAAE;QACpB,sGAAsG;QACtG,MAAM,IAAI,KAAK,CAAC,4BAA4B,OAAO,IAAI,CAAC,CAAC;KAC1D;IAED,KAAK,MAAM,WAAW,IAAI,QAAQ,EAAE;QAClC,MAAM,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAE/F,CAAC;QAEF,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;KAC9D;IAED,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,mEAAmE,CAAC,CAAC;IACrG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,kEAAkE,CAAC,CAAC;IAClG,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,gDAAgD,CAAC,CAAC;IAEnF,WAAW,EAAE,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;IAE1C,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;AACH,CAAC","sourcesContent":["import { PackageDefinitions, getVersion } from '@ms-cloudpack/package-utilities';\nimport {\n TaskReporter,\n bold,\n debugLoggingConfig,\n defaultLoggingConfig,\n verboseLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\nimport { Command } from 'commander';\nimport glob from 'glob';\nimport path from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\nimport { initTelemetry, setSharedTelemetryAttributes } from './initTelemetry.js';\nimport { PerfMarkerCliEntry } from './performance/markers.js';\nimport { readConfig } from '@ms-cloudpack/config';\nimport type { CommandFunction } from './types/CommandFunction.js';\n\nconst filename = fileURLToPath(import.meta.url);\nconst dirname = path.dirname(filename);\n\n/**\n * Entry point for the cloudpack CLI.\n * Resolves all commands defined within the \"./commands\" folder.\n */\nexport async function main(testOptions?: {\n appPath: string;\n argv: string[];\n reporter: TaskReporter;\n preParseOverrides?: (program: Command) => void;\n}) {\n performance.mark(PerfMarkerCliEntry);\n\n const argv = testOptions?.argv || process.argv;\n const appPath = testOptions?.appPath || process.cwd();\n const reporter = testOptions?.reporter || new TaskReporter();\n const config = await readConfig(appPath);\n\n const program = new Command();\n const plainTextMode = argv.includes('--no-color') || argv.includes('-n');\n const version = getVersion(import.meta.url);\n const useDebugLogging = argv.includes('--debug') || argv.includes('-d');\n const verb = argv[2];\n const useVerboseLogging = argv.includes('--verbose') || argv.includes('-v') || verb === 'bundle';\n\n program.name('cloudpack').version(version).usage('<command> [options]');\n\n reporter.setOptions({\n productName: 'Cloudpack',\n version,\n plainTextMode,\n description: () => `Running \"${bold(argv.slice(2).join(' '))}\"`,\n helpMessage: config.helpMessage,\n ...defaultLoggingConfig,\n ...(useVerboseLogging && verboseLoggingConfig),\n ...(useDebugLogging && debugLoggingConfig),\n });\n\n await initTelemetry(\n {\n useDebugLogging,\n useVerboseLogging,\n telemetryConfig: config.telemetry,\n },\n reporter,\n );\n\n // Make sure the package has a valid definition.\n const definition = await PackageDefinitions.getInstance().get(appPath);\n\n if (!definition) {\n throw new Error(`There was no package.json located at \"${appPath}\".`);\n }\n\n setSharedTelemetryAttributes({\n verb,\n arguments: argv.slice(3).join(' '),\n environment: process.env.CI || process.env.TF_BUILD ? 'ci' : 'local',\n appName: definition.name || '<unkown>',\n });\n\n // Ensure the glob works in tests\n const commandsGlob = `commands/*/index${path.extname(filename)}`;\n const commands = glob.sync(commandsGlob, { cwd: dirname });\n if (!commands.length) {\n // There was an issue with the glob above not working in tests, so make sure that doesn't happen again\n throw new Error(`No commands found under \"${dirname}\".`);\n }\n\n for (const commandPath of commands) {\n const commandFunction = (await import(pathToFileURL(path.join(dirname, commandPath)).toString())) as {\n init: CommandFunction;\n };\n\n commandFunction.init(program, { reporter, appPath, config });\n }\n\n program.option('-v, --verbose', 'Show additional details about the running tasks. (default: false)');\n program.option('-d, --debug', 'Show debug information (superset of --verbose). (default: false)');\n program.option('-n, --no-color', 'Disable colors in the output. (default: false)');\n\n testOptions?.preParseOverrides?.(program);\n\n await program.parseAsync(argv);\n\n if (program.args.length === 0) {\n program.help();\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.16",
|
|
4
4
|
"description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"cloudpack": "./bin/cloudpack.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@ms-cloudpack/api-server": "^0.6.
|
|
13
|
+
"@ms-cloudpack/api-server": "^0.6.20",
|
|
14
14
|
"@ms-cloudpack/bundler": "^0.13.3",
|
|
15
15
|
"@ms-cloudpack/config": "^0.7.5",
|
|
16
16
|
"@ms-cloudpack/create-express-app": "^1.3.7",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"@ms-cloudpack/package-utilities": "^3.1.5",
|
|
21
21
|
"@ms-cloudpack/path-string-parsing": "^1.0.2",
|
|
22
22
|
"@ms-cloudpack/path-utilities": "^2.3.0",
|
|
23
|
-
"@ms-cloudpack/task-reporter": "^0.5.
|
|
24
|
-
"@ms-cloudpack/telemetry": "^0.3.
|
|
23
|
+
"@ms-cloudpack/task-reporter": "^0.5.2",
|
|
24
|
+
"@ms-cloudpack/telemetry": "^0.3.4",
|
|
25
25
|
"chokidar": "^3.5.3",
|
|
26
|
-
"commander": "^
|
|
26
|
+
"commander": "^11.0.0",
|
|
27
27
|
"es-module-lexer": "^1.0.3",
|
|
28
28
|
"fast-glob": "^3.2.12",
|
|
29
29
|
"filenamify": "^6.0.0",
|