@ms-cloudpack/cli 0.76.7 → 0.76.9

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.
@@ -4,15 +4,15 @@ import { reusedOptions } from '../../utilities/reusedOptions.js';
4
4
  export const init = (program) => {
5
5
  program.addSubCommand({
6
6
  name: 'bundle',
7
- description: 'Bundles a package.',
7
+ description: 'Bundle one or more packages. It will bundle the current package unless --match is specified.',
8
8
  options: {
9
+ match: reusedOptions.match('Bundle specific package(s)'),
9
10
  mode: reusedOptions.mode({ action: 'bundle' }),
10
11
  bundler: reusedOptions.bundler(),
11
- match: reusedOptions.match('Bundle specific package(s)'),
12
12
  package: new Option('--package <package>').hideHelp().argParser(() => {
13
13
  throw new InvalidArgumentError('Use --match instead of --package');
14
14
  }),
15
- outdir: new Option('--outdir <path>', 'Path for the bundle output, relative to current path (or the resolved path to --package if specified). ' +
15
+ outdir: new Option('--outdir <path>', 'Path for the bundle output, relative to current path (or the resolved path to --match if specified). ' +
16
16
  'Default is a path under the cloudpack cache.'),
17
17
  disableSourceMaps: new Option('--disable-source-maps', 'Disable source maps.'),
18
18
  logBundleInfo: reusedOptions.logBundleInfo(),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,iCAAiC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAgB;QACnC,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,oBAAoB;QACjC,OAAO,EAAE;YACP,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;YAC9C,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE;YAChC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC;YACxD,OAAO,EAAE,IAAI,MAAM,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE;gBACnE,MAAM,IAAI,oBAAoB,CAAC,kCAAkC,CAAC,CAAC;YACrE,CAAC,CAAC;YACF,MAAM,EAAE,IAAI,MAAM,CAChB,iBAAiB,EACjB,yGAAyG;gBACvG,8CAA8C,CACjD;YACD,iBAAiB,EAAE,IAAI,MAAM,CAAC,uBAAuB,EAAE,sBAAsB,CAAC;YAC9E,aAAa,EAAE,aAAa,CAAC,aAAa,EAAE;SAC7C;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { InvalidArgumentError, Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n/** Defines the \"bundle\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<BundleOptions>({\n name: 'bundle',\n description: 'Bundles a package.',\n options: {\n mode: reusedOptions.mode({ action: 'bundle' }),\n bundler: reusedOptions.bundler(),\n match: reusedOptions.match('Bundle specific package(s)'),\n package: new Option('--package <package>').hideHelp().argParser(() => {\n throw new InvalidArgumentError('Use --match instead of --package');\n }),\n outdir: new Option(\n '--outdir <path>',\n 'Path for the bundle output, relative to current path (or the resolved path to --package if specified). ' +\n 'Default is a path under the cloudpack cache.',\n ),\n disableSourceMaps: new Option('--disable-source-maps', 'Disable source maps.'),\n logBundleInfo: reusedOptions.logBundleInfo(),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,iCAAiC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAgB;QACnC,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,8FAA8F;QAC3G,OAAO,EAAE;YACP,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC;YACxD,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;YAC9C,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE;YAChC,OAAO,EAAE,IAAI,MAAM,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE;gBACnE,MAAM,IAAI,oBAAoB,CAAC,kCAAkC,CAAC,CAAC;YACrE,CAAC,CAAC;YACF,MAAM,EAAE,IAAI,MAAM,CAChB,iBAAiB,EACjB,uGAAuG;gBACrG,8CAA8C,CACjD;YACD,iBAAiB,EAAE,IAAI,MAAM,CAAC,uBAAuB,EAAE,sBAAsB,CAAC;YAC9E,aAAa,EAAE,aAAa,CAAC,aAAa,EAAE;SAC7C;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { InvalidArgumentError, Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { BundleOptions } from './types/BundleOptions.js';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n/** Defines the \"bundle\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<BundleOptions>({\n name: 'bundle',\n description: 'Bundle one or more packages. It will bundle the current package unless --match is specified.',\n options: {\n match: reusedOptions.match('Bundle specific package(s)'),\n mode: reusedOptions.mode({ action: 'bundle' }),\n bundler: reusedOptions.bundler(),\n package: new Option('--package <package>').hideHelp().argParser(() => {\n throw new InvalidArgumentError('Use --match instead of --package');\n }),\n outdir: new Option(\n '--outdir <path>',\n 'Path for the bundle output, relative to current path (or the resolved path to --match if specified). ' +\n 'Default is a path under the cloudpack cache.',\n ),\n disableSourceMaps: new Option('--disable-source-maps', 'Disable source maps.'),\n logBundleInfo: reusedOptions.logBundleInfo(),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAalB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAG9E,gCAAgC;AAChC,eAAO,MAAM,IAAI,EAAE,mBAclB,CAAC"}
@@ -4,6 +4,7 @@ export const init = (program) => {
4
4
  name: 'cache',
5
5
  description: 'Operations related to the Cloudpack cache (requires a sub-command).',
6
6
  usage: '<command>',
7
+ hideSharedOptions: true,
7
8
  });
8
9
  cacheCommand.addSubCommand({
9
10
  name: 'clean',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAGA,gCAAgC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;QACzC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,qEAAqE;QAClF,KAAK,EAAE,WAAW;KACnB,CAAC,CAAC;IAEH,YAAY,CAAC,aAAa,CAAe;QACvC,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,6BAA6B;QAC1C,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC;KACxC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { CleanOptions } from './clean.js';\n\n/** Defines the \"cache\" verb. */\nexport const init: CommandInitFunction = (program) => {\n const cacheCommand = program.addSubCommand({\n name: 'cache',\n description: 'Operations related to the Cloudpack cache (requires a sub-command).',\n usage: '<command>',\n });\n\n cacheCommand.addSubCommand<CleanOptions>({\n name: 'clean',\n alias: 'clear',\n description: 'Clears the Cloudpack cache.',\n getExecutor: () => import('./clean.js'),\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAGA,gCAAgC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;QACzC,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,qEAAqE;QAClF,KAAK,EAAE,WAAW;QAClB,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAC;IAEH,YAAY,CAAC,aAAa,CAAe;QACvC,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,6BAA6B;QAC1C,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC;KACxC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { CleanOptions } from './clean.js';\n\n/** Defines the \"cache\" verb. */\nexport const init: CommandInitFunction = (program) => {\n const cacheCommand = program.addSubCommand({\n name: 'cache',\n description: 'Operations related to the Cloudpack cache (requires a sub-command).',\n usage: '<command>',\n hideSharedOptions: true,\n });\n\n cacheCommand.addSubCommand<CleanOptions>({\n name: 'clean',\n alias: 'clear',\n description: 'Clears the Cloudpack cache.',\n getExecutor: () => import('./clean.js'),\n });\n};\n"]}
@@ -4,9 +4,9 @@ const hideSharedOptions = ['cachePath', 'features'];
4
4
  export const init = (program) => {
5
5
  const infoCommand = program.addSubCommand({
6
6
  name: 'info',
7
- description: 'Get repo info relevant to cloudpack (requires a sub-command).',
7
+ description: 'Get repo info relevant to Cloudpack (requires a sub-command).',
8
8
  usage: '<command>',
9
- hideSharedOptions,
9
+ hideSharedOptions: true,
10
10
  });
11
11
  infoCommand.addSubCommand({
12
12
  name: 'lock-file',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/info/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,MAAM,iBAAiB,GAA+B,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAEhF,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;QACxC,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,+DAA+D;QAC5E,KAAK,EAAE,WAAW;QAClB,iBAAiB;KAClB,CAAC,CAAC;IAEH,WAAW,CAAC,aAAa,CAAC;QACxB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,gFAAgF;QAC7F,iBAAiB;QACjB,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAuB,CAAC;KACnD,CAAC,CAAC;IAEH,WAAW,CAAC,aAAa,CAAC;QACxB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,oDAAoD;QACjE,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,4BAA4B,CAAC;QACvD,iBAAiB;QACjB,OAAO,EAAE;YACP,IAAI,EAAE,IAAI,MAAM,CAAC,QAAQ,EAAE,0BAA0B,CAAC;SACvD;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { SharedOptions } from '../../types/SharedOptions.js';\n\nconst hideSharedOptions: Array<keyof SharedOptions> = ['cachePath', 'features'];\n\n/** Defines the \"info\" verb. */\nexport const init: CommandInitFunction = (program) => {\n const infoCommand = program.addSubCommand({\n name: 'info',\n description: 'Get repo info relevant to cloudpack (requires a sub-command).',\n usage: '<command>',\n hideSharedOptions,\n });\n\n infoCommand.addSubCommand({\n name: 'lock-file',\n alias: 'lockfile',\n description: 'Get info about potentially problematic deps from the lock file (yarn v1 only).',\n hideSharedOptions,\n getExecutor: () => import('./lockFile/execute.js'),\n });\n\n infoCommand.addSubCommand({\n name: 'non-semver-deps',\n description: 'Get a list of non-semver deps from local packages.',\n getExecutor: () => import('./nonSemverDeps/execute.js'),\n hideSharedOptions,\n options: {\n prod: new Option('--prod', 'Only get production deps'),\n },\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/info/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,MAAM,iBAAiB,GAA+B,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAEhF,+BAA+B;AAC/B,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;QACxC,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,+DAA+D;QAC5E,KAAK,EAAE,WAAW;QAClB,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAC;IAEH,WAAW,CAAC,aAAa,CAAC;QACxB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,gFAAgF;QAC7F,iBAAiB;QACjB,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAuB,CAAC;KACnD,CAAC,CAAC;IAEH,WAAW,CAAC,aAAa,CAAC;QACxB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,oDAAoD;QACjE,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,4BAA4B,CAAC;QACvD,iBAAiB;QACjB,OAAO,EAAE;YACP,IAAI,EAAE,IAAI,MAAM,CAAC,QAAQ,EAAE,0BAA0B,CAAC;SACvD;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { Option } from 'commander';\nimport type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { SharedOptions } from '../../types/SharedOptions.js';\n\nconst hideSharedOptions: Array<keyof SharedOptions> = ['cachePath', 'features'];\n\n/** Defines the \"info\" verb. */\nexport const init: CommandInitFunction = (program) => {\n const infoCommand = program.addSubCommand({\n name: 'info',\n description: 'Get repo info relevant to Cloudpack (requires a sub-command).',\n usage: '<command>',\n hideSharedOptions: true,\n });\n\n infoCommand.addSubCommand({\n name: 'lock-file',\n alias: 'lockfile',\n description: 'Get info about potentially problematic deps from the lock file (yarn v1 only).',\n hideSharedOptions,\n getExecutor: () => import('./lockFile/execute.js'),\n });\n\n infoCommand.addSubCommand({\n name: 'non-semver-deps',\n description: 'Get a list of non-semver deps from local packages.',\n getExecutor: () => import('./nonSemverDeps/execute.js'),\n hideSharedOptions,\n options: {\n prod: new Option('--prod', 'Only get production deps'),\n },\n });\n};\n"]}
@@ -4,14 +4,14 @@ import { reusedOptions } from '../../utilities/reusedOptions.js';
4
4
  export const init = (program) => {
5
5
  program.addSubCommand({
6
6
  name: 'link',
7
- description: 'Links the package(s) found within the current folder to an existing cloudpack start session.',
7
+ description: 'Links the package(s) found within the current folder to an existing "cloudpack start" session.',
8
8
  options: {
9
9
  remote: new Option('--remote [remote]', 'Link to a remote session. Specify one of the following, listed in order of preference:\n' +
10
10
  '- WebSocket URL: e.g., "wss://example.com:9890" or "ws://example.com:9890"\n' +
11
11
  '- URL: e.g., "http://example.com" or "https://example.com"\n' +
12
12
  '- hostname: e.g., "example.com" (attempts both wss:// and ws:// connections)\n' +
13
13
  '- no value: Uses "localhost" (attempts both wss:// and ws:// connections)\n'),
14
- ignore: new Option('--ignore [packages...]', 'Ignore these packages when linking. This can be used for packages in the current repo ' +
14
+ ignore: new Option('--ignore [packages...]', 'Ignore these packages when linking. Can be used for packages in the current repo ' +
15
15
  'that have issues being bundled.'),
16
16
  all: new Option('--all', "Link all internal packages discovered within the linked repo's graph."),
17
17
  ignoreResolutions: new Option('--ignore-resolutions', "Don't apply resolutions from the host repo's package.json to linked packages."),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/link/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,EAAE,8FAA8F;QAC3G,OAAO,EAAE;YACP,MAAM,EAAE,IAAI,MAAM,CAChB,mBAAmB,EACnB,0FAA0F;gBACxF,8EAA8E;gBAC9E,8DAA8D;gBAC9D,gFAAgF;gBAChF,6EAA6E,CAChF;YACD,MAAM,EAAE,IAAI,MAAM,CAChB,wBAAwB,EACxB,wFAAwF;gBACtF,iCAAiC,CACpC;YACD,GAAG,EAAE,IAAI,MAAM,CAAC,OAAO,EAAE,uEAAuE,CAAC;YACjG,iBAAiB,EAAE,IAAI,MAAM,CAC3B,sBAAsB,EACtB,+EAA+E,CAChF;YACD,eAAe,EAAE,IAAI,MAAM,CACzB,+BAA+B,EAC/B,mDAAmD;gBACjD,sFAAsF;gBACtF,+EAA+E;gBAC/E,+EAA+E,CAClF;iBACE,OAAO,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;iBAChC,OAAO,CAAC,QAAQ,CAAC;YACpB,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;YAC5B,aAAa,EAAE,aAAa,CAAC,aAAa,EAAE;SAC7C;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 { LinkOptions } from './types/LinkOptions.js';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n/** Defines the \"link\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<LinkOptions>({\n name: 'link',\n description: 'Links the package(s) found within the current folder to an existing cloudpack start session.',\n options: {\n remote: new Option(\n '--remote [remote]',\n 'Link to a remote session. Specify one of the following, listed in order of preference:\\n' +\n '- WebSocket URL: e.g., \"wss://example.com:9890\" or \"ws://example.com:9890\"\\n' +\n '- URL: e.g., \"http://example.com\" or \"https://example.com\"\\n' +\n '- hostname: e.g., \"example.com\" (attempts both wss:// and ws:// connections)\\n' +\n '- no value: Uses \"localhost\" (attempts both wss:// and ws:// connections)\\n',\n ),\n ignore: new Option(\n '--ignore [packages...]',\n 'Ignore these packages when linking. This can be used for packages in the current repo ' +\n 'that have issues being bundled.',\n ),\n all: new Option('--all', \"Link all internal packages discovered within the linked repo's graph.\"),\n ignoreResolutions: new Option(\n '--ignore-resolutions',\n \"Don't apply resolutions from the host repo's package.json to linked packages.\",\n ),\n resolveStrategy: new Option(\n '--resolve-strategy <strategy>',\n 'Strategy to use when resolving linked packages.\\n' +\n '- \"dedupe\": Attempt to dedupe packages from the resolve map by removing all but the ' +\n 'highest version that satisfies semver requirements from all parent entries.\\n' +\n `- \"duplicate\": Allow duplicates in the resolve map (don't bump dependencies).`,\n )\n .choices(['dedupe', 'duplicate'])\n .default('dedupe'),\n cache: reusedOptions.cache(),\n logResolveMap: reusedOptions.logResolveMap(),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/link/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,EAAE,gGAAgG;QAC7G,OAAO,EAAE;YACP,MAAM,EAAE,IAAI,MAAM,CAChB,mBAAmB,EACnB,0FAA0F;gBACxF,8EAA8E;gBAC9E,8DAA8D;gBAC9D,gFAAgF;gBAChF,6EAA6E,CAChF;YACD,MAAM,EAAE,IAAI,MAAM,CAChB,wBAAwB,EACxB,mFAAmF;gBACjF,iCAAiC,CACpC;YACD,GAAG,EAAE,IAAI,MAAM,CAAC,OAAO,EAAE,uEAAuE,CAAC;YACjG,iBAAiB,EAAE,IAAI,MAAM,CAC3B,sBAAsB,EACtB,+EAA+E,CAChF;YACD,eAAe,EAAE,IAAI,MAAM,CACzB,+BAA+B,EAC/B,mDAAmD;gBACjD,sFAAsF;gBACtF,+EAA+E;gBAC/E,+EAA+E,CAClF;iBACE,OAAO,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;iBAChC,OAAO,CAAC,QAAQ,CAAC;YACpB,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;YAC5B,aAAa,EAAE,aAAa,CAAC,aAAa,EAAE;SAC7C;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 { LinkOptions } from './types/LinkOptions.js';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n/** Defines the \"link\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<LinkOptions>({\n name: 'link',\n description: 'Links the package(s) found within the current folder to an existing \"cloudpack start\" session.',\n options: {\n remote: new Option(\n '--remote [remote]',\n 'Link to a remote session. Specify one of the following, listed in order of preference:\\n' +\n '- WebSocket URL: e.g., \"wss://example.com:9890\" or \"ws://example.com:9890\"\\n' +\n '- URL: e.g., \"http://example.com\" or \"https://example.com\"\\n' +\n '- hostname: e.g., \"example.com\" (attempts both wss:// and ws:// connections)\\n' +\n '- no value: Uses \"localhost\" (attempts both wss:// and ws:// connections)\\n',\n ),\n ignore: new Option(\n '--ignore [packages...]',\n 'Ignore these packages when linking. Can be used for packages in the current repo ' +\n 'that have issues being bundled.',\n ),\n all: new Option('--all', \"Link all internal packages discovered within the linked repo's graph.\"),\n ignoreResolutions: new Option(\n '--ignore-resolutions',\n \"Don't apply resolutions from the host repo's package.json to linked packages.\",\n ),\n resolveStrategy: new Option(\n '--resolve-strategy <strategy>',\n 'Strategy to use when resolving linked packages.\\n' +\n '- \"dedupe\": Attempt to dedupe packages from the resolve map by removing all but the ' +\n 'highest version that satisfies semver requirements from all parent entries.\\n' +\n `- \"duplicate\": Allow duplicates in the resolve map (don't bump dependencies).`,\n )\n .choices(['dedupe', 'duplicate'])\n .default('dedupe'),\n cache: reusedOptions.cache(),\n logResolveMap: reusedOptions.logResolveMap(),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/report/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAK9E,iCAAiC;AACjC,eAAO,MAAM,IAAI,EAAE,mBAiBlB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/report/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAK9E,iCAAiC;AACjC,eAAO,MAAM,IAAI,EAAE,mBAkBlB,CAAC"}
@@ -3,14 +3,15 @@ const hideSharedOptions = ['cachePath', 'features'];
3
3
  export const init = (program) => {
4
4
  const infoCommand = program.addSubCommand({
5
5
  name: 'report',
6
- description: 'Report telemetries need to be reported to Cloudpack.',
6
+ description: 'Report telemetry data (requires a sub-command).',
7
7
  usage: '<command>',
8
- hideSharedOptions,
8
+ hideSharedOptions: true,
9
9
  });
10
10
  infoCommand.addSubCommand({
11
11
  name: 'legacy-start',
12
- description: 'Legacy start telemetry. This is useful to track cloudpack vs legacy start usage.',
12
+ description: 'Report the start of a legacy app. This is useful to track cloudpack vs legacy start usage.',
13
13
  hideSharedOptions,
14
+ // The run of the "cloudpack report legacy-start" command will be reported to telemetry.
14
15
  getExecutor: () => Promise.resolve({
15
16
  execute: () => Promise.resolve({ message: 'Legacy start telemetry reported.' }),
16
17
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/report/index.ts"],"names":[],"mappings":"AAGA,MAAM,iBAAiB,GAA+B,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAEhF,iCAAiC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;QACxC,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,sDAAsD;QACnE,KAAK,EAAE,WAAW;QAClB,iBAAiB;KAClB,CAAC,CAAC;IAEH,WAAW,CAAC,aAAa,CAAC;QACxB,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,kFAAkF;QAC/F,iBAAiB;QACjB,WAAW,EAAE,GAAG,EAAE,CAChB,OAAO,CAAC,OAAO,CAAC;YACd,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC;SAChF,CAAC;KACL,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { SharedOptions } from '../../types/SharedOptions.js';\n\nconst hideSharedOptions: Array<keyof SharedOptions> = ['cachePath', 'features'];\n\n/** Defines the \"report\" verb. */\nexport const init: CommandInitFunction = (program) => {\n const infoCommand = program.addSubCommand({\n name: 'report',\n description: 'Report telemetries need to be reported to Cloudpack.',\n usage: '<command>',\n hideSharedOptions,\n });\n\n infoCommand.addSubCommand({\n name: 'legacy-start',\n description: 'Legacy start telemetry. This is useful to track cloudpack vs legacy start usage.',\n hideSharedOptions,\n getExecutor: () =>\n Promise.resolve({\n execute: () => Promise.resolve({ message: 'Legacy start telemetry reported.' }),\n }),\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/report/index.ts"],"names":[],"mappings":"AAGA,MAAM,iBAAiB,GAA+B,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAEhF,iCAAiC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;QACxC,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,iDAAiD;QAC9D,KAAK,EAAE,WAAW;QAClB,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAC;IAEH,WAAW,CAAC,aAAa,CAAC;QACxB,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,4FAA4F;QACzG,iBAAiB;QACjB,wFAAwF;QACxF,WAAW,EAAE,GAAG,EAAE,CAChB,OAAO,CAAC,OAAO,CAAC;YACd,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC;SAChF,CAAC;KACL,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { SharedOptions } from '../../types/SharedOptions.js';\n\nconst hideSharedOptions: Array<keyof SharedOptions> = ['cachePath', 'features'];\n\n/** Defines the \"report\" verb. */\nexport const init: CommandInitFunction = (program) => {\n const infoCommand = program.addSubCommand({\n name: 'report',\n description: 'Report telemetry data (requires a sub-command).',\n usage: '<command>',\n hideSharedOptions: true,\n });\n\n infoCommand.addSubCommand({\n name: 'legacy-start',\n description: 'Report the start of a legacy app. This is useful to track cloudpack vs legacy start usage.',\n hideSharedOptions,\n // The run of the \"cloudpack report legacy-start\" command will be reported to telemetry.\n getExecutor: () =>\n Promise.resolve({\n execute: () => Promise.resolve({ message: 'Legacy start telemetry reported.' }),\n }),\n });\n};\n"]}
@@ -7,19 +7,19 @@ export const init = (program) => {
7
7
  name: 'start',
8
8
  description: 'Starts a web inner-loop for an app.',
9
9
  options: {
10
- mode: reusedOptions.mode({ action: 'run' }),
11
10
  app: reusedOptions.app(),
12
11
  open: [
13
- new Option('--open <url>', 'Open the browser to a specific url.'),
12
+ new Option('--open <url>', 'Open the browser to a specific URL.'),
14
13
  new Option('--no-open', 'Do not open the browser.'),
15
14
  ],
16
15
  cache: reusedOptions.cache(),
16
+ mode: reusedOptions.mode({ action: 'run' }),
17
17
  logResolveMap: reusedOptions.logResolveMap(),
18
18
  logBundleInfo: reusedOptions.logBundleInfo({ requiresNoCache: true }),
19
- apiServerPort: getPortOption('--api-server-port <port>', 'API'),
19
+ apiServerPort: getPortOption('--api-server-port <port>', 'API', true),
20
20
  appServerPort: getPortOption('--app-server-port <port>', 'app'),
21
21
  bundleServerPort: getPortOption('--bundle-server-port <port>', 'bundle'),
22
- login: reusedOptions.login(),
22
+ login: reusedOptions.login('start'),
23
23
  },
24
24
  getExecutor: () => import('./execute.js'),
25
25
  // If cwd isn't a cloudpack app, discover other cloudpack apps and possibly prompt the user
@@ -27,10 +27,8 @@ export const init = (program) => {
27
27
  discoverAppPaths: 'single',
28
28
  });
29
29
  };
30
- function getPortOption(flags, name) {
31
- return new Option(flags, `Port to use for the ${name} server (single, comma-separated, or range with dash).`)
32
- .argParser(parsePorts)
33
- .hideHelp();
30
+ function getPortOption(flags, name, isFirst) {
31
+ return new Option(flags, `Port for the ${name} server (${isFirst ? 'single, comma-separated, or range with dash' : 'as above'}).`).argParser(parsePorts);
34
32
  }
35
33
  function parsePorts(value) {
36
34
  if (value.includes('-')) {
@@ -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,qCAAqC;QAClD,OAAO,EAAE;YACP,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YAC3C,GAAG,EAAE,aAAa,CAAC,GAAG,EAAE;YACxB,IAAI,EAAE;gBACJ,IAAI,MAAM,CAAC,cAAc,EAAE,qCAAqC,CAAC;gBACjE,IAAI,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC;aACpD;YACD,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE;YAC5B,aAAa,EAAE,aAAa,CAAC,aAAa,EAAE;YAC5C,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;YACrE,aAAa,EAAE,aAAa,CAAC,0BAA0B,EAAE,KAAK,CAAC;YAC/D,aAAa,EAAE,aAAa,CAAC,0BAA0B,EAAE,KAAK,CAAC;YAC/D,gBAAgB,EAAE,aAAa,CAAC,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,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 for an app.',\n options: {\n mode: reusedOptions.mode({ action: 'run' }),\n app: reusedOptions.app(),\n open: [\n new Option('--open <url>', 'Open the browser to a specific url.'),\n new Option('--no-open', 'Do not open the browser.'),\n ],\n cache: reusedOptions.cache(),\n logResolveMap: reusedOptions.logResolveMap(),\n logBundleInfo: reusedOptions.logBundleInfo({ requiresNoCache: true }),\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 // If cwd isn't a cloudpack app, discover other cloudpack apps and possibly prompt the user\n // to choose one. Also handles --app.\n discoverAppPaths: 'single',\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
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"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,MAAM,CACf,KAAK,EACL,gBAAgB,IAAI,YAAY,OAAO,CAAC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC,UAAU,IAAI,CACzG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,UAAU,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 for an app.',\n options: {\n app: reusedOptions.app(),\n open: [\n new Option('--open <url>', 'Open the browser to a specific URL.'),\n new Option('--no-open', 'Do not open the browser.'),\n ],\n cache: reusedOptions.cache(),\n mode: reusedOptions.mode({ action: 'run' }),\n logResolveMap: reusedOptions.logResolveMap(),\n logBundleInfo: reusedOptions.logBundleInfo({ requiresNoCache: true }),\n apiServerPort: getPortOption('--api-server-port <port>', 'API', true),\n appServerPort: getPortOption('--app-server-port <port>', 'app'),\n bundleServerPort: getPortOption('--bundle-server-port <port>', 'bundle'),\n login: reusedOptions.login('start'),\n },\n getExecutor: () => import('./execute.js'),\n // If cwd isn't a cloudpack app, discover other cloudpack apps and possibly prompt the user\n // to choose one. Also handles --app.\n discoverAppPaths: 'single',\n });\n};\n\nfunction getPortOption(flags: string, name: string, isFirst?: boolean): Option {\n return new Option(\n flags,\n `Port for the ${name} server (${isFirst ? 'single, comma-separated, or range with dash' : 'as above'}).`,\n ).argParser(parsePorts);\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"]}
@@ -8,7 +8,7 @@ export const init = (program) => {
8
8
  'By default (without --upload) it will download any packages not found in the local cache.',
9
9
  options: {
10
10
  upload: new Option('--upload', 'Upload packages to the remote cache (instead of downloading).'),
11
- login: reusedOptions.login(),
11
+ login: reusedOptions.login('sync'),
12
12
  },
13
13
  getExecutor: () => import('./execute.js'),
14
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,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"]}
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,CAAC,MAAM,CAAC;SACnC;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('sync'),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
@@ -3,7 +3,7 @@ import { reusedOptions } from '../../utilities/reusedOptions.js';
3
3
  export const init = (program) => {
4
4
  program.addSubCommand({
5
5
  name: 'unlink',
6
- description: 'Unlinks the package(s) found within the current folder from a cloudpack start session.',
6
+ description: 'Unlinks the package(s) found within the current folder from a "cloudpack start" session.',
7
7
  options: {
8
8
  logResolveMap: reusedOptions.logResolveMap(),
9
9
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/unlink/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,iCAAiC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAgB;QACnC,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,wFAAwF;QACrG,OAAO,EAAE;YACP,aAAa,EAAE,aAAa,CAAC,aAAa,EAAE;SAC7C;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { UnlinkOptions } from './types/UnlinkOptions.js';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n/** Defines the \"unlink\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<UnlinkOptions>({\n name: 'unlink',\n description: 'Unlinks the package(s) found within the current folder from a cloudpack start session.',\n options: {\n logResolveMap: reusedOptions.logResolveMap(),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/unlink/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,iCAAiC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,OAAO,EAAE,EAAE;IACnD,OAAO,CAAC,aAAa,CAAgB;QACnC,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,0FAA0F;QACvG,OAAO,EAAE;YACP,aAAa,EAAE,aAAa,CAAC,aAAa,EAAE;SAC7C;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { CommandInitFunction } from '../../types/CommandInitFunction.js';\nimport type { UnlinkOptions } from './types/UnlinkOptions.js';\nimport { reusedOptions } from '../../utilities/reusedOptions.js';\n\n/** Defines the \"unlink\" verb. */\nexport const init: CommandInitFunction = (program) => {\n program.addSubCommand<UnlinkOptions>({\n name: 'unlink',\n description: 'Unlinks the package(s) found within the current folder from a \"cloudpack start\" session.',\n options: {\n logResolveMap: reusedOptions.logResolveMap(),\n },\n getExecutor: () => import('./execute.js'),\n });\n};\n"]}
package/lib/main.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAOrD,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACrC;AAED;;;GAGG;AACH,wBAAsB,IAAI,CAAC,OAAO,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4C5E"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAOrD,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,mBAAmB,CAAC;CACrC;AAED;;;GAGG;AACH,wBAAsB,IAAI,CAAC,OAAO,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C5E"}
package/lib/main.js CHANGED
@@ -26,6 +26,9 @@ export async function main(options = {}) {
26
26
  usage: '<command> [options]',
27
27
  outputOptions,
28
28
  programOptions: { cwd, version, argv, disableTelemetry },
29
+ // The top-level command should realistically only ever be used with --help or --version,
30
+ // so hide most of the options.
31
+ hideSharedOptions: true,
29
32
  });
30
33
  // Get all the available commands
31
34
  const commandsGlob = 'commands/*/index';
package/lib/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAi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QAAQ,CAAC,MAAM,EAAE,CAAC;QACrB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,+BAA+B,UAAU,IAAI,YAAY,MAAM,CAAC,CAAC;IACnF,CAAC;IAED,KAAK,MAAM,WAAW,IAAI,QAAQ,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC;QACzD,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAsB,CAAC;QAEtE,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC;AACtB,CAAC","sourcesContent":["import { getDisplayVersion } from '@ms-cloudpack/package-utilities';\nimport { globSourceFiles } from '@ms-cloudpack/path-utilities';\nimport type { OutputConfiguration } from 'commander';\nimport path from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\nimport type { CommandInitModule } from './types/CommandInitFunction.js';\nimport { PerfMarkerCliEntry } from './performance/markers.js';\nimport { CloudpackCommand } from './utilities/CloudpackCommand.js';\n\n/** Override options for tests */\nexport interface MainOptions {\n cwd?: string;\n disableTelemetry?: boolean;\n argv?: string[];\n outputOptions?: OutputConfiguration;\n}\n\n/**\n * Entry point for the cloudpack CLI.\n * Resolves all commands defined within the \"./commands\" folder.\n */\nexport async function main(options: Partial<MainOptions> = {}): Promise<void> {\n const {\n argv = [...process.argv],\n // eslint-disable-next-line no-restricted-properties -- this is where the default is supplied\n cwd = process.cwd(),\n disableTelemetry,\n outputOptions,\n } = options;\n\n performance.mark(PerfMarkerCliEntry);\n\n if (argv[3] === '--') {\n // Remove the \"--\" argument in case it's added by lage\n argv.splice(3, 1);\n }\n\n const version = getDisplayVersion(import.meta.url);\n\n // Create the top-level command and apply common options\n // (avoids \"unknown option\" errors if they're specified without a verb)\n const program = new CloudpackCommand({\n name: 'cloudpack',\n description: 'A tool for managing fast inner and outer looping in web apps. Requires a sub-command.',\n usage: '<command> [options]',\n outputOptions,\n programOptions: { cwd, version, argv, disableTelemetry },\n });\n\n // Get all the available commands\n const commandsGlob = 'commands/*/index';\n const commands = await globSourceFiles(import.meta.url, commandsGlob);\n if (!commands.length) {\n const currentDir = path.dirname(fileURLToPath(import.meta.url));\n throw new Error(`No commands found matching \"${currentDir}/${commandsGlob}.*\".`);\n }\n\n for (const commandPath of commands) {\n const commandUrl = pathToFileURL(commandPath).toString();\n const commandModule = (await import(commandUrl)) as CommandInitModule;\n\n commandModule.init(program);\n }\n\n await program.run();\n}\n"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAUnE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,UAAgC,EAAE;IAC3D,MAAM,EACJ,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IACxB,6FAA6F;IAC7F,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EACnB,gBAAgB,EAChB,aAAa,GACd,GAAG,OAAO,CAAC;IAEZ,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAErC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACrB,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEnD,wDAAwD;IACxD,uEAAuE;IACvE,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC;QACnC,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,uFAAuF;QACpG,KAAK,EAAE,qBAAqB;QAC5B,aAAa;QACb,cAAc,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE;QACxD,yFAAyF;QACzF,+BAA+B;QAC/B,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAC;IAEH,iCAAiC;IACjC,MAAM,YAAY,GAAG,kBAAkB,CAAC;IACxC,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACtE,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACrB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,+BAA+B,UAAU,IAAI,YAAY,MAAM,CAAC,CAAC;IACnF,CAAC;IAED,KAAK,MAAM,WAAW,IAAI,QAAQ,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC;QACzD,MAAM,aAAa,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAsB,CAAC;QAEtE,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC;AACtB,CAAC","sourcesContent":["import { getDisplayVersion } from '@ms-cloudpack/package-utilities';\nimport { globSourceFiles } from '@ms-cloudpack/path-utilities';\nimport type { OutputConfiguration } from 'commander';\nimport path from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\nimport type { CommandInitModule } from './types/CommandInitFunction.js';\nimport { PerfMarkerCliEntry } from './performance/markers.js';\nimport { CloudpackCommand } from './utilities/CloudpackCommand.js';\n\n/** Override options for tests */\nexport interface MainOptions {\n cwd?: string;\n disableTelemetry?: boolean;\n argv?: string[];\n outputOptions?: OutputConfiguration;\n}\n\n/**\n * Entry point for the cloudpack CLI.\n * Resolves all commands defined within the \"./commands\" folder.\n */\nexport async function main(options: Partial<MainOptions> = {}): Promise<void> {\n const {\n argv = [...process.argv],\n // eslint-disable-next-line no-restricted-properties -- this is where the default is supplied\n cwd = process.cwd(),\n disableTelemetry,\n outputOptions,\n } = options;\n\n performance.mark(PerfMarkerCliEntry);\n\n if (argv[3] === '--') {\n // Remove the \"--\" argument in case it's added by lage\n argv.splice(3, 1);\n }\n\n const version = getDisplayVersion(import.meta.url);\n\n // Create the top-level command and apply common options\n // (avoids \"unknown option\" errors if they're specified without a verb)\n const program = new CloudpackCommand({\n name: 'cloudpack',\n description: 'A tool for managing fast inner and outer looping in web apps. Requires a sub-command.',\n usage: '<command> [options]',\n outputOptions,\n programOptions: { cwd, version, argv, disableTelemetry },\n // The top-level command should realistically only ever be used with --help or --version,\n // so hide most of the options.\n hideSharedOptions: true,\n });\n\n // Get all the available commands\n const commandsGlob = 'commands/*/index';\n const commands = await globSourceFiles(import.meta.url, commandsGlob);\n if (!commands.length) {\n const currentDir = path.dirname(fileURLToPath(import.meta.url));\n throw new Error(`No commands found matching \"${currentDir}/${commandsGlob}.*\".`);\n }\n\n for (const commandPath of commands) {\n const commandUrl = pathToFileURL(commandPath).toString();\n const commandModule = (await import(commandUrl)) as CommandInitModule;\n\n commandModule.init(program);\n }\n\n await program.run();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CloudpackCommand.d.ts","sourceRoot":"","sources":["../../src/utilities/CloudpackCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EA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C,aAAa,SAAS,MAAM,EAAE,eAAe,SAAS,MAAM,GAAG,KAAK,EACvF,MAAM,EAAE,sBAAsB,CAAC,aAAa,EAAE,eAAe,CAAC,GAC7D,gBAAgB,CAAC,aAAa,EAAE,eAAe,CAAC;IAQnD,qEAAqE;IACxD,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAWjC,qGAAqG;IACrG,OAAO,CAAC,aAAa;IAMrB,iGAAiG;IACjG,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,UAAU;CAqCnB"}
@@ -1,8 +1,9 @@
1
- import { Command, Help, Option } from 'commander';
1
+ import { Command, Option } from 'commander';
2
2
  import { CommandExecutor } from './CommandExecutor.js';
3
3
  import { environmentInfo } from '@ms-cloudpack/environment';
4
4
  import { parseFeature } from './parseFeature.js';
5
5
  import { parseDefine } from './parseDefine.js';
6
+ import { CloudpackHelp, optionGroups } from './CloudpackHelp.js';
6
7
  /**
7
8
  * This wraps the `Command` class from [`commander`](https://www.npmjs.com/package/commander) with
8
9
  * Cloudpack-specific functionality and simpler APIs.
@@ -29,7 +30,10 @@ export class CloudpackCommand {
29
30
  command.version(params.programOptions.version);
30
31
  command.description(params.description);
31
32
  command.allowExcessArguments(false);
32
- command.createHelp = () => new CloudpackHelp();
33
+ const isTopLevel = !params.parent;
34
+ command.createHelp = () => new CloudpackHelp({ isTopLevel });
35
+ // set the default help group for options
36
+ command.optionsGroup(optionGroups.default);
33
37
  params.usage && command.usage(params.usage);
34
38
  params.alias && command.alias(params.alias);
35
39
  params.addHelpText && command.addHelpText(params.addHelpText.position, params.addHelpText.text);
@@ -45,16 +49,27 @@ export class CloudpackCommand {
45
49
  // Add shared options. These must be manually added to the program command and each sub-command
46
50
  // because commander doesn't natively support inheriting options.
47
51
  this._addOptions({
48
- verbose: new Option('-v, --verbose', 'Show additional details about the running tasks.'),
49
- debug: new Option('-d, --debug', 'Show debug information (superset of --verbose).').conflicts('verbose'),
50
- quiet: new Option('-q, --quiet', 'Disable non-essential logging.').conflicts('verbose').conflicts('debug'),
52
+ verbose: new Option('-v, --verbose', 'Show additional details in logging.').helpGroup(optionGroups.logging),
53
+ debug: new Option('-d, --debug', 'Show debug information (superset of --verbose).')
54
+ .conflicts('verbose')
55
+ .helpGroup(optionGroups.logging),
56
+ quiet: new Option('-q, --quiet', 'Disable non-essential logging.')
57
+ .conflicts('verbose')
58
+ .conflicts('debug')
59
+ .helpGroup(optionGroups.logging),
51
60
  color:
52
61
  // In the parsed options, this will be a boolean `color` with default value true (except in tests and CI)
53
- new Option('-n, --no-color', 'Disable colors in the output.').default(!environmentInfo.isJest && !environmentInfo.isLage && !environmentInfo.isCI),
54
- features: new Option('--features <featureNames...>', 'Enable experimental features.').argParser(parseFeature),
55
- cachePath: new Option('--cache-path <path>', 'Custom cache folder. To change the default, run `cloudpack config set cachePath <path>`.'),
56
- define: new Option('--define <key=value>', 'Define a global variable. Can be specified multiple times.').argParser(parseDefine),
57
- logFile: new Option('--log-file', 'Write log file with all console output.'),
62
+ new Option('-n, --no-color', 'Disable colors in the output.')
63
+ .helpGroup(optionGroups.logging)
64
+ .default(!environmentInfo.isJest && !environmentInfo.isLage && !environmentInfo.isCI),
65
+ logFile: new Option('--log-file', 'Write a log file with all console output.').helpGroup(optionGroups.logging),
66
+ cachePath: new Option('--cache-path <path>', 'Custom cache folder. To change the default, run `cloudpack config set cachePath <path>`.').helpGroup(optionGroups.common),
67
+ define: new Option('--define <key=value>', 'Define a global variable. Can be specified multiple times.')
68
+ .helpGroup(optionGroups.common)
69
+ .argParser(parseDefine),
70
+ features: new Option('--features <featureNames...>', 'Enable experimental features.')
71
+ .helpGroup(optionGroups.common)
72
+ .argParser(parseFeature),
58
73
  }, params.hideSharedOptions);
59
74
  }
60
75
  /** Create a child command. */
@@ -127,14 +142,4 @@ export class CloudpackCommand {
127
142
  });
128
143
  }
129
144
  }
130
- class CloudpackHelp extends Help {
131
- visibleOptions(cmd) {
132
- const options = super.visibleOptions(cmd);
133
- if (cmd.name() !== 'cloudpack') {
134
- // Remove --version from help except at the top level (it's not very useful)
135
- return options.filter((option) => option.name() !== 'version');
136
- }
137
- return options;
138
- }
139
- }
140
145
  //# sourceMappingURL=CloudpackCommand.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CloudpackCommand.js","sourceRoot":"","sources":["../../src/utilities/CloudpackCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAqE,MAAM,WAAW,CAAC;AAIrH,OAAO,EAAE,eAAe,EAA8B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA0D/C;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IACnB,QAAQ,CAAU;IAClB,eAAe,CAAiB;IAChC,iBAAiB,CAAmC;IAE5D;;;OAGG;IACH;IACE,4EAA4E;IAC5E,MAIC;QAED,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAEjD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC/C,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACxC,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACpC,OAAO,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC,IAAI,aAAa,EAAE,CAAC;QAE/C,MAAM,CAA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AM,IAAI,KAAK,CAAC,gEAAgE,IAAI,GAAG,CAAC,CAAC;YAC3F,CAAC;YAED,MAAM,eAAe,GAAG,IAAI,eAAe,CAA2B;gBACpE,IAAI,EAAE,aAAa;gBACnB,OAAO;gBACP,OAAO;gBACP,cAAc,EAAE,IAAI,CAAC,eAAe;gBACpC,IAAI;gBACJ,gBAAgB,EAAE,IAAI,CAAC,iBAAiB;aACzC,CAAC,CAAC;YACH,MAAM,eAAe,CAAC,OAAO,EAAE,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,aAAc,SAAQ,IAAI;IAC9B,cAAc,CAAC,GAAY;QACzB,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAE1C,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,WAAW,EAAE,CAAC;YAC/B,4EAA4E;YAC5E,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,SAAS,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["import { Command, Help, Option, type AddHelpTextPosition, type Argument, type OutputConfiguration } from 'commander';\nimport type { CommandActionModule } from '../types/CommandAction.js';\nimport type { ProgramOptions } from '../types/ProgramOptions.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\nimport { CommandExecutor, type CommandExecutorParams } from './CommandExecutor.js';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport { parseFeature } from './parseFeature.js';\nimport type { AppPathDiscoveryMode } from '../types/AppPathDiscoveryMode.js';\nimport { parseDefine } from './parseDefine.js';\n\n/**\n * Parameters for creating a command.\n * `TOptions` should be the command-specific options (if any), e.g. `StartOptions`.\n */\ninterface CloudpackCommandParams<TOptions extends object, TArguments extends object>\n extends Pick<CommandExecutorParams, 'discoverAppPaths'> {\n /** Command name */\n name: string;\n\n /** Command description */\n description: string;\n\n /**\n * Options specific to this command. The record ensures that all options are available in the CLI.\n * Allow multiple options for the same key since commander supports it with negatable options.\n */\n options?: Record<keyof TOptions, Option | Option[]>; //\n\n /** Arguments specific to this command. Key order determines the arg order. */\n args?: Record<keyof TArguments, Argument>;\n\n /**\n * Function returning an async import of the command's `src/commands/<name>/execute.ts` module.\n * Importing only on demand makes Cloudpack start up faster since it doesn't have to parse\n * every command's dependencies (many of which may be unrelated to the command being run).\n *\n * This can be undefined for a command that only has sub-commands.\n */\n getExecutor?: () => Promise<CommandActionModule<TOptions>>;\n\n /** Usage message override */\n usage?: string;\n\n /** Alternative name for the command */\n alias?: string;\n\n /** Extra text to be displayed with the built-in help. */\n addHelpText?: {\n /**\n * `'before'` or `'after'` to affect just this command.\n * `'beforeAll'` or `'afterAll'` to affect this command and all its subcommands.\n */\n position: AddHelpTextPosition;\n text: string;\n };\n\n /** Output options override (mainly for testing) */\n outputOptions?: OutputConfiguration;\n\n /**\n * The shared options are relevant for most commands, but this allows omitting them from help\n * where they're not relevant. `true` hides all shared options, or an array hides specific ones.\n */\n hideSharedOptions?: Array<keyof SharedOptions> | true;\n}\n\n/**\n * This wraps the `Command` class from [`commander`](https://www.npmjs.com/package/commander) with\n * Cloudpack-specific functionality and simpler APIs.\n *\n * Similar to the pattern from `commander`, this class represents both the program and its sub-commands.\n * - The top-level \"program\" command should be created with `new CloudpackCommand()`.\n * - Sub-commands should be created with the `.addSubCommand` method on the parent.\n */\nexport class CloudpackCommand<TOptions extends object, TArguments extends object> {\n private _command: Command;\n private _programOptions: ProgramOptions;\n private _discoverAppPaths: AppPathDiscoveryMode | undefined;\n\n /**\n * This should only be used directly (outside this class) to create the top-level `program` command.\n * To add sub-commands, use `.addSubCommand` instead.\n */\n constructor(\n // The extra options here shouldn't be exposed to the `createSubCommand` API\n params: CloudpackCommandParams<TOptions, TArguments> & {\n programOptions: ProgramOptions;\n /** This must be undefined for the top-level program command */\n parent?: Command;\n },\n ) {\n this._programOptions = params.programOptions;\n this._discoverAppPaths = params.discoverAppPaths;\n\n const command = params.parent?.command(params.name) || new Command(params.name);\n this._command = command;\n\n command.version(params.programOptions.version);\n command.description(params.description);\n command.allowExcessArguments(false);\n command.createHelp = () => new CloudpackHelp();\n\n params.usage && command.usage(params.usage);\n params.alias && command.alias(params.alias);\n params.addHelpText && command.addHelpText(params.addHelpText.position, params.addHelpText.text);\n params.outputOptions && command.configureOutput(params.outputOptions);\n params.getExecutor && this._addAction(params.getExecutor);\n\n if (params.args) {\n this._addArguemnts<TArguments>(params.args);\n }\n\n if (params.options) {\n // Add the command-specific options first so they show up first in help\n this._addOptions<TOptions>(params.options);\n }\n\n // Add shared options. These must be manually added to the program command and each sub-command\n // because commander doesn't natively support inheriting options.\n this._addOptions<SharedOptions>(\n {\n verbose: new Option('-v, --verbose', 'Show additional details about the running tasks.'),\n debug: new Option('-d, --debug', 'Show debug information (superset of --verbose).').conflicts('verbose'),\n quiet: new Option('-q, --quiet', 'Disable non-essential logging.').conflicts('verbose').conflicts('debug'),\n color:\n // In the parsed options, this will be a boolean `color` with default value true (except in tests and CI)\n new Option('-n, --no-color', 'Disable colors in the output.').default(\n !environmentInfo.isJest && !environmentInfo.isLage && !environmentInfo.isCI,\n ),\n features: new Option('--features <featureNames...>', 'Enable experimental features.').argParser(parseFeature),\n cachePath: new Option(\n '--cache-path <path>',\n 'Custom cache folder. To change the default, run `cloudpack config set cachePath <path>`.',\n ),\n define: new Option(\n '--define <key=value>',\n 'Define a global variable. Can be specified multiple times.',\n ).argParser(parseDefine),\n logFile: new Option('--log-file', 'Write log file with all console output.'),\n },\n params.hideSharedOptions,\n );\n }\n\n /** Create a child command. */\n public addSubCommand<TChildOptions extends object, TChildArguments extends object = never>(\n params: CloudpackCommandParams<TChildOptions, TChildArguments>,\n ): CloudpackCommand<TChildOptions, TChildArguments> {\n return new CloudpackCommand<TChildOptions, TChildArguments>({\n ...params,\n programOptions: this._programOptions,\n parent: this._command,\n });\n }\n\n /** Run the program (only works on the top-level program command). */\n public async run(): Promise<void> {\n if (this._command.parent) {\n throw new Error('Only the top-level program command can be run directly.');\n }\n\n await this._command.parseAsync(this._programOptions.argv);\n if (this._command.args.length === 0) {\n this._command.help();\n }\n }\n\n /** Add arguments. The generic enforces that argument objects are included for all keys of a type. */\n private _addArguemnts<TAddArguments extends object>(args: Record<keyof TAddArguments, Argument>): void {\n for (const argument of Object.values(args)) {\n this._command.addArgument(argument as Argument);\n }\n }\n\n /** Add options. The generic enforces that option objects are included for all keys of a type. */\n private _addOptions<TAddOptions extends object>(\n options: Record<keyof TAddOptions, Option | Option[]>,\n hideOptions?: Array<keyof TAddOptions> | true,\n ): void {\n for (const [name, optionOrOptions] of Object.entries(options) as [keyof TAddOptions, Option | Option[]][]) {\n const optionArray = Array.isArray(optionOrOptions) ? optionOrOptions : [optionOrOptions];\n for (const option of optionArray) {\n if (hideOptions === true || hideOptions?.includes(name)) {\n option.hideHelp();\n }\n this._command.addOption(option);\n }\n }\n }\n\n private _addAction(getExecutor: NonNullable<CloudpackCommandParams<TOptions, TArguments>['getExecutor']>): void {\n const command = this._command;\n // The action function receives parsed options as its first parameter, but we ignore those\n // because they only contain options *specific to this command*, not shared options like `debug`.\n command.action(async () => {\n // Commander has support for custom parsers that parse arguments.\n // Use processedArgs instead of args to get the parsed arguments.\n const processedArgs = command.processedArgs as string[];\n\n // Get the shared options too, not just the ones for this command.\n // (In `cloudpackCommand`, we added the shared options to each command object so that they show up\n // in help, but commander still seems to respect options only at the first command where they're\n // encountered, which for shared options will always be the program command.)\n const options = command.optsWithGlobals<TOptions & SharedOptions>();\n\n // Usually `command` will be a sub-command (e.g. \"bundle\"), but it could also be a sub-sub-command\n // (e.g. \"cache clean\").\n const verb = command.parent?.parent ? `${command.parent.name()} ${command.name()}` : command.name();\n\n // Dynamically import the execute function\n const { execute } = await getExecutor();\n if (typeof execute !== 'function') {\n // throw instead of exiting politely, since this is a major developer error\n throw new Error(`No execute function was exported from the command module for ${verb}.`);\n }\n\n const commandExecutor = new CommandExecutor<TOptions & SharedOptions>({\n args: processedArgs,\n options,\n execute,\n programOptions: this._programOptions,\n verb,\n discoverAppPaths: this._discoverAppPaths,\n });\n await commandExecutor.execute();\n });\n }\n}\n\nclass CloudpackHelp extends Help {\n visibleOptions(cmd: Command): Option[] {\n const options = super.visibleOptions(cmd);\n\n if (cmd.name() !== 'cloudpack') {\n // Remove --version from help except at the top level (it's not very useful)\n return options.filter((option) => option.name() !== 'version');\n }\n\n return options;\n }\n}\n"]}
1
+ {"version":3,"file":"CloudpackCommand.js","sourceRoot":"","sources":["../../src/utilities/CloudpackCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAqE,MAAM,WAAW,CAAC;AAI/G,OAAO,EAAE,eAAe,EAA8B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA0DjE;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IACnB,QAAQ,CAAU;IAClB,eAAe,CAAiB;IAChC,iBAAiB,CAAmC;IAE5D;;;OAGG;IACH;IACE,4EAA4E;IAC5E,MAIC;QAED,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAEjD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChF,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,OA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;IAEO,UAAU,CAAC,WAAqF;QACtG,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,0FAA0F;QAC1F,iGAAiG;QACjG,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;YACxB,iEAAiE;YACjE,iEAAiE;YACjE,MAAM,aAAa,GAAG,OAAO,CAAC,aAAyB,CAAC;YAExD,kEAAkE;YAClE,kGAAkG;YAClG,gGAAgG;YAChG,6EAA6E;YAC7E,MAAM,OAAO,GAAG,OAAO,CAAC,eAAe,EAA4B,CAAC;YAEpE,kGAAkG;YAClG,wBAAwB;YACxB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAEpG,0CAA0C;YAC1C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;YACxC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBAClC,2EAA2E;gBAC3E,MAAM,IAAI,KAAK,CAAC,gEAAgE,IAAI,GAAG,CAAC,CAAC;YAC3F,CAAC;YAED,MAAM,eAAe,GAAG,IAAI,eAAe,CAA2B;gBACpE,IAAI,EAAE,aAAa;gBACnB,OAAO;gBACP,OAAO;gBACP,cAAc,EAAE,IAAI,CAAC,eAAe;gBACpC,IAAI;gBACJ,gBAAgB,EAAE,IAAI,CAAC,iBAAiB;aACzC,CAAC,CAAC;YACH,MAAM,eAAe,CAAC,OAAO,EAAE,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { Command, Option, type AddHelpTextPosition, type Argument, type OutputConfiguration } from 'commander';\nimport type { CommandActionModule } from '../types/CommandAction.js';\nimport type { ProgramOptions } from '../types/ProgramOptions.js';\nimport type { SharedOptions } from '../types/SharedOptions.js';\nimport { CommandExecutor, type CommandExecutorParams } from './CommandExecutor.js';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport { parseFeature } from './parseFeature.js';\nimport type { AppPathDiscoveryMode } from '../types/AppPathDiscoveryMode.js';\nimport { parseDefine } from './parseDefine.js';\nimport { CloudpackHelp, optionGroups } from './CloudpackHelp.js';\n\n/**\n * Parameters for creating a command.\n * `TOptions` should be the command-specific options (if any), e.g. `StartOptions`.\n */\ninterface CloudpackCommandParams<TOptions extends object, TArguments extends object>\n extends Pick<CommandExecutorParams, 'discoverAppPaths'> {\n /** Command name */\n name: string;\n\n /** Command description */\n description: string;\n\n /**\n * Options specific to this command. The record ensures that all options are available in the CLI.\n * Allow multiple options for the same key since commander supports it with negatable options.\n */\n options?: Record<keyof TOptions, Option | Option[]>; //\n\n /** Arguments specific to this command. Key order determines the arg order. */\n args?: Record<keyof TArguments, Argument>;\n\n /**\n * Function returning an async import of the command's `src/commands/<name>/execute.ts` module.\n * Importing only on demand makes Cloudpack start up faster since it doesn't have to parse\n * every command's dependencies (many of which may be unrelated to the command being run).\n *\n * This can be undefined for a command that only has sub-commands.\n */\n getExecutor?: () => Promise<CommandActionModule<TOptions>>;\n\n /** Usage message override */\n usage?: string;\n\n /** Alternative name for the command */\n alias?: string;\n\n /** Extra text to be displayed with the built-in help. */\n addHelpText?: {\n /**\n * `'before'` or `'after'` to affect just this command.\n * `'beforeAll'` or `'afterAll'` to affect this command and all its subcommands.\n */\n position: AddHelpTextPosition;\n text: string;\n };\n\n /** Output options override (mainly for testing) */\n outputOptions?: OutputConfiguration;\n\n /**\n * The shared options are relevant for most commands, but this allows omitting them from help\n * where they're not relevant. `true` hides all shared options, or an array hides specific ones.\n */\n hideSharedOptions?: Array<keyof SharedOptions> | true;\n}\n\n/**\n * This wraps the `Command` class from [`commander`](https://www.npmjs.com/package/commander) with\n * Cloudpack-specific functionality and simpler APIs.\n *\n * Similar to the pattern from `commander`, this class represents both the program and its sub-commands.\n * - The top-level \"program\" command should be created with `new CloudpackCommand()`.\n * - Sub-commands should be created with the `.addSubCommand` method on the parent.\n */\nexport class CloudpackCommand<TOptions extends object, TArguments extends object> {\n private _command: Command;\n private _programOptions: ProgramOptions;\n private _discoverAppPaths: AppPathDiscoveryMode | undefined;\n\n /**\n * This should only be used directly (outside this class) to create the top-level `program` command.\n * To add sub-commands, use `.addSubCommand` instead.\n */\n constructor(\n // The extra options here shouldn't be exposed to the `createSubCommand` API\n params: CloudpackCommandParams<TOptions, TArguments> & {\n programOptions: ProgramOptions;\n /** This must be undefined for the top-level program command */\n parent?: Command;\n },\n ) {\n this._programOptions = params.programOptions;\n this._discoverAppPaths = params.discoverAppPaths;\n\n const command = params.parent?.command(params.name) || new Command(params.name);\n this._command = command;\n\n command.version(params.programOptions.version);\n command.description(params.description);\n command.allowExcessArguments(false);\n\n const isTopLevel = !params.parent;\n command.createHelp = () => new CloudpackHelp({ isTopLevel });\n // set the default help group for options\n command.optionsGroup(optionGroups.default);\n\n params.usage && command.usage(params.usage);\n params.alias && command.alias(params.alias);\n params.addHelpText && command.addHelpText(params.addHelpText.position, params.addHelpText.text);\n params.outputOptions && command.configureOutput(params.outputOptions);\n params.getExecutor && this._addAction(params.getExecutor);\n\n if (params.args) {\n this._addArguemnts<TArguments>(params.args);\n }\n\n if (params.options) {\n // Add the command-specific options first so they show up first in help\n this._addOptions<TOptions>(params.options);\n }\n\n // Add shared options. These must be manually added to the program command and each sub-command\n // because commander doesn't natively support inheriting options.\n this._addOptions<SharedOptions>(\n {\n verbose: new Option('-v, --verbose', 'Show additional details in logging.').helpGroup(optionGroups.logging),\n debug: new Option('-d, --debug', 'Show debug information (superset of --verbose).')\n .conflicts('verbose')\n .helpGroup(optionGroups.logging),\n quiet: new Option('-q, --quiet', 'Disable non-essential logging.')\n .conflicts('verbose')\n .conflicts('debug')\n .helpGroup(optionGroups.logging),\n color:\n // In the parsed options, this will be a boolean `color` with default value true (except in tests and CI)\n new Option('-n, --no-color', 'Disable colors in the output.')\n .helpGroup(optionGroups.logging)\n .default(!environmentInfo.isJest && !environmentInfo.isLage && !environmentInfo.isCI),\n logFile: new Option('--log-file', 'Write a log file with all console output.').helpGroup(optionGroups.logging),\n cachePath: new Option(\n '--cache-path <path>',\n 'Custom cache folder. To change the default, run `cloudpack config set cachePath <path>`.',\n ).helpGroup(optionGroups.common),\n define: new Option('--define <key=value>', 'Define a global variable. Can be specified multiple times.')\n .helpGroup(optionGroups.common)\n .argParser(parseDefine),\n features: new Option('--features <featureNames...>', 'Enable experimental features.')\n .helpGroup(optionGroups.common)\n .argParser(parseFeature),\n },\n params.hideSharedOptions,\n );\n }\n\n /** Create a child command. */\n public addSubCommand<TChildOptions extends object, TChildArguments extends object = never>(\n params: CloudpackCommandParams<TChildOptions, TChildArguments>,\n ): CloudpackCommand<TChildOptions, TChildArguments> {\n return new CloudpackCommand<TChildOptions, TChildArguments>({\n ...params,\n programOptions: this._programOptions,\n parent: this._command,\n });\n }\n\n /** Run the program (only works on the top-level program command). */\n public async run(): Promise<void> {\n if (this._command.parent) {\n throw new Error('Only the top-level program command can be run directly.');\n }\n\n await this._command.parseAsync(this._programOptions.argv);\n if (this._command.args.length === 0) {\n this._command.help();\n }\n }\n\n /** Add arguments. The generic enforces that argument objects are included for all keys of a type. */\n private _addArguemnts<TAddArguments extends object>(args: Record<keyof TAddArguments, Argument>): void {\n for (const argument of Object.values(args)) {\n this._command.addArgument(argument as Argument);\n }\n }\n\n /** Add options. The generic enforces that option objects are included for all keys of a type. */\n private _addOptions<TAddOptions extends object>(\n options: Record<keyof TAddOptions, Option | Option[]>,\n hideOptions?: Array<keyof TAddOptions> | true,\n ): void {\n for (const [name, optionOrOptions] of Object.entries(options) as [keyof TAddOptions, Option | Option[]][]) {\n const optionArray = Array.isArray(optionOrOptions) ? optionOrOptions : [optionOrOptions];\n for (const option of optionArray) {\n if (hideOptions === true || hideOptions?.includes(name)) {\n option.hideHelp();\n }\n this._command.addOption(option);\n }\n }\n }\n\n private _addAction(getExecutor: NonNullable<CloudpackCommandParams<TOptions, TArguments>['getExecutor']>): void {\n const command = this._command;\n // The action function receives parsed options as its first parameter, but we ignore those\n // because they only contain options *specific to this command*, not shared options like `debug`.\n command.action(async () => {\n // Commander has support for custom parsers that parse arguments.\n // Use processedArgs instead of args to get the parsed arguments.\n const processedArgs = command.processedArgs as string[];\n\n // Get the shared options too, not just the ones for this command.\n // (In `cloudpackCommand`, we added the shared options to each command object so that they show up\n // in help, but commander still seems to respect options only at the first command where they're\n // encountered, which for shared options will always be the program command.)\n const options = command.optsWithGlobals<TOptions & SharedOptions>();\n\n // Usually `command` will be a sub-command (e.g. \"bundle\"), but it could also be a sub-sub-command\n // (e.g. \"cache clean\").\n const verb = command.parent?.parent ? `${command.parent.name()} ${command.name()}` : command.name();\n\n // Dynamically import the execute function\n const { execute } = await getExecutor();\n if (typeof execute !== 'function') {\n // throw instead of exiting politely, since this is a major developer error\n throw new Error(`No execute function was exported from the command module for ${verb}.`);\n }\n\n const commandExecutor = new CommandExecutor<TOptions & SharedOptions>({\n args: processedArgs,\n options,\n execute,\n programOptions: this._programOptions,\n verb,\n discoverAppPaths: this._discoverAppPaths,\n });\n await commandExecutor.execute();\n });\n }\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import { Command, Help, type Option } from 'commander';
2
+ /**
3
+ * Names (in order) of commands that go in the "basic" group.
4
+ */
5
+ export declare const basicCommands: string[];
6
+ /**
7
+ * Help group names for options (pass to `option.helpGroup()`).
8
+ *
9
+ * The ordering of entries is used to determine the order of sections in help output.
10
+ */
11
+ export declare const optionGroups: {
12
+ default: string;
13
+ /** Options related to the logging output */
14
+ logging: string;
15
+ /** Non-logging options shared between all/most commands */
16
+ common: string;
17
+ };
18
+ export declare class CloudpackHelp extends Help {
19
+ private _isTopLevel;
20
+ constructor(params: {
21
+ isTopLevel: boolean;
22
+ });
23
+ visibleCommands(cmd: Command): Command[];
24
+ visibleOptions(cmd: Command): Option[];
25
+ /**
26
+ * Group options or child commands for help.
27
+ */
28
+ groupItems<T extends Command | Option>(unsortedItems: T[], visibleItems: T[], getGroup: (item: T) => string): Map<string, T[]>;
29
+ }
30
+ //# sourceMappingURL=CloudpackHelp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudpackHelp.d.ts","sourceRoot":"","sources":["../../src/utilities/CloudpackHelp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,aAAa,UAAgD,CAAC;AAe3E;;;;GAIG;AACH,eAAO,MAAM,YAAY;;IAEvB,4CAA4C;;IAE5C,2DAA2D;;CAE5D,CAAC;AAEF,qBAAa,aAAc,SAAQ,IAAI;IACrC,OAAO,CAAC,WAAW,CAAU;gBAEjB,MAAM,EAAE;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE;IAOlC,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,EAAE;IAWxC,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE;IAW/C;;OAEG;IACM,UAAU,CAAC,CAAC,SAAS,OAAO,GAAG,MAAM,EAC5C,aAAa,EAAE,CAAC,EAAE,EAClB,YAAY,EAAE,CAAC,EAAE,EACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAC5B,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;CAoCpB"}
@@ -0,0 +1,89 @@
1
+ import { Command, Help } from 'commander';
2
+ /**
3
+ * Names (in order) of commands that go in the "basic" group.
4
+ */
5
+ export const basicCommands = ['start', 'init', 'bundle', 'link', 'unlink'];
6
+ /**
7
+ * Help group names for the primary commands.
8
+ * (Sub-commands will use the default "Commands:" group.)
9
+ *
10
+ * The ordering of entries is used to determine the order of sections in help output.
11
+ */
12
+ const commandGroups = {
13
+ /** Main commands the user cares about */
14
+ basic: 'Basic commands:',
15
+ /** Lower-level or lesser-used commands (default value) */
16
+ other: 'Other commands:',
17
+ };
18
+ /**
19
+ * Help group names for options (pass to `option.helpGroup()`).
20
+ *
21
+ * The ordering of entries is used to determine the order of sections in help output.
22
+ */
23
+ export const optionGroups = {
24
+ default: 'Options:',
25
+ /** Options related to the logging output */
26
+ logging: 'Logging options:',
27
+ /** Non-logging options shared between all/most commands */
28
+ common: 'Common options:',
29
+ };
30
+ export class CloudpackHelp extends Help {
31
+ _isTopLevel;
32
+ constructor(params) {
33
+ super();
34
+ // Sort commands by name
35
+ this.sortSubcommands = true;
36
+ this._isTopLevel = params.isTopLevel;
37
+ }
38
+ visibleCommands(cmd) {
39
+ const commands = super.visibleCommands(cmd);
40
+ const helpIndex = commands.findIndex((c) => c.name() === 'help');
41
+ if (helpIndex >= 0) {
42
+ // Move the help command to the end of the list
43
+ const helpCommand = commands.splice(helpIndex, 1)[0];
44
+ commands.push(helpCommand);
45
+ }
46
+ return commands;
47
+ }
48
+ visibleOptions(cmd) {
49
+ const options = super.visibleOptions(cmd);
50
+ if (!this._isTopLevel) {
51
+ // Remove --version from help except at the top level (it's not very useful)
52
+ return options.filter((option) => option.name() !== 'version');
53
+ }
54
+ return options;
55
+ }
56
+ /**
57
+ * Group options or child commands for help.
58
+ */
59
+ groupItems(unsortedItems, visibleItems, getGroup) {
60
+ const isCommands = (unsortedItems[0] || visibleItems[0]) instanceof Command;
61
+ let groups;
62
+ if (isCommands && this._isTopLevel) {
63
+ groups = super.groupItems(unsortedItems, visibleItems, (item) => basicCommands.includes(item.name()) ? commandGroups.basic : commandGroups.other);
64
+ const basicGroup = groups.get(commandGroups.basic);
65
+ if (basicGroup) {
66
+ // Force the basic commands to use the order from the array
67
+ basicGroup.sort((a, b) => basicCommands.indexOf(a.name()) - basicCommands.indexOf(b.name()));
68
+ }
69
+ }
70
+ else {
71
+ groups = super.groupItems(unsortedItems, visibleItems, (item) => item.name() === 'help' ? optionGroups.common : getGroup(item));
72
+ }
73
+ if (groups.size < 2) {
74
+ return groups;
75
+ }
76
+ // Sort the groups: anything not listed goes first, followed by groups in the listed order.
77
+ const orderedGroupNames = Object.values(isCommands ? commandGroups : optionGroups);
78
+ const unlistedGroups = [...groups.keys()].filter((g) => !orderedGroupNames.includes(g));
79
+ const sortedGroups = new Map();
80
+ for (const groupName of [...unlistedGroups, ...orderedGroupNames]) {
81
+ const group = groups.get(groupName);
82
+ if (group) {
83
+ sortedGroups.set(groupName, group);
84
+ }
85
+ }
86
+ return sortedGroups;
87
+ }
88
+ }
89
+ //# sourceMappingURL=CloudpackHelp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudpackHelp.js","sourceRoot":"","sources":["../../src/utilities/CloudpackHelp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAe,MAAM,WAAW,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,aAAa,GAAG;IACpB,yCAAyC;IACzC,KAAK,EAAE,iBAAiB;IACxB,0DAA0D;IAC1D,KAAK,EAAE,iBAAiB;CACzB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,UAAU;IACnB,4CAA4C;IAC5C,OAAO,EAAE,kBAAkB;IAC3B,2DAA2D;IAC3D,MAAM,EAAE,iBAAiB;CAC1B,CAAC;AAEF,MAAM,OAAO,aAAc,SAAQ,IAAI;IAC7B,WAAW,CAAU;IAE7B,YAAY,MAA+B;QACzC,KAAK,EAAE,CAAC;QACR,wBAAwB;QACxB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;IACvC,CAAC;IAEQ,eAAe,CAAC,GAAY;QACnC,MAAM,QAAQ,GAAG,KAAK,CAAC,eA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AAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QAED,OAAO,YAAY,CAAC;IACtB,CAAC;CACF","sourcesContent":["import { Command, Help, type Option } from 'commander';\n\n/**\n * Names (in order) of commands that go in the \"basic\" group.\n */\nexport const basicCommands = ['start', 'init', 'bundle', 'link', 'unlink'];\n\n/**\n * Help group names for the primary commands.\n * (Sub-commands will use the default \"Commands:\" group.)\n *\n * The ordering of entries is used to determine the order of sections in help output.\n */\nconst commandGroups = {\n /** Main commands the user cares about */\n basic: 'Basic commands:',\n /** Lower-level or lesser-used commands (default value) */\n other: 'Other commands:',\n};\n\n/**\n * Help group names for options (pass to `option.helpGroup()`).\n *\n * The ordering of entries is used to determine the order of sections in help output.\n */\nexport const optionGroups = {\n default: 'Options:',\n /** Options related to the logging output */\n logging: 'Logging options:',\n /** Non-logging options shared between all/most commands */\n common: 'Common options:',\n};\n\nexport class CloudpackHelp extends Help {\n private _isTopLevel: boolean;\n\n constructor(params: { isTopLevel: boolean }) {\n super();\n // Sort commands by name\n this.sortSubcommands = true;\n this._isTopLevel = params.isTopLevel;\n }\n\n override visibleCommands(cmd: Command): Command[] {\n const commands = super.visibleCommands(cmd);\n const helpIndex = commands.findIndex((c) => c.name() === 'help');\n if (helpIndex >= 0) {\n // Move the help command to the end of the list\n const helpCommand = commands.splice(helpIndex, 1)[0];\n commands.push(helpCommand);\n }\n return commands;\n }\n\n override visibleOptions(cmd: Command): Option[] {\n const options = super.visibleOptions(cmd);\n\n if (!this._isTopLevel) {\n // Remove --version from help except at the top level (it's not very useful)\n return options.filter((option) => option.name() !== 'version');\n }\n\n return options;\n }\n\n /**\n * Group options or child commands for help.\n */\n override groupItems<T extends Command | Option>(\n unsortedItems: T[],\n visibleItems: T[],\n getGroup: (item: T) => string,\n ): Map<string, T[]> {\n const isCommands = (unsortedItems[0] || visibleItems[0]) instanceof Command;\n let groups: Map<string, T[]>;\n if (isCommands && this._isTopLevel) {\n groups = super.groupItems(unsortedItems, visibleItems, (item) =>\n basicCommands.includes(item.name()) ? commandGroups.basic : commandGroups.other,\n );\n const basicGroup = groups.get(commandGroups.basic);\n if (basicGroup) {\n // Force the basic commands to use the order from the array\n basicGroup.sort((a, b) => basicCommands.indexOf(a.name()) - basicCommands.indexOf(b.name()));\n }\n } else {\n groups = super.groupItems(unsortedItems, visibleItems, (item) =>\n item.name() === 'help' ? optionGroups.common : getGroup(item),\n );\n }\n\n if (groups.size < 2) {\n return groups;\n }\n\n // Sort the groups: anything not listed goes first, followed by groups in the listed order.\n const orderedGroupNames = Object.values(isCommands ? commandGroups : optionGroups);\n const unlistedGroups = [...groups.keys()].filter((g) => !orderedGroupNames.includes(g));\n\n const sortedGroups = new Map<string, T[]>();\n for (const groupName of [...unlistedGroups, ...orderedGroupNames]) {\n const group = groups.get(groupName);\n if (group) {\n sortedGroups.set(groupName, group);\n }\n }\n\n return sortedGroups;\n }\n}\n"]}
@@ -25,7 +25,7 @@ export declare const reusedOptions: {
25
25
  }) => Option;
26
26
  /** `--no-cache` option */
27
27
  readonly cache: () => Option;
28
- readonly login: () => Option;
28
+ readonly login: (command: "sync" | "start") => Option;
29
29
  };
30
30
  export declare function getDefaultLogin(): string;
31
31
  //# sourceMappingURL=reusedOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reusedOptions.d.ts","sourceRoot":"","sources":["../../src/utilities/reusedOptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,MAAM,EAAE,MAAM,WAAW,CAAC;AAKzD;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;;OAGG;6BACa;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;;uCAOT;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE;;IAOvD;;;OAGG;uCACuB,MAAM;6BAKhB;QAAE,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAA;KAAE;IAO5C,0BAA0B;;;CAQgD,CAAC;AAmB7E,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
1
+ {"version":3,"file":"reusedOptions.d.ts","sourceRoot":"","sources":["../../src/utilities/reusedOptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,MAAM,EAAE,MAAM,WAAW,CAAC;AAMzD;;GAEG;AACH,eAAO,MAAM,aAAa;IACxB;;;OAGG;6BACa;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;;uCAOT;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE;;IAQvD;;;OAGG;uCACuB,MAAM;6BAKhB;QAAE,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAA;KAAE;IAO5C,0BAA0B;;8BAET,MAAM,GAAG,OAAO;CASyC,CAAC;AAmB7E,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
@@ -2,6 +2,7 @@ import { bundlerNames } from '@ms-cloudpack/bundler';
2
2
  import { InvalidArgumentError, Option } from 'commander';
3
3
  import { parseMatch } from './parseMatch.js';
4
4
  import { environmentInfo } from '@ms-cloudpack/environment';
5
+ import { optionGroups } from './CloudpackHelp.js';
5
6
  /**
6
7
  * These options are used by multiple commands, but should be manually added.
7
8
  */
@@ -10,12 +11,12 @@ export const reusedOptions = {
10
11
  * Specific app(s) to target. NOTE: This will only be respected if the `program.addSubCommand` call
11
12
  * also sets `discoverAppPaths`.
12
13
  */
13
- app: (options) => new Option('--app <appPackageName>', `Run Cloudpack targeting ${options?.multi ? 'specific app(s)' : 'a specific app'} ` +
14
+ app: (options) => new Option('--app <packageName>', `Run Cloudpack targeting ${options?.multi ? 'specific app(s)' : 'a specific app'} ` +
14
15
  '(prefers an exact match, or falls back to substrings).'),
15
16
  bundler: () => new Option('--bundler <name>', 'Force using a specific bundler.').choices(bundlerNames),
16
- logBundleInfo: (options) => new Option('--log-bundle-info', 'For each package, write log files in its output folder with bundle input, output, and analyzed info.' +
17
- (options?.requiresNoCache ? ' (Note: requires --no-cache option if bundle output already exists.)' : '')),
18
- logResolveMap: () => new Option('--log-resolve-map', 'Log the resolve map to "resolve-map.json" for diagnostics.'),
17
+ logBundleInfo: (options) => new Option('--log-bundle-info', "Write log files in each package's output folder with bundle input, output, and info." +
18
+ (options?.requiresNoCache ? ' (Requires --no-cache if bundle output already exists.)' : '')).helpGroup(optionGroups.logging),
19
+ logResolveMap: () => new Option('--log-resolve-map', 'Log the resolve map to "resolve-map.json".').helpGroup(optionGroups.logging),
19
20
  /**
20
21
  * @param descriptionStart Start of description for this command, e.g. "Bundle specific package(s)"
21
22
  * (it will automatically include an optional version note and examples)
@@ -26,7 +27,7 @@ export const reusedOptions = {
26
27
  .default('library'),
27
28
  /** `--no-cache` option */
28
29
  cache: () => new Option('--no-cache', 'Rebuild all packages, rather than using cached assets.'),
29
- login: () => new Option('--login <method>', 'How to authenticate against the remote cache.')
30
+ login: (command) => new Option('--login <method>', `How to authenticate against the remote cache${command === 'start' ? ' (only if starting a remote app)' : ''}.`)
30
31
  .choices(['interactive', 'azure-cli', 'device-code'])
31
32
  .default(getDefaultLogin(), '"azure-cli" in CI, "device-code" in Github Codespaces, "interactive" otherwise'),
32
33
  // Verify the type with `satisfies` to preserve individual function signatures.
@@ -1 +1 @@
1
- {"version":3,"file":"reusedOptions.js","sourceRoot":"","sources":["../../src/utilities/reusedOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,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;AAG5D;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;;OAGG;IACH,GAAG,EAAE,CAAC,OAA6B,EAAE,EAAE,CACrC,IAAI,MAAM,CACR,wBAAwB,EACxB,2BAA2B,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,G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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,MAAM,UAAU,eAAe;IAC7B,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 { bundlerNames } from '@ms-cloudpack/bundler';\nimport type { BundleMode } from '@ms-cloudpack/common-types';\nimport { InvalidArgumentError, Option } from 'commander';\nimport { parseMatch } from './parseMatch.js';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport type { ReusedOptions } from '../types/ReusedOptions.js';\n\n/**\n * These options are used by multiple commands, but should be manually added.\n */\nexport const reusedOptions = {\n /**\n * Specific app(s) to target. NOTE: This will only be respected if the `program.addSubCommand` call\n * also sets `discoverAppPaths`.\n */\n app: (options?: { multi?: boolean }) =>\n new Option(\n '--app <appPackageName>',\n `Run Cloudpack targeting ${options?.multi ? 'specific app(s)' : 'a specific app'} ` +\n '(prefers an exact match, or falls back to substrings).',\n ),\n bundler: () => new Option('--bundler <name>', 'Force using a specific bundler.').choices(bundlerNames),\n logBundleInfo: (options?: { requiresNoCache?: boolean }) =>\n new Option(\n '--log-bundle-info',\n 'For each package, write log files in its output folder with bundle input, output, and analyzed info.' +\n (options?.requiresNoCache ? ' (Note: requires --no-cache option if bundle output already exists.)' : ''),\n ),\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 /** `--no-cache` option */\n cache: () => 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 // Verify the type with `satisfies` to preserve individual function signatures.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} as const satisfies Record<keyof ReusedOptions, (...args: any[]) => Option>;\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\nexport function getDefaultLogin(): string {\n return environmentInfo.isCI ? 'azure-cli' : environmentInfo.isCodespaces ? 'device-code' : 'interactive';\n}\n"]}
1
+ {"version":3,"file":"reusedOptions.js","sourceRoot":"","sources":["../../src/utilities/reusedOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,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,OAAO,EA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wD,CAAC;IAC/F,KAAK,EAAE,CAAC,OAAyB,EAAE,EAAE,CACnC,IAAI,MAAM,CACR,kBAAkB,EAClB,+CAA+C,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,EAAE,GAAG,CAChH;SACE,OAAO,CAAC,CAAC,aAAa,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;SACpD,OAAO,CAAC,eAAe,EAAE,EAAE,gFAAgF,CAAC;IACjH,+EAA+E;IAC/E,8DAA8D;CACY,CAAC;AAE7E,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,MAAM,UAAU,eAAe;IAC7B,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 { bundlerNames } from '@ms-cloudpack/bundler';\nimport type { BundleMode } from '@ms-cloudpack/common-types';\nimport { InvalidArgumentError, Option } from 'commander';\nimport { parseMatch } from './parseMatch.js';\nimport { environmentInfo } from '@ms-cloudpack/environment';\nimport type { ReusedOptions } from '../types/ReusedOptions.js';\nimport { optionGroups } from './CloudpackHelp.js';\n\n/**\n * These options are used by multiple commands, but should be manually added.\n */\nexport const reusedOptions = {\n /**\n * Specific app(s) to target. NOTE: This will only be respected if the `program.addSubCommand` call\n * also sets `discoverAppPaths`.\n */\n app: (options?: { multi?: boolean }) =>\n new Option(\n '--app <packageName>',\n `Run Cloudpack targeting ${options?.multi ? 'specific app(s)' : 'a specific app'} ` +\n '(prefers an exact match, or falls back to substrings).',\n ),\n bundler: () => new Option('--bundler <name>', 'Force using a specific bundler.').choices(bundlerNames),\n logBundleInfo: (options?: { requiresNoCache?: boolean }) =>\n new Option(\n '--log-bundle-info',\n \"Write log files in each package's output folder with bundle input, output, and info.\" +\n (options?.requiresNoCache ? ' (Requires --no-cache if bundle output already exists.)' : ''),\n ).helpGroup(optionGroups.logging),\n logResolveMap: () =>\n new Option('--log-resolve-map', 'Log the resolve map to \"resolve-map.json\".').helpGroup(optionGroups.logging),\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 /** `--no-cache` option */\n cache: () => new Option('--no-cache', 'Rebuild all packages, rather than using cached assets.'),\n login: (command: 'sync' | 'start') =>\n new Option(\n '--login <method>',\n `How to authenticate against the remote cache${command === 'start' ? ' (only if starting a remote app)' : ''}.`,\n )\n .choices(['interactive', 'azure-cli', 'device-code'])\n .default(getDefaultLogin(), '\"azure-cli\" in CI, \"device-code\" in Github Codespaces, \"interactive\" otherwise'),\n // Verify the type with `satisfies` to preserve individual function signatures.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} as const satisfies Record<keyof ReusedOptions, (...args: any[]) => Option>;\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\nexport function 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.76.7",
3
+ "version": "0.76.9",
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",
@@ -18,24 +18,24 @@
18
18
  "cloudpack": "./bin/cloudpack.js"
19
19
  },
20
20
  "dependencies": {
21
- "@ms-cloudpack/api-server": "^0.64.7",
22
- "@ms-cloudpack/app-server": "^0.19.4",
23
- "@ms-cloudpack/bundler": "^0.25.21",
24
- "@ms-cloudpack/bundler-capabilities": "^0.2.33",
25
- "@ms-cloudpack/common-types": "^0.26.3",
26
- "@ms-cloudpack/config": "^0.37.1",
27
- "@ms-cloudpack/create-express-app": "^1.10.42",
21
+ "@ms-cloudpack/api-server": "^0.64.9",
22
+ "@ms-cloudpack/app-server": "^0.20.1",
23
+ "@ms-cloudpack/bundler": "^0.25.23",
24
+ "@ms-cloudpack/bundler-capabilities": "^0.2.34",
25
+ "@ms-cloudpack/common-types": "^0.26.4",
26
+ "@ms-cloudpack/config": "^0.37.2",
27
+ "@ms-cloudpack/create-express-app": "^1.10.43",
28
28
  "@ms-cloudpack/environment": "^0.1.1",
29
29
  "@ms-cloudpack/json-utilities": "^0.1.10",
30
- "@ms-cloudpack/link-proxy": "^0.2.21",
31
- "@ms-cloudpack/overlay": "^0.19.17",
32
- "@ms-cloudpack/package-utilities": "^12.3.19",
30
+ "@ms-cloudpack/link-proxy": "^0.2.23",
31
+ "@ms-cloudpack/overlay": "^0.19.19",
32
+ "@ms-cloudpack/package-utilities": "^12.3.20",
33
33
  "@ms-cloudpack/path-string-parsing": "^1.2.7",
34
- "@ms-cloudpack/path-utilities": "^3.1.13",
35
- "@ms-cloudpack/remote-cache": "^0.11.29",
36
- "@ms-cloudpack/setup-utilities": "^0.5.34",
34
+ "@ms-cloudpack/path-utilities": "^3.1.14",
35
+ "@ms-cloudpack/remote-cache": "^0.11.30",
36
+ "@ms-cloudpack/setup-utilities": "^0.5.35",
37
37
  "@ms-cloudpack/task-reporter": "^0.17.2",
38
- "@ms-cloudpack/telemetry": "^0.11.31",
38
+ "@ms-cloudpack/telemetry": "^0.11.32",
39
39
  "@yarnpkg/lockfile": "^1.1.0",
40
40
  "commander": "^14.0.0",
41
41
  "cross-spawn": "^7.0.3",
@@ -48,7 +48,7 @@
48
48
  "workspace-tools": "^0.38.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@ms-cloudpack/common-types": "^0.26.3",
51
+ "@ms-cloudpack/common-types": "^0.26.4",
52
52
  "@ms-cloudpack/common-types-browser": "^0.6.2",
53
53
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
54
54
  "@ms-cloudpack/scripts": "^0.0.1",