@ms-cloudpack/cli 0.72.37 → 0.72.39

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":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAKlE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAI5D;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CAsH/C,CAAC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAKlE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAI5D;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,YAAY,CAiI/C,CAAC"}
@@ -35,9 +35,20 @@ export const execute = async (params) => {
35
35
  const cliPath = await resolve('@ms-cloudpack/cli', currentDir);
36
36
  overlayPath = cliPath ? path.join(cliPath, 'node_modules', '@ms-cloudpack/overlay') : undefined;
37
37
  }
38
+ const shouldUseRemoteCache = config.features?.enableCloudHosted || config.features?.enableRemoteCacheDownloads;
38
39
  const [apiContext] = autoDispose(await createPartialApiContext({
39
40
  ...apiContextOptions,
40
- items: ['bus', 'watcher', 'taskRunner', 'packages', 'session', 'packageImportPaths', 'packageHashes'],
41
+ items: [
42
+ 'bus',
43
+ 'watcher',
44
+ 'taskRunner',
45
+ 'packages',
46
+ 'session',
47
+ 'packageImportPaths',
48
+ 'packageHashes',
49
+ shouldUseRemoteCache && 'remoteCacheClient',
50
+ ],
51
+ remoteCacheClientLoginMethod: options.login,
41
52
  overlayPath,
42
53
  }));
43
54
  const { packages, session } = apiContext;
@@ -1 +1 @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,SAAS,EAAE,CAAC;IACzC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,OAAe,CAAC;QACpB,IAAK,GAAwB,CAAC,IAAI,KAAK,eAAe,IAAI,MAAM,EAAE,MAAM,EAAE,CAAC;YACzE,MAAM,aAAa,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1F,OAAO;gBACL,eAAe,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,mDAAmD;oBAC3F,QAAQ,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,0DAA0D;oBAC/F,oBAAoB,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,8BAA+B,GAAa,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC;QACxE,CAAC;QACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACtC,CAAC;AACH,CAAC;AAED,wBAAwB","sourcesContent":["import {\n createPartialApiContext,\n ensurePackageBundled,\n type CloudpackServer,\n type Context,\n} from '@ms-cloudpack/api-server';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { isExternalPackage, resolve } from '@ms-cloudpack/path-utilities';\nimport { makeUrl } from '@ms-cloudpack/path-string-parsing';\nimport { cyan, yellow, bold } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { PerfMarkerCliEntry } from '../../performance/markers.js';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { runPrerequisites } from '../../utilities/runPrerequisites.js';\nimport { getStartingAppPath } from './getStartingAppPath.js';\nimport { openBrowser } from './openBrowser.js';\nimport { trackSession } from './trackSession.js';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { getCertificate } from '@ms-cloudpack/setup-utilities';\nimport { getConfigOptionsFromCliOptions } from '../../utilities/getConfigOptionsFromCliOptions.js';\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport const execute: CommandAction<StartOptions> = async (params) => {\n const { options, cwd, initialize, autoDispose } = params;\n\n const appPathResult = await getStartingAppPath(cwd, options.app);\n if (typeof appPathResult !== 'string') {\n return appPathResult;\n }\n const appPath = appPathResult;\n const apiContextOptions = await initialize({ appPath, configOptions: getConfigOptionsFromCliOptions(options) });\n const { config, telemetryClient } = apiContextOptions;\n\n console.log('App path:', yellow(appPath));\n console.log('Bundle mode:', yellow(options.mode));\n\n await runPrerequisites(apiContextOptions);\n\n const currentDir = path.dirname(fileURLToPath(import.meta.url));\n let overlayPath = await resolve('@ms-cloudpack/overlay', currentDir);\n\n // If overlay is an internal package, resolve the overlay from the current package's linked node modules\n // to \"externalize\" it, so that we always use the bundled version of the overlay instead of the source.\n if (overlayPath && !isExternalPackage(overlayPath)) {\n const cliPath = await resolve('@ms-cloudpack/cli', currentDir);\n overlayPath = cliPath ? path.join(cliPath, 'node_modules', '@ms-cloudpack/overlay') : undefined;\n }\n\n const [apiContext] = autoDispose(\n await createPartialApiContext({\n ...apiContextOptions,\n items: ['bus', 'watcher', 'taskRunner', 'packages', 'session', 'packageImportPaths', 'packageHashes'],\n overlayPath,\n }),\n );\n const { packages, session } = apiContext;\n\n // Increment the session version if caching is disabled.\n if (options.cache === false) {\n session.incrementSessionVersion();\n }\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\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 // Start api server for tracking status and handling remote requests.\n const apiServerResult = await createApiServer(options, apiContext);\n if (apiServerResult.hasErrors) {\n return apiServerResult;\n }\n const { apiServer } = apiServerResult;\n\n // Kick off bundling app package as soon as api server is ready.\n void ensurePackageBundled({\n input: { name: definition.name, version: definition.version },\n ctx: apiContext,\n });\n\n // Then start bundle and app servers for hosting the app.\n const { startServers } = await import('@ms-cloudpack/app-server');\n const servers = await startServers(\n {\n definition,\n bundleServerOptions: { disableCache: !options.cache, port: options.bundleServerPort },\n port: options.appServerPort,\n },\n apiContext,\n );\n\n // Save the session to active sessions.\n const sessionTracker = await trackSession(session);\n\n const cleanup = async () => {\n // Stop tracking the session.\n await sessionTracker.close();\n\n await Promise.all(\n Object.entries({ apiServer, ...servers }).map(async ([name, server]) => {\n if (!server) return;\n\n const desc = `${name} (${server.url})`;\n console.info(`Closing ${desc}`);\n try {\n await server.close();\n console.info(`Closed ${desc}`);\n } catch (err) {\n console.warn(`Error closing ${desc}:`, err);\n }\n }),\n );\n };\n\n autoDispose({ dispose: cleanup });\n\n const defaultUrl = makeUrl(config.server?.defaultPath || '', session.urls.appServer).href;\n\n const cliEntryMarker = performance.getEntriesByName(PerfMarkerCliEntry, 'mark')[0];\n if (cliEntryMarker) {\n telemetryClient.tracer.startSpan('TIME_TO_OPEN_BROWSER', { startTime: cliEntryMarker.startTime }).end();\n } else {\n throw new Error('TIME_TO_OPEN_BROWSER marker not found');\n }\n\n // Open the browser.\n if (options.open !== false) {\n openBrowser(defaultUrl).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:', defaultUrl);\n });\n } else {\n console.log('Please open the browser manually to:', defaultUrl);\n }\n\n return null; // the command should keep running\n};\n\n/**\n * Create the API server, or return an error message if the server could not be created.\n */\nasync function createApiServer(\n options: StartOptions,\n apiContext: Context,\n): Promise<{ hasErrors: false; apiServer: CloudpackServer } | { hasErrors: true; message: string }> {\n const { session } = apiContext;\n const { config } = session;\n const { server, appPath } = config;\n\n // If a cert is needed, check that it exists.\n if (server?.https === true && !(await getCertificate({ domain: server?.domain, cwd: appPath }))) {\n return {\n hasErrors: true,\n message:\n `The local site is configured to use https in cloudpack.config.json, but is missing a cert.\\n\\n` +\n `Run \"${cyan(bold('cloudpack setup'))}\" to create the required certificate and try start again.\\n`,\n };\n }\n\n const { createCloudpackServer } = await import('@ms-cloudpack/api-server');\n\n try {\n const apiServer = await createCloudpackServer({ port: options.apiServerPort }, apiContext);\n return { hasErrors: false, apiServer };\n } catch (err) {\n let message: string;\n if ((err as { code: string }).code === 'EADDRNOTAVAIL' && server?.domain) {\n const primaryDomain = (Array.isArray(server.domain) ? server.domain : [server.domain])[0];\n message =\n `The domain \"${cyan(bold(primaryDomain))}\" in cloudpack.config.json is not resolvable.\\n\\n` +\n `Run \"${cyan(bold('cloudpack setup'))}\" to add the appropriate entries to your hosts file and ` +\n `try start again.\\n`;\n } else {\n message = `Error creating API server: ${(err as Error).stack || err}`;\n }\n return { hasErrors: true, message };\n }\n}\n\n// cspell:ignore Prereqs\n"]}
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/commands/start/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EA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,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC;QACxE,CAAC;QACD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACtC,CAAC;AACH,CAAC;AAED,wBAAwB","sourcesContent":["import {\n createPartialApiContext,\n ensurePackageBundled,\n type CloudpackServer,\n type Context,\n} from '@ms-cloudpack/api-server';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { isExternalPackage, resolve } from '@ms-cloudpack/path-utilities';\nimport { makeUrl } from '@ms-cloudpack/path-string-parsing';\nimport { cyan, yellow, bold } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { PerfMarkerCliEntry } from '../../performance/markers.js';\nimport type { CommandAction } from '../../types/CommandAction.js';\nimport { runPrerequisites } from '../../utilities/runPrerequisites.js';\nimport { getStartingAppPath } from './getStartingAppPath.js';\nimport { openBrowser } from './openBrowser.js';\nimport { trackSession } from './trackSession.js';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { getCertificate } from '@ms-cloudpack/setup-utilities';\nimport { getConfigOptionsFromCliOptions } from '../../utilities/getConfigOptionsFromCliOptions.js';\n\n/**\n * Defines the \"start\" verb entry point.\n */\nexport const execute: CommandAction<StartOptions> = async (params) => {\n const { options, cwd, initialize, autoDispose } = params;\n\n const appPathResult = await getStartingAppPath(cwd, options.app);\n if (typeof appPathResult !== 'string') {\n return appPathResult;\n }\n const appPath = appPathResult;\n const apiContextOptions = await initialize({ appPath, configOptions: getConfigOptionsFromCliOptions(options) });\n const { config, telemetryClient } = apiContextOptions;\n\n console.log('App path:', yellow(appPath));\n console.log('Bundle mode:', yellow(options.mode));\n\n await runPrerequisites(apiContextOptions);\n\n const currentDir = path.dirname(fileURLToPath(import.meta.url));\n let overlayPath = await resolve('@ms-cloudpack/overlay', currentDir);\n\n // If overlay is an internal package, resolve the overlay from the current package's linked node modules\n // to \"externalize\" it, so that we always use the bundled version of the overlay instead of the source.\n if (overlayPath && !isExternalPackage(overlayPath)) {\n const cliPath = await resolve('@ms-cloudpack/cli', currentDir);\n overlayPath = cliPath ? path.join(cliPath, 'node_modules', '@ms-cloudpack/overlay') : undefined;\n }\n\n const shouldUseRemoteCache = config.features?.enableCloudHosted || config.features?.enableRemoteCacheDownloads;\n const [apiContext] = autoDispose(\n await createPartialApiContext({\n ...apiContextOptions,\n items: [\n 'bus',\n 'watcher',\n 'taskRunner',\n 'packages',\n 'session',\n 'packageImportPaths',\n 'packageHashes',\n shouldUseRemoteCache && 'remoteCacheClient',\n ],\n remoteCacheClientLoginMethod: options.login,\n overlayPath,\n }),\n );\n const { packages, session } = apiContext;\n\n // Increment the session version if caching is disabled.\n if (options.cache === false) {\n session.incrementSessionVersion();\n }\n\n // Make sure the package has a valid definition.\n const definition = await packages.get(appPath);\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 // Start api server for tracking status and handling remote requests.\n const apiServerResult = await createApiServer(options, apiContext);\n if (apiServerResult.hasErrors) {\n return apiServerResult;\n }\n const { apiServer } = apiServerResult;\n\n // Kick off bundling app package as soon as api server is ready.\n void ensurePackageBundled({\n input: { name: definition.name, version: definition.version },\n ctx: apiContext,\n });\n\n // Then start bundle and app servers for hosting the app.\n const { startServers } = await import('@ms-cloudpack/app-server');\n const servers = await startServers(\n {\n definition,\n bundleServerOptions: { disableCache: !options.cache, port: options.bundleServerPort },\n port: options.appServerPort,\n },\n apiContext,\n );\n\n // Save the session to active sessions.\n const sessionTracker = await trackSession(session);\n\n const cleanup = async () => {\n // Stop tracking the session.\n await sessionTracker.close();\n\n await Promise.all(\n Object.entries({ apiServer, ...servers }).map(async ([name, server]) => {\n if (!server) return;\n\n const desc = `${name} (${server.url})`;\n console.info(`Closing ${desc}`);\n try {\n await server.close();\n console.info(`Closed ${desc}`);\n } catch (err) {\n console.warn(`Error closing ${desc}:`, err);\n }\n }),\n );\n };\n\n autoDispose({ dispose: cleanup });\n\n const defaultUrl = makeUrl(config.server?.defaultPath || '', session.urls.appServer).href;\n\n const cliEntryMarker = performance.getEntriesByName(PerfMarkerCliEntry, 'mark')[0];\n if (cliEntryMarker) {\n telemetryClient.tracer.startSpan('TIME_TO_OPEN_BROWSER', { startTime: cliEntryMarker.startTime }).end();\n } else {\n throw new Error('TIME_TO_OPEN_BROWSER marker not found');\n }\n\n // Open the browser.\n if (options.open !== false) {\n openBrowser(defaultUrl).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:', defaultUrl);\n });\n } else {\n console.log('Please open the browser manually to:', defaultUrl);\n }\n\n return null; // the command should keep running\n};\n\n/**\n * Create the API server, or return an error message if the server could not be created.\n */\nasync function createApiServer(\n options: StartOptions,\n apiContext: Context,\n): Promise<{ hasErrors: false; apiServer: CloudpackServer } | { hasErrors: true; message: string }> {\n const { session } = apiContext;\n const { config } = session;\n const { server, appPath } = config;\n\n // If a cert is needed, check that it exists.\n if (server?.https === true && !(await getCertificate({ domain: server?.domain, cwd: appPath }))) {\n return {\n hasErrors: true,\n message:\n `The local site is configured to use https in cloudpack.config.json, but is missing a cert.\\n\\n` +\n `Run \"${cyan(bold('cloudpack setup'))}\" to create the required certificate and try start again.\\n`,\n };\n }\n\n const { createCloudpackServer } = await import('@ms-cloudpack/api-server');\n\n try {\n const apiServer = await createCloudpackServer({ port: options.apiServerPort }, apiContext);\n return { hasErrors: false, apiServer };\n } catch (err) {\n let message: string;\n if ((err as { code: string }).code === 'EADDRNOTAVAIL' && server?.domain) {\n const primaryDomain = (Array.isArray(server.domain) ? server.domain : [server.domain])[0];\n message =\n `The domain \"${cyan(bold(primaryDomain))}\" in cloudpack.config.json is not resolvable.\\n\\n` +\n `Run \"${cyan(bold('cloudpack setup'))}\" to add the appropriate entries to your hosts file and ` +\n `try start again.\\n`;\n } else {\n message = `Error creating API server: ${(err as Error).stack || err}`;\n }\n return { hasErrors: true, message };\n }\n}\n\n// cspell:ignore Prereqs\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAK9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAmBlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAK9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAoBlB,CAAC"}
@@ -15,6 +15,7 @@ export const init = (program) => {
15
15
  apiServerPort: getPortOption('--api-server-port <port>', 'API'),
16
16
  appServerPort: getPortOption('--app-server-port <port>', 'app'),
17
17
  bundleServerPort: getPortOption('--bundle-server-port <port>', 'bundle'),
18
+ login: reusedOptions.login(),
18
19
  },
19
20
  getExecutor: () => import('./execute.js'),
20
21
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,gCAAgC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAe;QAClC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,0DAA0D;QACvE,OAAO,EAAE;YACP,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YAC3C,GAAG,EAAE,IAAI,MAAM,CACb,wBAAwB,EACxB,qGAAqG,CACtG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MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,oBAAoB,CAAC,qCAAqC,KAAK,GAAG,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { InvalidArgumentError, Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { portNumbers } from 'get-port';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n/** Defines the \"start\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<StartOptions>({\n name: 'start',\n description: 'Starts a web inner-loop from the current package folder.',\n options: {\n mode: reusedOptions.mode({ action: 'run' }),\n app: new Option(\n '--app <appPackageName>',\n 'Run Cloudpack targeting a specific app (only needed if running init at a higher level in the repo).',\n ),\n open: new Option('--no-open', 'Do not open the browser.'),\n cache: reusedOptions.noCache(),\n logResolveMap: reusedOptions.logResolveMap(),\n apiServerPort: getPortOption('--api-server-port <port>', 'API'),\n appServerPort: getPortOption('--app-server-port <port>', 'app'),\n bundleServerPort: getPortOption('--bundle-server-port <port>', 'bundle'),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n\nfunction getPortOption(flags: string, name: string): Option {\n return new Option(flags, `Port to use for the ${name} server (single, comma-separated, or range with dash).`)\n .argParser(parsePorts)\n .hideHelp();\n}\n\nfunction parsePorts(value: string): number[] {\n if (value.includes('-')) {\n const split = value.split('-');\n if (split.length !== 2) {\n throw new InvalidArgumentError(`Invalid port range: \"${value}\"`);\n }\n return [...portNumbers(parseNumber(split[0]), parseNumber(split[1]))];\n }\n\n return value.split(',').map(parseNumber);\n}\n\nfunction parseNumber(value: string): number {\n value = value.trim();\n const parsed = parseInt(value, 10);\n if (isNaN(parsed)) {\n throw new InvalidArgumentError(`Port must be a number; received: \"${value}\"`);\n }\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,CAAC,KAAa;IAC/B,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,oBAAoB,CAAC,wBAAwB,KAAK,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,CAAC,GAAG,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,oBAAoB,CAAC,qCAAqC,KAAK,GAAG,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { InvalidArgumentError, Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { StartOptions } from './types/StartOptions.js';\nimport { portNumbers } from 'get-port';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n/** Defines the \"start\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<StartOptions>({\n name: 'start',\n description: 'Starts a web inner-loop from the current package folder.',\n options: {\n mode: reusedOptions.mode({ action: 'run' }),\n app: new Option(\n '--app <appPackageName>',\n 'Run Cloudpack targeting a specific app (only needed if running init at a higher level in the repo).',\n ),\n open: new Option('--no-open', 'Do not open the browser.'),\n cache: reusedOptions.noCache(),\n logResolveMap: reusedOptions.logResolveMap(),\n apiServerPort: getPortOption('--api-server-port <port>', 'API'),\n appServerPort: getPortOption('--app-server-port <port>', 'app'),\n bundleServerPort: getPortOption('--bundle-server-port <port>', 'bundle'),\n login: reusedOptions.login(),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n\nfunction getPortOption(flags: string, name: string): Option {\n return new Option(flags, `Port to use for the ${name} server (single, comma-separated, or range with dash).`)\n .argParser(parsePorts)\n .hideHelp();\n}\n\nfunction parsePorts(value: string): number[] {\n if (value.includes('-')) {\n const split = value.split('-');\n if (split.length !== 2) {\n throw new InvalidArgumentError(`Invalid port range: \"${value}\"`);\n }\n return [...portNumbers(parseNumber(split[0]), parseNumber(split[1]))];\n }\n\n return value.split(',').map(parseNumber);\n}\n\nfunction parseNumber(value: string): number {\n value = value.trim();\n const parsed = parseInt(value, 10);\n if (isNaN(parsed)) {\n throw new InvalidArgumentError(`Port must be a number; received: \"${value}\"`);\n }\n return parsed;\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { BundleMode } from '@ms-cloudpack/common-types';
2
+ import type { LoginMethod } from '@ms-cloudpack/remote-cache';
2
3
  export interface StartOptions {
3
4
  /** Writes the resolve map to `resolve-map.json`. */
4
5
  logResolveMap?: boolean;
@@ -16,5 +17,7 @@ export interface StartOptions {
16
17
  appServerPort?: number | number[];
17
18
  /** Mostly for testing: custom port for the bundle server */
18
19
  bundleServerPort?: number | number[];
20
+ /** How to authenticate against the remote cache */
21
+ login: LoginMethod;
19
22
  }
20
23
  //# sourceMappingURL=StartOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StartOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,6DAA6D;IAC7D,IAAI,EAAE,UAAU,CAAC;IAEjB,wGAAwG;IACxG,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAElC,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAElC,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACtC"}
1
+ {"version":3,"file":"StartOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,6DAA6D;IAC7D,IAAI,EAAE,UAAU,CAAC;IAEjB,wGAAwG;IACxG,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,+DAA+D;IAC/D,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAElC,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAElC,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAErC,mDAAmD;IACnD,KAAK,EAAE,WAAW,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"StartOptions.js","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { BundleMode } from '@ms-cloudpack/common-types';\n\nexport interface StartOptions {\n /** Writes the resolve map to `resolve-map.json`. */\n logResolveMap?: boolean;\n\n /** The mode to start in (library/development/production). */\n mode: BundleMode;\n\n /** Specifies which specific app to run, in the case of running `init` at a higher level in the repo. */\n app?: string;\n\n /** Whether to open the browser (default true) */\n open?: boolean;\n\n /** Whether to use the cache on first request (default true) */\n cache?: boolean;\n\n /** Mostly for testing: custom port for the API server */\n apiServerPort?: number | number[];\n\n /** Mostly for testing: custom port for the app server (also set in config via `server.port`) */\n appServerPort?: number | number[];\n\n /** Mostly for testing: custom port for the bundle server */\n bundleServerPort?: number | number[];\n}\n"]}
1
+ {"version":3,"file":"StartOptions.js","sourceRoot":"","sources":["../../../../src/commands/start/types/StartOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { BundleMode } from '@ms-cloudpack/common-types';\nimport type { LoginMethod } from '@ms-cloudpack/remote-cache';\n\nexport interface StartOptions {\n /** Writes the resolve map to `resolve-map.json`. */\n logResolveMap?: boolean;\n\n /** The mode to start in (library/development/production). */\n mode: BundleMode;\n\n /** Specifies which specific app to run, in the case of running `init` at a higher level in the repo. */\n app?: string;\n\n /** Whether to open the browser (default true) */\n open?: boolean;\n\n /** Whether to use the cache on first request (default true) */\n cache?: boolean;\n\n /** Mostly for testing: custom port for the API server */\n apiServerPort?: number | number[];\n\n /** Mostly for testing: custom port for the app server (also set in config via `server.port`) */\n appServerPort?: number | number[];\n\n /** Mostly for testing: custom port for the bundle server */\n bundleServerPort?: number | number[];\n\n /** How to authenticate against the remote cache */\n login: LoginMethod;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAQ9E,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,mBAclB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAI9E,+BAA+B;AAC/B,eAAO,MAAM,IAAI,EAAE,mBAYlB,CAAC"}
@@ -1,8 +1,5 @@
1
1
  import { Option } from 'commander';
2
- import { environmentInfo } from '@ms-cloudpack/environment';
3
- function getDefaultLogin() {
4
- return environmentInfo.isCI ? 'azure-cli' : environmentInfo.isCodespaces ? 'device-code' : 'interactive';
5
- }
2
+ import { reusedOptions } from '../../utilities/reusedOptions.js';
6
3
  /** Defines the "sync" verb. */
7
4
  export const init = (program) => {
8
5
  program.addSubCommand({
@@ -11,9 +8,7 @@ export const init = (program) => {
11
8
  'By default (without --upload) it will download any packages not found in the local cache.',
12
9
  options: {
13
10
  upload: new Option('--upload', 'Upload packages to the remote cache (instead of downloading).'),
14
- login: new Option('--login <method>', 'How to authenticate against the remote cache.')
15
- .choices(['interactive', 'azure-cli', 'device-code'])
16
- .default(getDefaultLogin(), '"azure-cli" in CI, "device-code" in Github Codespaces, "interactive" otherwise'),
11
+ login: reusedOptions.login(),
17
12
  },
18
13
  getExecutor: () => import('./execute.js'),
19
14
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,SAAS,eAAe;IACtB,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC;AAC3G,CAAC;AAED,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAc;QACjC,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,2CAA2C;YAC3C,2FAA2F;QAC7F,OAAO,EAAE;YACP,MAAM,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,+DAA+D,CAAC;YAC/F,KAAK,EAAE,IAAI,MAAM,CAAC,kBAAkB,EAAE,+CAA+C,CAAC;iBACnF,OAAO,CAAC,CAAC,aAAa,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;iBACpD,OAAO,CAAC,eAAe,EAAE,EAAE,gFAAgF,CAAC;SAChH;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { SyncOptions } from './types/SyncOptions.js';\nimport { environmentInfo } from '@ms-cloudpack/environment';\n\nfunction getDefaultLogin(): string {\n return environmentInfo.isCI ? 'azure-cli' : environmentInfo.isCodespaces ? 'device-code' : 'interactive';\n}\n\n/** Defines the \"sync\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<SyncOptions>({\n name: 'sync',\n description:\n 'Syncs packages from/to the remote cache. ' +\n 'By default (without --upload) it will download any packages not found in the local cache.',\n options: {\n upload: new Option('--upload', 'Upload packages to the remote cache (instead of downloading).'),\n login: new Option('--login <method>', 'How to authenticate against the remote cache.')\n .choices(['interactive', 'azure-cli', 'device-code'])\n .default(getDefaultLogin(), '\"azure-cli\" in CI, \"device-code\" in Github Codespaces, \"interactive\" otherwise'),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAc;QACjC,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,2CAA2C;YAC3C,2FAA2F;QAC7F,OAAO,EAAE;YACP,MAAM,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,+DAA+D,CAAC;YAC/F,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;SAC7B;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { SyncOptions } from './types/SyncOptions.js';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n/** Defines the \"sync\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<SyncOptions>({\n name: 'sync',\n description:\n 'Syncs packages from/to the remote cache. ' +\n 'By default (without --upload) it will download any packages not found in the local cache.',\n options: {\n upload: new Option('--upload', 'Upload packages to the remote cache (instead of downloading).'),\n login: reusedOptions.login(),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
@@ -13,5 +13,6 @@ export declare const reusedOptions: {
13
13
  action: "bundle" | "run";
14
14
  }) => Option;
15
15
  readonly noCache: () => Option;
16
+ readonly login: () => Option;
16
17
  };
17
18
  //# sourceMappingURL=reusedOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reusedOptions.d.ts","sourceRoot":"","sources":["../../src/utilities/reusedOptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,MAAM,EAAE,MAAM,WAAW,CAAC;AAGzD;;GAEG;AACH,eAAO,MAAM,aAAa;;IAExB;;;OAGG;uCACuB,MAAM;6BAKhB;QAAE,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAA;KAAE;;CAQpC,CAAC"}
1
+ {"version":3,"file":"reusedOptions.d.ts","sourceRoot":"","sources":["../../src/utilities/reusedOptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,MAAM,EAAE,MAAM,WAAW,CAAC;AAIzD;;GAEG;AACH,eAAO,MAAM,aAAa;;IAExB;;;OAGG;uCACuB,MAAM;6BAKhB;QAAE,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAA;KAAE;;;CAYpC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { InvalidArgumentError, Option } from 'commander';
2
2
  import { parseMatch } from './parseMatch.js';
3
+ import { environmentInfo } from '@ms-cloudpack/environment';
3
4
  /**
4
5
  * These options are used by multiple commands, but should be manually added.
5
6
  */
@@ -14,6 +15,9 @@ export const reusedOptions = {
14
15
  .argParser(parseBundleMode)
15
16
  .default('library'),
16
17
  noCache: () => new Option('--no-cache', 'Rebuild all packages, rather than using cached assets.'),
18
+ login: () => new Option('--login <method>', 'How to authenticate against the remote cache.')
19
+ .choices(['interactive', 'azure-cli', 'device-code'])
20
+ .default(getDefaultLogin(), '"azure-cli" in CI, "device-code" in Github Codespaces, "interactive" otherwise'),
17
21
  };
18
22
  /** Parse the session mode based on user input (e.g. --mode argument in start.) */
19
23
  function parseBundleMode(mode) {
@@ -31,4 +35,7 @@ function parseBundleMode(mode) {
31
35
  throw new InvalidArgumentError(`Valid options are 'lib', 'dev', or 'prod'.`);
32
36
  }
33
37
  }
38
+ function getDefaultLogin() {
39
+ return environmentInfo.isCI ? 'azure-cli' : environmentInfo.isCodespaces ? 'device-code' : 'interactive';
40
+ }
34
41
  //# sourceMappingURL=reusedOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reusedOptions.js","sourceRoot":"","sources":["../../src/utilities/reusedOptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,mBAAmB,EAAE,4DAA4D,CAAC;IAClH;;;OAGG;IACH,KAAK,EAAE,CAAC,gBAAwB,EAAE,EAAE,CAClC,IAAI,MAAM,CACR,oBAAoB,EACpB,GAAG,gBAAgB,gEAAgE,CACpF,CAAC,SAAS,CAAC,UAAU,CAAC;IACzB,IAAI,EAAE,CAAC,OAAqC,EAAE,EAAE,CAC9C,IAAI,MAAM,CACR,eAAe,EACf,eAAe,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,aAAa,6BAA6B,CAC/G;SACE,SAAS,CAAC,eAAe,CAAC;SAC1B,OAAO,CAAC,SAAS,CAAC;IACvB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,YAAY,EAAE,wDAAwD,CAAC;CACzF,CAAC;AAEX,kFAAkF;AAClF,SAAS,eAAe,CAAC,IAAY;IACnC,QAAQ,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC3B,KAAK,KAAK,CAAC;QACX,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,KAAK,CAAC;QACX,KAAK,aAAa;YAChB,OAAO,aAAa,CAAC;QACvB,KAAK,MAAM,CAAC;QACZ,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB;YACE,MAAM,IAAI,oBAAoB,CAAC,4CAA4C,CAAC,CAAC;IACjF,CAAC;AACH,CAAC","sourcesContent":["import type { BundleMode } from '@ms-cloudpack/common-types';\nimport { InvalidArgumentError, Option } from 'commander';\nimport { parseMatch } from './parseMatch.js';\n\n/**\n * These options are used by multiple commands, but should be manually added.\n */\nexport const reusedOptions = {\n logResolveMap: () => new Option('--log-resolve-map', 'Log the resolve map to \"resolve-map.json\" for diagnostics.'),\n /**\n * @param descriptionStart Start of description for this command, e.g. \"Bundle specific package(s)\"\n * (it will automatically include an optional version note and examples)\n */\n match: (descriptionStart: string) =>\n new Option(\n '--match <match...>',\n `${descriptionStart}, optionally with a version: e.g. \"foo\", \"@foo/*\", \"foo@1.2.3\"`,\n ).argParser(parseMatch),\n mode: (options: { action: 'bundle' | 'run' }) =>\n new Option(\n '--mode <mode>',\n `The mode to ${options.action === 'bundle' ? 'bundle the package' : 'run the app'} in. (library | production)`,\n )\n .argParser(parseBundleMode)\n .default('library'),\n noCache: () => new Option('--no-cache', 'Rebuild all packages, rather than using cached assets.'),\n} as const;\n\n/** Parse the session mode based on user input (e.g. --mode argument in start.) */\nfunction parseBundleMode(mode: string): BundleMode {\n switch (mode.toLowerCase()) {\n case 'lib':\n case 'library':\n return 'library';\n case 'dev':\n case 'development':\n return 'development';\n case 'prod':\n case 'production':\n return 'production';\n default:\n throw new InvalidArgumentError(`Valid options are 'lib', 'dev', or 'prod'.`);\n }\n}\n"]}
1
+ {"version":3,"file":"reusedOptions.js","sourceRoot":"","sources":["../../src/utilities/reusedOptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,mBAAmB,EAAE,4DAA4D,CAAC;IAClH;;;OAGG;IACH,KAAK,EAAE,CAAC,gBAAwB,EAAE,EAAE,CAClC,IAAI,MAAM,CACR,oBAAoB,EACpB,GAAG,gBAAgB,gEAAgE,CACpF,CAAC,SAAS,CAAC,UAAU,CAAC;IACzB,IAAI,EAAE,CAAC,OAAqC,EAAE,EAAE,CAC9C,IAAI,MAAM,CACR,eAAe,EACf,eAAe,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,aAAa,6BAA6B,CAC/G;SACE,SAAS,CAAC,eAAe,CAAC;SAC1B,OAAO,CAAC,SAAS,CAAC;IACvB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,MAAM,CAAC,YAAY,EAAE,wDAAwD,CAAC;IACjG,KAAK,EAAE,GAAG,EAAE,CACV,IAAI,MAAM,CAAC,kBAAkB,EAAE,+CAA+C,CAAC;SAC5E,OAAO,CAAC,CAAC,aAAa,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;SACpD,OAAO,CAAC,eAAe,EAAE,EAAE,gFAAgF,CAAC;CACzG,CAAC;AAEX,kFAAkF;AAClF,SAAS,eAAe,CAAC,IAAY;IACnC,QAAQ,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QAC3B,KAAK,KAAK,CAAC;QACX,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,KAAK,CAAC;QACX,KAAK,aAAa;YAChB,OAAO,aAAa,CAAC;QACvB,KAAK,MAAM,CAAC;QACZ,KAAK,YAAY;YACf,OAAO,YAAY,CAAC;QACtB;YACE,MAAM,IAAI,oBAAoB,CAAC,4CAA4C,CAAC,CAAC;IACjF,CAAC;AACH,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC;AAC3G,CAAC","sourcesContent":["import type { BundleMode } from '@ms-cloudpack/common-types';\nimport { InvalidArgumentError, Option } from 'commander';\nimport { parseMatch } from './parseMatch.js';\nimport { environmentInfo } from '@ms-cloudpack/environment';\n\n/**\n * These options are used by multiple commands, but should be manually added.\n */\nexport const reusedOptions = {\n logResolveMap: () => new Option('--log-resolve-map', 'Log the resolve map to \"resolve-map.json\" for diagnostics.'),\n /**\n * @param descriptionStart Start of description for this command, e.g. \"Bundle specific package(s)\"\n * (it will automatically include an optional version note and examples)\n */\n match: (descriptionStart: string) =>\n new Option(\n '--match <match...>',\n `${descriptionStart}, optionally with a version: e.g. \"foo\", \"@foo/*\", \"foo@1.2.3\"`,\n ).argParser(parseMatch),\n mode: (options: { action: 'bundle' | 'run' }) =>\n new Option(\n '--mode <mode>',\n `The mode to ${options.action === 'bundle' ? 'bundle the package' : 'run the app'} in. (library | production)`,\n )\n .argParser(parseBundleMode)\n .default('library'),\n noCache: () => new Option('--no-cache', 'Rebuild all packages, rather than using cached assets.'),\n login: () =>\n new Option('--login <method>', 'How to authenticate against the remote cache.')\n .choices(['interactive', 'azure-cli', 'device-code'])\n .default(getDefaultLogin(), '\"azure-cli\" in CI, \"device-code\" in Github Codespaces, \"interactive\" otherwise'),\n} as const;\n\n/** Parse the session mode based on user input (e.g. --mode argument in start.) */\nfunction parseBundleMode(mode: string): BundleMode {\n switch (mode.toLowerCase()) {\n case 'lib':\n case 'library':\n return 'library';\n case 'dev':\n case 'development':\n return 'development';\n case 'prod':\n case 'production':\n return 'production';\n default:\n throw new InvalidArgumentError(`Valid options are 'lib', 'dev', or 'prod'.`);\n }\n}\n\nfunction getDefaultLogin(): string {\n return environmentInfo.isCI ? 'azure-cli' : environmentInfo.isCodespaces ? 'device-code' : 'interactive';\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.72.37",
3
+ "version": "0.72.39",
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,21 +10,21 @@
10
10
  "cloudpack": "./bin/cloudpack.js"
11
11
  },
12
12
  "dependencies": {
13
- "@ms-cloudpack/api-server": "^0.58.2",
14
- "@ms-cloudpack/app-server": "^0.17.32",
15
- "@ms-cloudpack/bundler": "^0.23.30",
16
- "@ms-cloudpack/common-types": "^0.24.1",
17
- "@ms-cloudpack/config": "^0.33.7",
13
+ "@ms-cloudpack/api-server": "^0.58.4",
14
+ "@ms-cloudpack/app-server": "^0.17.34",
15
+ "@ms-cloudpack/bundler": "^0.23.31",
16
+ "@ms-cloudpack/common-types": "^0.24.2",
17
+ "@ms-cloudpack/config": "^0.33.8",
18
18
  "@ms-cloudpack/environment": "^0.1.1",
19
19
  "@ms-cloudpack/json-utilities": "^0.1.10",
20
- "@ms-cloudpack/overlay": "^0.17.113",
21
- "@ms-cloudpack/package-utilities": "^11.1.1",
20
+ "@ms-cloudpack/overlay": "^0.17.115",
21
+ "@ms-cloudpack/package-utilities": "^11.1.2",
22
22
  "@ms-cloudpack/path-string-parsing": "^1.2.6",
23
- "@ms-cloudpack/path-utilities": "^2.8.2",
24
- "@ms-cloudpack/remote-cache": "^0.10.1",
25
- "@ms-cloudpack/setup-utilities": "^0.5.8",
23
+ "@ms-cloudpack/path-utilities": "^2.8.3",
24
+ "@ms-cloudpack/remote-cache": "^0.10.3",
25
+ "@ms-cloudpack/setup-utilities": "^0.5.9",
26
26
  "@ms-cloudpack/task-reporter": "^0.14.8",
27
- "@ms-cloudpack/telemetry": "^0.10.6",
27
+ "@ms-cloudpack/telemetry": "^0.10.7",
28
28
  "@yarnpkg/lockfile": "^1.1.0",
29
29
  "commander": "^11.1.0",
30
30
  "cross-spawn": "^7.0.3",
@@ -37,7 +37,7 @@
37
37
  "workspace-tools": "^0.38.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@ms-cloudpack/common-types": "^0.24.1",
40
+ "@ms-cloudpack/common-types": "^0.24.2",
41
41
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
42
42
  "@ms-cloudpack/scripts": "^0.0.1",
43
43
  "@ms-cloudpack/test-utilities": "^0.5.0",