@ms-cloudpack/cli 0.48.0 → 0.48.1

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.
@@ -0,0 +1,4 @@
1
+ import type { CommandAction } from '../../types/CommandAction.js';
2
+ /** Clear the Cloudpack cache. */
3
+ export declare const execute: CommandAction<undefined>;
4
+ //# sourceMappingURL=clean.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,iCAAiC;AACjC,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC,SAAS,CAqB5C,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { getCachePath } from '@ms-cloudpack/api-server';
2
+ import fsPromises from 'fs/promises';
3
+ /** Clear the Cloudpack cache. */
4
+ export const execute = async ({ cwd, initialize, exit }) => {
5
+ await initialize(cwd);
6
+ const cachePath = getCachePath();
7
+ const cacheDescription = `the Cloudpack cache (${cachePath})`;
8
+ let message;
9
+ let hasErrors = false;
10
+ try {
11
+ await fsPromises.rm(cachePath, { recursive: true, force: true });
12
+ message = `Successfully cleared ${cacheDescription}`;
13
+ hasErrors = false;
14
+ }
15
+ catch (err) {
16
+ message = `Failed to clear ${cacheDescription}: ${err.message || err}`;
17
+ hasErrors = true;
18
+ }
19
+ await exit({
20
+ exitCode: hasErrors ? 1 : 0,
21
+ message,
22
+ });
23
+ };
24
+ //# sourceMappingURL=clean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clean.js","sourceRoot":"","sources":["../../../src/commands/cache/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,UAAU,MAAM,aAAa,CAAC;AAGrC,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAA6B,KAAK,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;IACnF,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;IAEtB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,wBAAwB,SAAS,GAAG,CAAC;IAC9D,IAAI,OAAe,CAAC;IACpB,IAAI,SAAS,GAAG,KAAK,CAAC;IAEtB,IAAI;QACF,MAAM,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,OAAO,GAAG,wBAAwB,gBAAgB,EAAE,CAAC;QACrD,SAAS,GAAG,KAAK,CAAC;KACnB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,GAAG,mBAAmB,gBAAgB,KAAM,GAAa,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC;QAClF,SAAS,GAAG,IAAI,CAAC;KAClB;IAED,MAAM,IAAI,CAAC;QACT,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO;KACR,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { getCachePath } from '@ms-cloudpack/api-server';\nimport fsPromises from 'fs/promises';\nimport type { CommandAction } from '../../types/CommandAction.js';\n\n/** Clear the Cloudpack cache. */\nexport const execute: CommandAction<undefined> = async ({ cwd, initialize, exit }) => {\n await initialize(cwd);\n\n const cachePath = getCachePath();\n const cacheDescription = `the Cloudpack cache (${cachePath})`;\n let message: string;\n let hasErrors = false;\n\n try {\n await fsPromises.rm(cachePath, { recursive: true, force: true });\n message = `Successfully cleared ${cacheDescription}`;\n hasErrors = false;\n } catch (err) {\n message = `Failed to clear ${cacheDescription}: ${(err as Error).message || err}`;\n hasErrors = true;\n }\n\n await exit({\n exitCode: hasErrors ? 1 : 0,\n message,\n });\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,eAAO,MAAM,IAAI,EAAE,eAelB,CAAC"}
@@ -0,0 +1,14 @@
1
+ export const init = (command, createAction) => {
2
+ const cacheCommand = command
3
+ .command('cache')
4
+ .description('Operations related to the Cloudpack cache (requires a sub-command).')
5
+ .usage('<command>');
6
+ cacheCommand
7
+ .command('clean')
8
+ .description('Clears the Cloudpack cache.')
9
+ .alias('clear')
10
+ .action(createAction(() => ({
11
+ execute: import('./clean.js'),
12
+ })));
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;IAC7D,MAAM,YAAY,GAAG,OAAO;SACzB,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,qEAAqE,CAAC;SAClF,KAAK,CAAC,WAAW,CAAC,CAAC;IAEtB,YAAY;SACT,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,6BAA6B,CAAC;SAC1C,KAAK,CAAC,OAAO,CAAC;SACd,MAAM,CACL,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC;KAC9B,CAAC,CAAC,CACJ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\nexport const init: CommandFunction = (command, createAction) => {\n const cacheCommand = command\n .command('cache')\n .description('Operations related to the Cloudpack cache (requires a sub-command).')\n .usage('<command>');\n\n cacheCommand\n .command('clean')\n .description('Clears the Cloudpack cache.')\n .alias('clear')\n .action(\n createAction(() => ({\n execute: import('./clean.js'),\n })),\n );\n};\n"]}
@@ -1,5 +1,5 @@
1
- import { pathExists } from 'fs-extra';
2
1
  import { findCloudpackAppPaths } from '../../common/findCloudpackAppPaths.js';
2
+ import fs from 'fs';
3
3
  import path from 'path';
4
4
  import { createPathToChoiceMap } from './createPathToChoiceMap.js';
5
5
  import { getAppPathFromUser } from './getAppPathFromUser.js';
@@ -12,7 +12,7 @@ import { getAppPathFromUser } from './getAppPathFromUser.js';
12
12
  * @returns The app path of the app that Cloudpack should start
13
13
  */
14
14
  export async function getStartingAppPath(cwd, desiredApp) {
15
- const cwdIsCloudpackApp = await pathExists(path.resolve(path.join(cwd, 'cloudpack.config.json')));
15
+ const cwdIsCloudpackApp = fs.existsSync(path.resolve(path.join(cwd, 'cloudpack.config.json')));
16
16
  if (cwdIsCloudpackApp) {
17
17
  return cwd;
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getStartingAppPath.js","sourceRoot":"","sources":["../../../src/commands/start/getStartingAppPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAW,EAAE,UAAmB;IACvE,MAAM,iBAAiB,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAClG,IAAI,iBAAiB,EAAE;QACrB,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,WAAW,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;KACvB;SAAM;QACL,MAAM,wBAAwB,GAAG,MAAM,qBAAqB,CAAC,WAAW,CAAC,CAAC;QAC1E,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;QAC/E,OAAO,OAAO,IAAI,GAAG,CAAC;KACvB;AACH,CAAC","sourcesContent":["import { pathExists } from 'fs-extra';\nimport { findCloudpackAppPaths } from '../../common/findCloudpackAppPaths.js';\nimport path from 'path';\nimport { createPathToChoiceMap } from './createPathToChoiceMap.js';\nimport { getAppPathFromUser } from './getAppPathFromUser.js';\n\n/**\n * Gets the appPath from which Cloudpack will start. If the CWD is a Cloudpack-enabled app,\n * we'll start there; otherwise, we'll scan for Cloudpack-enabled app and present the user\n * with a menu. If no app are found, Cloudpack will just try to start the CWD anyway.\n * @param cwd - The current working directory to start in when finding the starting app path\n * @param desiredApp - The app that should be started as specified via --app arg\n * @returns The app path of the app that Cloudpack should start\n */\nexport async function getStartingAppPath(cwd: string, desiredApp?: string) {\n const cwdIsCloudpackApp = await pathExists(path.resolve(path.join(cwd, 'cloudpack.config.json')));\n if (cwdIsCloudpackApp) {\n return cwd;\n }\n\n const folderPaths = findCloudpackAppPaths(cwd);\n if (folderPaths.length === 0) {\n return cwd;\n } else if (folderPaths.length === 1) {\n return folderPaths[0];\n } else {\n const pathToCloudpackConfigMap = await createPathToChoiceMap(folderPaths);\n const appPath = await getAppPathFromUser(pathToCloudpackConfigMap, desiredApp);\n return appPath ?? cwd;\n }\n}\n"]}
1
+ {"version":3,"file":"getStartingAppPath.js","sourceRoot":"","sources":["../../../src/commands/start/getStartingAppPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAW,EAAE,UAAmB;IACvE,MAAM,iBAAiB,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAC/F,IAAI,iBAAiB,EAAE;QACrB,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,WAAW,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;KACvB;SAAM;QACL,MAAM,wBAAwB,GAAG,MAAM,qBAAqB,CAAC,WAAW,CAAC,CAAC;QAC1E,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;QAC/E,OAAO,OAAO,IAAI,GAAG,CAAC;KACvB;AACH,CAAC","sourcesContent":["import { findCloudpackAppPaths } from '../../common/findCloudpackAppPaths.js';\nimport fs from 'fs';\nimport path from 'path';\nimport { createPathToChoiceMap } from './createPathToChoiceMap.js';\nimport { getAppPathFromUser } from './getAppPathFromUser.js';\n\n/**\n * Gets the appPath from which Cloudpack will start. If the CWD is a Cloudpack-enabled app,\n * we'll start there; otherwise, we'll scan for Cloudpack-enabled app and present the user\n * with a menu. If no app are found, Cloudpack will just try to start the CWD anyway.\n * @param cwd - The current working directory to start in when finding the starting app path\n * @param desiredApp - The app that should be started as specified via --app arg\n * @returns The app path of the app that Cloudpack should start\n */\nexport async function getStartingAppPath(cwd: string, desiredApp?: string) {\n const cwdIsCloudpackApp = fs.existsSync(path.resolve(path.join(cwd, 'cloudpack.config.json')));\n if (cwdIsCloudpackApp) {\n return cwd;\n }\n\n const folderPaths = findCloudpackAppPaths(cwd);\n if (folderPaths.length === 0) {\n return cwd;\n } else if (folderPaths.length === 1) {\n return folderPaths[0];\n } else {\n const pathToCloudpackConfigMap = await createPathToChoiceMap(folderPaths);\n const appPath = await getAppPathFromUser(pathToCloudpackConfigMap, desiredApp);\n return appPath ?? cwd;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/cli",
3
- "version": "0.48.0",
3
+ "version": "0.48.1",
4
4
  "description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,11 +11,11 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@lage-run/target-graph": "^0.8.7",
14
- "@ms-cloudpack/api-server": "^0.21.0",
14
+ "@ms-cloudpack/api-server": "^0.21.1",
15
15
  "@ms-cloudpack/config": "^0.13.0",
16
16
  "@ms-cloudpack/create-express-app": "^1.3.11",
17
17
  "@ms-cloudpack/json-utilities": "^0.0.7",
18
- "@ms-cloudpack/overlay": "^0.16.2",
18
+ "@ms-cloudpack/overlay": "^0.16.3",
19
19
  "@ms-cloudpack/package-utilities": "^5.1.9",
20
20
  "@ms-cloudpack/path-string-parsing": "^1.1.0",
21
21
  "@ms-cloudpack/path-utilities": "^2.3.4",
@@ -24,7 +24,6 @@
24
24
  "commander": "^11.0.0",
25
25
  "cross-spawn": "^7.0.3",
26
26
  "fast-glob": "^3.2.12",
27
- "fs-extra": "^11.0.0",
28
27
  "glob-hasher": "^1.2.1",
29
28
  "jsdom": "^22.0.0",
30
29
  "open": "^9.0.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/dashboard/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,eAAO,MAAM,IAAI,EAAE,eAKlB,CAAC"}
@@ -1,7 +0,0 @@
1
- export const init = (command) => {
2
- command
3
- .command('dashboard')
4
- .description('Shows the dashboard.')
5
- .action(() => console.log('i am showing the dashboard.'));
6
- };
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dashboard/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,OAAO,EAAE,EAAE;IAC/C,OAAO;SACJ,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC","sourcesContent":["import type { CommandFunction } from '../../types/CommandFunction.js';\n\nexport const init: CommandFunction = (command) => {\n command\n .command('dashboard')\n .description('Shows the dashboard.')\n .action(() => console.log('i am showing the dashboard.'));\n};\n"]}
File without changes