piral-cli 0.15.0-alpha.4257 → 0.15.0-alpha.4314
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/README.md +7 -5
- package/lib/apps/debug-pilet.js +2 -1
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.js +2 -1
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/new-pilet.d.ts +2 -2
- package/lib/apps/new-pilet.js +3 -3
- package/lib/apps/new-pilet.js.map +1 -1
- package/lib/apps/new-piral.d.ts +2 -2
- package/lib/apps/new-piral.js +6 -5
- package/lib/apps/new-piral.js.map +1 -1
- package/lib/apps/publish-piral.d.ts +2 -2
- package/lib/apps/publish-piral.js +9 -8
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/upgrade-pilet.js +3 -3
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/apps/upgrade-piral.js +2 -2
- package/lib/apps/upgrade-piral.js.map +1 -1
- package/lib/commands.js +8 -8
- package/lib/commands.js.map +1 -1
- package/lib/common/clients/index.d.ts +3 -1
- package/lib/common/clients/index.js +3 -1
- package/lib/common/clients/index.js.map +1 -1
- package/lib/common/clients/npm.d.ts +1 -0
- package/lib/common/clients/npm.js +7 -1
- package/lib/common/clients/npm.js.map +1 -1
- package/lib/common/clients/pnp.d.ts +6 -0
- package/lib/common/clients/pnp.js +95 -0
- package/lib/common/clients/pnp.js.map +1 -0
- package/lib/common/clients/yarn.js +3 -3
- package/lib/common/clients/yarn.js.map +1 -1
- package/lib/common/config.d.ts +1 -2
- package/lib/common/config.js +1 -2
- package/lib/common/config.js.map +1 -1
- package/lib/common/emulator.js +1 -1
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/enums.d.ts +0 -4
- package/lib/common/enums.js +1 -6
- package/lib/common/enums.js.map +1 -1
- package/lib/common/http.d.ts +4 -2
- package/lib/common/http.js +25 -11
- package/lib/common/http.js.map +1 -1
- package/lib/common/interactive.js +10 -5
- package/lib/common/interactive.js.map +1 -1
- package/lib/common/language.d.ts +3 -13
- package/lib/common/language.js +52 -12
- package/lib/common/language.js.map +1 -1
- package/lib/common/log.d.ts +1 -0
- package/lib/common/log.js +9 -2
- package/lib/common/log.js.map +1 -1
- package/lib/common/npm.d.ts +1 -1
- package/lib/common/npm.js +13 -5
- package/lib/common/npm.js.map +1 -1
- package/lib/common/package.d.ts +9 -3
- package/lib/common/package.js +11 -25
- package/lib/common/package.js.map +1 -1
- package/lib/common/port.d.ts +1 -0
- package/lib/common/port.js +11 -1
- package/lib/common/port.js.map +1 -1
- package/lib/common/scaffold.d.ts +12 -10
- package/lib/common/scaffold.js +6 -12
- package/lib/common/scaffold.js.map +1 -1
- package/lib/common/template.d.ts +1 -3
- package/lib/common/template.js +21 -47
- package/lib/common/template.js.map +1 -1
- package/lib/helpers.d.ts +3 -5
- package/lib/helpers.js +3 -21
- package/lib/helpers.js.map +1 -1
- package/lib/messages.d.ts +83 -5
- package/lib/messages.js +95 -8
- package/lib/messages.js.map +1 -1
- package/lib/release.d.ts +1 -1
- package/lib/release.js +32 -5
- package/lib/release.js.map +1 -1
- package/lib/types/common.d.ts +1 -2
- package/lib/types/public.d.ts +2 -1
- package/package.json +3 -5
- package/src/apps/debug-pilet.ts +3 -1
- package/src/apps/debug-piral.ts +3 -1
- package/src/apps/new-pilet.test.ts +1 -2
- package/src/apps/new-pilet.ts +4 -4
- package/src/apps/new-piral.test.ts +1 -2
- package/src/apps/new-piral.ts +8 -12
- package/src/apps/publish-piral.ts +21 -10
- package/src/apps/upgrade-pilet.ts +3 -3
- package/src/apps/upgrade-piral.ts +2 -1
- package/src/commands.ts +9 -10
- package/src/common/clients/index.ts +3 -1
- package/src/common/clients/npm.ts +4 -0
- package/src/common/clients/pnp.ts +77 -0
- package/src/common/clients/yarn.ts +3 -3
- package/src/common/config.ts +2 -3
- package/src/common/emulator.ts +2 -2
- package/src/common/enums.ts +0 -5
- package/src/common/http.ts +37 -14
- package/src/common/interactive.ts +12 -7
- package/src/common/language.ts +66 -11
- package/src/common/log.ts +9 -1
- package/src/common/npm.ts +21 -6
- package/src/common/package.test.ts +11 -3
- package/src/common/package.ts +20 -34
- package/src/common/port.ts +10 -0
- package/src/common/scaffold.ts +8 -16
- package/src/common/template.ts +19 -40
- package/src/helpers.test.ts +2 -22
- package/src/helpers.ts +4 -24
- package/src/messages.ts +93 -6
- package/src/release.ts +40 -6
- package/src/types/common.ts +1 -2
- package/src/types/public.ts +3 -1
- package/templates/piral-index.js.ejs +0 -16
package/lib/release.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export interface QualifiedReleaseProvider {
|
|
|
4
4
|
action: ReleaseProvider;
|
|
5
5
|
}
|
|
6
6
|
export declare function setReleaseProvider(provider: QualifiedReleaseProvider): void;
|
|
7
|
-
export declare function publishArtifacts(providerName: string, files: Array<string>, args: Record<string, string>, interactive: boolean): Promise<void>;
|
|
7
|
+
export declare function publishArtifacts(providerName: string, directory: string, files: Array<string>, args: Record<string, string>, interactive: boolean): Promise<void>;
|
package/lib/release.js
CHANGED
|
@@ -13,11 +13,21 @@ exports.publishArtifacts = exports.setReleaseProvider = void 0;
|
|
|
13
13
|
const path_1 = require("path");
|
|
14
14
|
const common_1 = require("./common");
|
|
15
15
|
const helpers_1 = require("./helpers");
|
|
16
|
+
function getVersion(directory) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const data = yield (0, common_1.findFile)(directory, 'package.json');
|
|
19
|
+
if (!data) {
|
|
20
|
+
(0, common_1.fail)('packageJsonNotFound_0020');
|
|
21
|
+
}
|
|
22
|
+
const { version } = require(data);
|
|
23
|
+
return version;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
16
26
|
const providers = {
|
|
17
27
|
none() {
|
|
18
28
|
return Promise.resolve();
|
|
19
29
|
},
|
|
20
|
-
xcopy(files, args) {
|
|
30
|
+
xcopy(_, files, args) {
|
|
21
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
32
|
const { target } = args;
|
|
23
33
|
if (!target) {
|
|
@@ -26,9 +36,26 @@ const providers = {
|
|
|
26
36
|
yield Promise.all(files.map((file) => __awaiter(this, void 0, void 0, function* () { return (0, common_1.copy)(file, (0, path_1.resolve)(target, (0, path_1.basename)(file))); })));
|
|
27
37
|
});
|
|
28
38
|
},
|
|
29
|
-
feed(files, args, interactive) {
|
|
39
|
+
feed(directory, files, args, interactive) {
|
|
30
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
|
|
41
|
+
const { url, apiKey, scheme = 'basic', version = yield getVersion(directory) } = args;
|
|
42
|
+
if (!url) {
|
|
43
|
+
(0, common_1.fail)('publishFeedMissingUrl_0115');
|
|
44
|
+
}
|
|
45
|
+
if (!version) {
|
|
46
|
+
(0, common_1.fail)('publishFeedMissingVersion_0116');
|
|
47
|
+
}
|
|
48
|
+
const data = {
|
|
49
|
+
version,
|
|
50
|
+
type: 'custom',
|
|
51
|
+
};
|
|
52
|
+
for (const file of files) {
|
|
53
|
+
const relPath = (0, path_1.relative)(directory, file);
|
|
54
|
+
const fileName = (0, path_1.basename)(file);
|
|
55
|
+
const content = yield (0, common_1.readBinary)((0, path_1.dirname)(file), fileName);
|
|
56
|
+
data[relPath] = [content, fileName];
|
|
57
|
+
}
|
|
58
|
+
yield (0, common_1.postForm)(url, scheme, apiKey, data, {}, undefined, interactive);
|
|
32
59
|
});
|
|
33
60
|
},
|
|
34
61
|
};
|
|
@@ -47,9 +74,9 @@ function setReleaseProvider(provider) {
|
|
|
47
74
|
}
|
|
48
75
|
}
|
|
49
76
|
exports.setReleaseProvider = setReleaseProvider;
|
|
50
|
-
function publishArtifacts(providerName, files, args, interactive) {
|
|
77
|
+
function publishArtifacts(providerName, directory, files, args, interactive) {
|
|
51
78
|
const runRelease = findReleaseProvider(providerName);
|
|
52
|
-
return runRelease(files, args, interactive);
|
|
79
|
+
return runRelease(directory, files, args, interactive);
|
|
53
80
|
}
|
|
54
81
|
exports.publishArtifacts = publishArtifacts;
|
|
55
82
|
//# sourceMappingURL=release.js.map
|
package/lib/release.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.js","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"release.js","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"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"}
|
package/lib/types/common.d.ts
CHANGED
|
@@ -39,12 +39,11 @@ export interface Bundler {
|
|
|
39
39
|
ready(): Promise<void>;
|
|
40
40
|
}
|
|
41
41
|
export interface ReleaseProvider {
|
|
42
|
-
(files: Array<string>, args: Record<string, string>, interactive: boolean): Promise<void>;
|
|
42
|
+
(directory: string, files: Array<string>, args: Record<string, string>, interactive: boolean): Promise<void>;
|
|
43
43
|
}
|
|
44
44
|
export interface TemplateFileLocation {
|
|
45
45
|
from: string;
|
|
46
46
|
to: string;
|
|
47
|
-
template?: boolean;
|
|
48
47
|
deep?: boolean;
|
|
49
48
|
once?: boolean;
|
|
50
49
|
}
|
package/lib/types/public.d.ts
CHANGED
|
@@ -190,12 +190,13 @@ export interface BundlerDefinition {
|
|
|
190
190
|
buildPilet: BuildPiletBundlerDefinition;
|
|
191
191
|
}
|
|
192
192
|
export declare type PiletSchemaVersion = 'none' | 'v0' | 'v1' | 'v2';
|
|
193
|
+
export declare type SourceLanguage = 'js' | 'ts';
|
|
193
194
|
export declare type PiletPublishScheme = 'none' | 'digest' | 'bearer' | 'basic';
|
|
194
195
|
export declare type PiletPublishSource = 'local' | 'npm' | 'remote';
|
|
195
196
|
export declare type PiralBuildType = 'all' | 'release' | 'emulator' | 'emulator-sources';
|
|
196
197
|
export declare type PiletBuildType = 'default' | 'standalone' | 'manifest';
|
|
197
198
|
export declare type PackageType = 'registry' | 'file' | 'git';
|
|
198
|
-
export declare type NpmClientType = 'npm' | 'yarn' | 'pnpm' | 'lerna' | 'rush';
|
|
199
|
+
export declare type NpmClientType = 'npm' | 'yarn' | 'pnp' | 'pnpm' | 'lerna' | 'rush';
|
|
199
200
|
export declare type Framework = 'piral-native' | 'piral' | 'piral-core' | 'piral-base';
|
|
200
201
|
export interface StandardEnvProps {
|
|
201
202
|
production?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.4314",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@parcel/logger": "^1.11.1",
|
|
50
|
-
"@types/ejs": "^2.6.3",
|
|
51
50
|
"@types/express": "^4.16.1",
|
|
52
51
|
"@types/glob": "^7.1.1",
|
|
53
52
|
"@types/inquirer": "^6.0.0",
|
|
@@ -74,11 +73,10 @@
|
|
|
74
73
|
"dependencies": {
|
|
75
74
|
"chalk": "^2.4.2",
|
|
76
75
|
"dets": "^0.11.1",
|
|
77
|
-
"
|
|
78
|
-
"kras": "^0.14.0",
|
|
76
|
+
"kras": "^0.14.1",
|
|
79
77
|
"rimraf": "^3.0.0",
|
|
80
78
|
"typescript": "^4.0.2",
|
|
81
79
|
"yargs": "^15.4.1"
|
|
82
80
|
},
|
|
83
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "8bd59debe22a0fed137458a5295eb2ea43d9e0d3"
|
|
84
82
|
}
|
package/src/apps/debug-pilet.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
normalizePublicUrl,
|
|
21
21
|
findFile,
|
|
22
22
|
createInitialKrasConfig,
|
|
23
|
+
getAvailablePort,
|
|
23
24
|
} from '../common';
|
|
24
25
|
|
|
25
26
|
export interface DebugPiletOptions {
|
|
@@ -183,9 +184,9 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
|
|
|
183
184
|
const {
|
|
184
185
|
entry = debugPiletDefaults.entry,
|
|
185
186
|
target = debugPiletDefaults.target,
|
|
186
|
-
port = debugPiletDefaults.port,
|
|
187
187
|
open = debugPiletDefaults.open,
|
|
188
188
|
hmr = debugPiletDefaults.hmr,
|
|
189
|
+
port: originalPort = debugPiletDefaults.port,
|
|
189
190
|
publicUrl: originalPublicUrl = debugPiletDefaults.publicUrl,
|
|
190
191
|
logLevel = debugPiletDefaults.logLevel,
|
|
191
192
|
concurrency = debugPiletDefaults.concurrency,
|
|
@@ -301,6 +302,7 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
|
|
|
301
302
|
},
|
|
302
303
|
};
|
|
303
304
|
const configs = [krasBaseConfig, ...pilets.map((p) => resolve(p.root, krasrc)), krasRootConfig];
|
|
305
|
+
const port = await getAvailablePort(originalPort);
|
|
304
306
|
const krasConfig = readKrasConfig({ port, initial, required }, ...configs);
|
|
305
307
|
|
|
306
308
|
log('generalVerbose_0004', `Using kras with configuration: ${JSON.stringify(krasConfig, undefined, 2)}`);
|
package/src/apps/debug-piral.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
logDone,
|
|
17
17
|
getDestination,
|
|
18
18
|
createInitialKrasConfig,
|
|
19
|
+
getAvailablePort,
|
|
19
20
|
} from '../common';
|
|
20
21
|
|
|
21
22
|
export interface DebugPiralOptions {
|
|
@@ -103,9 +104,9 @@ export async function debugPiral(baseDir = process.cwd(), options: DebugPiralOpt
|
|
|
103
104
|
const {
|
|
104
105
|
entry = debugPiralDefaults.entry,
|
|
105
106
|
target = debugPiralDefaults.target,
|
|
106
|
-
port = debugPiralDefaults.port,
|
|
107
107
|
open = debugPiralDefaults.open,
|
|
108
108
|
hmr = debugPiralDefaults.hmr,
|
|
109
|
+
port: originalPort = debugPiralDefaults.port,
|
|
109
110
|
publicUrl: originalPublicUrl = debugPiralDefaults.publicUrl,
|
|
110
111
|
logLevel = debugPiralDefaults.logLevel,
|
|
111
112
|
optimizeModules = debugPiralDefaults.optimizeModules,
|
|
@@ -168,6 +169,7 @@ export async function debugPiral(baseDir = process.cwd(), options: DebugPiralOpt
|
|
|
168
169
|
},
|
|
169
170
|
},
|
|
170
171
|
};
|
|
172
|
+
const port = await getAvailablePort(originalPort);
|
|
171
173
|
const krasConfig = readKrasConfig({ port, initial, required }, krasBaseConfig, krasRootConfig);
|
|
172
174
|
|
|
173
175
|
log('generalVerbose_0004', `Using kras with configuration: ${JSON.stringify(krasConfig, undefined, 2)}`);
|
|
@@ -2,7 +2,6 @@ import { mkdtempSync, existsSync } from 'fs';
|
|
|
2
2
|
import { tmpdir } from 'os';
|
|
3
3
|
import { join, resolve } from 'path';
|
|
4
4
|
import { newPilet } from './new-pilet';
|
|
5
|
-
import { SourceLanguage } from '../common';
|
|
6
5
|
|
|
7
6
|
function createTempDir() {
|
|
8
7
|
return mkdtempSync(join(tmpdir(), 'piral-tests-new-pilet-'));
|
|
@@ -69,7 +68,7 @@ describe('New Pilet Command', () => {
|
|
|
69
68
|
jest.setTimeout(60000);
|
|
70
69
|
const dir = createTempDir();
|
|
71
70
|
await newPilet(dir, {
|
|
72
|
-
language:
|
|
71
|
+
language: 'js',
|
|
73
72
|
install: false,
|
|
74
73
|
source: 'piral@latest',
|
|
75
74
|
});
|
package/src/apps/new-pilet.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { resolve, basename } from 'path';
|
|
2
|
-
import { LogLevels, NpmClientType } from '../types';
|
|
2
|
+
import { SourceLanguage, LogLevels, NpmClientType } from '../types';
|
|
3
3
|
import {
|
|
4
4
|
ForceOverwrite,
|
|
5
|
-
SourceLanguage,
|
|
6
5
|
createDirectory,
|
|
7
6
|
createFileIfNotExists,
|
|
8
7
|
installNpmPackage,
|
|
@@ -102,7 +101,7 @@ export const newPiletDefaults: NewPiletOptions = {
|
|
|
102
101
|
install: true,
|
|
103
102
|
template: undefined,
|
|
104
103
|
logLevel: LogLevels.info,
|
|
105
|
-
npmClient:
|
|
104
|
+
npmClient: undefined,
|
|
106
105
|
bundlerName: 'none',
|
|
107
106
|
variables: {},
|
|
108
107
|
};
|
|
@@ -119,6 +118,7 @@ export async function newPilet(baseDir = process.cwd(), options: NewPiletOptions
|
|
|
119
118
|
logLevel = newPiletDefaults.logLevel,
|
|
120
119
|
bundlerName = newPiletDefaults.bundlerName,
|
|
121
120
|
variables = newPiletDefaults.variables,
|
|
121
|
+
npmClient: defaultNpmClient = newPiletDefaults.npmClient,
|
|
122
122
|
} = options;
|
|
123
123
|
const fullBase = resolve(process.cwd(), baseDir);
|
|
124
124
|
const root = resolve(fullBase, target);
|
|
@@ -128,7 +128,7 @@ export async function newPilet(baseDir = process.cwd(), options: NewPiletOptions
|
|
|
128
128
|
const success = await createDirectory(root);
|
|
129
129
|
|
|
130
130
|
if (success) {
|
|
131
|
-
const npmClient = await determineNpmClient(root,
|
|
131
|
+
const npmClient = await determineNpmClient(root, defaultNpmClient);
|
|
132
132
|
const projectName = basename(root);
|
|
133
133
|
|
|
134
134
|
progress(`Scaffolding new pilet in %s ...`, root);
|
|
@@ -2,7 +2,6 @@ import { mkdtempSync, existsSync } from 'fs';
|
|
|
2
2
|
import { tmpdir } from 'os';
|
|
3
3
|
import { join, resolve } from 'path';
|
|
4
4
|
import { newPiral } from './new-piral';
|
|
5
|
-
import { SourceLanguage } from '../common';
|
|
6
5
|
|
|
7
6
|
function createTempDir() {
|
|
8
7
|
return mkdtempSync(join(tmpdir(), 'piral-tests-new-piral-'));
|
|
@@ -37,7 +36,7 @@ describe('New Piral Command', () => {
|
|
|
37
36
|
jest.setTimeout(60000);
|
|
38
37
|
const dir = createTempDir();
|
|
39
38
|
await newPiral(dir, {
|
|
40
|
-
language:
|
|
39
|
+
language: 'js',
|
|
41
40
|
install: false,
|
|
42
41
|
});
|
|
43
42
|
expect(existsSync(resolve(dir, 'node_modules/piral/package.json'))).toBeTruthy();
|
package/src/apps/new-piral.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { resolve, basename } from 'path';
|
|
2
2
|
import { frameworkKeys } from '../helpers';
|
|
3
|
-
import { LogLevels, Framework, NpmClientType } from '../types';
|
|
3
|
+
import { SourceLanguage, LogLevels, Framework, NpmClientType } from '../types';
|
|
4
4
|
import {
|
|
5
5
|
ForceOverwrite,
|
|
6
|
-
SourceLanguage,
|
|
7
6
|
installNpmPackage,
|
|
8
7
|
updateExistingJson,
|
|
9
8
|
getPiralPackage,
|
|
@@ -22,7 +21,6 @@ import {
|
|
|
22
21
|
config,
|
|
23
22
|
initNpmProject,
|
|
24
23
|
} from '../common';
|
|
25
|
-
import { sourceLanguageKeys } from '..';
|
|
26
24
|
|
|
27
25
|
export interface NewPiralOptions {
|
|
28
26
|
/**
|
|
@@ -102,7 +100,7 @@ export const newPiralDefaults: NewPiralOptions = {
|
|
|
102
100
|
install: true,
|
|
103
101
|
template: 'default',
|
|
104
102
|
logLevel: LogLevels.info,
|
|
105
|
-
npmClient:
|
|
103
|
+
npmClient: undefined,
|
|
106
104
|
bundlerName: 'none',
|
|
107
105
|
variables: {},
|
|
108
106
|
};
|
|
@@ -121,6 +119,7 @@ export async function newPiral(baseDir = process.cwd(), options: NewPiralOptions
|
|
|
121
119
|
logLevel = newPiralDefaults.logLevel,
|
|
122
120
|
bundlerName = newPiralDefaults.bundlerName,
|
|
123
121
|
variables = newPiralDefaults.variables,
|
|
122
|
+
npmClient: defaultNpmClient = newPiralDefaults.npmClient,
|
|
124
123
|
} = options;
|
|
125
124
|
const fullBase = resolve(process.cwd(), baseDir);
|
|
126
125
|
const root = resolve(fullBase, target);
|
|
@@ -134,7 +133,7 @@ export async function newPiral(baseDir = process.cwd(), options: NewPiralOptions
|
|
|
134
133
|
const success = await createDirectory(root);
|
|
135
134
|
|
|
136
135
|
if (success) {
|
|
137
|
-
const npmClient = await determineNpmClient(root,
|
|
136
|
+
const npmClient = await determineNpmClient(root, defaultNpmClient);
|
|
138
137
|
const packageRef = combinePackageRef(framework, version, 'registry');
|
|
139
138
|
const projectName = basename(root);
|
|
140
139
|
|
|
@@ -177,14 +176,11 @@ always-auth=true`,
|
|
|
177
176
|
|
|
178
177
|
progress(`Taking care of templating ...`);
|
|
179
178
|
|
|
180
|
-
|
|
179
|
+
const data = getPiralScaffoldData(language, root, app, framework, variables);
|
|
181
180
|
|
|
182
|
-
await
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
getPiralScaffoldData(language, root, app, framework, variables),
|
|
186
|
-
forceOverwrite,
|
|
187
|
-
);
|
|
181
|
+
await updateExistingJson(root, 'package.json', getPiralPackage(app, data, version, bundlerName));
|
|
182
|
+
|
|
183
|
+
await scaffoldPiralSourceFiles(template, registry, data, forceOverwrite);
|
|
188
184
|
|
|
189
185
|
if (install) {
|
|
190
186
|
progress(`Installing dependencies ...`);
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { publishArtifacts } from '../release';
|
|
3
|
+
import {
|
|
4
|
+
setLogLevel,
|
|
5
|
+
progress,
|
|
6
|
+
checkExists,
|
|
7
|
+
fail,
|
|
8
|
+
logDone,
|
|
9
|
+
logReset,
|
|
10
|
+
publishNpmPackage,
|
|
11
|
+
matchFiles,
|
|
12
|
+
log,
|
|
13
|
+
} from '../common';
|
|
3
14
|
import { LogLevels, PiralBuildType } from '../types';
|
|
4
|
-
import { setLogLevel, progress, checkExists, fail, logDone, logReset, publishNpmPackage, matchFiles } from '../common';
|
|
5
15
|
|
|
6
16
|
export interface PublishPiralOptions {
|
|
7
17
|
/**
|
|
@@ -15,9 +25,9 @@ export interface PublishPiralOptions {
|
|
|
15
25
|
logLevel?: LogLevels;
|
|
16
26
|
|
|
17
27
|
/**
|
|
18
|
-
* The
|
|
28
|
+
* The options to supply for the provider.
|
|
19
29
|
*/
|
|
20
|
-
|
|
30
|
+
opts?: Record<string, string>;
|
|
21
31
|
|
|
22
32
|
/**
|
|
23
33
|
* Defines if authorization tokens can be retrieved interactively.
|
|
@@ -40,7 +50,7 @@ export const publishPiralDefaults: PublishPiralOptions = {
|
|
|
40
50
|
logLevel: LogLevels.info,
|
|
41
51
|
type: 'all',
|
|
42
52
|
provider: 'none',
|
|
43
|
-
|
|
53
|
+
opts: {},
|
|
44
54
|
interactive: false,
|
|
45
55
|
};
|
|
46
56
|
|
|
@@ -59,6 +69,7 @@ async function publishEmulator(
|
|
|
59
69
|
}
|
|
60
70
|
|
|
61
71
|
const files = await matchFiles(directory, '*.tgz');
|
|
72
|
+
log('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
|
|
62
73
|
|
|
63
74
|
if (files.length !== 1) {
|
|
64
75
|
fail('publishEmulatorFilesUnexpected_0111', directory);
|
|
@@ -70,8 +81,7 @@ async function publishEmulator(
|
|
|
70
81
|
return p;
|
|
71
82
|
}, [] as Array<string>);
|
|
72
83
|
|
|
73
|
-
|
|
74
|
-
await publishNpmPackage(directory, file, flags);
|
|
84
|
+
await publishNpmPackage(directory, file, flags, interactive);
|
|
75
85
|
}
|
|
76
86
|
|
|
77
87
|
async function publishRelease(
|
|
@@ -90,7 +100,8 @@ async function publishRelease(
|
|
|
90
100
|
}
|
|
91
101
|
|
|
92
102
|
const files = await matchFiles(directory, '**/*');
|
|
93
|
-
|
|
103
|
+
log('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
|
|
104
|
+
await publishArtifacts(providerName, directory, files, args, interactive);
|
|
94
105
|
}
|
|
95
106
|
|
|
96
107
|
export async function publishPiral(baseDir = process.cwd(), options: PublishPiralOptions = {}) {
|
|
@@ -98,7 +109,7 @@ export async function publishPiral(baseDir = process.cwd(), options: PublishPira
|
|
|
98
109
|
source = publishPiralDefaults.source,
|
|
99
110
|
type = publishPiralDefaults.type,
|
|
100
111
|
logLevel = publishPiralDefaults.logLevel,
|
|
101
|
-
|
|
112
|
+
opts = publishPiralDefaults.opts,
|
|
102
113
|
provider = publishPiralDefaults.provider,
|
|
103
114
|
interactive = publishPiralDefaults.interactive,
|
|
104
115
|
} = options;
|
|
@@ -113,14 +124,14 @@ export async function publishPiral(baseDir = process.cwd(), options: PublishPira
|
|
|
113
124
|
|
|
114
125
|
if (type !== 'release') {
|
|
115
126
|
progress('Publishing emulator package ...');
|
|
116
|
-
await publishEmulator(fullBase, source,
|
|
127
|
+
await publishEmulator(fullBase, source, opts, interactive);
|
|
117
128
|
logDone(`Successfully published emulator.`);
|
|
118
129
|
logReset();
|
|
119
130
|
}
|
|
120
131
|
|
|
121
132
|
if (type !== 'emulator') {
|
|
122
133
|
progress('Publishing release files ...');
|
|
123
|
-
await publishRelease(fullBase, source, provider,
|
|
134
|
+
await publishRelease(fullBase, source, provider, opts, interactive);
|
|
124
135
|
logDone(`Successfully published release.`);
|
|
125
136
|
logReset();
|
|
126
137
|
}
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
getPiralPath,
|
|
25
25
|
isMonorepoPackageRef,
|
|
26
26
|
getPiletScaffoldData,
|
|
27
|
-
SourceLanguage,
|
|
28
27
|
} from '../common';
|
|
29
28
|
|
|
30
29
|
export interface UpgradePiletOptions {
|
|
@@ -88,6 +87,7 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
|
|
|
88
87
|
logLevel = upgradePiletDefaults.logLevel,
|
|
89
88
|
install = upgradePiletDefaults.install,
|
|
90
89
|
variables = upgradePiletDefaults.variables,
|
|
90
|
+
npmClient: defaultNpmClient = upgradePiletDefaults.npmClient,
|
|
91
91
|
} = options;
|
|
92
92
|
const fullBase = resolve(process.cwd(), baseDir);
|
|
93
93
|
const root = resolve(fullBase, target);
|
|
@@ -98,13 +98,13 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
|
|
|
98
98
|
fail('invalidPiletTarget_0040');
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
const npmClient = await determineNpmClient(root,
|
|
101
|
+
const npmClient = await determineNpmClient(root, defaultNpmClient);
|
|
102
102
|
const pckg = await readJson(root, 'package.json');
|
|
103
103
|
const { devDependencies = {}, dependencies = {}, piral, source } = pckg;
|
|
104
104
|
|
|
105
105
|
if (piral && typeof piral === 'object') {
|
|
106
106
|
const sourceName = piral.name;
|
|
107
|
-
const language = /\.jsx?$/.test(source) ?
|
|
107
|
+
const language = /\.jsx?$/.test(source) ? 'js' : 'ts';
|
|
108
108
|
|
|
109
109
|
if (!sourceName || typeof sourceName !== 'string') {
|
|
110
110
|
fail('invalidPiletPackage_0042');
|
|
@@ -80,6 +80,7 @@ export async function upgradePiral(baseDir = process.cwd(), options: UpgradePira
|
|
|
80
80
|
target = upgradePiralDefaults.target,
|
|
81
81
|
logLevel = upgradePiralDefaults.logLevel,
|
|
82
82
|
install = upgradePiralDefaults.install,
|
|
83
|
+
npmClient: defaultNpmClient = upgradePiralDefaults.npmClient,
|
|
83
84
|
} = options;
|
|
84
85
|
const fullBase = resolve(process.cwd(), baseDir);
|
|
85
86
|
const root = resolve(fullBase, target);
|
|
@@ -91,7 +92,7 @@ export async function upgradePiral(baseDir = process.cwd(), options: UpgradePira
|
|
|
91
92
|
fail('packageJsonNotFound_0020');
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
const npmClient = await determineNpmClient(root,
|
|
95
|
+
const npmClient = await determineNpmClient(root, defaultNpmClient);
|
|
95
96
|
|
|
96
97
|
progress(`Checking provided version ...`);
|
|
97
98
|
const realVersion = await findSpecificVersion('piral-cli', version);
|
package/src/commands.ts
CHANGED
|
@@ -6,9 +6,7 @@ import {
|
|
|
6
6
|
forceOverwriteKeys,
|
|
7
7
|
keyOfForceOverwrite,
|
|
8
8
|
valueOfForceOverwrite,
|
|
9
|
-
keyOfSourceLanguage,
|
|
10
9
|
sourceLanguageKeys,
|
|
11
|
-
valueOfSourceLanguage,
|
|
12
10
|
frameworkKeys,
|
|
13
11
|
clientTypeKeys,
|
|
14
12
|
schemaKeys,
|
|
@@ -27,6 +25,7 @@ import {
|
|
|
27
25
|
PiletSchemaVersion,
|
|
28
26
|
PiletBuildType,
|
|
29
27
|
PiletPublishScheme,
|
|
28
|
+
SourceLanguage,
|
|
30
29
|
} from './types';
|
|
31
30
|
|
|
32
31
|
function specializeCommand(commands: Array<ToolCommand<any>>, command: ToolCommand<any>, suffix: string) {
|
|
@@ -205,9 +204,9 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
205
204
|
.choices('provider', availableReleaseProviders)
|
|
206
205
|
.describe('provider', 'Sets the provider for publishing the release assets.')
|
|
207
206
|
.default('provider', apps.publishPiralDefaults.provider)
|
|
208
|
-
.option('
|
|
209
|
-
.describe('
|
|
210
|
-
.default('
|
|
207
|
+
.option('opts', undefined)
|
|
208
|
+
.describe('opts', 'Sets the options to forward to the chosen provider.')
|
|
209
|
+
.default('opts', apps.publishPiralDefaults.opts)
|
|
211
210
|
.boolean('interactive')
|
|
212
211
|
.describe('interactive', 'Defines if authorization tokens can be retrieved interactively.')
|
|
213
212
|
.default('interactive', apps.publishPiralDefaults.interactive)
|
|
@@ -221,7 +220,7 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
221
220
|
logLevel: args['log-level'] as LogLevels,
|
|
222
221
|
type: args.type as PiralBuildType,
|
|
223
222
|
provider: args.provider as string,
|
|
224
|
-
|
|
223
|
+
opts: args.opts as Record<string, string>,
|
|
225
224
|
interactive: args.interactive as boolean,
|
|
226
225
|
});
|
|
227
226
|
},
|
|
@@ -299,7 +298,7 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
299
298
|
.default('force-overwrite', keyOfForceOverwrite(apps.newPiralDefaults.forceOverwrite))
|
|
300
299
|
.choices('language', sourceLanguageKeys)
|
|
301
300
|
.describe('language', 'Determines the programming language for the new Piral instance.')
|
|
302
|
-
.default('language',
|
|
301
|
+
.default('language', apps.newPiralDefaults.language)
|
|
303
302
|
.string('template')
|
|
304
303
|
.describe('template', 'Sets the boilerplate template package to be used when scaffolding.')
|
|
305
304
|
.default('template', apps.newPiralDefaults.template)
|
|
@@ -324,7 +323,7 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
324
323
|
version: args.tag as string,
|
|
325
324
|
registry: args.registry as string,
|
|
326
325
|
forceOverwrite: valueOfForceOverwrite(args['force-overwrite'] as string),
|
|
327
|
-
language:
|
|
326
|
+
language: args.language as SourceLanguage,
|
|
328
327
|
install: args.install as boolean,
|
|
329
328
|
template: args.template as string,
|
|
330
329
|
logLevel: args['log-level'] as LogLevels,
|
|
@@ -684,7 +683,7 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
684
683
|
.default('log-level', apps.newPiletDefaults.logLevel)
|
|
685
684
|
.choices('language', sourceLanguageKeys)
|
|
686
685
|
.describe('language', 'Determines the programming language for the new pilet.')
|
|
687
|
-
.default('language',
|
|
686
|
+
.default('language', apps.newPiletDefaults.language)
|
|
688
687
|
.string('template')
|
|
689
688
|
.describe('template', 'Sets the boilerplate template package to be used when scaffolding.')
|
|
690
689
|
.default('template', apps.newPiletDefaults.template)
|
|
@@ -707,7 +706,7 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
707
706
|
source: args.source as string,
|
|
708
707
|
registry: args.registry as string,
|
|
709
708
|
forceOverwrite: valueOfForceOverwrite(args['force-overwrite'] as string),
|
|
710
|
-
language:
|
|
709
|
+
language: args.language as SourceLanguage,
|
|
711
710
|
logLevel: args['log-level'] as LogLevels,
|
|
712
711
|
install: args.install as boolean,
|
|
713
712
|
template: args.template as string,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as lerna from './lerna';
|
|
2
2
|
import * as npm from './npm';
|
|
3
|
+
import * as pnp from './pnp';
|
|
3
4
|
import * as pnpm from './pnpm';
|
|
4
5
|
import * as rush from './rush';
|
|
5
6
|
import * as yarn from './yarn';
|
|
@@ -7,6 +8,7 @@ import * as yarn from './yarn';
|
|
|
7
8
|
export const clients = {
|
|
8
9
|
lerna,
|
|
9
10
|
npm,
|
|
11
|
+
pnp,
|
|
10
12
|
pnpm,
|
|
11
13
|
rush,
|
|
12
14
|
yarn,
|
|
@@ -14,7 +16,7 @@ export const clients = {
|
|
|
14
16
|
|
|
15
17
|
type ClientName = keyof typeof clients;
|
|
16
18
|
|
|
17
|
-
const directClients = ['npm', 'yarn', 'pnpm'];
|
|
19
|
+
const directClients = ['npm', 'pnp', 'yarn', 'pnpm'];
|
|
18
20
|
|
|
19
21
|
export function isWrapperClient(client: ClientName) {
|
|
20
22
|
return !directClients.includes(client);
|
|
@@ -47,6 +47,10 @@ export async function initProject(projectName: string, target: string) {}
|
|
|
47
47
|
|
|
48
48
|
// Functions to exclusively use from npm client:
|
|
49
49
|
|
|
50
|
+
export async function loginUser() {
|
|
51
|
+
await runNpmProcess(['login'], '.');
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
export async function unpackPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
51
55
|
const ms = new MemoryStream();
|
|
52
56
|
await runNpmProcess(['pack', packageRef, ...flags], target, ms);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { log } from '../log';
|
|
3
|
+
import { findFile } from '../io';
|
|
4
|
+
import { runCommand } from '../scripts';
|
|
5
|
+
import { MemoryStream } from '../MemoryStream';
|
|
6
|
+
|
|
7
|
+
// Helpers:
|
|
8
|
+
|
|
9
|
+
function runYarnProcess(args: Array<string>, target: string, output?: NodeJS.WritableStream) {
|
|
10
|
+
log('generalDebug_0003', 'Starting the Yarn PnP process ...');
|
|
11
|
+
const cwd = resolve(process.cwd(), target);
|
|
12
|
+
return runCommand('yarn', args, cwd, output);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function convert(flags: Array<string>) {
|
|
16
|
+
return flags.map((flag) => {
|
|
17
|
+
switch (flag) {
|
|
18
|
+
case '--save-exact':
|
|
19
|
+
return '--exact';
|
|
20
|
+
case '--save-dev':
|
|
21
|
+
return '--dev';
|
|
22
|
+
case '--no-save':
|
|
23
|
+
// unfortunately no (https://github.com/yarnpkg/yarn/issues/1743)
|
|
24
|
+
return '';
|
|
25
|
+
default:
|
|
26
|
+
return flag;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Client interface functions:
|
|
32
|
+
|
|
33
|
+
export async function installDependencies(target = '.', ...flags: Array<string>) {
|
|
34
|
+
const ms = new MemoryStream();
|
|
35
|
+
await runYarnProcess(['install', ...convert(flags)], target, ms);
|
|
36
|
+
log('generalDebug_0003', `Yarn PnP install dependencies result: ${ms.value}`);
|
|
37
|
+
return ms.value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function installPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
41
|
+
const ms = new MemoryStream();
|
|
42
|
+
await runYarnProcess(['add', packageRef, ...convert(flags)], target, ms);
|
|
43
|
+
log('generalDebug_0003', `Yarn PnP install package result: ${ms.value}`);
|
|
44
|
+
return ms.value;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function detectClient(root: string) {
|
|
48
|
+
return !!(await findFile(root, '.pnp.cjs'));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export async function initProject(projectName: string, target: string) {}
|
|
52
|
+
|
|
53
|
+
export async function isProject(root: string, packageRef: string) {
|
|
54
|
+
const details = await listProjects(root);
|
|
55
|
+
|
|
56
|
+
if (typeof details === 'object') {
|
|
57
|
+
return typeof details?.[packageRef]?.location === 'string';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Functions to exclusively use from yarn client:
|
|
64
|
+
|
|
65
|
+
export async function listProjects(target: string) {
|
|
66
|
+
const ms = new MemoryStream();
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
await runYarnProcess(['workspaces', 'info'], target, ms);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
log('generalDebug_0003', `yarn workspaces error: ${e}`);
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
log('generalDebug_0003', `yarn workspaces result: ${ms.value}`);
|
|
76
|
+
return JSON.parse(ms.value);
|
|
77
|
+
}
|