piral-cli 1.4.0-beta.6250 → 1.4.0-beta.6253
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/lib/api.js +8 -17
- package/lib/api.js.map +1 -1
- package/lib/apps/add-piral-instance-pilet.js +20 -31
- package/lib/apps/add-piral-instance-pilet.js.map +1 -1
- package/lib/apps/build-pilet.js +139 -147
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.js +130 -144
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.js +107 -119
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.js +62 -70
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/declaration-piral.js +6 -17
- package/lib/apps/declaration-piral.js.map +1 -1
- package/lib/apps/new-pilet.js +71 -82
- package/lib/apps/new-pilet.js.map +1 -1
- package/lib/apps/new-piral.js +42 -53
- package/lib/apps/new-piral.js.map +1 -1
- package/lib/apps/pack-pilet.js +7 -18
- package/lib/apps/pack-pilet.js.map +1 -1
- package/lib/apps/publish-pilet.js +127 -141
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/publish-piral.js +48 -63
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/remove-piral-instance-pilet.js +30 -35
- package/lib/apps/remove-piral-instance-pilet.js.map +1 -1
- package/lib/apps/run-emulator-piral.js +49 -61
- package/lib/apps/run-emulator-piral.js.map +1 -1
- package/lib/apps/upgrade-pilet.js +64 -76
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/apps/upgrade-piral.js +31 -43
- package/lib/apps/upgrade-piral.js.map +1 -1
- package/lib/apps/validate-pilet.js +34 -45
- package/lib/apps/validate-pilet.js.map +1 -1
- package/lib/apps/validate-piral.js +29 -51
- package/lib/apps/validate-piral.js.map +1 -1
- package/lib/build/bundler-calls.js +12 -3
- package/lib/build/bundler-calls.js.map +1 -1
- package/lib/build/run-build-pilet.js +5 -14
- package/lib/build/run-build-pilet.js.map +1 -1
- package/lib/build/run-build-piral.js +5 -14
- package/lib/build/run-build-piral.js.map +1 -1
- package/lib/build/run-debug-mono-piral.js +5 -14
- package/lib/build/run-debug-mono-piral.js.map +1 -1
- package/lib/build/run-debug-pilet.js +5 -14
- package/lib/build/run-debug-pilet.js.map +1 -1
- package/lib/build/run-debug-piral.js +5 -14
- package/lib/build/run-debug-piral.js.map +1 -1
- package/lib/bundler.js +100 -127
- package/lib/bundler.js.map +1 -1
- package/lib/commands.js +5 -1
- package/lib/commands.js.map +1 -1
- package/lib/common/browser.js +13 -26
- package/lib/common/browser.js.map +1 -1
- package/lib/common/compatibility.js +10 -21
- package/lib/common/compatibility.js.map +1 -1
- package/lib/common/declaration.js +80 -101
- package/lib/common/declaration.js.map +1 -1
- package/lib/common/emulator.js +186 -182
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/http.js +7 -4
- package/lib/common/http.js.map +1 -1
- package/lib/common/importmap.js +172 -187
- package/lib/common/importmap.js.map +1 -1
- package/lib/common/injectors.js +4 -1
- package/lib/common/injectors.js.map +1 -1
- package/lib/common/inspect.js +5 -2
- package/lib/common/inspect.js.map +1 -1
- package/lib/common/interactive.js +9 -15
- package/lib/common/interactive.js.map +1 -1
- package/lib/common/io.js +256 -299
- package/lib/common/io.js.map +1 -1
- package/lib/common/language.js +21 -5
- package/lib/common/language.js.map +1 -1
- package/lib/common/npm.js +193 -228
- package/lib/common/npm.js.map +1 -1
- package/lib/common/pack.js +71 -86
- package/lib/common/pack.js.map +1 -1
- package/lib/common/package.js +428 -448
- package/lib/common/package.js.map +1 -1
- package/lib/common/parallel.js +12 -23
- package/lib/common/parallel.js.map +1 -1
- package/lib/common/patcher.js +54 -71
- package/lib/common/patcher.js.map +1 -1
- package/lib/common/platform.js +1 -12
- package/lib/common/platform.js.map +1 -1
- package/lib/common/port.js +11 -24
- package/lib/common/port.js.map +1 -1
- package/lib/common/rules.js +6 -17
- package/lib/common/rules.js.map +1 -1
- package/lib/common/scaffold.js +52 -59
- package/lib/common/scaffold.js.map +1 -1
- package/lib/common/shell.js +50 -58
- package/lib/common/shell.js.map +1 -1
- package/lib/common/spec.js +1 -1
- package/lib/common/spec.js.map +1 -1
- package/lib/common/template.js +3 -14
- package/lib/common/template.js.map +1 -1
- package/lib/common/watcher.js +7 -16
- package/lib/common/watcher.js.map +1 -1
- package/lib/common/website.d.ts +5 -1
- package/lib/common/website.js +71 -57
- package/lib/common/website.js.map +1 -1
- package/lib/injectors/pilet-injector.js +138 -145
- package/lib/injectors/pilet-injector.js.map +1 -1
- package/lib/injectors/piral-injector.js +55 -67
- package/lib/injectors/piral-injector.js.map +1 -1
- package/lib/messages.d.ts +81 -0
- package/lib/messages.js +94 -1
- package/lib/messages.js.map +1 -1
- package/lib/npm-clients/bun.js +36 -60
- package/lib/npm-clients/bun.js.map +1 -1
- package/lib/npm-clients/index.js +10 -21
- package/lib/npm-clients/index.js.map +1 -1
- package/lib/npm-clients/lerna.js +48 -72
- package/lib/npm-clients/lerna.js.map +1 -1
- package/lib/npm-clients/npm.js +69 -105
- package/lib/npm-clients/npm.js.map +1 -1
- package/lib/npm-clients/pnp.js +35 -59
- package/lib/npm-clients/pnp.js.map +1 -1
- package/lib/npm-clients/pnpm.js +35 -59
- package/lib/npm-clients/pnpm.js.map +1 -1
- package/lib/npm-clients/rush.js +53 -77
- package/lib/npm-clients/rush.js.map +1 -1
- package/lib/npm-clients/yarn.js +35 -59
- package/lib/npm-clients/yarn.js.map +1 -1
- package/lib/platforms/node.js +4 -17
- package/lib/platforms/node.js.map +1 -1
- package/lib/platforms/web.js +81 -96
- package/lib/platforms/web.js.map +1 -1
- package/lib/plugin.js +56 -75
- package/lib/plugin.js.map +1 -1
- package/lib/questionnaire.js +46 -12
- package/lib/questionnaire.js.map +1 -1
- package/lib/release.js +32 -47
- package/lib/release.js.map +1 -1
- package/lib/rules/index.js +10 -23
- package/lib/rules/index.js.map +1 -1
- package/lib/rules/pilet-has-externals-as-peers.js +34 -45
- package/lib/rules/pilet-has-externals-as-peers.js.map +1 -1
- package/lib/rules/pilet-has-no-self-reference.js +16 -27
- package/lib/rules/pilet-has-no-self-reference.js.map +1 -1
- package/lib/rules/pilet-has-non-conflicting-css.js +27 -42
- package/lib/rules/pilet-has-non-conflicting-css.js.map +1 -1
- package/lib/rules/pilet-stays-small.js +20 -33
- package/lib/rules/pilet-stays-small.js.map +1 -1
- package/lib/rules/pilet-uses-latest-piral.js +17 -28
- package/lib/rules/pilet-uses-latest-piral.js.map +1 -1
- package/lib/rules/piral-has-valid-devDependencies.js +4 -1
- package/lib/rules/piral-has-valid-devDependencies.js.map +1 -1
- package/lib/runner.js +3 -12
- package/lib/runner.js.map +1 -1
- package/lib/select.js +21 -32
- package/lib/select.js.map +1 -1
- package/lib/start.js +6 -17
- package/lib/start.js.map +1 -1
- package/package.json +2 -2
- package/src/apps/build-piral.test.ts +1 -1
- package/src/common/package.ts +23 -17
- package/src/common/shell.ts +2 -1
- package/src/common/website.ts +47 -16
- package/src/injectors/pilet-injector.ts +12 -2
- package/src/messages.ts +93 -0
package/lib/apps/pack-pilet.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.packPilet = exports.packPiletDefaults = void 0;
|
|
13
4
|
const path_1 = require("path");
|
|
@@ -18,15 +9,13 @@ exports.packPiletDefaults = {
|
|
|
18
9
|
target: '.',
|
|
19
10
|
logLevel: types_1.LogLevels.info,
|
|
20
11
|
};
|
|
21
|
-
function packPilet(baseDir = process.cwd(), options = {}) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(0, common_1.logDone)(`Pilet packed successfully!`);
|
|
29
|
-
});
|
|
12
|
+
async function packPilet(baseDir = process.cwd(), options = {}) {
|
|
13
|
+
const { source = exports.packPiletDefaults.source, target = exports.packPiletDefaults.target, logLevel = exports.packPiletDefaults.logLevel, } = options;
|
|
14
|
+
const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
|
|
15
|
+
(0, common_1.setLogLevel)(logLevel);
|
|
16
|
+
(0, common_1.progress)('Reading configuration ...');
|
|
17
|
+
await (0, common_1.createPiletPackage)(fullBase, source, target);
|
|
18
|
+
(0, common_1.logDone)(`Pilet packed successfully!`);
|
|
30
19
|
}
|
|
31
20
|
exports.packPilet = packPilet;
|
|
32
21
|
//# sourceMappingURL=pack-pilet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-pilet.js","sourceRoot":"","sources":["../../src/apps/pack-pilet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pack-pilet.js","sourceRoot":"","sources":["../../src/apps/pack-pilet.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,sCAA+E;AAC/E,oCAAqC;AAmBxB,QAAA,iBAAiB,GAAqB;IACjD,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,iBAAS,CAAC,IAAI;CACzB,CAAC;AAEK,KAAK,UAAU,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,UAA4B,EAAE;IACrF,MAAM,EACJ,MAAM,GAAG,yBAAiB,CAAC,MAAM,EACjC,MAAM,GAAG,yBAAiB,CAAC,MAAM,EACjC,QAAQ,GAAG,yBAAiB,CAAC,QAAQ,GACtC,GAAG,OAAO,CAAC;IACZ,MAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;IACjD,IAAA,oBAAW,EAAC,QAAQ,CAAC,CAAC;IACtB,IAAA,iBAAQ,EAAC,2BAA2B,CAAC,CAAC;IACtC,MAAM,IAAA,2BAAkB,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,IAAA,gBAAO,EAAC,4BAA4B,CAAC,CAAC;AACxC,CAAC;AAXD,8BAWC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.publishPilet = exports.publishPiletDefaults = void 0;
|
|
13
4
|
const path_1 = require("path");
|
|
@@ -31,149 +22,144 @@ function isSubDir(parent, dir) {
|
|
|
31
22
|
const rel = (0, path_1.relative)(parent, dir);
|
|
32
23
|
return rel && !rel.startsWith('..') && !(0, path_1.isAbsolute)(rel);
|
|
33
24
|
}
|
|
34
|
-
function getFiles(baseDir, sources, from, fresh, originalSchemaVersion, logLevel, bundlerName, _, ca) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
(0, common_1.fail)('entryFileMissing_0077');
|
|
41
|
-
}
|
|
42
|
-
return yield Promise.all(allEntries.map((entryModule) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const targetDir = (0, path_1.dirname)(entryModule);
|
|
44
|
-
(0, common_1.progress)('Triggering pilet build ...');
|
|
45
|
-
const { root, piletPackage, importmap, peerDependencies, peerModules, apps, schema } = yield (0, common_1.retrievePiletData)(targetDir);
|
|
46
|
-
const schemaVersion = originalSchemaVersion || schema || common_1.config.schemaVersion || common_1.defaultSchemaVersion;
|
|
47
|
-
const piralInstances = apps.map((m) => m.appPackage.name);
|
|
48
|
-
const { main = 'dist/index.js', name = 'pilet' } = piletPackage;
|
|
49
|
-
const propDest = (0, path_1.resolve)(root, main);
|
|
50
|
-
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" is supposed to generate artifact in "${propDest}".`);
|
|
51
|
-
const usePropDest = (0, path_1.dirname)(propDest) !== root && isSubDir(root, propDest);
|
|
52
|
-
const dest = usePropDest ? propDest : (0, path_1.resolve)(root, 'dist');
|
|
53
|
-
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" is generating artifact in "${dest}".`);
|
|
54
|
-
const outDir = (0, path_1.dirname)(dest);
|
|
55
|
-
const outFile = (0, path_1.basename)(dest);
|
|
56
|
-
const externals = (0, common_1.combinePiletExternals)(piralInstances, peerDependencies, peerModules, importmap);
|
|
57
|
-
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" uses externals: ${externals.join(', ')}.`);
|
|
58
|
-
(0, common_1.progress)('Removing output directory ...');
|
|
59
|
-
yield (0, common_1.removeDirectory)(outDir);
|
|
60
|
-
(0, common_1.logInfo)('Bundle pilet ...');
|
|
61
|
-
yield (0, bundler_1.callPiletBuild)({
|
|
62
|
-
root,
|
|
63
|
-
piralInstances,
|
|
64
|
-
optimizeModules: false,
|
|
65
|
-
sourceMaps: true,
|
|
66
|
-
watch: false,
|
|
67
|
-
contentHash: true,
|
|
68
|
-
minify: true,
|
|
69
|
-
externals,
|
|
70
|
-
targetDir,
|
|
71
|
-
importmap,
|
|
72
|
-
outFile,
|
|
73
|
-
outDir,
|
|
74
|
-
entryModule: `./${(0, path_1.relative)(root, entryModule)}`,
|
|
75
|
-
logLevel,
|
|
76
|
-
version: schemaVersion,
|
|
77
|
-
ignored: [],
|
|
78
|
-
_,
|
|
79
|
-
}, bundlerName);
|
|
80
|
-
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" built successfully!`);
|
|
81
|
-
(0, common_1.progress)('Triggering pilet pack ...');
|
|
82
|
-
const file = yield (0, common_1.createPiletPackage)(root, '.', '.');
|
|
83
|
-
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" packed successfully!`);
|
|
84
|
-
return file;
|
|
85
|
-
})));
|
|
25
|
+
async function getFiles(baseDir, sources, from, fresh, originalSchemaVersion, logLevel, bundlerName, _, ca) {
|
|
26
|
+
if (fresh) {
|
|
27
|
+
(0, common_1.log)('generalDebug_0003', 'Detected "--fresh". Trying to resolve the package.json.');
|
|
28
|
+
const allEntries = await (0, common_1.matchAnyPilet)(baseDir, sources);
|
|
29
|
+
if (allEntries.length === 0) {
|
|
30
|
+
(0, common_1.fail)('entryFileMissing_0077');
|
|
86
31
|
}
|
|
87
|
-
|
|
88
|
-
(0,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
32
|
+
return await Promise.all(allEntries.map(async (entryModule) => {
|
|
33
|
+
const targetDir = (0, path_1.dirname)(entryModule);
|
|
34
|
+
(0, common_1.progress)('Triggering pilet build ...');
|
|
35
|
+
const { root, piletPackage, importmap, peerDependencies, peerModules, apps, schema } = await (0, common_1.retrievePiletData)(targetDir);
|
|
36
|
+
const schemaVersion = originalSchemaVersion || schema || common_1.config.schemaVersion || common_1.defaultSchemaVersion;
|
|
37
|
+
const piralInstances = apps.map((m) => m.appPackage.name);
|
|
38
|
+
const { main = 'dist/index.js', name = 'pilet' } = piletPackage;
|
|
39
|
+
const propDest = (0, path_1.resolve)(root, main);
|
|
40
|
+
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" is supposed to generate artifact in "${propDest}".`);
|
|
41
|
+
const usePropDest = (0, path_1.dirname)(propDest) !== root && isSubDir(root, propDest);
|
|
42
|
+
const dest = usePropDest ? propDest : (0, path_1.resolve)(root, 'dist');
|
|
43
|
+
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" is generating artifact in "${dest}".`);
|
|
44
|
+
const outDir = (0, path_1.dirname)(dest);
|
|
45
|
+
const outFile = (0, path_1.basename)(dest);
|
|
46
|
+
const externals = (0, common_1.combinePiletExternals)(piralInstances, peerDependencies, peerModules, importmap);
|
|
47
|
+
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" uses externals: ${externals.join(', ')}.`);
|
|
48
|
+
(0, common_1.progress)('Removing output directory ...');
|
|
49
|
+
await (0, common_1.removeDirectory)(outDir);
|
|
50
|
+
(0, common_1.logInfo)('Bundle pilet ...');
|
|
51
|
+
await (0, bundler_1.callPiletBuild)({
|
|
52
|
+
root,
|
|
53
|
+
piralInstances,
|
|
54
|
+
optimizeModules: false,
|
|
55
|
+
sourceMaps: true,
|
|
56
|
+
watch: false,
|
|
57
|
+
contentHash: true,
|
|
58
|
+
minify: true,
|
|
59
|
+
externals,
|
|
60
|
+
targetDir,
|
|
61
|
+
importmap,
|
|
62
|
+
outFile,
|
|
63
|
+
outDir,
|
|
64
|
+
entryModule: `./${(0, path_1.relative)(root, entryModule)}`,
|
|
65
|
+
logLevel,
|
|
66
|
+
version: schemaVersion,
|
|
67
|
+
ignored: [],
|
|
68
|
+
_,
|
|
69
|
+
}, bundlerName);
|
|
70
|
+
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" built successfully!`);
|
|
71
|
+
(0, common_1.progress)('Triggering pilet pack ...');
|
|
72
|
+
const file = await (0, common_1.createPiletPackage)(root, '.', '.');
|
|
73
|
+
(0, common_1.log)('generalDebug_0003', `Pilet "${name}" packed successfully!`);
|
|
74
|
+
return file;
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
(0, common_1.log)('generalDebug_0003', `Did not find fresh flag. Trying to match from "${from}".`);
|
|
79
|
+
switch (from) {
|
|
80
|
+
case 'local': {
|
|
81
|
+
(0, common_1.log)('generalDebug_0003', `Matching files using "${sources.join('", "')}".`);
|
|
82
|
+
const allFiles = await Promise.all(sources.map((s) => (0, common_1.matchFiles)(baseDir, s)));
|
|
83
|
+
return allFiles.reduce((result, files) => [...result, ...files], []);
|
|
84
|
+
}
|
|
85
|
+
case 'remote': {
|
|
86
|
+
(0, common_1.log)('generalDebug_0003', `Download file from "${sources.join('", "')}".`);
|
|
87
|
+
const allFiles = await Promise.all(sources.map((s) => (0, common_1.downloadFile)(s, ca)));
|
|
88
|
+
return allFiles.reduce((result, files) => [...result, ...files], []);
|
|
89
|
+
}
|
|
90
|
+
case 'npm': {
|
|
91
|
+
(0, common_1.log)('generalDebug_0003', `View npm package "${sources.join('", "')}".`);
|
|
92
|
+
const allUrls = await Promise.all(sources.map((s) => (0, common_1.findNpmTarball)(s)));
|
|
93
|
+
(0, common_1.log)('generalDebug_0003', `Download file from "${allUrls.join('", "')}".`);
|
|
94
|
+
const allFiles = await Promise.all(allUrls.map((url) => (0, common_1.downloadFile)(url, ca)));
|
|
95
|
+
return allFiles.reduce((result, files) => [...result, ...files], []);
|
|
107
96
|
}
|
|
108
97
|
}
|
|
109
|
-
}
|
|
98
|
+
}
|
|
110
99
|
}
|
|
111
|
-
function publishPilet(baseDir = process.cwd(), options = {}) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
(0, common_1.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
(0, common_1.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
(0, common_1.log)('
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (result.
|
|
146
|
-
|
|
147
|
-
if (result.response) {
|
|
148
|
-
(0, common_1.log)('httpPostResponse_0067', result);
|
|
149
|
-
}
|
|
150
|
-
(0, common_1.progress)(`Published successfully!`);
|
|
151
|
-
}
|
|
152
|
-
else if (result.status === 402) {
|
|
153
|
-
(0, common_1.log)('failedToUploadPayment_0161', result.response);
|
|
154
|
-
}
|
|
155
|
-
else if (result.status === 409) {
|
|
156
|
-
(0, common_1.log)('failedToUploadVersion_0162', result.response);
|
|
157
|
-
}
|
|
158
|
-
else if (result.status === 413) {
|
|
159
|
-
(0, common_1.log)('failedToUploadSize_0163', result.response);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
(0, common_1.log)('failedToUpload_0062', fileName);
|
|
100
|
+
async function publishPilet(baseDir = process.cwd(), options = {}) {
|
|
101
|
+
const { fresh = exports.publishPiletDefaults.fresh, source = fresh ? './src/index' : '*.tgz', url = common_1.config.url ?? exports.publishPiletDefaults.url, apiKey = common_1.config.apiKeys?.[url] ?? common_1.config.apiKey ?? exports.publishPiletDefaults.apiKey, logLevel = exports.publishPiletDefaults.logLevel, from = exports.publishPiletDefaults.from, schemaVersion = exports.publishPiletDefaults.schemaVersion, cert = common_1.config.cert ?? exports.publishPiletDefaults.cert, fields = exports.publishPiletDefaults.fields, headers = exports.publishPiletDefaults.headers, mode = exports.publishPiletDefaults.mode, interactive = exports.publishPiletDefaults.interactive, _ = {}, bundlerName, } = options;
|
|
102
|
+
const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
|
|
103
|
+
(0, common_1.setLogLevel)(logLevel);
|
|
104
|
+
(0, common_1.progress)('Reading configuration ...');
|
|
105
|
+
if (!url) {
|
|
106
|
+
(0, common_1.fail)('missingPiletFeedUrl_0060');
|
|
107
|
+
}
|
|
108
|
+
(0, common_1.log)('generalDebug_0003', 'Checking if certificate exists.');
|
|
109
|
+
let ca = undefined;
|
|
110
|
+
if (await (0, common_1.checkExists)(cert)) {
|
|
111
|
+
const dir = (0, path_1.dirname)(cert);
|
|
112
|
+
const file = (0, path_1.basename)(cert);
|
|
113
|
+
(0, common_1.log)('generalDebug_0003', `Reading certificate file "${file}" from "${dir}".`);
|
|
114
|
+
ca = await (0, common_1.readBinary)(dir, file);
|
|
115
|
+
}
|
|
116
|
+
(0, common_1.log)('generalDebug_0003', 'Getting the tgz files ...');
|
|
117
|
+
const sources = Array.isArray(source) ? source : [source];
|
|
118
|
+
const files = await getFiles(fullBase, sources, from, fresh, schemaVersion, logLevel, bundlerName, _, ca);
|
|
119
|
+
const successfulUploads = [];
|
|
120
|
+
(0, common_1.log)('generalDebug_0003', 'Received available tgz files.');
|
|
121
|
+
if (files.length === 0) {
|
|
122
|
+
(0, common_1.fail)('missingPiletTarball_0061', sources);
|
|
123
|
+
}
|
|
124
|
+
(0, common_1.log)('generalInfo_0000', `Using feed service "${url}".`);
|
|
125
|
+
for (const file of files) {
|
|
126
|
+
(0, common_1.log)('generalDebug_0003', 'Reading the file for upload ...');
|
|
127
|
+
const fileName = (0, path_1.relative)(fullBase, file);
|
|
128
|
+
const content = await (0, common_1.readBinary)(fullBase, fileName);
|
|
129
|
+
if (content) {
|
|
130
|
+
(0, common_1.progress)(`Publishing "%s" ...`, file, url);
|
|
131
|
+
const result = await (0, common_1.postFile)(url, mode, apiKey, content, fields, headers, ca, interactive);
|
|
132
|
+
if (result.success) {
|
|
133
|
+
successfulUploads.push(file);
|
|
134
|
+
if (result.response) {
|
|
135
|
+
(0, common_1.log)('httpPostResponse_0067', result);
|
|
163
136
|
}
|
|
137
|
+
(0, common_1.progress)(`Published successfully!`);
|
|
138
|
+
}
|
|
139
|
+
else if (result.status === 402) {
|
|
140
|
+
(0, common_1.log)('failedToUploadPayment_0161', result.response);
|
|
141
|
+
}
|
|
142
|
+
else if (result.status === 409) {
|
|
143
|
+
(0, common_1.log)('failedToUploadVersion_0162', result.response);
|
|
144
|
+
}
|
|
145
|
+
else if (result.status === 413) {
|
|
146
|
+
(0, common_1.log)('failedToUploadSize_0163', result.response);
|
|
164
147
|
}
|
|
165
148
|
else {
|
|
166
|
-
(0, common_1.log)('
|
|
149
|
+
(0, common_1.log)('failedToUpload_0062', fileName);
|
|
167
150
|
}
|
|
168
|
-
(0, common_1.log)('generalDebug_0003', 'Finished uploading the file.');
|
|
169
|
-
}
|
|
170
|
-
if (files.length === successfulUploads.length) {
|
|
171
|
-
(0, common_1.logDone)(`Pilet(s) published successfully!`);
|
|
172
151
|
}
|
|
173
152
|
else {
|
|
174
|
-
(0, common_1.
|
|
153
|
+
(0, common_1.log)('failedToRead_0063', fileName);
|
|
175
154
|
}
|
|
176
|
-
|
|
155
|
+
(0, common_1.log)('generalDebug_0003', 'Finished uploading the file.');
|
|
156
|
+
}
|
|
157
|
+
if (files.length === successfulUploads.length) {
|
|
158
|
+
(0, common_1.logDone)(`Pilet(s) published successfully!`);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
(0, common_1.fail)('failedUploading_0064');
|
|
162
|
+
}
|
|
177
163
|
}
|
|
178
164
|
exports.publishPilet = publishPilet;
|
|
179
165
|
//# sourceMappingURL=publish-pilet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-pilet.js","sourceRoot":"","sources":["../../src/apps/publish-pilet.ts"],"names":[],"mappings":"
|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C,CAAC;SACpC;QAED,IAAA,YAAG,EAAC,mBAAmB,EAAE,8BAA8B,CAAC,CAAC;KAC1D;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,iBAAiB,CAAC,MAAM,EAAE;QAC7C,IAAA,gBAAO,EAAC,kCAAkC,CAAC,CAAC;KAC7C;SAAM;QACL,IAAA,aAAI,EAAC,sBAAsB,CAAC,CAAC;KAC9B;AACH,CAAC;AArFD,oCAqFC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.publishPiral = exports.publishPiralDefaults = void 0;
|
|
13
4
|
const path_1 = require("path");
|
|
@@ -22,62 +13,56 @@ exports.publishPiralDefaults = {
|
|
|
22
13
|
opts: {},
|
|
23
14
|
interactive: false,
|
|
24
15
|
};
|
|
25
|
-
function publishEmulator(baseDir, source, args = {}, interactive = false) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
yield (0, common_1.publishNpmPackage)(directory, file, flags, interactive);
|
|
44
|
-
});
|
|
16
|
+
async function publishEmulator(baseDir, source, args = {}, interactive = false) {
|
|
17
|
+
const type = 'emulator';
|
|
18
|
+
const directory = (0, path_1.resolve)(baseDir, source, type);
|
|
19
|
+
const exists = await (0, common_1.checkExists)(directory);
|
|
20
|
+
if (!exists) {
|
|
21
|
+
(0, common_1.fail)('publishDirectoryMissing_0110', directory);
|
|
22
|
+
}
|
|
23
|
+
const files = await (0, common_1.matchFiles)(directory, '*.tgz');
|
|
24
|
+
(0, common_1.log)('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
|
|
25
|
+
if (files.length !== 1) {
|
|
26
|
+
(0, common_1.fail)('publishEmulatorFilesUnexpected_0111', directory);
|
|
27
|
+
}
|
|
28
|
+
const [file] = files;
|
|
29
|
+
const flags = Object.keys(args).reduce((p, c) => {
|
|
30
|
+
p.push(`--${c}`, args[c]);
|
|
31
|
+
return p;
|
|
32
|
+
}, []);
|
|
33
|
+
await (0, common_1.publishNpmPackage)(directory, file, flags, interactive);
|
|
45
34
|
}
|
|
46
|
-
function publishRelease(baseDir, source, providerName, args = {}, interactive = false) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
yield (0, release_1.publishArtifacts)(providerName, directory, files, args, interactive);
|
|
57
|
-
});
|
|
35
|
+
async function publishRelease(baseDir, source, providerName, args = {}, interactive = false) {
|
|
36
|
+
const type = 'release';
|
|
37
|
+
const directory = (0, path_1.resolve)(baseDir, source, type);
|
|
38
|
+
const exists = await (0, common_1.checkExists)(directory);
|
|
39
|
+
if (!exists) {
|
|
40
|
+
(0, common_1.fail)('publishDirectoryMissing_0110', directory);
|
|
41
|
+
}
|
|
42
|
+
const files = await (0, common_1.matchFiles)(directory, '**/*');
|
|
43
|
+
(0, common_1.log)('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
|
|
44
|
+
await (0, release_1.publishArtifacts)(providerName, directory, files, args, interactive);
|
|
58
45
|
}
|
|
59
|
-
function publishPiral(baseDir = process.cwd(), options = {}) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
});
|
|
46
|
+
async function publishPiral(baseDir = process.cwd(), options = {}) {
|
|
47
|
+
const { source = exports.publishPiralDefaults.source, type = exports.publishPiralDefaults.type, logLevel = exports.publishPiralDefaults.logLevel, opts = exports.publishPiralDefaults.opts, provider = exports.publishPiralDefaults.provider, interactive = exports.publishPiralDefaults.interactive, } = options;
|
|
48
|
+
const fullBase = (0, path_1.resolve)(process.cwd(), baseDir);
|
|
49
|
+
(0, common_1.setLogLevel)(logLevel);
|
|
50
|
+
if (type === 'emulator-sources') {
|
|
51
|
+
(0, common_1.fail)('publishEmulatorSourcesInvalid_0114');
|
|
52
|
+
}
|
|
53
|
+
(0, common_1.progress)('Reading configuration ...');
|
|
54
|
+
if (type !== 'release') {
|
|
55
|
+
(0, common_1.progress)('Publishing emulator package ...');
|
|
56
|
+
await publishEmulator(fullBase, source, opts, interactive);
|
|
57
|
+
(0, common_1.logDone)(`Successfully published emulator.`);
|
|
58
|
+
(0, common_1.logReset)();
|
|
59
|
+
}
|
|
60
|
+
if (type !== 'emulator') {
|
|
61
|
+
(0, common_1.progress)('Publishing release files ...');
|
|
62
|
+
await publishRelease(fullBase, source, provider, opts, interactive);
|
|
63
|
+
(0, common_1.logDone)(`Successfully published release.`);
|
|
64
|
+
(0, common_1.logReset)();
|
|
65
|
+
}
|
|
81
66
|
}
|
|
82
67
|
exports.publishPiral = publishPiral;
|
|
83
68
|
//# sourceMappingURL=publish-piral.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-piral.js","sourceRoot":"","sources":["../../src/apps/publish-piral.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish-piral.js","sourceRoot":"","sources":["../../src/apps/publish-piral.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,wCAA8C;AAC9C,oCAAqD;AACrD,sCAUmB;AAkCN,QAAA,oBAAoB,GAAwB;IACvD,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,iBAAS,CAAC,IAAI;IACxB,IAAI,EAAE,KAAK;IACX,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,EAAE;IACR,WAAW,EAAE,KAAK;CACnB,CAAC;AAEF,KAAK,UAAU,eAAe,CAC5B,OAAe,EACf,MAAc,EACd,OAA+B,EAAE,EACjC,WAAW,GAAG,KAAK;IAEnB,MAAM,IAAI,GAAG,UAAU,CAAC;IACxB,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAW,EAAC,SAAS,CAAC,CAAC;IAE5C,IAAI,CAAC,MAAM,EAAE;QACX,IAAA,aAAI,EAAC,8BAA8B,EAAE,SAAS,CAAC,CAAC;KACjD;IAED,MAAM,KAAK,GAAG,MAAM,IAAA,mBAAU,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACnD,IAAA,YAAG,EAAC,mBAAmB,EAAE,SAAS,KAAK,CAAC,MAAM,QAAQ,SAAS,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEzF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,IAAA,aAAI,EAAC,qCAAqC,EAAE,SAAS,CAAC,CAAC;KACxD;IAED,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACrB,MAAM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