@ms-cloudpack/cli 0.45.0 → 0.45.2

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.
@@ -13,7 +13,7 @@ export async function evaluateImportsForOverrides(options) {
13
13
  // Iterate through imports and find their path from the resolve map.
14
14
  for (const [dependencyName, dependencyImportPaths] of imports.entries()) {
15
15
  const resolveEntry = findResolveMapEntry({ definition, packageName: dependencyName, resolveMap });
16
- const { path: dependencyPath } = resolveEntry || {};
16
+ const dependencyPath = resolveEntry?.path;
17
17
  const dependencyDefinition = dependencyPath ? await packages.get(dependencyPath) : undefined;
18
18
  if (!dependencyPath || !dependencyDefinition) {
19
19
  const errorMessage = `Package "${displayName}" imports from the package "${dependencyName}" but it couldn't be found. ` +
@@ -34,52 +34,52 @@ export async function evaluateImportsForOverrides(options) {
34
34
  throw new Error(`Package "${displayName}" depends on "${dependencyName}" but it is missing a name or version.`);
35
35
  }
36
36
  for (const dependencyImportPath of dependencyImportPaths) {
37
+ if (flattenedExports[dependencyImportPath]) {
38
+ continue;
39
+ }
37
40
  // We are missing an import path. We need to add this entry to the exports map in package settings.
38
- if (!flattenedExports[dependencyImportPath]) {
39
- generatedPackageSettings ??= getPackageSettings({
40
- config: { generated: { packageSettings } },
41
- name,
42
- version,
43
- firstMatch: true,
44
- }).generatedPackageSettings;
45
- if (!generatedPackageSettings) {
46
- generatedPackageSettings = {
47
- match: {
48
- name,
49
- version: `^${version}`,
41
+ generatedPackageSettings ??= getPackageSettings({
42
+ config: { generated: { packageSettings } },
43
+ name,
44
+ version,
45
+ firstMatch: true,
46
+ }).generatedPackageSettings;
47
+ if (!generatedPackageSettings) {
48
+ generatedPackageSettings = {
49
+ match: {
50
+ name,
51
+ version: `^${version}`,
52
+ },
53
+ exports: {},
54
+ };
55
+ packageSettings.push(generatedPackageSettings);
56
+ }
57
+ generatedPackageSettings.exports ??= {};
58
+ const addedEntry = await addExportsMapEntry({
59
+ exports: generatedPackageSettings.exports,
60
+ packagePath: dependencyPath,
61
+ importPath: dependencyImportPath,
62
+ }, {
63
+ packages,
64
+ });
65
+ if (!addedEntry) {
66
+ const errorMessage = `Imported "${cyan(dependencyImportPath.replace('.', dependencyName))}" but a corresponding file couldn't be found. Either correct the import or adjust the "${cyan(dependencyName)}" package version to one that supports this import path.\n${bulletedList([`${cyan(displayName)}: ${packagePath}`, `${cyan(dependencyName)}: ${dependencyPath}`], 2)}`;
67
+ console.error(errorMessage);
68
+ errors.push(errorMessage);
69
+ }
70
+ else {
71
+ changes.push({
72
+ name: dependencyName,
73
+ version: dependencyDefinition.version || '',
74
+ path: dependencyPath,
75
+ changes: [
76
+ {
77
+ type: 'added-export',
78
+ change: dependencyImportPath,
79
+ reason: `Imported by "${displayName}"`,
50
80
  },
51
- exports: {},
52
- };
53
- packageSettings.push(generatedPackageSettings);
54
- }
55
- generatedPackageSettings.exports ??= {};
56
- const addedEntry = await addExportsMapEntry({
57
- exports: generatedPackageSettings.exports,
58
- packagePath: dependencyPath,
59
- importPath: dependencyImportPath,
60
- }, {
61
- packages,
81
+ ],
62
82
  });
63
- if (!addedEntry) {
64
- const errorMessage = `Imported "${cyan(dependencyImportPath.replace('.', dependencyName))}" but a corresponding file couldn't be found. Either correct the import or adjust the "${cyan(dependencyName)}" package version to one that supports this import path.\n${bulletedList([`${cyan(displayName)}: ${packagePath}`, `${cyan(dependencyName)}: ${dependencyPath}`], 2)}`;
65
- console.error(errorMessage);
66
- errors.push(errorMessage);
67
- continue;
68
- }
69
- else {
70
- changes.push({
71
- name: dependencyName,
72
- version: dependencyDefinition.version || '',
73
- path: dependencyPath,
74
- changes: [
75
- {
76
- type: 'added-export',
77
- change: dependencyImportPath,
78
- reason: `Imported by "${displayName}"`,
79
- },
80
- ],
81
- });
82
- }
83
83
  generatedPackageSettings.exports = alphabetizeObject(generatedPackageSettings.exports);
84
84
  // Since we've found a missing exports, we need to re-enqueue the dependency for evaluation.
85
85
  packagePathsToEvaluate.add(dependencyPath);
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateImportsForOverrides.js","sourceRoot":"","sources":["../../../src/commands/init/evaluateImportsForOverrides.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGjE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,OASjD;IACC,MAAM,EACJ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,GACX,GAAG,OAAO,CAAC;IACZ,MAAM,WAAW,GAAG,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;IAC/D,MAAM,OAAO,GAA8B,EAAE,CAAC;IAC9C,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,oEAAoE;IACpE,KAAK,MAAM,CAAC,cAAc,EAAE,qBAAqB,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE;QACvE,MAAM,YAAY,GAAG,mBAAmB,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC;QAClG,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,YAAY,IAAI,EAAE,CAAC;QACpD,MAAM,oBAAoB,GAAG,cAAc,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAE7F,IAAI,CAAC,cAAc,IAAI,CAAC,oBAAoB,EAAE;YAC5C,MAAM,YAAY,GAChB,YAAY,WAAW,+BAA+B,cAAc,8BAA8B;gBAClG,gBAAgB,cAAc,mCAAmC,WAAW,IAAI,CAA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AAiB,CAAuC,GAAM;IACrE,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,MAAM,eAAe,GAA+B,EAAE,CAAC;IAEvD,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;QAC5B,eAAe,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;KACjC;IAED,OAAO,eAAoB,CAAC;AAC9B,CAAC","sourcesContent":["import type { PackageDefinitionsCache, PackageJson, PackageJsonExportsObject } from '@ms-cloudpack/bundler-types';\nimport type { GeneratedConfig, PackageSettings } from '@ms-cloudpack/config';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n flattenExportsMap,\n getExportsMap,\n} from '@ms-cloudpack/package-utilities';\nimport { bulletedList, cyan } from '@ms-cloudpack/task-reporter';\nimport type { GeneratedPackageChanges } from './types/GeneratedPackageChanges.js';\n\n/**\n * Evaluate the imports depended on by a package to determine if missing exports map paths need to be added.\n * If so, updates package overrides to the given packageOverrides array.\n */\nexport async function evaluateImportsForOverrides(options: {\n packages: PackageDefinitionsCache;\n imports: Map<string, Set<string>>;\n definition: PackageJson;\n packagePath: string;\n generatedConfig: GeneratedConfig;\n packagePathsToEvaluate: Set<string>;\n evaluatedPackages: Set<string>;\n resolveMap: ResolveMap;\n}): Promise<{ changes: GeneratedPackageChanges[]; errors: string[] }> {\n const {\n packages,\n imports,\n definition,\n packagePath,\n generatedConfig,\n packagePathsToEvaluate,\n evaluatedPackages,\n resolveMap,\n } = options;\n const displayName = `${definition.name}@${definition.version}`;\n const changes: GeneratedPackageChanges[] = [];\n const errors: string[] = [];\n\n // Iterate through imports and find their path from the resolve map.\n for (const [dependencyName, dependencyImportPaths] of imports.entries()) {\n const resolveEntry = findResolveMapEntry({ definition, packageName: dependencyName, resolveMap });\n const { path: dependencyPath } = resolveEntry || {};\n const dependencyDefinition = dependencyPath ? await packages.get(dependencyPath) : undefined;\n\n if (!dependencyPath || !dependencyDefinition) {\n const errorMessage =\n `Package \"${displayName}\" imports from the package \"${dependencyName}\" but it couldn't be found. ` +\n `Ensure that \"${dependencyName}\" is listed in dependencies of \"${displayName}\".`;\n console.error(errorMessage);\n errors.push(errorMessage);\n\n continue;\n }\n\n // Make sure to add the package to the list of packages to evaluate.\n packagePathsToEvaluate.add(dependencyPath);\n\n // Get the flattened bundle-able exports map for this dependency and iterate through our import paths to ensure nothing is missing.\n const exports = await getExportsMap({ packagePath: dependencyPath }, { packages });\n const flattenedExports = flattenExportsMap(exports);\n const packageSettings = (generatedConfig.packageSettings ??= []);\n const { name, version } = dependencyDefinition;\n let generatedPackageSettings: PackageSettings | undefined;\n\n if (!name || !version) {\n throw new Error(`Package \"${displayName}\" depends on \"${dependencyName}\" but it is missing a name or version.`);\n }\n\n for (const dependencyImportPath of dependencyImportPaths) {\n // We are missing an import path. We need to add this entry to the exports map in package settings.\n if (!flattenedExports[dependencyImportPath]) {\n generatedPackageSettings ??= getPackageSettings({\n config: { generated: { packageSettings } },\n name,\n version,\n firstMatch: true,\n }).generatedPackageSettings;\n\n if (!generatedPackageSettings) {\n generatedPackageSettings = {\n match: {\n name,\n version: `^${version}`,\n },\n exports: {},\n };\n packageSettings.push(generatedPackageSettings);\n }\n\n generatedPackageSettings.exports ??= {};\n\n const addedEntry = await addExportsMapEntry(\n {\n exports: generatedPackageSettings.exports,\n packagePath: dependencyPath,\n importPath: dependencyImportPath,\n },\n {\n packages,\n },\n );\n\n if (!addedEntry) {\n const errorMessage = `Imported \"${cyan(\n dependencyImportPath.replace('.', dependencyName),\n )}\" but a corresponding file couldn't be found. Either correct the import or adjust the \"${cyan(\n dependencyName,\n )}\" package version to one that supports this import path.\\n${bulletedList(\n [`${cyan(displayName)}: ${packagePath}`, `${cyan(dependencyName)}: ${dependencyPath}`],\n 2,\n )}`;\n console.error(errorMessage);\n errors.push(errorMessage);\n\n continue;\n } else {\n changes.push({\n name: dependencyName,\n version: dependencyDefinition.version || '',\n path: dependencyPath,\n changes: [\n {\n type: 'added-export',\n change: dependencyImportPath,\n reason: `Imported by \"${displayName}\"`,\n },\n ],\n });\n }\n\n generatedPackageSettings.exports = alphabetizeObject<PackageJsonExportsObject>(\n generatedPackageSettings.exports as PackageJsonExportsObject,\n );\n\n // Since we've found a missing exports, we need to re-enqueue the dependency for evaluation.\n packagePathsToEvaluate.add(dependencyPath);\n evaluatedPackages.delete(dependencyPath);\n }\n }\n }\n\n return { changes, errors };\n}\n\n/** Quick helper to alphabetize the exports. */\nfunction alphabetizeObject<T extends { [key: string]: unknown }>(obj: T): T {\n const sortedKeys = Object.keys(obj).sort();\n const alphabetizedObj: { [key: string]: unknown } = {};\n\n for (const key of sortedKeys) {\n alphabetizedObj[key] = obj[key];\n }\n\n return alphabetizedObj as T;\n}\n"]}
1
+ {"version":3,"file":"evaluateImportsForOverrides.js","sourceRoot":"","sources":["../../../src/commands/init/evaluateImportsForOverrides.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGjE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,OASjD;IACC,MAAM,EACJ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,GACX,GAAG,OAAO,CAAC;IACZ,MAAM,WAAW,GAAG,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;IAC/D,MAAM,OAAO,GAA8B,EAAE,CAAC;IAC9C,MAAM,MAAM,GAAa,EAAE,CAAC;I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BAAoB,CAAC,OAAO,IAAI,EAAE;oBAC3C,IAAI,EAAE,cAAc;oBACpB,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,cAAc;4BACpB,MAAM,EAAE,oBAAoB;4BAC5B,MAAM,EAAE,gBAAgB,WAAW,GAAG;yBACvC;qBACF;iBACF,CAAC,CAAC;gBAEH,wBAAwB,CAAC,OAAO,GAAG,iBAAiB,CAClD,wBAAwB,CAAC,OAAmC,CAC7D,CAAC;gBAEF,4FAA4F;gBAC5F,sBAAsB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;gBAC3C,iBAAiB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;aAC1C;SACF;KACF;IAED,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC;AAED,+CAA+C;AAC/C,SAAS,iBAAiB,CAAuC,GAAM;IACrE,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,MAAM,eAAe,GAA+B,EAAE,CAAC;IAEvD,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;QAC5B,eAAe,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;KACjC;IAED,OAAO,eAAoB,CAAC;AAC9B,CAAC","sourcesContent":["import type { PackageDefinitionsCache, PackageJson, PackageJsonExportsObject } from '@ms-cloudpack/bundler-types';\nimport type { GeneratedConfig, PackageSettings } from '@ms-cloudpack/config';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n flattenExportsMap,\n getExportsMap,\n} from '@ms-cloudpack/package-utilities';\nimport { bulletedList, cyan } from '@ms-cloudpack/task-reporter';\nimport type { GeneratedPackageChanges } from './types/GeneratedPackageChanges.js';\n\n/**\n * Evaluate the imports depended on by a package to determine if missing exports map paths need to be added.\n * If so, updates package overrides to the given packageOverrides array.\n */\nexport async function evaluateImportsForOverrides(options: {\n packages: PackageDefinitionsCache;\n imports: Map<string, Set<string>>;\n definition: PackageJson;\n packagePath: string;\n generatedConfig: GeneratedConfig;\n packagePathsToEvaluate: Set<string>;\n evaluatedPackages: Set<string>;\n resolveMap: ResolveMap;\n}): Promise<{ changes: GeneratedPackageChanges[]; errors: string[] }> {\n const {\n packages,\n imports,\n definition,\n packagePath,\n generatedConfig,\n packagePathsToEvaluate,\n evaluatedPackages,\n resolveMap,\n } = options;\n const displayName = `${definition.name}@${definition.version}`;\n const changes: GeneratedPackageChanges[] = [];\n const errors: string[] = [];\n\n // Iterate through imports and find their path from the resolve map.\n for (const [dependencyName, dependencyImportPaths] of imports.entries()) {\n const resolveEntry = findResolveMapEntry({ definition, packageName: dependencyName, resolveMap });\n const dependencyPath = resolveEntry?.path;\n const dependencyDefinition = dependencyPath ? await packages.get(dependencyPath) : undefined;\n\n if (!dependencyPath || !dependencyDefinition) {\n const errorMessage =\n `Package \"${displayName}\" imports from the package \"${dependencyName}\" but it couldn't be found. ` +\n `Ensure that \"${dependencyName}\" is listed in dependencies of \"${displayName}\".`;\n console.error(errorMessage);\n errors.push(errorMessage);\n\n continue;\n }\n\n // Make sure to add the package to the list of packages to evaluate.\n packagePathsToEvaluate.add(dependencyPath);\n\n // Get the flattened bundle-able exports map for this dependency and iterate through our import paths to ensure nothing is missing.\n const exports = await getExportsMap({ packagePath: dependencyPath }, { packages });\n const flattenedExports = flattenExportsMap(exports);\n const packageSettings = (generatedConfig.packageSettings ??= []);\n const { name, version } = dependencyDefinition;\n let generatedPackageSettings: PackageSettings | undefined;\n\n if (!name || !version) {\n throw new Error(`Package \"${displayName}\" depends on \"${dependencyName}\" but it is missing a name or version.`);\n }\n\n for (const dependencyImportPath of dependencyImportPaths) {\n if (flattenedExports[dependencyImportPath]) {\n continue;\n }\n\n // We are missing an import path. We need to add this entry to the exports map in package settings.\n generatedPackageSettings ??= getPackageSettings({\n config: { generated: { packageSettings } },\n name,\n version,\n firstMatch: true,\n }).generatedPackageSettings;\n\n if (!generatedPackageSettings) {\n generatedPackageSettings = {\n match: {\n name,\n version: `^${version}`,\n },\n exports: {},\n };\n packageSettings.push(generatedPackageSettings);\n }\n\n generatedPackageSettings.exports ??= {};\n\n const addedEntry = await addExportsMapEntry(\n {\n exports: generatedPackageSettings.exports,\n packagePath: dependencyPath,\n importPath: dependencyImportPath,\n },\n {\n packages,\n },\n );\n\n if (!addedEntry) {\n const errorMessage = `Imported \"${cyan(\n dependencyImportPath.replace('.', dependencyName),\n )}\" but a corresponding file couldn't be found. Either correct the import or adjust the \"${cyan(\n dependencyName,\n )}\" package version to one that supports this import path.\\n${bulletedList(\n [`${cyan(displayName)}: ${packagePath}`, `${cyan(dependencyName)}: ${dependencyPath}`],\n 2,\n )}`;\n console.error(errorMessage);\n errors.push(errorMessage);\n } else {\n changes.push({\n name: dependencyName,\n version: dependencyDefinition.version || '',\n path: dependencyPath,\n changes: [\n {\n type: 'added-export',\n change: dependencyImportPath,\n reason: `Imported by \"${displayName}\"`,\n },\n ],\n });\n\n generatedPackageSettings.exports = alphabetizeObject<PackageJsonExportsObject>(\n generatedPackageSettings.exports as PackageJsonExportsObject,\n );\n\n // Since we've found a missing exports, we need to re-enqueue the dependency for evaluation.\n packagePathsToEvaluate.add(dependencyPath);\n evaluatedPackages.delete(dependencyPath);\n }\n }\n }\n\n return { changes, errors };\n}\n\n/** Quick helper to alphabetize the exports. */\nfunction alphabetizeObject<T extends { [key: string]: unknown }>(obj: T): T {\n const sortedKeys = Object.keys(obj).sort();\n const alphabetizedObj: { [key: string]: unknown } = {};\n\n for (const key of sortedKeys) {\n alphabetizedObj[key] = obj[key];\n }\n\n return alphabetizedObj as T;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"getStartingAppPath.d.ts","sourceRoot":"","sources":["../../../src/commands/start/getStartingAppPath.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,mBAcxE"}
1
+ {"version":3,"file":"getStartingAppPath.d.ts","sourceRoot":"","sources":["../../../src/commands/start/getStartingAppPath.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,mBAgBxE"}
@@ -17,7 +17,10 @@ export async function getStartingAppPath(cwd, desiredApp) {
17
17
  return cwd;
18
18
  }
19
19
  const folderPaths = findCloudpackAppPaths(cwd);
20
- if (folderPaths.length === 1) {
20
+ if (folderPaths.length === 0) {
21
+ return cwd;
22
+ }
23
+ else if (folderPaths.length === 1) {
21
24
  return folderPaths[0];
22
25
  }
23
26
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"getStartingAppPath.js","sourceRoot":"","sources":["../../../src/commands/start/getStartingAppPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAW,EAAE,UAAmB;IACvE,MAAM,iBAAiB,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAClG,IAAI,iBAAiB,EAAE;QACrB,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,WAAW,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;KACvB;SAAM;QACL,MAAM,wBAAwB,GAAG,MAAM,qBAAqB,CAAC,WAAW,CAAC,CAAC;QAC1E,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;QAC/E,OAAO,OAAO,IAAI,GAAG,CAAC;KACvB;AACH,CAAC","sourcesContent":["import { pathExists } from 'fs-extra';\nimport { findCloudpackAppPaths } from '../../common/findCloudpackAppPaths.js';\nimport path from 'path';\nimport { createPathToChoiceMap } from './createPathToChoiceMap.js';\nimport { getAppPathFromUser } from './getAppPathFromUser.js';\n\n/**\n * Gets the appPath from which Cloudpack will start. If the CWD is a Cloudpack-enabled app,\n * we'll start there; otherwise, we'll scan for Cloudpack-enabled app and present the user\n * with a menu. If no app are found, Cloudpack will just try to start the CWD anyway.\n * @param cwd - The current working directory to start in when finding the starting app path\n * @param desiredApp - The app that should be started as specified via --app arg\n * @returns The app path of the app that Cloudpack should start\n */\nexport async function getStartingAppPath(cwd: string, desiredApp?: string) {\n const cwdIsCloudpackApp = await pathExists(path.resolve(path.join(cwd, 'cloudpack.config.json')));\n if (cwdIsCloudpackApp) {\n return cwd;\n }\n\n const folderPaths = findCloudpackAppPaths(cwd);\n if (folderPaths.length === 1) {\n return folderPaths[0];\n } else {\n const pathToCloudpackConfigMap = await createPathToChoiceMap(folderPaths);\n const appPath = await getAppPathFromUser(pathToCloudpackConfigMap, desiredApp);\n return appPath ?? cwd;\n }\n}\n"]}
1
+ {"version":3,"file":"getStartingAppPath.js","sourceRoot":"","sources":["../../../src/commands/start/getStartingAppPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAW,EAAE,UAAmB;IACvE,MAAM,iBAAiB,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAClG,IAAI,iBAAiB,EAAE;QACrB,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,WAAW,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;KACvB;SAAM;QACL,MAAM,wBAAwB,GAAG,MAAM,qBAAqB,CAAC,WAAW,CAAC,CAAC;QAC1E,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;QAC/E,OAAO,OAAO,IAAI,GAAG,CAAC;KACvB;AACH,CAAC","sourcesContent":["import { pathExists } from 'fs-extra';\nimport { findCloudpackAppPaths } from '../../common/findCloudpackAppPaths.js';\nimport path from 'path';\nimport { createPathToChoiceMap } from './createPathToChoiceMap.js';\nimport { getAppPathFromUser } from './getAppPathFromUser.js';\n\n/**\n * Gets the appPath from which Cloudpack will start. If the CWD is a Cloudpack-enabled app,\n * we'll start there; otherwise, we'll scan for Cloudpack-enabled app and present the user\n * with a menu. If no app are found, Cloudpack will just try to start the CWD anyway.\n * @param cwd - The current working directory to start in when finding the starting app path\n * @param desiredApp - The app that should be started as specified via --app arg\n * @returns The app path of the app that Cloudpack should start\n */\nexport async function getStartingAppPath(cwd: string, desiredApp?: string) {\n const cwdIsCloudpackApp = await pathExists(path.resolve(path.join(cwd, 'cloudpack.config.json')));\n if (cwdIsCloudpackApp) {\n return cwd;\n }\n\n const folderPaths = findCloudpackAppPaths(cwd);\n if (folderPaths.length === 0) {\n return cwd;\n } else if (folderPaths.length === 1) {\n return folderPaths[0];\n } else {\n const pathToCloudpackConfigMap = await createPathToChoiceMap(folderPaths);\n const appPath = await getAppPathFromUser(pathToCloudpackConfigMap, desiredApp);\n return appPath ?? cwd;\n }\n}\n"]}
@@ -6,7 +6,7 @@ import { createPartialApiContext } from '../../common/createPartialApiContext.js
6
6
  import { isCIBuild } from '../../utilities/isCIBuild.js';
7
7
  export async function sync({ upload, nonInteractiveLogin }, context) {
8
8
  let hasErrors = false;
9
- let message = '';
9
+ let message = undefined;
10
10
  try {
11
11
  await setupReporting(context);
12
12
  const { config } = context;
@@ -1 +1 @@
1
- {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAe,EAAE,OAAoB;IAC3F,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,OAAO,GAAW,EAAE,CAAC;IACzB,IAAI;QACF,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAC9B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC3B,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC;QAC7C,IAAI,CAAC,iBAAiB,EAAE;YACtB,OAAO,CAA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esContent":["import { red } from '@ms-cloudpack/task-reporter';\nimport { stopTelemetry } from '../../initTelemetry.js';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport type { SyncOptions } from './types/SyncOptions.js';\nimport { setupReporting } from '../../setupReporting.js';\nimport { syncDownload, syncUpload } from '@ms-cloudpack/api-server/apis';\nimport { createPartialApiContext } from '../../common/createPartialApiContext.js';\nimport type { Context } from '@ms-cloudpack/api-server';\nimport { isCIBuild } from '../../utilities/isCIBuild.js';\n\nexport async function sync({ upload, nonInteractiveLogin }: SyncOptions, context: TaskContext) {\n let hasErrors = false;\n let message: string = '';\n try {\n await setupReporting(context);\n const { config } = context;\n const remoteCacheConfig = config.remoteCache;\n if (!remoteCacheConfig) {\n console.warn(\n 'Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file to use this feature.',\n );\n return;\n }\n\n const input = {\n isInteractiveLogin: !(isCIBuild() || nonInteractiveLogin),\n };\n\n let disposeContext: Context['dispose'] | undefined = undefined;\n\n if (upload) {\n const ctx = await createPartialApiContext(context, ['bus', 'taskRunner', 'watcher', 'packages', 'session']);\n disposeContext = ctx.dispose;\n await syncUpload({ input, ctx });\n } else {\n const ctx = await createPartialApiContext(context, ['packages', 'session']);\n disposeContext = ctx.dispose;\n await syncDownload({ input, ctx });\n }\n\n await disposeContext?.();\n hasErrors = context.reporter.hasErrors();\n } catch (error) {\n message = error instanceof Error ? error.message : '<Unknown error>';\n hasErrors = true;\n } finally {\n context.reporter.complete(hasErrors ? red(message) : message);\n await stopTelemetry();\n process.exit(hasErrors ? 1 : 0);\n }\n}\n"]}
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,E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,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;KAC1C;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACrE,SAAS,GAAG,IAAI,CAAC;KAClB;YAAS;QACR,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC9D,MAAM,aAAa,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACjC;AACH,CAAC","sourcesContent":["import { red } from '@ms-cloudpack/task-reporter';\nimport { stopTelemetry } from '../../initTelemetry.js';\nimport type { TaskContext } from '../../types/TaskContext.js';\nimport type { SyncOptions } from './types/SyncOptions.js';\nimport { setupReporting } from '../../setupReporting.js';\nimport { syncDownload, syncUpload } from '@ms-cloudpack/api-server/apis';\nimport { createPartialApiContext } from '../../common/createPartialApiContext.js';\nimport type { Context } from '@ms-cloudpack/api-server';\nimport { isCIBuild } from '../../utilities/isCIBuild.js';\n\nexport async function sync({ upload, nonInteractiveLogin }: SyncOptions, context: TaskContext) {\n let hasErrors = false;\n let message: string | undefined = undefined;\n try {\n await setupReporting(context);\n const { config } = context;\n const remoteCacheConfig = config.remoteCache;\n if (!remoteCacheConfig) {\n console.warn(\n 'Remote cache is not configured. Please add remoteCache to your cloudpack.config.json file to use this feature.',\n );\n return;\n }\n\n const input = {\n isInteractiveLogin: !(isCIBuild() || nonInteractiveLogin),\n };\n\n let disposeContext: Context['dispose'] | undefined = undefined;\n\n if (upload) {\n const ctx = await createPartialApiContext(context, ['bus', 'taskRunner', 'watcher', 'packages', 'session']);\n disposeContext = ctx.dispose;\n await syncUpload({ input, ctx });\n } else {\n const ctx = await createPartialApiContext(context, ['packages', 'session']);\n disposeContext = ctx.dispose;\n await syncDownload({ input, ctx });\n }\n\n await disposeContext?.();\n hasErrors = context.reporter.hasErrors();\n } catch (error) {\n message = error instanceof Error ? error.message : '<Unknown error>';\n hasErrors = true;\n } finally {\n context.reporter.complete(hasErrors ? red(message) : message);\n await stopTelemetry();\n process.exit(hasErrors ? 1 : 0);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.45.0",
3
+ "version": "0.45.2",
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",
@@ -11,15 +11,15 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@lage-run/target-graph": "^0.8.6",
14
- "@ms-cloudpack/api-server": "^0.14.2",
15
- "@ms-cloudpack/bundler": "^0.14.10",
16
- "@ms-cloudpack/config": "^0.12.0",
14
+ "@ms-cloudpack/api-server": "^0.14.4",
15
+ "@ms-cloudpack/bundler": "^0.14.11",
16
+ "@ms-cloudpack/config": "^0.12.1",
17
17
  "@ms-cloudpack/create-express-app": "^1.3.9",
18
18
  "@ms-cloudpack/data-bus": "^0.4.0",
19
19
  "@ms-cloudpack/file-watcher": "^0.0.3",
20
20
  "@ms-cloudpack/json-utilities": "^0.0.7",
21
- "@ms-cloudpack/overlay": "^0.14.11",
22
- "@ms-cloudpack/package-utilities": "^5.1.2",
21
+ "@ms-cloudpack/overlay": "^0.14.13",
22
+ "@ms-cloudpack/package-utilities": "^5.1.3",
23
23
  "@ms-cloudpack/path-string-parsing": "^1.0.3",
24
24
  "@ms-cloudpack/path-utilities": "^2.3.2",
25
25
  "@ms-cloudpack/task-reporter": "^0.7.2",