@ms-cloudpack/cli 0.69.1 → 0.69.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -12
- package/lib/__fixtures__/commandTestSetup.d.ts +0 -18
- package/lib/__fixtures__/commandTestSetup.d.ts.map +0 -1
- package/lib/__fixtures__/commandTestSetup.js +0 -61
- package/lib/__fixtures__/commandTestSetup.js.map +0 -1
- package/lib/__fixtures__/createMockSession.d.ts +0 -6
- package/lib/__fixtures__/createMockSession.d.ts.map +0 -1
- package/lib/__fixtures__/createMockSession.js +0 -19
- package/lib/__fixtures__/createMockSession.js.map +0 -1
- package/lib/__fixtures__/getPortArgsForStart.d.ts +0 -21
- package/lib/__fixtures__/getPortArgsForStart.d.ts.map +0 -1
- package/lib/__fixtures__/getPortArgsForStart.js +0 -36
- package/lib/__fixtures__/getPortArgsForStart.js.map +0 -1
- package/lib/__fixtures__/mainWrapper.d.ts +0 -9
- package/lib/__fixtures__/mainWrapper.d.ts.map +0 -1
- package/lib/__fixtures__/mainWrapper.js +0 -17
- package/lib/__fixtures__/mainWrapper.js.map +0 -1
- package/lib/__fixtures__/mockActiveSessions.d.ts +0 -15
- package/lib/__fixtures__/mockActiveSessions.d.ts.map +0 -1
- package/lib/__fixtures__/mockActiveSessions.js +0 -38
- package/lib/__fixtures__/mockActiveSessions.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.3",
|
|
4
4
|
"description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,20 +10,20 @@
|
|
|
10
10
|
"cloudpack": "./bin/cloudpack.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@ms-cloudpack/api-server": "^0.51.
|
|
14
|
-
"@ms-cloudpack/app-server": "^0.15.
|
|
15
|
-
"@ms-cloudpack/common-types": "^0.19.
|
|
16
|
-
"@ms-cloudpack/config": "^0.28.
|
|
13
|
+
"@ms-cloudpack/api-server": "^0.51.3",
|
|
14
|
+
"@ms-cloudpack/app-server": "^0.15.7",
|
|
15
|
+
"@ms-cloudpack/common-types": "^0.19.2",
|
|
16
|
+
"@ms-cloudpack/config": "^0.28.1",
|
|
17
17
|
"@ms-cloudpack/feature-flags": "^0.1.1",
|
|
18
18
|
"@ms-cloudpack/json-utilities": "^0.1.7",
|
|
19
|
-
"@ms-cloudpack/overlay": "^0.17.
|
|
20
|
-
"@ms-cloudpack/package-utilities": "^10.0.
|
|
19
|
+
"@ms-cloudpack/overlay": "^0.17.60",
|
|
20
|
+
"@ms-cloudpack/package-utilities": "^10.0.2",
|
|
21
21
|
"@ms-cloudpack/path-string-parsing": "^1.2.4",
|
|
22
|
-
"@ms-cloudpack/path-utilities": "^2.7.
|
|
23
|
-
"@ms-cloudpack/remote-cache": "^0.8.
|
|
24
|
-
"@ms-cloudpack/setup-utilities": "^0.3.
|
|
22
|
+
"@ms-cloudpack/path-utilities": "^2.7.39",
|
|
23
|
+
"@ms-cloudpack/remote-cache": "^0.8.7",
|
|
24
|
+
"@ms-cloudpack/setup-utilities": "^0.3.1",
|
|
25
25
|
"@ms-cloudpack/task-reporter": "^0.14.4",
|
|
26
|
-
"@ms-cloudpack/telemetry": "^0.6.
|
|
26
|
+
"@ms-cloudpack/telemetry": "^0.6.2",
|
|
27
27
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
28
28
|
"commander": "^11.1.0",
|
|
29
29
|
"cross-spawn": "^7.0.3",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"workspace-tools": "^0.36.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@ms-cloudpack/common-types": "^0.19.
|
|
39
|
+
"@ms-cloudpack/common-types": "^0.19.2",
|
|
40
40
|
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|
|
41
41
|
"@ms-cloudpack/scripts": "^0.0.1",
|
|
42
42
|
"@ms-cloudpack/test-utilities": "^0.5.0",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"build": "cloudpack-scripts build",
|
|
51
51
|
"lint:update": "cloudpack-scripts lint-update",
|
|
52
52
|
"lint": "cloudpack-scripts lint",
|
|
53
|
+
"prepack": "cp .npmignore lib/.npmignore",
|
|
53
54
|
"test:update": "cloudpack-scripts test-update",
|
|
54
55
|
"test:watch": "cloudpack-scripts test-watch",
|
|
55
56
|
"test": "cloudpack-scripts test"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const cliRoot: string;
|
|
2
|
-
export type CommandSpies = ReturnType<typeof commandBeforeAll>;
|
|
3
|
-
/**
|
|
4
|
-
* Shared setup for command tests: mock process.exit, spy on TaskReporter methods, override stdout
|
|
5
|
-
* for TaskReporter, etc. Returns an object with potentially-useful spies.
|
|
6
|
-
*/
|
|
7
|
-
export declare function commandBeforeAll(): {
|
|
8
|
-
exit: import(".store/jest-mock-npm-30.0.0-alpha.6-d61fbc299a/package").SpiedFunction<(code?: number) => never>;
|
|
9
|
-
reporterAddTask: import(".store/jest-mock-npm-30.0.0-alpha.6-d61fbc299a/package").SpiedFunction<(name: string, pending?: boolean) => import("@ms-cloudpack/task-reporter").TaskReporterTask>;
|
|
10
|
-
reporterComplete: import(".store/jest-mock-npm-30.0.0-alpha.6-d61fbc299a/package").SpiedFunction<(completeReason?: string, completedWithError?: boolean) => void>;
|
|
11
|
-
reporterStdoutOverride: import(".store/jest-mock-npm-30.0.0-alpha.6-d61fbc299a/package").Mock<(message: string) => void>;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Shared `afterEach` for command tests:
|
|
15
|
-
* Stop servers if relevant, verify that exit was called, and clear mocks.
|
|
16
|
-
*/
|
|
17
|
-
export declare function commandAfterEach(spies: Pick<CommandSpies, 'exit'>): Promise<void>;
|
|
18
|
-
//# sourceMappingURL=commandTestSetup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandTestSetup.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/commandTestSetup.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,OAAO,QAA4C,CAAC;AAEjE,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,gBAAgB;;;;4GAGmB,MAAM,KAAK,IAAI;EAgCjE;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,iBAavE"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { expect, jest } from '@jest/globals';
|
|
2
|
-
import { setStdoutOverride, TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
3
|
-
import { disableOpenBrowser } from '../commands/start/openBrowser.js';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
import { findPackageRoot } from 'workspace-tools';
|
|
7
|
-
import { stopServers } from '../utilities/stopServers.js';
|
|
8
|
-
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
// eslint-disable-next-line no-restricted-properties
|
|
10
|
-
export const cliRoot = findPackageRoot(dirname) || process.cwd();
|
|
11
|
-
/**
|
|
12
|
-
* Shared setup for command tests: mock process.exit, spy on TaskReporter methods, override stdout
|
|
13
|
-
* for TaskReporter, etc. Returns an object with potentially-useful spies.
|
|
14
|
-
*/
|
|
15
|
-
export function commandBeforeAll() {
|
|
16
|
-
const reporterAddTask = jest.spyOn(TaskReporter.prototype, 'addTask');
|
|
17
|
-
const reporterComplete = jest.spyOn(TaskReporter.prototype, 'complete');
|
|
18
|
-
const reporterStdoutOverride = jest.fn();
|
|
19
|
-
setStdoutOverride({ write: reporterStdoutOverride, columns: 80 });
|
|
20
|
-
// throw if anything calls process.exit() with non-zero code
|
|
21
|
-
const exit = jest.spyOn(process, 'exit').mockImplementation(((code) => {
|
|
22
|
-
if (code && code !== 0) {
|
|
23
|
-
// If reporter.complete() was called with a reason, include it in the error message
|
|
24
|
-
// to make debugging easier (since reporter logs are hidden from the console)
|
|
25
|
-
const completeReason = reporterComplete.mock.calls[0]?.[0];
|
|
26
|
-
throw new Error(`Process exited with code ${code}${completeReason ? `. Reason:\n${completeReason}` : ''}`);
|
|
27
|
-
}
|
|
28
|
-
})); // process.exit() returns `never`
|
|
29
|
-
// only for start, but doesn't hurt for other commands
|
|
30
|
-
disableOpenBrowser();
|
|
31
|
-
// We don't want to accidentally call these utilities during a test...
|
|
32
|
-
// NOTE: for this to work, the test must not synchronously import something referencing this package
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
34
|
-
jest.unstable_mockModule('@ms-cloudpack/setup-utilities', () => ({
|
|
35
|
-
__esModule: true,
|
|
36
|
-
createCertificate: jest.fn(() => Promise.reject('not implemented')),
|
|
37
|
-
updateHostsEntry: jest.fn(() => Promise.reject('not implemented')),
|
|
38
|
-
getCertificate: jest.fn(() => Promise.reject('not implemented')),
|
|
39
|
-
}));
|
|
40
|
-
return {
|
|
41
|
-
exit,
|
|
42
|
-
reporterAddTask,
|
|
43
|
-
reporterComplete,
|
|
44
|
-
reporterStdoutOverride,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Shared `afterEach` for command tests:
|
|
49
|
-
* Stop servers if relevant, verify that exit was called, and clear mocks.
|
|
50
|
-
*/
|
|
51
|
-
export async function commandAfterEach(spies) {
|
|
52
|
-
// This is for tests that use start, and must be done before the spies.exit check
|
|
53
|
-
await stopServers();
|
|
54
|
-
const exitCalled = spies.exit.mock.calls.length > 0;
|
|
55
|
-
jest.clearAllMocks();
|
|
56
|
-
if (!exitCalled) {
|
|
57
|
-
// Give a clearer error message here
|
|
58
|
-
expect('Test did not call process.exit(). If there was an earlier failure in the test, you can ignore this one.').toEqual('Test called process.exit()');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=commandTestSetup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandTestSetup.js","sourceRoot":"","sources":["../../src/__fixtures__/commandTestSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,oDAAoD;AACpD,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AAIjE;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACtE,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACxE,MAAM,sBAAsB,GAAG,IAAI,CAAC,EAAE,EAA6B,CAAC;IACpE,iBAAiB,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAElE,4DAA4D;IAC5D,MAAM,I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,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACpD,IAAI,CAAC,aAAa,EAAE,CAAC;IAErB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,oCAAoC;QACpC,MAAM,CACJ,yGAAyG,CAC1G,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC","sourcesContent":["import { expect, jest } from '@jest/globals';\nimport { setStdoutOverride, TaskReporter } from '@ms-cloudpack/task-reporter';\nimport { disableOpenBrowser } from '../commands/start/openBrowser.js';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { findPackageRoot } from 'workspace-tools';\nimport { stopServers } from '../utilities/stopServers.js';\n\nconst dirname = path.dirname(fileURLToPath(import.meta.url));\n// eslint-disable-next-line no-restricted-properties\nexport const cliRoot = findPackageRoot(dirname) || process.cwd();\n\nexport type CommandSpies = ReturnType<typeof commandBeforeAll>;\n\n/**\n * Shared setup for command tests: mock process.exit, spy on TaskReporter methods, override stdout\n * for TaskReporter, etc. Returns an object with potentially-useful spies.\n */\nexport function commandBeforeAll() {\n const reporterAddTask = jest.spyOn(TaskReporter.prototype, 'addTask');\n const reporterComplete = jest.spyOn(TaskReporter.prototype, 'complete');\n const reporterStdoutOverride = jest.fn<(message: string) => void>();\n setStdoutOverride({ write: reporterStdoutOverride, columns: 80 });\n\n // throw if anything calls process.exit() with non-zero code\n const exit = jest.spyOn(process, 'exit').mockImplementation(((code) => {\n if (code && code !== 0) {\n // If reporter.complete() was called with a reason, include it in the error message\n // to make debugging easier (since reporter logs are hidden from the console)\n const completeReason = reporterComplete.mock.calls[0]?.[0];\n throw new Error(`Process exited with code ${code}${completeReason ? `. Reason:\\n${completeReason}` : ''}`);\n }\n }) as typeof process.exit); // process.exit() returns `never`\n\n // only for start, but doesn't hurt for other commands\n disableOpenBrowser();\n\n // We don't want to accidentally call these utilities during a test...\n // NOTE: for this to work, the test must not synchronously import something referencing this package\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n jest.unstable_mockModule<typeof import('@ms-cloudpack/setup-utilities')>('@ms-cloudpack/setup-utilities', () => ({\n __esModule: true,\n createCertificate: jest.fn(() => Promise.reject('not implemented')),\n updateHostsEntry: jest.fn(() => Promise.reject('not implemented')),\n getCertificate: jest.fn(() => Promise.reject('not implemented')),\n }));\n\n return {\n exit,\n reporterAddTask,\n reporterComplete,\n reporterStdoutOverride,\n };\n}\n\n/**\n * Shared `afterEach` for command tests:\n * Stop servers if relevant, verify that exit was called, and clear mocks.\n */\nexport async function commandAfterEach(spies: Pick<CommandSpies, 'exit'>) {\n // This is for tests that use start, and must be done before the spies.exit check\n await stopServers();\n\n const exitCalled = spies.exit.mock.calls.length > 0;\n jest.clearAllMocks();\n\n if (!exitCalled) {\n // Give a clearer error message here\n expect(\n 'Test did not call process.exit(). If there was an earlier failure in the test, you can ignore this one.',\n ).toEqual('Test called process.exit()');\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createMockSession.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/createMockSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAiBpF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export function createMockSession(params) {
|
|
2
|
-
return {
|
|
3
|
-
...params,
|
|
4
|
-
config: { appPath: '/path/to/app', mode: 'library', generated: {} },
|
|
5
|
-
projectName: 'app',
|
|
6
|
-
resolveMap: {},
|
|
7
|
-
sequence: 0,
|
|
8
|
-
urls: {},
|
|
9
|
-
targetVersions: {},
|
|
10
|
-
sessionVersion: 1,
|
|
11
|
-
incrementSessionVersion: () => { },
|
|
12
|
-
incrementTargetVersion: () => { },
|
|
13
|
-
importMap: { imports: {} },
|
|
14
|
-
linkedPaths: [],
|
|
15
|
-
addLinkedPath: () => Promise.resolve({ resolveMap: {}, linkedPaths: [] }),
|
|
16
|
-
removeLinkedPath: () => Promise.resolve({ resolveMap: {}, linkedPaths: [] }),
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=createMockSession.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createMockSession.js","sourceRoot":"","sources":["../../src/__fixtures__/createMockSession.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,MAAyC;IACzE,OAAO;QACL,GAAG,MAAM;QACT,MAAM,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE;QACnE,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,CAAC;QACX,IAAI,EAAE,EAAE;QACR,cAAc,EAAE,EAAE;QAClB,cAAc,EAAE,CAAC;QACjB,uBAAuB,EAAE,GAAG,EAAE,GAAE,CAAC;QACjC,sBAAsB,EAAE,GAAG,EAAE,GAAE,CAAC;QAChC,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1B,WAAW,EAAE,EAAE;QACf,aAAa,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;QACzE,gBAAgB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC","sourcesContent":["import { type Session } from '@ms-cloudpack/api-server';\n\nexport function createMockSession(params: { id: string; cachePath: string }): Session {\n return {\n ...params,\n config: { appPath: '/path/to/app', mode: 'library', generated: {} },\n projectName: 'app',\n resolveMap: {},\n sequence: 0,\n urls: {},\n targetVersions: {},\n sessionVersion: 1,\n incrementSessionVersion: () => {},\n incrementTargetVersion: () => {},\n importMap: { imports: {} },\n linkedPaths: [],\n addLinkedPath: () => Promise.resolve({ resolveMap: {}, linkedPaths: [] }),\n removeLinkedPath: () => Promise.resolve({ resolveMap: {}, linkedPaths: [] }),\n };\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare const ranges: {
|
|
2
|
-
apiServer: {
|
|
3
|
-
[k: string]: number[];
|
|
4
|
-
};
|
|
5
|
-
appServer: {
|
|
6
|
-
[k: string]: number[];
|
|
7
|
-
};
|
|
8
|
-
bundleServer: {
|
|
9
|
-
[k: string]: number[];
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Get the designated range of ports for a given file.
|
|
14
|
-
*/
|
|
15
|
-
export declare function getPortsForFile(importMetaUrl: string, type: keyof typeof ranges): number[];
|
|
16
|
-
/**
|
|
17
|
-
* Get port args for the start command, with a non-overlapping ports based on the current file.
|
|
18
|
-
*/
|
|
19
|
-
export declare function getPortArgsForStart(importMetaUrl: string): string[];
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=getPortArgsForStart.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPortArgsForStart.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/getPortArgsForStart.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,MAAM;;;;;;;;;;CAIX,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,MAAM,GAAG,MAAM,EAAE,CAO1F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,YASxD"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { portNumbers } from 'get-port';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
// New files can be added to this list to get a port range.
|
|
4
|
-
const files = ['start.e2e.test.ts', 'link.e2e.test.ts', 'unlink.e2e.test.ts', 'getActiveSessions.test.ts'];
|
|
5
|
-
const makePortNumbers = (startPort) => Object.fromEntries(files.map((file) => [file, [...portNumbers(startPort + 1, (startPort += 10))]]));
|
|
6
|
-
// These start numbers are somewhat arbitrary: currently a bit above the default ranges.
|
|
7
|
-
const ranges = {
|
|
8
|
-
apiServer: makePortNumbers(9900),
|
|
9
|
-
appServer: makePortNumbers(5010),
|
|
10
|
-
bundleServer: makePortNumbers(5510),
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Get the designated range of ports for a given file.
|
|
14
|
-
*/
|
|
15
|
-
export function getPortsForFile(importMetaUrl, type) {
|
|
16
|
-
const filename = path.basename(importMetaUrl);
|
|
17
|
-
const range = ranges[type][filename];
|
|
18
|
-
if (!range) {
|
|
19
|
-
throw new Error(`Please add ${filename} to the list of files with port ranges`);
|
|
20
|
-
}
|
|
21
|
-
return range;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get port args for the start command, with a non-overlapping ports based on the current file.
|
|
25
|
-
*/
|
|
26
|
-
export function getPortArgsForStart(importMetaUrl) {
|
|
27
|
-
return [
|
|
28
|
-
'--api-server-port',
|
|
29
|
-
`${getPortsForFile(importMetaUrl, 'apiServer').join(',')}`,
|
|
30
|
-
'--app-server-port',
|
|
31
|
-
`${getPortsForFile(importMetaUrl, 'appServer').join(',')}`,
|
|
32
|
-
'--bundle-server-port',
|
|
33
|
-
`${getPortsForFile(importMetaUrl, 'bundleServer').join(',')}`,
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=getPortArgsForStart.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPortArgsForStart.js","sourceRoot":"","sources":["../../src/__fixtures__/getPortArgsForStart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAA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eAAe,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;KAC9D,CAAC;AACJ,CAAC","sourcesContent":["import { portNumbers } from 'get-port';\nimport path from 'path';\n\n// New files can be added to this list to get a port range.\nconst files = ['start.e2e.test.ts', 'link.e2e.test.ts', 'unlink.e2e.test.ts', 'getActiveSessions.test.ts'];\n\nconst makePortNumbers = (startPort: number) =>\n Object.fromEntries(files.map((file) => [file, [...portNumbers(startPort + 1, (startPort += 10))]]));\n\n// These start numbers are somewhat arbitrary: currently a bit above the default ranges.\nconst ranges = {\n apiServer: makePortNumbers(9900),\n appServer: makePortNumbers(5010),\n bundleServer: makePortNumbers(5510),\n};\n\n/**\n * Get the designated range of ports for a given file.\n */\nexport function getPortsForFile(importMetaUrl: string, type: keyof typeof ranges): number[] {\n const filename = path.basename(importMetaUrl);\n const range = ranges[type][filename];\n if (!range) {\n throw new Error(`Please add ${filename} to the list of files with port ranges`);\n }\n return range;\n}\n\n/**\n * Get port args for the start command, with a non-overlapping ports based on the current file.\n */\nexport function getPortArgsForStart(importMetaUrl: string) {\n return [\n '--api-server-port',\n `${getPortsForFile(importMetaUrl, 'apiServer').join(',')}`,\n '--app-server-port',\n `${getPortsForFile(importMetaUrl, 'appServer').join(',')}`,\n '--bundle-server-port',\n `${getPortsForFile(importMetaUrl, 'bundleServer').join(',')}`,\n ];\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type MainOptions } from '../main.js';
|
|
2
|
-
/**
|
|
3
|
-
* Call `main` with a cwd and appropriate args.
|
|
4
|
-
* Note that for the test, `options.argv` only needs to contain the verb and its args.
|
|
5
|
-
*/
|
|
6
|
-
export declare function mainWrapper(options: Omit<MainOptions, 'cwd'> & {
|
|
7
|
-
cwd: string;
|
|
8
|
-
}): Promise<void>;
|
|
9
|
-
//# sourceMappingURL=mainWrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mainWrapper.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/mainWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,iBAW9E"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { main } from '../main.js';
|
|
2
|
-
/**
|
|
3
|
-
* Call `main` with a cwd and appropriate args.
|
|
4
|
-
* Note that for the test, `options.argv` only needs to contain the verb and its args.
|
|
5
|
-
*/
|
|
6
|
-
export function mainWrapper(options) {
|
|
7
|
-
// Simulate running `cloudpack` from the command line (the first two args aren't used).
|
|
8
|
-
// Always run in quiet mode to avoid cluttering the test output with logs.
|
|
9
|
-
const argv = ['node', 'cloudpack', ...(options.argv || []), '--quiet'];
|
|
10
|
-
return main({
|
|
11
|
-
...options,
|
|
12
|
-
argv,
|
|
13
|
-
// Ensure no telemetry is sent during tests
|
|
14
|
-
disableTelemetry: true,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=mainWrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mainWrapper.js","sourceRoot":"","sources":["../../src/__fixtures__/mainWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,YAAY,CAAC;AAEpD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAmD;IAC7E,uFAAuF;IACvF,0EAA0E;IAC1E,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;IAEvE,OAAO,IAAI,CAAC;QACV,GAAG,OAAO;QACV,IAAI;QACJ,2CAA2C;QAC3C,gBAAgB,EAAE,IAAI;KACvB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { main, type MainOptions } from '../main.js';\n\n/**\n * Call `main` with a cwd and appropriate args.\n * Note that for the test, `options.argv` only needs to contain the verb and its args.\n */\nexport function mainWrapper(options: Omit<MainOptions, 'cwd'> & { cwd: string }) {\n // Simulate running `cloudpack` from the command line (the first two args aren't used).\n // Always run in quiet mode to avoid cluttering the test output with logs.\n const argv = ['node', 'cloudpack', ...(options.argv || []), '--quiet'];\n\n return main({\n ...options,\n argv,\n // Ensure no telemetry is sent during tests\n disableTelemetry: true,\n });\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Session } from '@ms-cloudpack/common-types';
|
|
2
|
-
import type { trackSession as trackSessionType } from '../commands/start/trackSession.js';
|
|
3
|
-
/**
|
|
4
|
-
* Mock `getActiveSessions` to return a custom list of sessions, and mock `trackSession` to add
|
|
5
|
-
* sessions to the list.
|
|
6
|
-
*
|
|
7
|
-
* This ensures that for link tests, there's not a prompt to choose a session.
|
|
8
|
-
*
|
|
9
|
-
* @param fromImportMetaUrl The import.meta.url of the test file calling this function.
|
|
10
|
-
*/
|
|
11
|
-
export declare function mockActiveSessions(fromImportMetaUrl: string): {
|
|
12
|
-
activeSessions: Session[];
|
|
13
|
-
trackSession: import(".store/jest-mock-npm-30.0.0-alpha.6-d61fbc299a/package").Mock<typeof trackSessionType>;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=mockActiveSessions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mockActiveSessions.d.ts","sourceRoot":"","sources":["../../src/__fixtures__/mockActiveSessions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAO1F;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,MAAM;oBAElC,OAAO,EAAE;;EAmBlC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jest } from '@jest/globals';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import { normalizedPathRelativeTo } from '@ms-cloudpack/path-utilities';
|
|
5
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
/**
|
|
7
|
-
* Mock `getActiveSessions` to return a custom list of sessions, and mock `trackSession` to add
|
|
8
|
-
* sessions to the list.
|
|
9
|
-
*
|
|
10
|
-
* This ensures that for link tests, there's not a prompt to choose a session.
|
|
11
|
-
*
|
|
12
|
-
* @param fromImportMetaUrl The import.meta.url of the test file calling this function.
|
|
13
|
-
*/
|
|
14
|
-
export function mockActiveSessions(fromImportMetaUrl) {
|
|
15
|
-
const mocks = {
|
|
16
|
-
activeSessions: [],
|
|
17
|
-
trackSession: jest.fn((session) => {
|
|
18
|
-
mocks.activeSessions.push(session);
|
|
19
|
-
return Promise.resolve({ close: () => Promise.resolve() });
|
|
20
|
-
}),
|
|
21
|
-
};
|
|
22
|
-
// These paths need to be relative to the test file, not the current file
|
|
23
|
-
jest.unstable_mockModule(getRelativePath(fromImportMetaUrl, '../commands/link/getActiveSessions.js'), () => ({
|
|
24
|
-
__esModule: true,
|
|
25
|
-
getActiveSessions: () => Promise.resolve(mocks.activeSessions),
|
|
26
|
-
}));
|
|
27
|
-
jest.unstable_mockModule(getRelativePath(fromImportMetaUrl, '../commands/start/trackSession.js'), () => ({
|
|
28
|
-
__esModule: true,
|
|
29
|
-
trackSession: mocks.trackSession,
|
|
30
|
-
}));
|
|
31
|
-
return mocks;
|
|
32
|
-
}
|
|
33
|
-
function getRelativePath(fromImportMetaUrl, toRelativePath) {
|
|
34
|
-
const fromAbsDir = path.dirname(fileURLToPath(fromImportMetaUrl));
|
|
35
|
-
const toAbsFile = path.resolve(currentDir, toRelativePath);
|
|
36
|
-
return normalizedPathRelativeTo(fromAbsDir, toAbsFile);
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=mockActiveSessions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mockActiveSessions.js","sourceRoot":"","sources":["../../src/__fixtures__/mockActiveSessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,iBAAyB;IAC1D,MAAM,KAAK,GAAG;QACZ,cAAc,EAAE,EAAe;QAC/B,YAAY,EAAE,IAAI,CAAC,EAAE,CAA0B,CAAC,OAAO,EAAE,EAAE;YACzD,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACnC,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC7D,CAAC,CAAC;KACH,CAAC;IAEF,yEAAyE;IACzE,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,iBAAiB,EAAE,uCAAuC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAC3G,UAAU,EAAE,IAAI;QAChB,iBAAiB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC;KAC/D,CAAC,CAAC,CAAC;IAEJ,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,iBAAiB,EAAE,mCAAmC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QACvG,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC,CAAC,CAAC;IAEJ,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,eAAe,CAAC,iBAAyB,EAAE,cAAsB;IACxE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAClE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC3D,OAAO,wBAAwB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACzD,CAAC","sourcesContent":["import { jest } from '@jest/globals';\nimport type { Session } from '@ms-cloudpack/common-types';\nimport type { trackSession as trackSessionType } from '../commands/start/trackSession.js';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { normalizedPathRelativeTo } from '@ms-cloudpack/path-utilities';\n\nconst currentDir = path.dirname(fileURLToPath(import.meta.url));\n\n/**\n * Mock `getActiveSessions` to return a custom list of sessions, and mock `trackSession` to add\n * sessions to the list.\n *\n * This ensures that for link tests, there's not a prompt to choose a session.\n *\n * @param fromImportMetaUrl The import.meta.url of the test file calling this function.\n */\nexport function mockActiveSessions(fromImportMetaUrl: string) {\n const mocks = {\n activeSessions: [] as Session[],\n trackSession: jest.fn<typeof trackSessionType>((session) => {\n mocks.activeSessions.push(session);\n return Promise.resolve({ close: () => Promise.resolve() });\n }),\n };\n\n // These paths need to be relative to the test file, not the current file\n jest.unstable_mockModule(getRelativePath(fromImportMetaUrl, '../commands/link/getActiveSessions.js'), () => ({\n __esModule: true,\n getActiveSessions: () => Promise.resolve(mocks.activeSessions),\n }));\n\n jest.unstable_mockModule(getRelativePath(fromImportMetaUrl, '../commands/start/trackSession.js'), () => ({\n __esModule: true,\n trackSession: mocks.trackSession,\n }));\n\n return mocks;\n}\n\nfunction getRelativePath(fromImportMetaUrl: string, toRelativePath: string) {\n const fromAbsDir = path.dirname(fileURLToPath(fromImportMetaUrl));\n const toAbsFile = path.resolve(currentDir, toRelativePath);\n return normalizedPathRelativeTo(fromAbsDir, toAbsFile);\n}\n"]}
|