@ms-cloudpack/cli 0.0.3 → 0.0.6
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/CHANGELOG.json +30 -1
- package/CHANGELOG.md +11 -2
- package/lib/cloudpack.d.ts +2 -0
- package/lib/cloudpack.js +4 -0
- package/lib/cloudpack.js.map +1 -0
- package/lib/commands/bundle/index.d.ts +2 -0
- package/lib/commands/bundle/index.js +7 -0
- package/lib/commands/bundle/index.js.map +1 -0
- package/lib/commands/dashboard/index.d.ts +2 -0
- package/lib/commands/dashboard/index.js +7 -0
- package/lib/commands/dashboard/index.js.map +1 -0
- package/lib/commands/start/index.d.ts +2 -0
- package/lib/commands/start/index.js +7 -0
- package/lib/commands/start/index.js.map +1 -0
- package/lib/commands/start/openBrowser.d.ts +4 -0
- package/lib/commands/start/openBrowser.js +10 -0
- package/lib/commands/start/openBrowser.js.map +1 -0
- package/lib/commands/start/parseRequestInfo.d.ts +5 -0
- package/lib/commands/start/parseRequestInfo.js +9 -0
- package/lib/commands/start/parseRequestInfo.js.map +1 -0
- package/lib/commands/start/start.d.ts +1 -0
- package/lib/commands/start/start.js +26 -0
- package/lib/commands/start/start.js.map +1 -0
- package/lib/commands/start/startAppServer.d.ts +13 -0
- package/lib/commands/start/startAppServer.js +28 -0
- package/lib/commands/start/startAppServer.js.map +1 -0
- package/lib/commands/start/startBundleServer.d.ts +5 -0
- package/lib/commands/start/startBundleServer.js +111 -0
- package/lib/commands/start/startBundleServer.js.map +1 -0
- package/lib/commands/start/types.d.ts +24 -0
- package/lib/commands/start/types.js +2 -0
- package/lib/commands/start/types.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +10 -7
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,36 @@
|
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sat, 14 May 2022 04:35:56 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/cli_v0.0.6",
|
|
7
|
+
"version": "0.0.6",
|
|
8
|
+
"comments": {
|
|
9
|
+
"none": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dzearing@microsoft.com",
|
|
12
|
+
"package": "@ms-cloudpack/cli",
|
|
13
|
+
"commit": "cc0844a7d18790d69e59b16dbd6eef8fab5bc4e0",
|
|
14
|
+
"comment": "Updating package details."
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"patch": [
|
|
18
|
+
{
|
|
19
|
+
"author": "beachball",
|
|
20
|
+
"package": "@ms-cloudpack/cli",
|
|
21
|
+
"comment": "Bump @ms-cloudpack/bundler to v0.0.6",
|
|
22
|
+
"commit": "14cd69e32bcb9e5b4dff9e3d1b5f0820cf3d7fdd"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"author": "beachball",
|
|
26
|
+
"package": "@ms-cloudpack/cli",
|
|
27
|
+
"comment": "Bump @ms-cloudpack/package-utilities to v0.1.6",
|
|
28
|
+
"commit": "14cd69e32bcb9e5b4dff9e3d1b5f0820cf3d7fdd"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"date": "Mon, 09 May 2022 23:39:35 GMT",
|
|
6
35
|
"tag": "@ms-cloudpack/cli_v0.0.3",
|
|
7
36
|
"version": "0.0.3",
|
|
8
37
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @ms-cloudpack/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 14 May 2022 04:35:56 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.0.6
|
|
8
|
+
|
|
9
|
+
Sat, 14 May 2022 04:35:56 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @ms-cloudpack/bundler to v0.0.6
|
|
14
|
+
- Bump @ms-cloudpack/package-utilities to v0.1.6
|
|
15
|
+
|
|
7
16
|
## 0.0.3
|
|
8
17
|
|
|
9
|
-
Mon, 09 May 2022 23:39:
|
|
18
|
+
Mon, 09 May 2022 23:39:35 GMT
|
|
10
19
|
|
|
11
20
|
### Patches
|
|
12
21
|
|
package/lib/cloudpack.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudpack.js","sourceRoot":"","sources":["../src/cloudpack.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bundle/index.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,IAAI,CAAC,OAAgB;IACnC,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,oBAAoB,CAAC;SACjC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dashboard/index.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,IAAI,CAAC,OAAgB;IACnC,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,IAAI,CAAC,OAAgB;IACnC,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,0DAA0D,CAAC;SACvE,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openBrowser.js","sourceRoot":"","sources":["../../../src/commands/start/openBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAY;IAC5C,IAAI,GAAG,EAAE;QACP,MAAM,IAAI,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;KACzC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function parseRequestInfo(requestPath) {
|
|
2
|
+
const matches = requestPath.match(/[/]?(@[-_a-z-A-Z0-9.]+\/[-_a-z-A-Z0-9.]+|[a-zA-Z-0-9.]+)(@([-_a-zA-Z-0-9.]+))?(\/[-_/a-zA-Z0-9.]+)?/) || [];
|
|
3
|
+
return {
|
|
4
|
+
packageName: matches[1] || '',
|
|
5
|
+
version: matches[3] || '',
|
|
6
|
+
filePath: matches[4] || '',
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=parseRequestInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseRequestInfo.js","sourceRoot":"","sources":["../../../src/commands/start/parseRequestInfo.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,MAAM,OAAO,GACX,WAAW,CAAC,KAAK,CACf,qGAAqG,CACtG,IAAI,EAAE,CAAC;IAEV,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;QAC7B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;QACzB,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function start(): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { startBundleServer } from './startBundleServer.js';
|
|
2
|
+
import { openBrowser } from './openBrowser.js';
|
|
3
|
+
import { startAppServer } from './startAppServer.js';
|
|
4
|
+
import { v4 as uuid } from 'uuid';
|
|
5
|
+
export async function start() {
|
|
6
|
+
const appPath = process.cwd();
|
|
7
|
+
const id = uuid();
|
|
8
|
+
// Initialize session definition.
|
|
9
|
+
const session = {
|
|
10
|
+
id,
|
|
11
|
+
appPath,
|
|
12
|
+
type: 'web-app',
|
|
13
|
+
mode: 'library',
|
|
14
|
+
};
|
|
15
|
+
// Start the bundle and html server for this session.
|
|
16
|
+
const [bundleServer, appServer] = await Promise.all([startBundleServer(session), startAppServer()]);
|
|
17
|
+
// Close things on completion.
|
|
18
|
+
process.on('SIGINT', async function () {
|
|
19
|
+
bundleServer.close();
|
|
20
|
+
appServer.close();
|
|
21
|
+
process.exit(0);
|
|
22
|
+
});
|
|
23
|
+
// Open the browser.
|
|
24
|
+
openBrowser(`http://localhost:${appServer.port}`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC9B,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC;IAElB,iCAAiC;IACjC,MAAM,OAAO,GAAY;QACvB,EAAE;QACF,OAAO;QACP,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;KAChB,CAAC;IAEF,qDAAqD;IACrD,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;IAEpG,8BAA8B;IAC9B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK;QACxB,YAAY,CAAC,KAAK,EAAE,CAAC;QACrB,SAAS,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,oBAAoB;IACpB,WAAW,CAAC,oBAAoB,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/**
|
|
3
|
+
* The app server hosts the appropriate routes for the web app, primarily returning html content
|
|
4
|
+
* which loads resources from the bundle server.
|
|
5
|
+
*
|
|
6
|
+
* Separating the app server from the bundle service keeps the routes separate - the app server
|
|
7
|
+
* can support whichever routes the app needs, while the bundle server can provide package
|
|
8
|
+
* assets in various forms using its own routing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function startAppServer(): Promise<{
|
|
11
|
+
close: () => import("http").Server;
|
|
12
|
+
port: number;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// import type { Session } from './types.js';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { slash } from '@ms-cloudpack/path-utilities';
|
|
4
|
+
import { createExpressApp } from '@ms-cloudpack/create-express-app';
|
|
5
|
+
/**
|
|
6
|
+
* The app server hosts the appropriate routes for the web app, primarily returning html content
|
|
7
|
+
* which loads resources from the bundle server.
|
|
8
|
+
*
|
|
9
|
+
* Separating the app server from the bundle service keeps the routes separate - the app server
|
|
10
|
+
* can support whichever routes the app needs, while the bundle server can provide package
|
|
11
|
+
* assets in various forms using its own routing.
|
|
12
|
+
*/
|
|
13
|
+
export async function startAppServer() {
|
|
14
|
+
const { server, port } = await createExpressApp([5000, 5001, 5002, 5003], (app) => {
|
|
15
|
+
// Set up the express app routes.
|
|
16
|
+
app.get('*', async (req, res) => {
|
|
17
|
+
const requestPath = slash(req.path.substring(1));
|
|
18
|
+
const requestExt = path.extname(requestPath);
|
|
19
|
+
console.log(`App server: Request: ${requestPath}, ext: ${requestExt}, ${port}`);
|
|
20
|
+
res.send(`<html><body>hello</body></html>`);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
close: () => server.close(),
|
|
25
|
+
port,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=startAppServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startAppServer.js","sourceRoot":"","sources":["../../../src/commands/start/startAppServer.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,gBAAgB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;QAChF,iCAAiC;QACjC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;YAC9B,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAE7C,OAAO,CAAC,GAAG,CAAC,wBAAwB,WAAW,UAAU,UAAU,KAAK,IAAI,EAAE,CAAC,CAAC;YAEhF,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;QAC3B,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { bundlePackage } from '@ms-cloudpack/bundler';
|
|
2
|
+
import { createExpressApp } from '@ms-cloudpack/create-express-app';
|
|
3
|
+
import { readJson, writeJsonSync } from '@ms-cloudpack/json-utilities';
|
|
4
|
+
import { createResolveMap, isExternalPackage } from '@ms-cloudpack/package-utilities';
|
|
5
|
+
import { slash } from '@ms-cloudpack/path-utilities';
|
|
6
|
+
import filenamify from 'filenamify';
|
|
7
|
+
import { ensureDir } from 'fs-extra';
|
|
8
|
+
import hash from 'object-hash';
|
|
9
|
+
import os from 'os';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { parseRequestInfo } from './parseRequestInfo.js';
|
|
12
|
+
const bundleLookupPath = path.join(os.tmpdir(), 'cloudpack-output', 'all-bundles.json');
|
|
13
|
+
export async function startBundleServer(session) {
|
|
14
|
+
const { appPath } = session;
|
|
15
|
+
const bundleActions = (await readJson(bundleLookupPath)) || {};
|
|
16
|
+
const pendingActions = {};
|
|
17
|
+
// Grab the installed dependency locations.
|
|
18
|
+
console.log(`BundleServer: Resolving dependencies...`);
|
|
19
|
+
const { resolveMap, stats } = await createResolveMap({ appPath });
|
|
20
|
+
console.log(`BundleServer: Resolved dependencies.`, stats);
|
|
21
|
+
const { server, port } = await createExpressApp([5500, 5501, 5502, 5503], (app) => {
|
|
22
|
+
// Set up the express app routes.
|
|
23
|
+
app.get('*', async (req, res) => {
|
|
24
|
+
const requestPath = slash(req.path.substring(1));
|
|
25
|
+
const requestExt = path.extname(requestPath);
|
|
26
|
+
const requestInfo = parseRequestInfo(requestPath);
|
|
27
|
+
const packagePath = resolveMap[requestInfo.packageName]?.path;
|
|
28
|
+
const isExternal = isExternalPackage(packagePath);
|
|
29
|
+
const force = req.query.force;
|
|
30
|
+
console.log(`BundleServer: Request: "${requestInfo.packageName}@${requestInfo.version}${requestInfo.filePath}"`);
|
|
31
|
+
// If there are invalid arguments, 400.
|
|
32
|
+
if (!requestPath || !requestExt || !requestInfo.packageName || !requestInfo.version) {
|
|
33
|
+
console.log(`BundleServer: Response (400): "${requestInfo.packageName}@${requestInfo.version}${requestInfo.filePath}"`);
|
|
34
|
+
res.status(400).send(`Requests must be in the format "/{packageName}@{version}/path/file.ext".`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// If it's an unrecognized package, 404.
|
|
38
|
+
if (!packagePath) {
|
|
39
|
+
console.log(`BundleServer: Response (404): "${requestInfo.packageName}@${requestInfo.version}${requestInfo.filePath}"`);
|
|
40
|
+
res.status(404).send(`The requested package "${packagePath}" is not available.`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Create an identifier for the bundle.
|
|
44
|
+
const bundleId = hash({
|
|
45
|
+
name: requestInfo.packageName,
|
|
46
|
+
version: isExternal ? requestInfo.version : packagePath,
|
|
47
|
+
mode: session.mode,
|
|
48
|
+
});
|
|
49
|
+
// Derive where the output should be.
|
|
50
|
+
const outputPath = path.join(os.tmpdir(), 'cloudpack-output', `${filenamify(requestInfo.packageName)}-${session.mode}-${requestInfo.version}-${bundleId}`);
|
|
51
|
+
let action = bundleActions[bundleId];
|
|
52
|
+
// If we haven't completed this bundle, enqueue it or piggyback on an existing run.
|
|
53
|
+
if (!action || force) {
|
|
54
|
+
let pendingAction = pendingActions[bundleId];
|
|
55
|
+
// Either latch on to a pending request or create a new one.
|
|
56
|
+
if (!pendingAction) {
|
|
57
|
+
pendingAction = pendingActions[bundleId] = new Promise((resolve) => {
|
|
58
|
+
// Define a helper function so that we can await on async operations.
|
|
59
|
+
async function createBundle() {
|
|
60
|
+
console.log(`BundleServer: No previous action found, bundling: "${requestInfo.packageName}@${requestInfo.version}${requestInfo.filePath}"`);
|
|
61
|
+
await ensureDir(outputPath);
|
|
62
|
+
const bundlerResult = await bundlePackage({
|
|
63
|
+
packagePath,
|
|
64
|
+
outputPath,
|
|
65
|
+
outputType: 'library',
|
|
66
|
+
});
|
|
67
|
+
console.log(`BundleServer: Bundle complete: ${outputPath}`);
|
|
68
|
+
bundleActions[bundleId] = {
|
|
69
|
+
id: bundleId,
|
|
70
|
+
packageName: requestInfo.packageName,
|
|
71
|
+
packageVersion: requestInfo.version,
|
|
72
|
+
outputPath,
|
|
73
|
+
result: bundlerResult.errors?.length == 0 ? 'success' : 'errors',
|
|
74
|
+
errors: bundlerResult.errors,
|
|
75
|
+
warnings: bundlerResult.warnings,
|
|
76
|
+
};
|
|
77
|
+
delete pendingActions[bundleId];
|
|
78
|
+
return bundleActions[bundleId];
|
|
79
|
+
}
|
|
80
|
+
// Call the async function and tie it in with the promise.
|
|
81
|
+
createBundle().then(resolve);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
console.log(`BundleServer: Previous action found, waiting: "${requestInfo.packageName}@${requestInfo.version}${requestInfo.filePath}"`);
|
|
86
|
+
}
|
|
87
|
+
action = await pendingAction;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
console.log(`BundleServer: Bundle cached, returning: "${requestInfo.packageName}@${requestInfo.version}${requestInfo.filePath}"`);
|
|
91
|
+
}
|
|
92
|
+
// At this point we should have an action compeleted.
|
|
93
|
+
if (action.result === 'errors') {
|
|
94
|
+
res.status(500).type('json').send(action);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
console.log(`BundleServer: Bundle returning: "${requestInfo.packageName}@${requestInfo.version}${requestInfo.filePath}"`);
|
|
98
|
+
// Try to return the result.
|
|
99
|
+
res.sendFile(path.join(outputPath, requestInfo.filePath));
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
close: () => {
|
|
105
|
+
writeJsonSync(bundleLookupPath, bundleActions);
|
|
106
|
+
server.close();
|
|
107
|
+
},
|
|
108
|
+
port,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=startBundleServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startBundleServer.js","sourceRoot":"","sources":["../../../src/commands/start/startBundleServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,kBAAkB,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AAI,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,QAAQ,GAAG,CAC3H,CAAC;iBACH;gBAED,MAAM,GAAG,MAAM,aAAa,CAAC;aAC9B;iBAAM;gBACL,OAAO,CAAC,GAAG,CACT,4CAA4C,WAAW,CAAC,WAAW,IAAI,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,QAAQ,GAAG,CACrH,CAAC;aACH;YAED,qDAAqD;YACrD,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE;gBAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aAC3C;iBAAM;gBACL,OAAO,CAAC,GAAG,CACT,oCAAoC,WAAW,CAAC,WAAW,IAAI,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,QAAQ,GAAG,CAC7G,CAAC;gBACF,4BAA4B;gBAC5B,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE,GAAG,EAAE;YACV,aAAa,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;YAC/C,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;QACD,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface Session {
|
|
2
|
+
/**
|
|
3
|
+
* The session id, used for identifying
|
|
4
|
+
*/
|
|
5
|
+
id: string;
|
|
6
|
+
/**
|
|
7
|
+
* The primary application path to monitor.
|
|
8
|
+
*/
|
|
9
|
+
appPath: string;
|
|
10
|
+
/**
|
|
11
|
+
* The type of session controls how the code is served via start.
|
|
12
|
+
* Web apps require app server and asset hosting, while libraries
|
|
13
|
+
* only need a bundle service.
|
|
14
|
+
*/
|
|
15
|
+
type: 'web-app' | 'library';
|
|
16
|
+
/**
|
|
17
|
+
* The mode of the session controls how the code is bundled. Library
|
|
18
|
+
* mode bundles each package in isolation, while development and
|
|
19
|
+
* production modes bundle the full app graph together. Library
|
|
20
|
+
* mode is fastest but packages must be complaint for loading in
|
|
21
|
+
* the browser.
|
|
22
|
+
*/
|
|
23
|
+
mode: 'library' | 'development' | 'production';
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/start/types.ts"],"names":[],"mappings":""}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function start(): Promise<void>;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import glob from 'glob';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
5
|
+
const currentPath = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
export async function start() {
|
|
7
|
+
const program = new Command();
|
|
8
|
+
program.name('cloudpack').usage('<command> [options]');
|
|
9
|
+
const commands = glob.sync('commands/*/index.js', { cwd: currentPath });
|
|
10
|
+
for (const commandPath of commands) {
|
|
11
|
+
const command = await import(pathToFileURL(path.resolve(currentPath, commandPath)).toString());
|
|
12
|
+
command.init(program);
|
|
13
|
+
}
|
|
14
|
+
program.parse(process.argv);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEnD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEjE,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAEvD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAExE,KAAK,MAAM,WAAW,IAAI,QAAQ,EAAE;QAClC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE/F,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACvB;IAED,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.24.0"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "The Cloudpack command line interface - a tool for managing fast inner and outer looping in web apps.",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"types": "./lib/index.d.ts",
|
|
7
8
|
"sideEffects": false,
|
|
@@ -15,10 +16,10 @@
|
|
|
15
16
|
"cloudpack": "./lib/cloudpack.js"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@ms-cloudpack/bundler": "^0.0.
|
|
19
|
+
"@ms-cloudpack/bundler": "^0.0.6",
|
|
19
20
|
"@ms-cloudpack/create-express-app": "^0.0.2",
|
|
20
21
|
"@ms-cloudpack/json-utilities": "^0.0.3",
|
|
21
|
-
"@ms-cloudpack/package-utilities": "^0.1.
|
|
22
|
+
"@ms-cloudpack/package-utilities": "^0.1.6",
|
|
22
23
|
"@ms-cloudpack/path-utilities": "^0.1.0",
|
|
23
24
|
"commander": "^9.1.0",
|
|
24
25
|
"filenamify": "^5.1.0",
|
|
@@ -38,10 +39,12 @@
|
|
|
38
39
|
"@types/uuid": "8.3.4"
|
|
39
40
|
},
|
|
40
41
|
"scripts": {
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
42
|
+
"api:update": "cloudpack-scripts api-update",
|
|
43
|
+
"api": "cloudpack-scripts api",
|
|
44
|
+
"build:watch": "cloudpack-scripts build-watch",
|
|
45
|
+
"build": "cloudpack-scripts build",
|
|
46
|
+
"lint:update": "cloudpack-scripts lint-update",
|
|
47
|
+
"lint": "cloudpack-scripts lint"
|
|
45
48
|
},
|
|
46
49
|
"files": [
|
|
47
50
|
"/lib"
|