@ms-cloudpack/cli 0.0.5 → 0.1.0
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 +67 -7
- package/CHANGELOG.md +26 -5
- package/lib/commands/start/createSession.d.ts +5 -0
- package/lib/commands/start/createSession.js +21 -0
- package/lib/commands/start/createSession.js.map +1 -0
- package/lib/commands/start/index.js +1 -0
- package/lib/commands/start/index.js.map +1 -1
- package/lib/commands/start/start.d.ts +3 -0
- package/lib/commands/start/start.js +11 -15
- package/lib/commands/start/start.js.map +1 -1
- package/lib/commands/start/startBundleServer.js +44 -35
- package/lib/commands/start/startBundleServer.js.map +1 -1
- package/lib/commands/start/types.d.ts +5 -0
- package/lib/getVersion.d.ts +1 -0
- package/lib/getVersion.js +10 -0
- package/lib/getVersion.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +9 -1
- package/lib/index.js.map +1 -1
- package/package.json +5 -5
- package/lib/tsdoc-metadata.json +0 -11
package/CHANGELOG.json
CHANGED
|
@@ -2,9 +2,69 @@
|
|
|
2
2
|
"name": "@ms-cloudpack/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Fri,
|
|
6
|
-
"tag": "@ms-cloudpack/cli_v0.0
|
|
7
|
-
"version": "0.0
|
|
5
|
+
"date": "Fri, 20 May 2022 04:25:53 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/cli_v0.1.0",
|
|
7
|
+
"version": "0.1.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dzearing@microsoft.com",
|
|
12
|
+
"package": "@ms-cloudpack/cli",
|
|
13
|
+
"commit": "b39bb143fc53e622c39f9e9fd349f71c9ebadd77",
|
|
14
|
+
"comment": "Integrating ori-api"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@ms-cloudpack/cli",
|
|
19
|
+
"comment": "Bump @ms-cloudpack/bundler to v0.1.0",
|
|
20
|
+
"commit": "b39bb143fc53e622c39f9e9fd349f71c9ebadd77"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@ms-cloudpack/cli",
|
|
25
|
+
"comment": "Bump @ms-cloudpack/create-express-app to v0.1.0",
|
|
26
|
+
"commit": "b39bb143fc53e622c39f9e9fd349f71c9ebadd77"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@ms-cloudpack/cli",
|
|
31
|
+
"comment": "Bump @ms-cloudpack/package-utilities to v0.2.0",
|
|
32
|
+
"commit": "b39bb143fc53e622c39f9e9fd349f71c9ebadd77"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@ms-cloudpack/cli",
|
|
37
|
+
"comment": "Bump @ms-cloudpack/path-utilities to v0.2.0",
|
|
38
|
+
"commit": "b39bb143fc53e622c39f9e9fd349f71c9ebadd77"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"date": "Thu, 19 May 2022 21:04:02 GMT",
|
|
45
|
+
"tag": "@ms-cloudpack/cli_v0.0.7",
|
|
46
|
+
"version": "0.0.7",
|
|
47
|
+
"comments": {
|
|
48
|
+
"patch": [
|
|
49
|
+
{
|
|
50
|
+
"author": "beachball",
|
|
51
|
+
"package": "@ms-cloudpack/cli",
|
|
52
|
+
"comment": "Bump @ms-cloudpack/bundler to v0.0.7",
|
|
53
|
+
"commit": "9bd9230fc985c94b2ad7d32a1abadada2fa75852"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@ms-cloudpack/cli",
|
|
58
|
+
"comment": "Bump @ms-cloudpack/package-utilities to v0.1.7",
|
|
59
|
+
"commit": "9bd9230fc985c94b2ad7d32a1abadada2fa75852"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"date": "Sat, 14 May 2022 04:36:11 GMT",
|
|
66
|
+
"tag": "@ms-cloudpack/cli_v0.0.6",
|
|
67
|
+
"version": "0.0.6",
|
|
8
68
|
"comments": {
|
|
9
69
|
"none": [
|
|
10
70
|
{
|
|
@@ -18,14 +78,14 @@
|
|
|
18
78
|
{
|
|
19
79
|
"author": "beachball",
|
|
20
80
|
"package": "@ms-cloudpack/cli",
|
|
21
|
-
"comment": "Bump @ms-cloudpack/bundler to v0.0.
|
|
22
|
-
"commit": "
|
|
81
|
+
"comment": "Bump @ms-cloudpack/bundler to v0.0.6",
|
|
82
|
+
"commit": "14cd69e32bcb9e5b4dff9e3d1b5f0820cf3d7fdd"
|
|
23
83
|
},
|
|
24
84
|
{
|
|
25
85
|
"author": "beachball",
|
|
26
86
|
"package": "@ms-cloudpack/cli",
|
|
27
|
-
"comment": "Bump @ms-cloudpack/package-utilities to v0.1.
|
|
28
|
-
"commit": "
|
|
87
|
+
"comment": "Bump @ms-cloudpack/package-utilities to v0.1.6",
|
|
88
|
+
"commit": "14cd69e32bcb9e5b4dff9e3d1b5f0820cf3d7fdd"
|
|
29
89
|
}
|
|
30
90
|
]
|
|
31
91
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
# Change Log - @ms-cloudpack/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri,
|
|
3
|
+
This log was last generated on Fri, 20 May 2022 04:25:53 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.0
|
|
7
|
+
## 0.1.0
|
|
8
8
|
|
|
9
|
-
Fri,
|
|
9
|
+
Fri, 20 May 2022 04:25:53 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Integrating ori-api (dzearing@microsoft.com)
|
|
14
|
+
- Bump @ms-cloudpack/bundler to v0.1.0
|
|
15
|
+
- Bump @ms-cloudpack/create-express-app to v0.1.0
|
|
16
|
+
- Bump @ms-cloudpack/package-utilities to v0.2.0
|
|
17
|
+
- Bump @ms-cloudpack/path-utilities to v0.2.0
|
|
18
|
+
|
|
19
|
+
## 0.0.7
|
|
20
|
+
|
|
21
|
+
Thu, 19 May 2022 21:04:02 GMT
|
|
22
|
+
|
|
23
|
+
### Patches
|
|
24
|
+
|
|
25
|
+
- Bump @ms-cloudpack/bundler to v0.0.7
|
|
26
|
+
- Bump @ms-cloudpack/package-utilities to v0.1.7
|
|
27
|
+
|
|
28
|
+
## 0.0.6
|
|
29
|
+
|
|
30
|
+
Sat, 14 May 2022 04:36:11 GMT
|
|
10
31
|
|
|
11
32
|
### Patches
|
|
12
33
|
|
|
13
|
-
- Bump @ms-cloudpack/bundler to v0.0.
|
|
14
|
-
- Bump @ms-cloudpack/package-utilities to v0.1.
|
|
34
|
+
- Bump @ms-cloudpack/bundler to v0.0.6
|
|
35
|
+
- Bump @ms-cloudpack/package-utilities to v0.1.6
|
|
15
36
|
|
|
16
37
|
## 0.0.3
|
|
17
38
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { v4 as uuid } from 'uuid';
|
|
2
|
+
import { createResolveMap } from '@ms-cloudpack/package-utilities';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
export async function createSession(options) {
|
|
6
|
+
const { appPath } = options;
|
|
7
|
+
const id = uuid();
|
|
8
|
+
// Grab the installed dependency locations.
|
|
9
|
+
console.log(`Resolving dependencies...`);
|
|
10
|
+
const resolveMap = await createResolveMap({ appPath });
|
|
11
|
+
fs.writeFileSync(path.join(process.cwd(), 'resolve-map.json'), JSON.stringify(resolveMap, null, 2));
|
|
12
|
+
console.log(`Resolved dependencies. (${Object.keys(resolveMap).length} total)`);
|
|
13
|
+
return {
|
|
14
|
+
id,
|
|
15
|
+
appPath,
|
|
16
|
+
type: 'web-app',
|
|
17
|
+
mode: 'library',
|
|
18
|
+
resolveMap,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=createSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSession.js","sourceRoot":"","sources":["../../../src/commands/start/createSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAuB;IACzD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC;IAElB,2CAA2C;IAC3C,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAEzC,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAEvD,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAEpG,OAAO,CAAC,GAAG,CAAC,2BAA2B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,SAAS,CAAC,CAAC;IAEhF,OAAO;QACL,EAAE;QACF,OAAO;QACP,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/start/index.ts"],"names":[],"mappings":"AAEA,+BAA+B;AAC/B,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"}
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
+
import { createSession } from './createSession.js';
|
|
1
2
|
import { startBundleServer } from './startBundleServer.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Defines the "start" verb entry point.
|
|
5
|
+
*/
|
|
5
6
|
export async function start() {
|
|
6
7
|
const appPath = process.cwd();
|
|
7
|
-
const id = uuid();
|
|
8
8
|
// Initialize session definition.
|
|
9
|
-
const session = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
mode: 'library',
|
|
14
|
-
};
|
|
15
|
-
// Start the bundle and html server for this session.
|
|
16
|
-
const [bundleServer, appServer] = await Promise.all([startBundleServer(session), startAppServer()]);
|
|
9
|
+
const session = await createSession({ appPath });
|
|
10
|
+
const bundleServer = await startBundleServer(session);
|
|
11
|
+
// TODO: Re-enable the app server once it's online.
|
|
12
|
+
// const [bundleServer, appServer] = await Promise.all([startBundleServer(session), startAppServer()]);
|
|
17
13
|
// Close things on completion.
|
|
18
14
|
process.on('SIGINT', async function () {
|
|
19
15
|
bundleServer.close();
|
|
20
|
-
appServer.close();
|
|
16
|
+
// appServer.close();
|
|
21
17
|
process.exit(0);
|
|
22
18
|
});
|
|
23
|
-
// Open the browser.
|
|
24
|
-
openBrowser(`http://localhost:${appServer.port}`);
|
|
19
|
+
// TODO: Uncomment when app server is added back. Open the browser.
|
|
20
|
+
// openBrowser(`http://localhost:${appServer.port}`);
|
|
25
21
|
}
|
|
26
22
|
//# sourceMappingURL=start.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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;AAE3D;;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;IAEtD,mDAAmD;IACnD,uGAAuG;IAEvG,8BAA8B;IAC9B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK;QACxB,YAAY,CAAC,KAAK,EAAE,CAAC;QACrB,qBAAqB;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,mEAAmE;IACnE,qDAAqD;AACvD,CAAC"}
|
|
@@ -1,63 +1,70 @@
|
|
|
1
1
|
import { bundlePackage } from '@ms-cloudpack/bundler';
|
|
2
2
|
import { createExpressApp } from '@ms-cloudpack/create-express-app';
|
|
3
3
|
import { readJson, writeJsonSync } from '@ms-cloudpack/json-utilities';
|
|
4
|
-
import {
|
|
4
|
+
import { isExternalPackage } from '@ms-cloudpack/package-utilities';
|
|
5
5
|
import { slash } from '@ms-cloudpack/path-utilities';
|
|
6
6
|
import filenamify from 'filenamify';
|
|
7
|
-
import
|
|
7
|
+
import fsExtra from 'fs-extra';
|
|
8
8
|
import hash from 'object-hash';
|
|
9
9
|
import os from 'os';
|
|
10
10
|
import path from 'path';
|
|
11
11
|
import { parseRequestInfo } from './parseRequestInfo.js';
|
|
12
|
+
const { ensureDir } = fsExtra;
|
|
12
13
|
const bundleLookupPath = path.join(os.tmpdir(), 'cloudpack-output', 'all-bundles.json');
|
|
13
14
|
export async function startBundleServer(session) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
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);
|
|
15
|
+
const createdBundles = (await readJson(bundleLookupPath)) || {};
|
|
16
|
+
const pendingBundles = {};
|
|
17
|
+
const { resolveMap } = session;
|
|
21
18
|
const { server, port } = await createExpressApp([5500, 5501, 5502, 5503], (app) => {
|
|
22
19
|
// Set up the express app routes.
|
|
23
20
|
app.get('*', async (req, res) => {
|
|
24
21
|
const requestPath = slash(req.path.substring(1));
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const packagePath = resolveMap[requestInfo.packageName]?.path;
|
|
22
|
+
const { packageName, version, filePath } = parseRequestInfo(requestPath);
|
|
23
|
+
const packagePath = resolveMap[`${packageName}@${version}`]?.path;
|
|
28
24
|
const isExternal = isExternalPackage(packagePath);
|
|
29
25
|
const force = req.query.force;
|
|
30
|
-
console.log(`BundleServer: Request: "${
|
|
31
|
-
// If
|
|
32
|
-
if (!requestPath || !
|
|
33
|
-
console.log(`BundleServer: Response (400): "${
|
|
26
|
+
console.log(`BundleServer: Request: "${packageName}@${version}${filePath}"`);
|
|
27
|
+
// If the package is missing, invalid arguments.
|
|
28
|
+
if (!requestPath || !packageName) {
|
|
29
|
+
console.log(`BundleServer: Response (400): "${packageName}@${version}${filePath}"`);
|
|
34
30
|
res.status(400).send(`Requests must be in the format "/{packageName}@{version}/path/file.ext".`);
|
|
35
31
|
return;
|
|
36
32
|
}
|
|
33
|
+
// If the version is missing, redirect to the primary version.
|
|
34
|
+
if (!version) {
|
|
35
|
+
const resolvedPackage = resolveMap[packageName];
|
|
36
|
+
if (!resolvedPackage) {
|
|
37
|
+
console.log(`BundleServer: Response (404): Unrecognized package "${packageName}"`);
|
|
38
|
+
res.status(404).send(`Unrecognized package "${packageName}".`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
res.redirect(`/${packageName}@${resolvedPackage.version}/${filePath}`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
37
44
|
// If it's an unrecognized package, 404.
|
|
38
45
|
if (!packagePath) {
|
|
39
|
-
console.log(`BundleServer: Response (404): "${
|
|
46
|
+
console.log(`BundleServer: Response (404): "${packageName}@${version}${filePath}"`);
|
|
40
47
|
res.status(404).send(`The requested package "${packagePath}" is not available.`);
|
|
41
48
|
return;
|
|
42
49
|
}
|
|
43
50
|
// Create an identifier for the bundle.
|
|
44
51
|
const bundleId = hash({
|
|
45
|
-
name:
|
|
46
|
-
version: isExternal ?
|
|
52
|
+
name: packageName,
|
|
53
|
+
version: isExternal ? version : packagePath,
|
|
47
54
|
mode: session.mode,
|
|
48
55
|
});
|
|
49
56
|
// Derive where the output should be.
|
|
50
|
-
const outputPath = path.join(os.tmpdir(), 'cloudpack-output', `${filenamify(
|
|
51
|
-
let action =
|
|
57
|
+
const outputPath = path.join(os.tmpdir(), 'cloudpack-output', `${filenamify(packageName)}-${session.mode}-${version}-${bundleId}`);
|
|
58
|
+
let action = createdBundles[bundleId];
|
|
52
59
|
// If we haven't completed this bundle, enqueue it or piggyback on an existing run.
|
|
53
60
|
if (!action || force) {
|
|
54
|
-
let pendingAction =
|
|
61
|
+
let pendingAction = pendingBundles[bundleId];
|
|
55
62
|
// Either latch on to a pending request or create a new one.
|
|
56
63
|
if (!pendingAction) {
|
|
57
|
-
pendingAction =
|
|
58
|
-
//
|
|
64
|
+
pendingAction = pendingBundles[bundleId] = new Promise((resolve) => {
|
|
65
|
+
// Async helper so that we can await and call resolve.
|
|
59
66
|
async function createBundle() {
|
|
60
|
-
console.log(`BundleServer: No previous action found, bundling: "${
|
|
67
|
+
console.log(`BundleServer: No previous action found, bundling: "${packageName}@${version}${filePath}"`);
|
|
61
68
|
await ensureDir(outputPath);
|
|
62
69
|
const bundlerResult = await bundlePackage({
|
|
63
70
|
packagePath,
|
|
@@ -65,44 +72,46 @@ export async function startBundleServer(session) {
|
|
|
65
72
|
outputType: 'library',
|
|
66
73
|
});
|
|
67
74
|
console.log(`BundleServer: Bundle complete: ${outputPath}`);
|
|
68
|
-
|
|
75
|
+
createdBundles[bundleId] = {
|
|
69
76
|
id: bundleId,
|
|
70
|
-
packageName:
|
|
71
|
-
packageVersion:
|
|
77
|
+
packageName: packageName,
|
|
78
|
+
packageVersion: version,
|
|
79
|
+
packagePath,
|
|
72
80
|
outputPath,
|
|
73
81
|
result: bundlerResult.errors?.length == 0 ? 'success' : 'errors',
|
|
74
82
|
errors: bundlerResult.errors,
|
|
75
83
|
warnings: bundlerResult.warnings,
|
|
76
84
|
};
|
|
77
|
-
delete
|
|
78
|
-
return
|
|
85
|
+
delete pendingBundles[bundleId];
|
|
86
|
+
return createdBundles[bundleId];
|
|
79
87
|
}
|
|
80
88
|
// Call the async function and tie it in with the promise.
|
|
81
89
|
createBundle().then(resolve);
|
|
82
90
|
});
|
|
83
91
|
}
|
|
84
92
|
else {
|
|
85
|
-
console.log(`BundleServer: Previous action found, waiting: "${
|
|
93
|
+
console.log(`BundleServer: Previous action found, waiting: "${packageName}@${version}${filePath}"`);
|
|
86
94
|
}
|
|
87
95
|
action = await pendingAction;
|
|
88
96
|
}
|
|
89
97
|
else {
|
|
90
|
-
console.log(`BundleServer: Bundle cached, returning: "${
|
|
98
|
+
console.log(`BundleServer: Bundle cached, returning: "${packageName}@${version}${filePath}"`);
|
|
91
99
|
}
|
|
92
100
|
// At this point we should have an action compeleted.
|
|
93
101
|
if (action.result === 'errors') {
|
|
94
102
|
res.status(500).type('json').send(action);
|
|
95
103
|
}
|
|
96
104
|
else {
|
|
97
|
-
console.log(`BundleServer: Bundle returning: "${
|
|
105
|
+
console.log(`BundleServer: Bundle returning: "${packageName}@${version}${filePath}"`);
|
|
98
106
|
// Try to return the result.
|
|
99
|
-
res.sendFile(path.join(outputPath,
|
|
107
|
+
res.sendFile(path.join(outputPath, filePath));
|
|
100
108
|
}
|
|
101
109
|
});
|
|
102
110
|
});
|
|
111
|
+
console.log(`Bundle server started (http://localhost:${port})`);
|
|
103
112
|
return {
|
|
104
113
|
close: () => {
|
|
105
|
-
writeJsonSync(bundleLookupPath,
|
|
114
|
+
writeJsonSync(bundleLookupPath, createdBundles);
|
|
106
115
|
server.close();
|
|
107
116
|
},
|
|
108
117
|
port,
|
|
@@ -1 +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,
|
|
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,EAAgB,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;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|
|
1
|
+
import type { ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
1
2
|
export interface Session {
|
|
2
3
|
/**
|
|
3
4
|
* The session id, used for identifying
|
|
@@ -21,4 +22,8 @@ export interface Session {
|
|
|
21
22
|
* the browser.
|
|
22
23
|
*/
|
|
23
24
|
mode: 'library' | 'development' | 'production';
|
|
25
|
+
/**
|
|
26
|
+
* Used to resolve packages in the dependency graph.
|
|
27
|
+
*/
|
|
28
|
+
resolveMap: ResolveMap;
|
|
24
29
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getVersion(): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { findPackageRoot } from '@ms-cloudpack/path-utilities';
|
|
4
|
+
import { readJsonSync } from '@ms-cloudpack/json-utilities';
|
|
5
|
+
export function getVersion() {
|
|
6
|
+
const packageJSONpath = path.join(findPackageRoot(path.dirname(fileURLToPath(import.meta.url))), 'package.json');
|
|
7
|
+
const definition = readJsonSync(packageJSONpath);
|
|
8
|
+
return definition.version;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=getVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVersion.js","sourceRoot":"","sources":["../src/getVersion.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,MAAM,UAAU,UAAU;IACxB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IACjH,MAAM,UAAU,GAAG,YAAY,CAAC,eAAe,CAAsB,CAAC;IAEtE,OAAO,UAAU,CAAC,OAAO,CAAC;AAC5B,CAAC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,15 +2,23 @@ import { Command } from 'commander';
|
|
|
2
2
|
import glob from 'glob';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
5
|
+
import { getVersion } from './getVersion.js';
|
|
5
6
|
const currentPath = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
/**
|
|
8
|
+
* Entry point for the cloudpack CLI. Resolves all commands defined
|
|
9
|
+
* within the "./commands" folder.
|
|
10
|
+
*/
|
|
6
11
|
export async function start() {
|
|
7
12
|
const program = new Command();
|
|
8
|
-
program.name('cloudpack').usage('<command> [options]');
|
|
13
|
+
program.name('cloudpack').version(getVersion()).usage('<command> [options]');
|
|
9
14
|
const commands = glob.sync('commands/*/index.js', { cwd: currentPath });
|
|
10
15
|
for (const commandPath of commands) {
|
|
11
16
|
const command = await import(pathToFileURL(path.resolve(currentPath, commandPath)).toString());
|
|
12
17
|
command.init(program);
|
|
13
18
|
}
|
|
14
19
|
program.parse(process.argv);
|
|
20
|
+
if (program.args.length === 0) {
|
|
21
|
+
program.help();
|
|
22
|
+
}
|
|
15
23
|
}
|
|
16
24
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":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"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,11 +16,11 @@
|
|
|
16
16
|
"cloudpack": "./lib/cloudpack.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@ms-cloudpack/bundler": "^0.0
|
|
20
|
-
"@ms-cloudpack/create-express-app": "^0.0
|
|
19
|
+
"@ms-cloudpack/bundler": "^0.1.0",
|
|
20
|
+
"@ms-cloudpack/create-express-app": "^0.1.0",
|
|
21
21
|
"@ms-cloudpack/json-utilities": "^0.0.3",
|
|
22
|
-
"@ms-cloudpack/package-utilities": "^0.
|
|
23
|
-
"@ms-cloudpack/path-utilities": "^0.
|
|
22
|
+
"@ms-cloudpack/package-utilities": "^0.2.0",
|
|
23
|
+
"@ms-cloudpack/path-utilities": "^0.2.0",
|
|
24
24
|
"commander": "^9.1.0",
|
|
25
25
|
"filenamify": "^5.1.0",
|
|
26
26
|
"fs-extra": "^10.1.0",
|
package/lib/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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.23.2"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|