piral-cli 1.5.1-beta.6844 → 1.5.1-beta.6849
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/apps/publish-piral.js +24 -3
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/common/release.d.ts +1 -1
- package/lib/common/release.js +3 -19
- package/lib/common/release.js.map +1 -1
- package/package.json +4 -4
- package/src/apps/publish-piral.ts +28 -3
- package/src/common/release.ts +4 -30
|
@@ -28,8 +28,8 @@ async function publishPiral(baseDir = process.cwd(), options = {}) {
|
|
|
28
28
|
(0, common_1.log)('generalDebug_0003', 'Getting the files ...');
|
|
29
29
|
const entryFiles = await (0, common_1.retrievePiralRoot)(fullBase, './');
|
|
30
30
|
const { name, root, ignored, externals, scripts, emulator = common_1.emulatorPackageName, } = await (0, common_1.retrievePiletsInfo)(entryFiles);
|
|
31
|
-
if (type === 'emulator' &&
|
|
32
|
-
(0, common_1.fail)('generalError_0002', `
|
|
31
|
+
if (type === 'emulator' && ![common_1.emulatorPackageName, common_1.emulatorWebsiteName].includes(emulator)) {
|
|
32
|
+
(0, common_1.fail)('generalError_0002', `The emulator type "${emulator}" is not supported. Select one of these types to use the publish command: "${common_1.emulatorWebsiteName}", "${common_1.emulatorPackageName}".`);
|
|
33
33
|
}
|
|
34
34
|
const dir = type === 'release' ? common_1.releaseName : common_1.emulatorName;
|
|
35
35
|
const targetDir = (0, path_1.resolve)(fullBase, source, dir);
|
|
@@ -96,7 +96,7 @@ async function publishPiral(baseDir = process.cwd(), options = {}) {
|
|
|
96
96
|
(0, common_1.progress)(`Published successfully!`);
|
|
97
97
|
(0, common_1.logDone)(`Release artifacts published successfully!`);
|
|
98
98
|
}
|
|
99
|
-
else {
|
|
99
|
+
else if (emulator === common_1.emulatorWebsiteName) {
|
|
100
100
|
const { version } = await (0, common_1.readJson)(targetDir, common_1.emulatorJson);
|
|
101
101
|
if (!version) {
|
|
102
102
|
(0, common_1.fail)('missingEmulatorWebsite_0130', targetDir);
|
|
@@ -114,6 +114,27 @@ async function publishPiral(baseDir = process.cwd(), options = {}) {
|
|
|
114
114
|
(0, common_1.progress)(`Published successfully!`);
|
|
115
115
|
(0, common_1.logDone)(`Emulator published successfully!`);
|
|
116
116
|
}
|
|
117
|
+
else if (emulator === common_1.emulatorPackageName) {
|
|
118
|
+
(0, common_1.log)('generalInfo_0000', `Using npm registry "${url}".`);
|
|
119
|
+
const files = await (0, common_1.matchFiles)(targetDir, '*.tgz');
|
|
120
|
+
(0, common_1.log)('generalDebug_0003', `Found ${files.length} in "${targetDir}": ${files.join(', ')}`);
|
|
121
|
+
const file = files[0];
|
|
122
|
+
if (!file) {
|
|
123
|
+
(0, common_1.fail)('publishEmulatorFilesUnexpected_0111', targetDir);
|
|
124
|
+
}
|
|
125
|
+
(0, common_1.progress)(`Publishing emulator to "%s" ...`, url);
|
|
126
|
+
try {
|
|
127
|
+
await (0, common_1.publishPackageEmulator)(targetDir, file, url, interactive);
|
|
128
|
+
(0, common_1.progress)(`Published successfully!`);
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
(0, common_1.fail)('failedUploading_0064');
|
|
132
|
+
}
|
|
133
|
+
(0, common_1.logDone)(`Emulator published successfully!`);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
// we should not enter here - anyway let's do nothing
|
|
137
|
+
}
|
|
117
138
|
}
|
|
118
139
|
exports.publishPiral = publishPiral;
|
|
119
140
|
//# sourceMappingURL=publish-piral.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-piral.js","sourceRoot":"","sources":["../../src/apps/publish-piral.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,oCAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"publish-piral.js","sourceRoot":"","sources":["../../src/apps/publish-piral.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,oCAAsE;AACtE,sCAyBmB;AA2EN,QAAA,oBAA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GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAEtB,IAAI,CAAC,IAAI,EAAE;YACT,IAAA,aAAI,EAAC,qCAAqC,EAAE,SAAS,CAAC,CAAC;SACxD;QAED,IAAA,iBAAQ,EAAC,iCAAiC,EAAE,GAAG,CAAC,CAAC;QAEjD,IAAI;YACF,MAAM,IAAA,+BAAsB,EAAC,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;YAChE,IAAA,iBAAQ,EAAC,yBAAyB,CAAC,CAAC;SACrC;QAAC,MAAM;YACN,IAAA,aAAI,EAAC,sBAAsB,CAAC,CAAC;SAC9B;QAED,IAAA,gBAAO,EAAC,kCAAkC,CAAC,CAAC;KAC7C;SAAM;QACL,qDAAqD;KACtD;AACH,CAAC;AApKD,oCAoKC"}
|
package/lib/common/release.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { PublishScheme } from '../types';
|
|
3
|
-
export declare function publishPackageEmulator(
|
|
3
|
+
export declare function publishPackageEmulator(directory: string, file: string, url?: string, interactive?: boolean): Promise<void>;
|
|
4
4
|
export declare function publishWebsiteEmulator(version: string, url: string, apiKey: string, mode: PublishScheme, directory: string, files: Array<string>, interactive: boolean, headers?: Record<string, string>, ca?: Buffer): Promise<import("./http").PostFormResult>;
|
package/lib/common/release.js
CHANGED
|
@@ -2,27 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.publishWebsiteEmulator = exports.publishPackageEmulator = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
-
const
|
|
5
|
+
const io_1 = require("./io");
|
|
6
6
|
const npm_1 = require("./npm");
|
|
7
7
|
const http_1 = require("./http");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const type = 'emulator';
|
|
11
|
-
const directory = (0, path_1.resolve)(baseDir, source, type);
|
|
12
|
-
const exists = await (0, io_1.checkExists)(directory);
|
|
13
|
-
if (!exists) {
|
|
14
|
-
(0, log_1.fail)('publishDirectoryMissing_0110', directory);
|
|
15
|
-
}
|
|
16
|
-
const files = await (0, io_1.matchFiles)(directory, '*.tgz');
|
|
17
|
-
(0, log_1.log)('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
|
|
18
|
-
if (files.length !== 1) {
|
|
19
|
-
(0, log_1.fail)('publishEmulatorFilesUnexpected_0111', directory);
|
|
20
|
-
}
|
|
21
|
-
const [file] = files;
|
|
22
|
-
const flags = Object.keys(args).reduce((p, c) => {
|
|
23
|
-
p.push(`--${c}`, args[c]);
|
|
24
|
-
return p;
|
|
25
|
-
}, []);
|
|
8
|
+
async function publishPackageEmulator(directory, file, url, interactive = false) {
|
|
9
|
+
const flags = url ? [`--registry=${url}`] : [];
|
|
26
10
|
await (0, npm_1.publishNpmPackage)(directory, file, flags, interactive);
|
|
27
11
|
}
|
|
28
12
|
exports.publishPackageEmulator = publishPackageEmulator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/common/release.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/common/release.ts"],"names":[],"mappings":";;;AAAA,+BAAmD;AACnD,6BAAkC;AAClC,+BAA0C;AAC1C,iCAA+C;AAGxC,KAAK,UAAU,sBAAsB,CAAC,SAAiB,EAAE,IAAY,EAAE,GAAY,EAAE,WAAW,GAAG,KAAK;IAC7G,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/C,MAAM,IAAA,uBAAiB,EAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;AAC/D,CAAC;AAHD,wDAGC;AAEM,KAAK,UAAU,sBAAsB,CAC1C,OAAe,EACf,GAAW,EACX,MAAc,EACd,IAAmB,EACnB,SAAiB,EACjB,KAAoB,EACpB,WAAoB,EACpB,OAAgC,EAChC,EAAW;IAEX,MAAM,IAAI,GAAgB;QACxB,OAAO;QACP,IAAI,EAAE,QAAQ;KACf,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,OAAO,GAAG,IAAA,eAAQ,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,IAAA,eAAQ,EAAC,IAAI,CAAC,CAAC;QAChC,MAAM,OAAO,GAAG,MAAM,IAAA,eAAU,EAAC,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC1D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KACrC;IAED,OAAO,MAAM,IAAA,eAAQ,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;AAC3E,CAAC;AAxBD,wDAwBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "1.5.1-beta.
|
|
3
|
+
"version": "1.5.1-beta.6849",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"main": "lib/index.js",
|
|
16
16
|
"typings": "lib/index.d.ts",
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
18
|
+
"node": ">=16.0.0"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"lib",
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"css-conflict-inspector": "^0.2.1",
|
|
78
78
|
"dets": "^0.14.2",
|
|
79
|
-
"kras": "^0.16.
|
|
79
|
+
"kras": "^0.16.1",
|
|
80
80
|
"rimraf": "^3.0.0",
|
|
81
81
|
"typescript": "^5.0.0",
|
|
82
82
|
"yargs": "^15.0.0"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "12a9d67b3f999d378d3786a9a0ca8d696cf0f75e"
|
|
85
85
|
}
|
|
@@ -19,10 +19,12 @@ import {
|
|
|
19
19
|
emulatorPackageName,
|
|
20
20
|
retrievePiletsInfo,
|
|
21
21
|
validateSharedDependencies,
|
|
22
|
+
publishNpmPackage,
|
|
22
23
|
getCertificate,
|
|
23
24
|
releaseName,
|
|
24
25
|
packageJson,
|
|
25
26
|
triggerBuildShell,
|
|
27
|
+
publishPackageEmulator,
|
|
26
28
|
} from '../common';
|
|
27
29
|
|
|
28
30
|
export interface PublishPiralOptions {
|
|
@@ -148,8 +150,8 @@ export async function publishPiral(baseDir = process.cwd(), options: PublishPira
|
|
|
148
150
|
emulator = emulatorPackageName,
|
|
149
151
|
} = await retrievePiletsInfo(entryFiles);
|
|
150
152
|
|
|
151
|
-
if (type === 'emulator' &&
|
|
152
|
-
fail('generalError_0002', `
|
|
153
|
+
if (type === 'emulator' && ![emulatorPackageName, emulatorWebsiteName].includes(emulator)) {
|
|
154
|
+
fail('generalError_0002', `The emulator type "${emulator}" is not supported. Select one of these types to use the publish command: "${emulatorWebsiteName}", "${emulatorPackageName}".`);
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
const dir = type === 'release' ? releaseName : emulatorName;
|
|
@@ -226,7 +228,7 @@ export async function publishPiral(baseDir = process.cwd(), options: PublishPira
|
|
|
226
228
|
progress(`Published successfully!`);
|
|
227
229
|
|
|
228
230
|
logDone(`Release artifacts published successfully!`);
|
|
229
|
-
} else {
|
|
231
|
+
} else if (emulator === emulatorWebsiteName) {
|
|
230
232
|
const { version } = await readJson(targetDir, emulatorJson);
|
|
231
233
|
|
|
232
234
|
if (!version) {
|
|
@@ -251,5 +253,28 @@ export async function publishPiral(baseDir = process.cwd(), options: PublishPira
|
|
|
251
253
|
progress(`Published successfully!`);
|
|
252
254
|
|
|
253
255
|
logDone(`Emulator published successfully!`);
|
|
256
|
+
} else if (emulator === emulatorPackageName) {
|
|
257
|
+
log('generalInfo_0000', `Using npm registry "${url}".`);
|
|
258
|
+
|
|
259
|
+
const files = await matchFiles(targetDir, '*.tgz');
|
|
260
|
+
log('generalDebug_0003', `Found ${files.length} in "${targetDir}": ${files.join(', ')}`);
|
|
261
|
+
const file = files[0];
|
|
262
|
+
|
|
263
|
+
if (!file) {
|
|
264
|
+
fail('publishEmulatorFilesUnexpected_0111', targetDir);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
progress(`Publishing emulator to "%s" ...`, url);
|
|
268
|
+
|
|
269
|
+
try {
|
|
270
|
+
await publishPackageEmulator(targetDir, file, url, interactive);
|
|
271
|
+
progress(`Published successfully!`);
|
|
272
|
+
} catch {
|
|
273
|
+
fail('failedUploading_0064');
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
logDone(`Emulator published successfully!`);
|
|
277
|
+
} else {
|
|
278
|
+
// we should not enter here - anyway let's do nothing
|
|
254
279
|
}
|
|
255
280
|
}
|
package/src/common/release.ts
CHANGED
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
import { basename, dirname, relative
|
|
2
|
-
import {
|
|
1
|
+
import { basename, dirname, relative } from 'path';
|
|
2
|
+
import { readBinary } from './io';
|
|
3
3
|
import { publishNpmPackage } from './npm';
|
|
4
4
|
import { FormDataObj, postForm } from './http';
|
|
5
|
-
import { checkExists, matchFiles, readBinary } from './io';
|
|
6
5
|
import { PublishScheme } from '../types';
|
|
7
6
|
|
|
8
|
-
export async function publishPackageEmulator(
|
|
9
|
-
|
|
10
|
-
source: string,
|
|
11
|
-
args: Record<string, string> = {},
|
|
12
|
-
interactive = false,
|
|
13
|
-
) {
|
|
14
|
-
const type = 'emulator';
|
|
15
|
-
const directory = resolve(baseDir, source, type);
|
|
16
|
-
const exists = await checkExists(directory);
|
|
17
|
-
|
|
18
|
-
if (!exists) {
|
|
19
|
-
fail('publishDirectoryMissing_0110', directory);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const files = await matchFiles(directory, '*.tgz');
|
|
23
|
-
log('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
|
|
24
|
-
|
|
25
|
-
if (files.length !== 1) {
|
|
26
|
-
fail('publishEmulatorFilesUnexpected_0111', directory);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const [file] = files;
|
|
30
|
-
const flags = Object.keys(args).reduce((p, c) => {
|
|
31
|
-
p.push(`--${c}`, args[c]);
|
|
32
|
-
return p;
|
|
33
|
-
}, [] as Array<string>);
|
|
34
|
-
|
|
7
|
+
export async function publishPackageEmulator(directory: string, file: string, url?: string, interactive = false) {
|
|
8
|
+
const flags = url ? [`--registry=${url}`] : [];
|
|
35
9
|
await publishNpmPackage(directory, file, flags, interactive);
|
|
36
10
|
}
|
|
37
11
|
|