piral-cli 0.15.2-beta.4923 → 0.15.2-beta.4932
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.
|
@@ -24,7 +24,8 @@ exports.runEmulatorPiralDefaults = {
|
|
|
24
24
|
npmClient: undefined,
|
|
25
25
|
};
|
|
26
26
|
function createTempDir() {
|
|
27
|
-
|
|
27
|
+
const root = (0, path_1.join)((0, os_1.tmpdir)(), 'piral-cli-');
|
|
28
|
+
return new Promise((resolve, reject) => (0, fs_1.mkdtemp)(root, (err, dir) => {
|
|
28
29
|
if (err) {
|
|
29
30
|
reject(err);
|
|
30
31
|
}
|
|
@@ -35,13 +36,13 @@ function createTempDir() {
|
|
|
35
36
|
}
|
|
36
37
|
function runEmulatorPiral(baseDir = process.cwd(), options = {}) {
|
|
37
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const { open = exports.runEmulatorPiralDefaults.open, port: originalPort = exports.runEmulatorPiralDefaults.port, logLevel = exports.runEmulatorPiralDefaults.logLevel, npmClient = exports.runEmulatorPiralDefaults.npmClient, registry = exports.runEmulatorPiralDefaults.registry, app, feed, } = options;
|
|
39
|
+
const { open = exports.runEmulatorPiralDefaults.open, port: originalPort = exports.runEmulatorPiralDefaults.port, logLevel = exports.runEmulatorPiralDefaults.logLevel, npmClient: defaultNpmClient = exports.runEmulatorPiralDefaults.npmClient, registry = exports.runEmulatorPiralDefaults.registry, app, feed, } = options;
|
|
39
40
|
const publicUrl = '/';
|
|
41
|
+
const api = common_1.config.piletApi;
|
|
40
42
|
const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
|
|
41
43
|
const baseMocks = (0, path_1.resolve)(fullBase, 'mocks');
|
|
42
44
|
(0, common_1.setLogLevel)(logLevel);
|
|
43
45
|
(0, common_1.progress)('Reading configuration ...');
|
|
44
|
-
const api = common_1.config.piletApi.replace(/^\/+/, '');
|
|
45
46
|
process.stderr.setMaxListeners(16);
|
|
46
47
|
process.stdout.setMaxListeners(16);
|
|
47
48
|
process.stdin.setMaxListeners(16);
|
|
@@ -51,6 +52,7 @@ function runEmulatorPiral(baseDir = process.cwd(), options = {}) {
|
|
|
51
52
|
yield (0, common_1.createFileIfNotExists)(appRoot, '.npmrc', `registry=${registry}
|
|
52
53
|
always-auth=true`, common_1.ForceOverwrite.yes);
|
|
53
54
|
}
|
|
55
|
+
const npmClient = yield (0, common_1.determineNpmClient)(appRoot, defaultNpmClient);
|
|
54
56
|
const [packageName] = yield (0, common_1.installPiralInstance)(app, fullBase, appRoot, npmClient);
|
|
55
57
|
const piral = (0, common_1.findPiralInstance)(packageName, appRoot, originalPort);
|
|
56
58
|
const port = yield (0, common_1.getAvailablePort)(piral.port);
|
|
@@ -67,7 +69,7 @@ always-auth=true`, common_1.ForceOverwrite.yes);
|
|
|
67
69
|
pilets: [],
|
|
68
70
|
app: (0, path_1.dirname)(piral.app),
|
|
69
71
|
publicUrl,
|
|
70
|
-
handle: [
|
|
72
|
+
handle: [publicUrl, api],
|
|
71
73
|
api,
|
|
72
74
|
},
|
|
73
75
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-emulator-piral.js","sourceRoot":"","sources":["../../src/apps/run-emulator-piral.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAA4B;AAC5B,2BAA6B;AAC7B,+
|
|
1
|
+
{"version":3,"file":"run-emulator-piral.js","sourceRoot":"","sources":["../../src/apps/run-emulator-piral.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAA4B;AAC5B,2BAA6B;AAC7B,+BAA8C;AAC9C,+BAAgE;AAChE,oCAAoD;AACpD,sCAcmB;AAwCN,QAAA,wBAAwB,GAA4B;IAC/D,QAAQ,EAAE,iBAAS,CAAC,IAAI;IACxB,IAAI,EAAE,eAAM,CAAC,WAAW;IACxB,IAAI,EAAE,eAAM,CAAC,IAAI;IACjB,QAAQ,EAAE,eAAM,CAAC,QAAQ;IACzB,SAAS,EAAE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;oBACT,MAAM,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC;oBACxB,GAAG;iBACJ;aACF;SACF,CAAC;QACF,MAAM,OAAO,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,IAAA,qBAAc,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,CAAC;QAE3E,IAAA,YAAG,EAAC,qBAAqB,EAAE,kCAAkC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAEzG,MAAM,UAAU,GAAG,IAAA,uBAAgB,EAAC,UAAU,CAAC,CAAC;QAChD,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAC/B,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACtC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,IAAA,2BAAkB,EAAC,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QAErE,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;QACzB,IAAA,oBAAW,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACrD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAClE,CAAC;CAAA;AAxED,4CAwEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "0.15.2-beta.
|
|
3
|
+
"version": "0.15.2-beta.4932",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"typescript": "^4.0.0",
|
|
81
81
|
"yargs": "^15.0.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "9c1242edc9f7bdd2255821500ca5503631cb7569"
|
|
84
84
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { tmpdir } from 'os';
|
|
2
2
|
import { mkdtemp } from 'fs';
|
|
3
|
-
import { dirname, resolve } from 'path';
|
|
3
|
+
import { dirname, join, resolve } from 'path';
|
|
4
4
|
import { readKrasConfig, krasrc, buildKrasWithCli } from 'kras';
|
|
5
5
|
import { LogLevels, NpmClientType } from '../types';
|
|
6
6
|
import {
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
createFileIfNotExists,
|
|
17
17
|
ForceOverwrite,
|
|
18
18
|
findPiralInstance,
|
|
19
|
+
determineNpmClient,
|
|
19
20
|
} from '../common';
|
|
20
21
|
|
|
21
22
|
export interface RunEmulatorPiralOptions {
|
|
@@ -65,8 +66,10 @@ export const runEmulatorPiralDefaults: RunEmulatorPiralOptions = {
|
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
function createTempDir() {
|
|
69
|
+
const root = join(tmpdir(), 'piral-cli-');
|
|
70
|
+
|
|
68
71
|
return new Promise<string>((resolve, reject) =>
|
|
69
|
-
mkdtemp(
|
|
72
|
+
mkdtemp(root, (err, dir) => {
|
|
70
73
|
if (err) {
|
|
71
74
|
reject(err);
|
|
72
75
|
} else {
|
|
@@ -81,18 +84,18 @@ export async function runEmulatorPiral(baseDir = process.cwd(), options: RunEmul
|
|
|
81
84
|
open = runEmulatorPiralDefaults.open,
|
|
82
85
|
port: originalPort = runEmulatorPiralDefaults.port,
|
|
83
86
|
logLevel = runEmulatorPiralDefaults.logLevel,
|
|
84
|
-
npmClient = runEmulatorPiralDefaults.npmClient,
|
|
87
|
+
npmClient: defaultNpmClient = runEmulatorPiralDefaults.npmClient,
|
|
85
88
|
registry = runEmulatorPiralDefaults.registry,
|
|
86
89
|
app,
|
|
87
90
|
feed,
|
|
88
91
|
} = options;
|
|
89
92
|
const publicUrl = '/';
|
|
93
|
+
const api = config.piletApi;
|
|
90
94
|
const fullBase = resolve(process.cwd(), baseDir);
|
|
91
95
|
const baseMocks = resolve(fullBase, 'mocks');
|
|
92
96
|
setLogLevel(logLevel);
|
|
93
97
|
|
|
94
98
|
progress('Reading configuration ...');
|
|
95
|
-
const api = config.piletApi.replace(/^\/+/, '');
|
|
96
99
|
|
|
97
100
|
process.stderr.setMaxListeners(16);
|
|
98
101
|
process.stdout.setMaxListeners(16);
|
|
@@ -112,6 +115,7 @@ always-auth=true`,
|
|
|
112
115
|
);
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
const npmClient = await determineNpmClient(appRoot, defaultNpmClient);
|
|
115
119
|
const [packageName] = await installPiralInstance(app, fullBase, appRoot, npmClient);
|
|
116
120
|
const piral = findPiralInstance(packageName, appRoot, originalPort);
|
|
117
121
|
const port = await getAvailablePort(piral.port);
|
|
@@ -129,7 +133,7 @@ always-auth=true`,
|
|
|
129
133
|
pilets: [],
|
|
130
134
|
app: dirname(piral.app),
|
|
131
135
|
publicUrl,
|
|
132
|
-
handle: [
|
|
136
|
+
handle: [publicUrl, api],
|
|
133
137
|
api,
|
|
134
138
|
},
|
|
135
139
|
},
|