piral-cli 0.14.24-beta.4163 → 0.14.24-beta.4168
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/new-pilet.js +5 -3
- package/lib/apps/new-pilet.js.map +1 -1
- package/lib/apps/new-piral.js +2 -2
- package/lib/apps/new-piral.js.map +1 -1
- package/lib/apps/publish-pilet.js +1 -1
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/publish-piral.js +1 -1
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/upgrade-pilet.js +2 -2
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/apps/upgrade-piral.js +1 -1
- package/lib/apps/upgrade-piral.js.map +1 -1
- package/lib/bundler.js +1 -1
- package/lib/bundler.js.map +1 -1
- package/lib/common/clients/lerna.d.ts +1 -0
- package/lib/common/clients/lerna.js +5 -1
- package/lib/common/clients/lerna.js.map +1 -1
- package/lib/common/clients/npm.d.ts +1 -0
- package/lib/common/clients/npm.js +5 -1
- package/lib/common/clients/npm.js.map +1 -1
- package/lib/common/clients/pnpm.d.ts +1 -0
- package/lib/common/clients/pnpm.js +5 -1
- package/lib/common/clients/pnpm.js.map +1 -1
- package/lib/common/clients/rush.d.ts +1 -0
- package/lib/common/clients/rush.js +30 -3
- package/lib/common/clients/rush.js.map +1 -1
- package/lib/common/clients/yarn.d.ts +1 -0
- package/lib/common/clients/yarn.js +5 -1
- package/lib/common/clients/yarn.js.map +1 -1
- package/lib/common/emulator.js +1 -1
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/inspect.js +2 -1
- package/lib/common/inspect.js.map +1 -1
- package/lib/common/npm.d.ts +7 -6
- package/lib/common/npm.js +16 -11
- package/lib/common/npm.js.map +1 -1
- package/lib/common/pack.js +1 -1
- package/lib/common/pack.js.map +1 -1
- package/lib/common/package.d.ts +6 -6
- package/lib/common/package.js +10 -1
- package/lib/common/package.js.map +1 -1
- package/lib/common/scaffold.js +1 -1
- package/lib/common/scaffold.js.map +1 -1
- package/lib/external/index.js +1982 -92
- package/lib/injectors/pilet.js +2 -2
- package/lib/injectors/pilet.js.map +1 -1
- package/lib/types/internal.d.ts +9 -1
- package/package.json +4 -2
- package/src/apps/new-pilet.ts +9 -5
- package/src/apps/new-piral.ts +4 -4
- package/src/apps/publish-pilet.ts +2 -2
- package/src/apps/publish-piral.ts +2 -2
- package/src/apps/upgrade-pilet.ts +4 -4
- package/src/apps/upgrade-piral.ts +2 -2
- package/src/bundler.test.ts +1 -1
- package/src/bundler.ts +2 -2
- package/src/common/clients/lerna.ts +2 -0
- package/src/common/clients/npm.ts +2 -0
- package/src/common/clients/pnpm.ts +2 -0
- package/src/common/clients/rush.ts +40 -4
- package/src/common/clients/yarn.ts +2 -0
- package/src/common/emulator.ts +2 -2
- package/src/common/inspect.ts +2 -1
- package/src/common/npm.test.ts +26 -24
- package/src/common/npm.ts +11 -6
- package/src/common/pack.test.ts +1 -1
- package/src/common/pack.ts +2 -2
- package/src/common/package.ts +16 -7
- package/src/common/scaffold.ts +2 -2
- package/src/external/index.ts +2 -1
- package/src/injectors/pilet.ts +3 -3
- package/src/types/internal.ts +6 -1
package/lib/injectors/pilet.js
CHANGED
|
@@ -21,8 +21,8 @@ function fillPiletMeta(pilet, basePath, metaFile) {
|
|
|
21
21
|
const { root, bundler } = pilet;
|
|
22
22
|
const metaPath = (0, path_1.join)(root, metaFile);
|
|
23
23
|
const packagePath = (0, path_1.join)(root, 'package.json');
|
|
24
|
-
const def =
|
|
25
|
-
const metaOverride = (0, fs_1.existsSync)(metaPath) ?
|
|
24
|
+
const def = external_1.jju.parse((0, fs_1.readFileSync)(packagePath, 'utf8'));
|
|
25
|
+
const metaOverride = (0, fs_1.existsSync)(metaPath) ? external_1.jju.parse((0, fs_1.readFileSync)(metaPath, 'utf8')) : undefined;
|
|
26
26
|
const file = bundler.bundle.name.replace(/^[\/\\]/, '');
|
|
27
27
|
const target = (0, path_1.join)(bundler.bundle.dir, file);
|
|
28
28
|
const url = new url_1.URL(file, basePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pilet.js","sourceRoot":"","sources":["../../src/injectors/pilet.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA0B;AAC1B,+BAA4B;AAE5B,2BAAwD;AAExD,uCAAoC;AACpC,yCAAkD;AAClD,6CAA0C;AAC1C,
|
|
1
|
+
{"version":3,"file":"pilet.js","sourceRoot":"","sources":["../../src/injectors/pilet.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA0B;AAC1B,+BAA4B;AAE5B,2BAAwD;AAExD,uCAAoC;AACpC,yCAAkD;AAClD,6CAA0C;AAC1C,0CAA+C;AAG/C,MAAM,EAAE,IAAI,EAAE,GAAG,eAAM,CAAC;AAsBxB,SAAS,aAAa,CAAC,KAAY,EAAE,QAAgB,EAAE,QAAgB;IACrE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAChC,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACtC,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAG,cAAG,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,IAAA,eAAU,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAG,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClG,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CA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ACnB,CAAC;iBACJ;aACF;YAED,OAAO,SAAS,CAAC;SAClB;aAAM,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;YAC7B,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;SACzC;IACH,CAAC;CACF;AAxKD,gCAwKC"}
|
package/lib/types/internal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { LogLevels } from './common';
|
|
2
|
+
import type { LogLevels, PiletsInfo } from './common';
|
|
3
3
|
export interface PackageData {
|
|
4
4
|
name: string;
|
|
5
5
|
version: string;
|
|
@@ -11,6 +11,14 @@ export interface PackageData {
|
|
|
11
11
|
email?: string;
|
|
12
12
|
};
|
|
13
13
|
custom?: any;
|
|
14
|
+
pilets?: PiletsInfo;
|
|
15
|
+
piralCLI?: {
|
|
16
|
+
generated: boolean;
|
|
17
|
+
version: string;
|
|
18
|
+
};
|
|
19
|
+
dependencies: Record<string, string>;
|
|
20
|
+
peerDependencies: Record<string, string>;
|
|
21
|
+
devDependencies: Record<string, string>;
|
|
14
22
|
}
|
|
15
23
|
export interface PackageFiles {
|
|
16
24
|
[file: string]: Buffer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "0.14.24-beta.
|
|
3
|
+
"version": "0.14.24-beta.4168",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@types/express": "^4.16.1",
|
|
51
51
|
"@types/glob": "^7.1.1",
|
|
52
52
|
"@types/inquirer": "^6.0.0",
|
|
53
|
+
"@types/jju": "^1.4.2",
|
|
53
54
|
"@types/mime": "^2.0.0",
|
|
54
55
|
"@types/node": "^12.7.2",
|
|
55
56
|
"@types/rc": "^1.1.0",
|
|
@@ -62,6 +63,7 @@
|
|
|
62
63
|
"get-port": "^5.0.0",
|
|
63
64
|
"glob": "^7.1.3",
|
|
64
65
|
"inquirer": "^6.2.2",
|
|
66
|
+
"jju": "^1.4.0",
|
|
65
67
|
"mime": "^2.5.2",
|
|
66
68
|
"open": "^7.1.0",
|
|
67
69
|
"rc": "^1.2.8",
|
|
@@ -77,5 +79,5 @@
|
|
|
77
79
|
"typescript": "^4.0.2",
|
|
78
80
|
"yargs": "^15.4.1"
|
|
79
81
|
},
|
|
80
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "5c3d75e1148d7def9bbc0d5c2628671c2356f816"
|
|
81
83
|
}
|
package/src/apps/new-pilet.ts
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
SourceLanguage,
|
|
6
6
|
createDirectory,
|
|
7
7
|
createFileIfNotExists,
|
|
8
|
-
|
|
8
|
+
installNpmPackage,
|
|
9
9
|
dissectPackageName,
|
|
10
10
|
copyPiralFiles,
|
|
11
11
|
patchPiletPackage,
|
|
12
12
|
scaffoldPiletSourceFiles,
|
|
13
|
-
|
|
13
|
+
installNpmDependencies,
|
|
14
14
|
combinePackageRef,
|
|
15
15
|
getPackageName,
|
|
16
16
|
getPackageVersion,
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
getPiralPath,
|
|
30
30
|
getPiletScaffoldData,
|
|
31
31
|
config,
|
|
32
|
+
initNpmProject,
|
|
32
33
|
} from '../common';
|
|
33
34
|
|
|
34
35
|
export interface NewPiletOptions {
|
|
@@ -128,6 +129,7 @@ export async function newPilet(baseDir = process.cwd(), options: NewPiletOptions
|
|
|
128
129
|
|
|
129
130
|
if (success) {
|
|
130
131
|
const npmClient = await determineNpmClient(root, options.npmClient);
|
|
132
|
+
const projectName = basename(root);
|
|
131
133
|
|
|
132
134
|
progress(`Scaffolding new pilet in %s ...`, root);
|
|
133
135
|
|
|
@@ -136,7 +138,7 @@ export async function newPilet(baseDir = process.cwd(), options: NewPiletOptions
|
|
|
136
138
|
'package.json',
|
|
137
139
|
JSON.stringify(
|
|
138
140
|
{
|
|
139
|
-
name:
|
|
141
|
+
name: projectName,
|
|
140
142
|
version: '1.0.0',
|
|
141
143
|
description: '',
|
|
142
144
|
keywords: ['pilet'],
|
|
@@ -152,6 +154,8 @@ export async function newPilet(baseDir = process.cwd(), options: NewPiletOptions
|
|
|
152
154
|
),
|
|
153
155
|
);
|
|
154
156
|
|
|
157
|
+
await initNpmProject(npmClient, projectName, root);
|
|
158
|
+
|
|
155
159
|
if (registry !== newPiletDefaults.registry) {
|
|
156
160
|
progress(`Setting up npm registry (%s) ...`, registry);
|
|
157
161
|
|
|
@@ -171,7 +175,7 @@ always-auth=true`,
|
|
|
171
175
|
|
|
172
176
|
progress(`Installing npm package %s ...`, packageRef);
|
|
173
177
|
|
|
174
|
-
await
|
|
178
|
+
await installNpmPackage(npmClient, packageRef, root, '--save-dev', '--save-exact');
|
|
175
179
|
} else {
|
|
176
180
|
progress(`Using locally available npm package %s ...`, sourceName);
|
|
177
181
|
}
|
|
@@ -213,7 +217,7 @@ always-auth=true`,
|
|
|
213
217
|
|
|
214
218
|
if (install) {
|
|
215
219
|
progress(`Installing dependencies ...`);
|
|
216
|
-
await
|
|
220
|
+
await installNpmDependencies(npmClient, root);
|
|
217
221
|
}
|
|
218
222
|
|
|
219
223
|
if (postScaffold) {
|
package/src/apps/new-piral.ts
CHANGED
|
@@ -3,14 +3,14 @@ import { LogLevels, Framework, NpmClientType } from '../types';
|
|
|
3
3
|
import {
|
|
4
4
|
ForceOverwrite,
|
|
5
5
|
SourceLanguage,
|
|
6
|
-
|
|
6
|
+
installNpmPackage,
|
|
7
7
|
updateExistingJson,
|
|
8
8
|
getPiralPackage,
|
|
9
9
|
scaffoldPiralSourceFiles,
|
|
10
10
|
createDirectory,
|
|
11
11
|
createFileIfNotExists,
|
|
12
12
|
logDone,
|
|
13
|
-
|
|
13
|
+
installNpmDependencies,
|
|
14
14
|
combinePackageRef,
|
|
15
15
|
setLogLevel,
|
|
16
16
|
fail,
|
|
@@ -162,7 +162,7 @@ always-auth=true`,
|
|
|
162
162
|
|
|
163
163
|
progress(`Installing npm package ${packageRef} ...`);
|
|
164
164
|
|
|
165
|
-
await
|
|
165
|
+
await installNpmPackage(npmClient, packageRef, root, '--save-exact');
|
|
166
166
|
|
|
167
167
|
progress(`Taking care of templating ...`);
|
|
168
168
|
|
|
@@ -177,7 +177,7 @@ always-auth=true`,
|
|
|
177
177
|
|
|
178
178
|
if (install) {
|
|
179
179
|
progress(`Installing dependencies ...`);
|
|
180
|
-
await
|
|
180
|
+
await installNpmDependencies(npmClient, root);
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
logDone(`Piral instance scaffolded successfully!`);
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
log,
|
|
14
14
|
config,
|
|
15
15
|
checkExists,
|
|
16
|
-
|
|
16
|
+
findNpmTarball,
|
|
17
17
|
downloadFile,
|
|
18
18
|
matchAnyPilet,
|
|
19
19
|
retrievePiletData,
|
|
@@ -192,7 +192,7 @@ async function getFiles(
|
|
|
192
192
|
}
|
|
193
193
|
case 'npm': {
|
|
194
194
|
log('generalDebug_0003', `View npm package "${sources.join('", "')}".`);
|
|
195
|
-
const allUrls = await Promise.all(sources.map((s) =>
|
|
195
|
+
const allUrls = await Promise.all(sources.map((s) => findNpmTarball(s)));
|
|
196
196
|
log('generalDebug_0003', `Download file from "${allUrls.join('", "')}".`);
|
|
197
197
|
const allFiles = await Promise.all(allUrls.map((url) => downloadFile(url, ca)));
|
|
198
198
|
return allFiles.reduce((result, files) => [...result, ...files], []);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { publishArtifacts } from '../release';
|
|
3
3
|
import { LogLevels, PiralBuildType } from '../types';
|
|
4
|
-
import { setLogLevel, progress, checkExists, fail, logDone, logReset,
|
|
4
|
+
import { setLogLevel, progress, checkExists, fail, logDone, logReset, publishNpmPackage, matchFiles } from '../common';
|
|
5
5
|
|
|
6
6
|
export interface PublishPiralOptions {
|
|
7
7
|
/**
|
|
@@ -58,7 +58,7 @@ async function publishEmulator(baseDir: string, source: string, args: Record<str
|
|
|
58
58
|
p.push(`--${c}`, args[c]);
|
|
59
59
|
return p;
|
|
60
60
|
}, [] as Array<string>);
|
|
61
|
-
await
|
|
61
|
+
await publishNpmPackage(directory, file, flags);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
async function publishRelease(
|
|
@@ -2,7 +2,7 @@ import { resolve } from 'path';
|
|
|
2
2
|
import { LogLevels, NpmClientType } from '../types';
|
|
3
3
|
import {
|
|
4
4
|
readJson,
|
|
5
|
-
|
|
5
|
+
installNpmPackage,
|
|
6
6
|
checkExistingDirectory,
|
|
7
7
|
patchPiletPackage,
|
|
8
8
|
copyPiralFiles,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
readPiralPackage,
|
|
11
11
|
getPiletsInfo,
|
|
12
12
|
runScript,
|
|
13
|
-
|
|
13
|
+
installNpmDependencies,
|
|
14
14
|
getCurrentPackageDetails,
|
|
15
15
|
checkAppShellPackage,
|
|
16
16
|
setLogLevel,
|
|
@@ -129,7 +129,7 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
|
|
|
129
129
|
if (!monorepoRef) {
|
|
130
130
|
// only install the latest if the shell does come from remote
|
|
131
131
|
progress(`Updating npm package to %s ...`, packageRef);
|
|
132
|
-
await
|
|
132
|
+
await installNpmPackage(npmClient, packageRef, root, '--no-save');
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
const piralInfo = await readPiralPackage(root, sourceName);
|
|
@@ -162,7 +162,7 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
|
|
|
162
162
|
|
|
163
163
|
if (install) {
|
|
164
164
|
progress(`Updating dependencies ...`);
|
|
165
|
-
await
|
|
165
|
+
await installNpmDependencies(npmClient, root);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
if (postUpgrade) {
|
|
@@ -3,7 +3,7 @@ import { LogLevels, NpmClientType } from '../types';
|
|
|
3
3
|
import {
|
|
4
4
|
readJson,
|
|
5
5
|
checkExistingDirectory,
|
|
6
|
-
|
|
6
|
+
installNpmDependencies,
|
|
7
7
|
setLogLevel,
|
|
8
8
|
progress,
|
|
9
9
|
fail,
|
|
@@ -113,7 +113,7 @@ export async function upgradePiral(baseDir = process.cwd(), options: UpgradePira
|
|
|
113
113
|
|
|
114
114
|
if (install) {
|
|
115
115
|
progress(`Updating the npm packages to %s ...`, version);
|
|
116
|
-
await
|
|
116
|
+
await installNpmDependencies(npmClient, root);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
logDone('Piral instance upgraded successfully!');
|
package/src/bundler.test.ts
CHANGED
package/src/bundler.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { callDynamic, callStatic } from './build/bundler-calls';
|
|
2
2
|
import { availableBundlers } from './helpers';
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
installNpmPackage,
|
|
5
5
|
cliVersion,
|
|
6
6
|
fail,
|
|
7
7
|
progress,
|
|
@@ -39,7 +39,7 @@ async function installDefaultBundler(root: string) {
|
|
|
39
39
|
const client = await determineNpmClient(root);
|
|
40
40
|
log('generalDebug_0003', `Prepare to install ${selectedPackage}@${cliVersion} using "${client}" into "${root}".`);
|
|
41
41
|
progress(`Installing ${selectedPackage} ...`);
|
|
42
|
-
await
|
|
42
|
+
await installNpmPackage(client, `${selectedPackage}@${cliVersion}`, root, '--save-dev', '--save-exact');
|
|
43
43
|
log('generalDebug_0003', `Installed bundler from "${selectedPackage}".`);
|
|
44
44
|
|
|
45
45
|
require('./inject').inject(selectedPackage);
|
|
@@ -47,3 +47,5 @@ export async function installPackage(packageRef: string, target = '.', ...flags:
|
|
|
47
47
|
export async function detectClient(root: string) {
|
|
48
48
|
return !!(await findFile(root, 'lerna.json'));
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
export async function initProject(projectName: string, target: string) {}
|
|
@@ -32,6 +32,8 @@ export async function detectClient(root: string) {
|
|
|
32
32
|
return !!(await findFile(root, 'package-lock.json'));
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export async function initProject(projectName: string, target: string) {}
|
|
36
|
+
|
|
35
37
|
// Functions to exclusively use from npm client:
|
|
36
38
|
|
|
37
39
|
export async function unpackPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
@@ -43,3 +43,5 @@ export async function installPackage(packageRef: string, target = '.', ...flags:
|
|
|
43
43
|
export async function detectClient(root: string) {
|
|
44
44
|
return !!(await findFile(root, 'pnpm-lock.yaml'));
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
export async function initProject(projectName: string, target: string) {}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { resolve } from 'path';
|
|
1
|
+
import { dirname, relative, resolve } from 'path';
|
|
2
2
|
import { log } from '../log';
|
|
3
|
-
import { findFile } from '../io';
|
|
3
|
+
import { findFile, readText, writeText } from '../io';
|
|
4
|
+
import { jju } from '../../external';
|
|
4
5
|
import { runCommand } from '../scripts';
|
|
5
6
|
import { MemoryStream } from '../MemoryStream';
|
|
6
7
|
|
|
7
8
|
// Helpers:
|
|
9
|
+
const rushJson = 'rush.json';
|
|
8
10
|
|
|
9
11
|
function runRushProcess(args: Array<string>, target: string, output?: NodeJS.WritableStream) {
|
|
10
12
|
log('generalDebug_0003', 'Starting the Rush process ...');
|
|
@@ -16,7 +18,8 @@ function convert(flags: Array<string>) {
|
|
|
16
18
|
return flags.map((flag) => {
|
|
17
19
|
switch (flag) {
|
|
18
20
|
case '--save-exact':
|
|
19
|
-
|
|
21
|
+
// discard as this may lead to problems
|
|
22
|
+
return '';
|
|
20
23
|
case '--save-dev':
|
|
21
24
|
return '--dev';
|
|
22
25
|
case '--no-save':
|
|
@@ -45,5 +48,38 @@ export async function installPackage(packageRef: string, target = '.', ...flags:
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
export async function detectClient(root: string) {
|
|
48
|
-
return !!(await findFile(root,
|
|
51
|
+
return !!(await findFile(root, rushJson));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function initProject(packageName: string, target: string) {
|
|
55
|
+
const rushPath = await findFile(target, rushJson);
|
|
56
|
+
|
|
57
|
+
if (!rushPath) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
`Could not find the "${rushJson}" from "${target}". Sure you want to create the project in the right directory?`,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const rushDir = dirname(rushPath);
|
|
64
|
+
const rushContent = await readText(rushDir, rushJson);
|
|
65
|
+
const rushData = jju.parse(rushContent);
|
|
66
|
+
const projectFolder = relative(rushDir, target);
|
|
67
|
+
|
|
68
|
+
if (!Array.isArray(rushData.projects)) {
|
|
69
|
+
rushData.projects = [];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
rushData.projects.push({
|
|
73
|
+
packageName,
|
|
74
|
+
projectFolder,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
await writeText(
|
|
78
|
+
rushDir,
|
|
79
|
+
rushJson,
|
|
80
|
+
jju.update(rushContent, rushData, {
|
|
81
|
+
mode: 'cjson',
|
|
82
|
+
indent: 2,
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
49
85
|
}
|
package/src/common/emulator.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { findDependencyVersion, copyScaffoldingFiles, isValidDependency } from '
|
|
|
3
3
|
import { createFileFromTemplateIfNotExists } from './template';
|
|
4
4
|
import { filesTar, filesOnceTar } from './constants';
|
|
5
5
|
import { cliVersion } from './info';
|
|
6
|
-
import {
|
|
6
|
+
import { createNpmPackage, makeExternals } from './npm';
|
|
7
7
|
import { createPiralDeclaration } from './declaration';
|
|
8
8
|
import { ForceOverwrite } from './enums';
|
|
9
9
|
import { createTarball } from './archive';
|
|
@@ -138,7 +138,7 @@ export async function createEmulatorSources(
|
|
|
138
138
|
|
|
139
139
|
export async function packageEmulator(rootDir: string) {
|
|
140
140
|
// finally package everything up
|
|
141
|
-
await
|
|
141
|
+
await createNpmPackage(rootDir);
|
|
142
142
|
|
|
143
143
|
// get all files
|
|
144
144
|
const names = await getFileNames(rootDir);
|
package/src/common/inspect.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { dirname, basename } from 'path';
|
|
2
2
|
import { unpackGzTar } from './archive';
|
|
3
|
+
import { jju } from '../external';
|
|
3
4
|
import { PackageData, PackageFiles } from '../types';
|
|
4
5
|
|
|
5
6
|
const packageRoot = 'package/';
|
|
@@ -8,7 +9,7 @@ function getPackageJson(files: PackageFiles): PackageData {
|
|
|
8
9
|
const fileName = `${packageRoot}package.json`;
|
|
9
10
|
const fileContent = files[fileName];
|
|
10
11
|
const content = fileContent.toString('utf8');
|
|
11
|
-
return
|
|
12
|
+
return jju.parse(content);
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
function getPiletMainPath(data: PackageData, files: PackageFiles) {
|
package/src/common/npm.test.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { resolve } from 'path';
|
|
|
2
2
|
import { clients } from './clients';
|
|
3
3
|
import {
|
|
4
4
|
dissectPackageName,
|
|
5
|
-
|
|
5
|
+
installNpmPackage,
|
|
6
6
|
isMonorepoPackageRef,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
installNpmDependencies,
|
|
8
|
+
createNpmPackage,
|
|
9
|
+
findNpmTarball,
|
|
10
10
|
findSpecificVersion,
|
|
11
11
|
findLatestVersion,
|
|
12
12
|
isLocalPackage,
|
|
@@ -165,37 +165,39 @@ describe('npm Module', () => {
|
|
|
165
165
|
|
|
166
166
|
it('installs a package using the npm command line tool without a target', async () => {
|
|
167
167
|
wrongCase = false;
|
|
168
|
-
await
|
|
168
|
+
await installNpmPackage('npm', 'foo', 'latest').then((result) => expect(result).toEqual(jsonValueString));
|
|
169
169
|
wrongCase = true;
|
|
170
|
-
await
|
|
170
|
+
await installNpmPackage('npm', 'foo', 'latest').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
171
171
|
});
|
|
172
172
|
|
|
173
173
|
it('installs a package using the npm command line tool without a version', async () => {
|
|
174
174
|
wrongCase = false;
|
|
175
|
-
await
|
|
175
|
+
await installNpmPackage('npm', 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
176
176
|
wrongCase = true;
|
|
177
|
-
await
|
|
177
|
+
await installNpmPackage('npm', 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
it('installs a package using the Yarn command line tool without a version', async () => {
|
|
181
181
|
wrongCase = false;
|
|
182
|
-
await
|
|
182
|
+
await installNpmPackage('yarn', 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
183
183
|
wrongCase = true;
|
|
184
|
-
await
|
|
184
|
+
await installNpmPackage('yarn', 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
185
185
|
});
|
|
186
186
|
|
|
187
187
|
it('installs a package using the Pnpm command line tool without a version', async () => {
|
|
188
188
|
wrongCase = false;
|
|
189
|
-
await
|
|
189
|
+
await installNpmPackage('pnpm', 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
190
190
|
wrongCase = true;
|
|
191
|
-
await
|
|
191
|
+
await installNpmPackage('pnpm', 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
it('installs a package using the npm command line tool with some flag', async () => {
|
|
195
195
|
wrongCase = false;
|
|
196
|
-
await
|
|
196
|
+
await installNpmPackage('npm', 'foo', '1.3', '.', '--a=b').then((result) =>
|
|
197
|
+
expect(result).toEqual(jsonValueString),
|
|
198
|
+
);
|
|
197
199
|
wrongCase = true;
|
|
198
|
-
await
|
|
200
|
+
await installNpmPackage('npm', 'foo', '1.3', '.', '--a=b').then((result) =>
|
|
199
201
|
expect(result).not.toEqual(jsonValueString),
|
|
200
202
|
);
|
|
201
203
|
});
|
|
@@ -242,37 +244,37 @@ describe('npm Module', () => {
|
|
|
242
244
|
|
|
243
245
|
it('install dependencies with npm client', async () => {
|
|
244
246
|
wrongCase = false;
|
|
245
|
-
await
|
|
247
|
+
await installNpmDependencies('npm').then((result) => expect(result).toEqual(jsonValueString));
|
|
246
248
|
wrongCase = true;
|
|
247
|
-
await
|
|
249
|
+
await installNpmDependencies('npm').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
248
250
|
});
|
|
249
251
|
|
|
250
252
|
it('install dependencies with pnpm client', async () => {
|
|
251
253
|
wrongCase = false;
|
|
252
|
-
await
|
|
254
|
+
await installNpmDependencies('pnpm').then((result) => expect(result).toEqual(jsonValueString));
|
|
253
255
|
wrongCase = true;
|
|
254
|
-
await
|
|
256
|
+
await installNpmDependencies('pnpm').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
255
257
|
});
|
|
256
258
|
|
|
257
259
|
it('install dependencies with yarn client', async () => {
|
|
258
260
|
wrongCase = false;
|
|
259
|
-
await
|
|
261
|
+
await installNpmDependencies('yarn').then((result) => expect(result).toEqual(jsonValueString));
|
|
260
262
|
wrongCase = true;
|
|
261
|
-
await
|
|
263
|
+
await installNpmDependencies('yarn').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
262
264
|
});
|
|
263
265
|
|
|
264
266
|
it('create npm package', async () => {
|
|
265
267
|
wrongCase = false;
|
|
266
|
-
await
|
|
268
|
+
await createNpmPackage().then((result) => expect(result).toEqual(jsonValueString));
|
|
267
269
|
wrongCase = true;
|
|
268
|
-
await
|
|
270
|
+
await createNpmPackage().then((result) => expect(result).not.toEqual(jsonValueString));
|
|
269
271
|
});
|
|
270
272
|
|
|
271
273
|
it('find npm tarball', async () => {
|
|
272
274
|
wrongCase = false;
|
|
273
|
-
await
|
|
275
|
+
await findNpmTarball('foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
274
276
|
wrongCase = true;
|
|
275
|
-
await
|
|
277
|
+
await findNpmTarball('foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
276
278
|
});
|
|
277
279
|
|
|
278
280
|
it('find latest version', async () => {
|
package/src/common/npm.ts
CHANGED
|
@@ -114,12 +114,12 @@ export async function isMonorepoPackageRef(refName: string, root: string): Promi
|
|
|
114
114
|
return false;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
export function
|
|
117
|
+
export function installNpmDependencies(client: NpmClientType, target = '.'): Promise<string> {
|
|
118
118
|
const { installDependencies } = clients[client];
|
|
119
119
|
return installDependencies(target);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
export async function
|
|
122
|
+
export async function installNpmPackage(
|
|
123
123
|
client: NpmClientType,
|
|
124
124
|
packageRef: string,
|
|
125
125
|
target = '.',
|
|
@@ -137,17 +137,22 @@ export async function installPackage(
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
export function
|
|
140
|
+
export function initNpmProject(client: NpmClientType, projectName: string, target: string) {
|
|
141
|
+
const { initProject } = clients[client];
|
|
142
|
+
return initProject(projectName, target);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function publishNpmPackage(target = '.', file = '*.tgz', flags: Array<string> = []): Promise<string> {
|
|
141
146
|
const { publishPackage } = clients.npm;
|
|
142
147
|
return publishPackage(target, file, ...flags);
|
|
143
148
|
}
|
|
144
149
|
|
|
145
|
-
export function
|
|
150
|
+
export function createNpmPackage(target = '.'): Promise<string> {
|
|
146
151
|
const { createPackage } = clients.npm;
|
|
147
152
|
return createPackage(target);
|
|
148
153
|
}
|
|
149
154
|
|
|
150
|
-
export function
|
|
155
|
+
export function findNpmTarball(packageRef: string): Promise<string> {
|
|
151
156
|
const { findTarball } = clients.npm;
|
|
152
157
|
return findTarball(packageRef);
|
|
153
158
|
}
|
|
@@ -404,7 +409,7 @@ export function makePiletExternals(
|
|
|
404
409
|
externals: Array<string>,
|
|
405
410
|
fromEmulator: boolean,
|
|
406
411
|
piralInfo: any,
|
|
407
|
-
) {
|
|
412
|
+
): Array<string> {
|
|
408
413
|
if (fromEmulator) {
|
|
409
414
|
const { sharedDependencies = makeExternals(dependencies, externals, true) } = piralInfo;
|
|
410
415
|
return sharedDependencies;
|
package/src/common/pack.test.ts
CHANGED
package/src/common/pack.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve, join } from 'path';
|
|
2
2
|
import { log, progress, fail } from './log';
|
|
3
3
|
import { readJson, move } from './io';
|
|
4
|
-
import {
|
|
4
|
+
import { createNpmPackage } from './npm';
|
|
5
5
|
import { ForceOverwrite } from './enums';
|
|
6
6
|
|
|
7
7
|
async function getFile(root: string, name: string, dest: string) {
|
|
@@ -38,7 +38,7 @@ export async function createPiletPackage(baseDir: string, source: string, target
|
|
|
38
38
|
|
|
39
39
|
progress(`Packing pilet in ${dest} ...`);
|
|
40
40
|
log('generalDebug_0003', 'Creating package ...');
|
|
41
|
-
await
|
|
41
|
+
await createNpmPackage(root);
|
|
42
42
|
log('generalDebug_0003', 'Successfully created package.');
|
|
43
43
|
const name = `${pckg.name}-${pckg.version}.tgz`.replace(/@/g, '').replace(/\//g, '-');
|
|
44
44
|
log('generalDebug_0003', `Assumed package name "${name}".`);
|