@ms-cloudpack/cli 0.1.0 → 0.1.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.
- package/CHANGELOG.json +28 -1
- package/CHANGELOG.md +12 -2
- package/lib/commands/start/start.js +5 -4
- package/lib/commands/start/start.js.map +1 -1
- package/lib/commands/start/startAppServer.d.ts +2 -1
- package/lib/commands/start/startAppServer.js +16 -2
- package/lib/commands/start/startAppServer.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,34 @@
|
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sat, 21 May 2022 00:31:20 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/cli_v0.1.1",
|
|
7
|
+
"version": "0.1.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dzearing@microsoft.com",
|
|
12
|
+
"package": "@ms-cloudpack/cli",
|
|
13
|
+
"commit": "c26c7bcc7abda501d07180598e3da003b435b03b",
|
|
14
|
+
"comment": "Adding call to burn import map on the page and placeholder html rendering logic."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@ms-cloudpack/cli",
|
|
19
|
+
"comment": "Bump @ms-cloudpack/bundler to v0.1.1",
|
|
20
|
+
"commit": "c26c7bcc7abda501d07180598e3da003b435b03b"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@ms-cloudpack/cli",
|
|
25
|
+
"comment": "Bump @ms-cloudpack/package-utilities to v0.3.0",
|
|
26
|
+
"commit": "c26c7bcc7abda501d07180598e3da003b435b03b"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"date": "Fri, 20 May 2022 04:26:15 GMT",
|
|
6
33
|
"tag": "@ms-cloudpack/cli_v0.1.0",
|
|
7
34
|
"version": "0.1.0",
|
|
8
35
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# Change Log - @ms-cloudpack/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 21 May 2022 00:31:20 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.1.1
|
|
8
|
+
|
|
9
|
+
Sat, 21 May 2022 00:31:20 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Adding call to burn import map on the page and placeholder html rendering logic. (dzearing@microsoft.com)
|
|
14
|
+
- Bump @ms-cloudpack/bundler to v0.1.1
|
|
15
|
+
- Bump @ms-cloudpack/package-utilities to v0.3.0
|
|
16
|
+
|
|
7
17
|
## 0.1.0
|
|
8
18
|
|
|
9
|
-
Fri, 20 May 2022 04:
|
|
19
|
+
Fri, 20 May 2022 04:26:15 GMT
|
|
10
20
|
|
|
11
21
|
### Minor changes
|
|
12
22
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createSession } from './createSession.js';
|
|
2
2
|
import { startBundleServer } from './startBundleServer.js';
|
|
3
|
+
import { startAppServer } from './startAppServer.js';
|
|
4
|
+
import { openBrowser } from './openBrowser.js';
|
|
3
5
|
/**
|
|
4
6
|
* Defines the "start" verb entry point.
|
|
5
7
|
*/
|
|
@@ -8,15 +10,14 @@ export async function start() {
|
|
|
8
10
|
// Initialize session definition.
|
|
9
11
|
const session = await createSession({ appPath });
|
|
10
12
|
const bundleServer = await startBundleServer(session);
|
|
11
|
-
|
|
12
|
-
// const [bundleServer, appServer] = await Promise.all([startBundleServer(session), startAppServer()]);
|
|
13
|
+
const appServer = await startAppServer(session, `http://localhost:${bundleServer.port}`);
|
|
13
14
|
// Close things on completion.
|
|
14
15
|
process.on('SIGINT', async function () {
|
|
15
16
|
bundleServer.close();
|
|
16
|
-
|
|
17
|
+
appServer.close();
|
|
17
18
|
process.exit(0);
|
|
18
19
|
});
|
|
19
20
|
// TODO: Uncomment when app server is added back. Open the browser.
|
|
20
|
-
|
|
21
|
+
openBrowser(`http://localhost:${appServer.port}`);
|
|
21
22
|
}
|
|
22
23
|
//# sourceMappingURL=start.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE9B,iCAAiC;IACjC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,oBAAoB,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;IAEzF,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,mEAAmE;IACnE,WAAW,CAAC,oBAAoB,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import type { Session } from './types.js';
|
|
2
3
|
/**
|
|
3
4
|
* The app server hosts the appropriate routes for the web app, primarily returning html content
|
|
4
5
|
* which loads resources from the bundle server.
|
|
@@ -7,7 +8,7 @@
|
|
|
7
8
|
* can support whichever routes the app needs, while the bundle server can provide package
|
|
8
9
|
* assets in various forms using its own routing.
|
|
9
10
|
*/
|
|
10
|
-
export declare function startAppServer(): Promise<{
|
|
11
|
+
export declare function startAppServer(session: Session, bundleServerUrl: string): Promise<{
|
|
11
12
|
close: () => import("http").Server;
|
|
12
13
|
port: number;
|
|
13
14
|
}>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// import type { Session } from './types.js';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { slash } from '@ms-cloudpack/path-utilities';
|
|
4
|
+
import { createImportMap } from '@ms-cloudpack/package-utilities';
|
|
4
5
|
import { createExpressApp } from '@ms-cloudpack/create-express-app';
|
|
5
6
|
/**
|
|
6
7
|
* The app server hosts the appropriate routes for the web app, primarily returning html content
|
|
@@ -10,14 +11,27 @@ import { createExpressApp } from '@ms-cloudpack/create-express-app';
|
|
|
10
11
|
* can support whichever routes the app needs, while the bundle server can provide package
|
|
11
12
|
* assets in various forms using its own routing.
|
|
12
13
|
*/
|
|
13
|
-
export async function startAppServer() {
|
|
14
|
+
export async function startAppServer(session, bundleServerUrl) {
|
|
15
|
+
const importMap = await createImportMap(session.resolveMap, bundleServerUrl);
|
|
14
16
|
const { server, port } = await createExpressApp([5000, 5001, 5002, 5003], (app) => {
|
|
15
17
|
// Set up the express app routes.
|
|
16
18
|
app.get('*', async (req, res) => {
|
|
17
19
|
const requestPath = slash(req.path.substring(1));
|
|
18
20
|
const requestExt = path.extname(requestPath);
|
|
21
|
+
const entryScript = `${bundleServerUrl}/session/app/lib/index.js`; // getEntryScript(requestPath);
|
|
19
22
|
console.log(`App server: Request: ${requestPath}, ext: ${requestExt}, ${port}`);
|
|
20
|
-
res.
|
|
23
|
+
res.cookie('cloudpack-session-id', session.id);
|
|
24
|
+
res.set('Content-Security-Policy', `connect-src 'self' ws:;`);
|
|
25
|
+
res.send(`
|
|
26
|
+
<html>
|
|
27
|
+
<head>
|
|
28
|
+
<script type="importmap">${JSON.stringify(importMap, null, 2)}</script>
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<script type="module" src="${entryScript}"></script>
|
|
32
|
+
</body>
|
|
33
|
+
</html>
|
|
34
|
+
`);
|
|
21
35
|
});
|
|
22
36
|
});
|
|
23
37
|
return {
|
|
@@ -1 +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;
|
|
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,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAgB,EAAE,eAAuB;IAC5E,M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
"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",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"cloudpack": "./lib/cloudpack.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@ms-cloudpack/bundler": "^0.1.
|
|
19
|
+
"@ms-cloudpack/bundler": "^0.1.1",
|
|
20
20
|
"@ms-cloudpack/create-express-app": "^0.1.0",
|
|
21
21
|
"@ms-cloudpack/json-utilities": "^0.0.3",
|
|
22
|
-
"@ms-cloudpack/package-utilities": "^0.
|
|
22
|
+
"@ms-cloudpack/package-utilities": "^0.3.0",
|
|
23
23
|
"@ms-cloudpack/path-utilities": "^0.2.0",
|
|
24
24
|
"commander": "^9.1.0",
|
|
25
25
|
"filenamify": "^5.1.0",
|