piral-cli 0.15.0-beta.4630 → 0.15.0-beta.4670
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 +17 -0
- package/lib/apps/build-pilet.js +6 -5
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.js +7 -6
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.js +130 -109
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.js +58 -52
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/publish-pilet.js +3 -3
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/upgrade-pilet.js +5 -8
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/build/run-build-pilet.js +4 -4
- package/lib/build/run-build-pilet.js.map +1 -1
- package/lib/build/run-build-piral.js +3 -3
- package/lib/build/run-build-piral.js.map +1 -1
- package/lib/build/run-debug-mono-piral.js +3 -3
- package/lib/build/run-debug-mono-piral.js.map +1 -1
- package/lib/build/run-debug-pilet.js +4 -4
- package/lib/build/run-debug-pilet.js.map +1 -1
- package/lib/build/run-debug-piral.js +3 -3
- package/lib/build/run-debug-piral.js.map +1 -1
- package/lib/common/declaration.js +2 -0
- package/lib/common/declaration.js.map +1 -1
- package/lib/common/envs.js +7 -4
- package/lib/common/envs.js.map +1 -1
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.js +2 -0
- package/lib/common/index.js.map +1 -1
- package/lib/common/package.d.ts +0 -4
- package/lib/common/package.js +5 -7
- package/lib/common/package.js.map +1 -1
- package/lib/common/watcher.d.ts +5 -0
- package/lib/common/watcher.js +21 -0
- package/lib/common/watcher.js.map +1 -0
- package/lib/external/index.js +274 -274
- package/lib/types/public.d.ts +7 -7
- package/package.json +3 -3
- package/src/apps/build-pilet.ts +7 -5
- package/src/apps/build-piral.ts +7 -6
- package/src/apps/debug-pilet.ts +179 -146
- package/src/apps/debug-piral.ts +69 -61
- package/src/apps/publish-pilet.ts +3 -3
- package/src/apps/upgrade-pilet.ts +7 -9
- package/src/build/run-build-pilet.ts +4 -4
- package/src/build/run-build-piral.ts +3 -3
- package/src/build/run-debug-mono-piral.ts +3 -3
- package/src/build/run-debug-pilet.ts +5 -4
- package/src/build/run-debug-piral.ts +3 -3
- package/src/common/declaration.ts +2 -0
- package/src/common/envs.ts +6 -4
- package/src/common/index.ts +2 -0
- package/src/common/package.ts +5 -5
- package/src/common/watcher.ts +24 -0
- package/src/types/public.ts +7 -7
|
@@ -138,12 +138,12 @@ async function getFiles(
|
|
|
138
138
|
const { root, piletPackage, importmap, peerDependencies, peerModules, apps } = await retrievePiletData(
|
|
139
139
|
targetDir,
|
|
140
140
|
);
|
|
141
|
-
const
|
|
141
|
+
const piralInstances = apps.map((m) => m.appPackage.name);
|
|
142
142
|
const { main = 'dist/index.js', name = 'pilet' } = piletPackage;
|
|
143
143
|
const dest = resolve(root, main);
|
|
144
144
|
const outDir = dirname(dest);
|
|
145
145
|
const outFile = basename(dest);
|
|
146
|
-
const externals = combinePiletExternals(
|
|
146
|
+
const externals = combinePiletExternals(piralInstances, peerDependencies, peerModules, importmap);
|
|
147
147
|
progress('Triggering pilet build ...');
|
|
148
148
|
|
|
149
149
|
if (fresh) {
|
|
@@ -156,7 +156,7 @@ async function getFiles(
|
|
|
156
156
|
await callPiletBuild(
|
|
157
157
|
{
|
|
158
158
|
root,
|
|
159
|
-
|
|
159
|
+
piralInstances,
|
|
160
160
|
optimizeModules: false,
|
|
161
161
|
sourceMaps: true,
|
|
162
162
|
contentHash: true,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { LogLevels, NpmClientType } from '../types';
|
|
3
3
|
import {
|
|
4
|
-
readJson,
|
|
5
4
|
installNpmPackage,
|
|
6
5
|
checkExistingDirectory,
|
|
7
6
|
patchPiletPackage,
|
|
@@ -24,6 +23,7 @@ import {
|
|
|
24
23
|
getPiralPath,
|
|
25
24
|
isMonorepoPackageRef,
|
|
26
25
|
getPiletScaffoldData,
|
|
26
|
+
retrievePiletData,
|
|
27
27
|
} from '../common';
|
|
28
28
|
|
|
29
29
|
export interface UpgradePiletOptions {
|
|
@@ -99,11 +99,11 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const npmClient = await determineNpmClient(root, defaultNpmClient);
|
|
102
|
-
const
|
|
103
|
-
const { devDependencies = {}, dependencies = {},
|
|
102
|
+
const { apps, piletPackage } = await retrievePiletData(root);
|
|
103
|
+
const { devDependencies = {}, dependencies = {}, source } = piletPackage;
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
const sourceName =
|
|
105
|
+
for (const { appPackage } of apps) {
|
|
106
|
+
const sourceName = appPackage.name;
|
|
107
107
|
const language = /\.jsx?$/.test(source) ? 'js' : 'ts';
|
|
108
108
|
|
|
109
109
|
if (!sourceName || typeof sourceName !== 'string') {
|
|
@@ -170,9 +170,7 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
|
|
|
170
170
|
log('generalDebug_0003', `Run: ${postUpgrade}`);
|
|
171
171
|
await runScript(postUpgrade, root);
|
|
172
172
|
}
|
|
173
|
-
|
|
174
|
-
logDone('Pilet upgraded successfully!');
|
|
175
|
-
} else {
|
|
176
|
-
fail('invalidPiletPackage_0041');
|
|
177
173
|
}
|
|
174
|
+
|
|
175
|
+
logDone('Pilet upgraded successfully!');
|
|
178
176
|
}
|
|
@@ -5,7 +5,7 @@ let handler: PiletBuildHandler;
|
|
|
5
5
|
|
|
6
6
|
function run(
|
|
7
7
|
root: string,
|
|
8
|
-
|
|
8
|
+
piralInstances: Array<string>,
|
|
9
9
|
sourceMaps: boolean,
|
|
10
10
|
contentHash: boolean,
|
|
11
11
|
minify: boolean,
|
|
@@ -21,13 +21,13 @@ function run(
|
|
|
21
21
|
) {
|
|
22
22
|
setStandardEnvs({
|
|
23
23
|
production: true,
|
|
24
|
-
|
|
24
|
+
piralInstances,
|
|
25
25
|
root,
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
return handler.create({
|
|
29
29
|
root,
|
|
30
|
-
|
|
30
|
+
piralInstances,
|
|
31
31
|
entryModule,
|
|
32
32
|
targetDir,
|
|
33
33
|
outDir,
|
|
@@ -54,7 +54,7 @@ process.on('message', async (msg) => {
|
|
|
54
54
|
case 'start':
|
|
55
55
|
const bundler = await run(
|
|
56
56
|
process.cwd(),
|
|
57
|
-
msg.
|
|
57
|
+
msg.piralInstances,
|
|
58
58
|
msg.sourceMaps,
|
|
59
59
|
msg.contentHash,
|
|
60
60
|
msg.minify,
|
|
@@ -5,7 +5,7 @@ let handler: PiralBuildHandler;
|
|
|
5
5
|
|
|
6
6
|
function run(
|
|
7
7
|
root: string,
|
|
8
|
-
|
|
8
|
+
piralInstances: Array<string>,
|
|
9
9
|
emulator: boolean,
|
|
10
10
|
standalone: boolean,
|
|
11
11
|
sourceMaps: boolean,
|
|
@@ -25,7 +25,7 @@ function run(
|
|
|
25
25
|
publicPath: publicUrl,
|
|
26
26
|
debugPiral: emulator,
|
|
27
27
|
debugPilet: emulator || standalone,
|
|
28
|
-
|
|
28
|
+
piralInstances,
|
|
29
29
|
dependencies: externals,
|
|
30
30
|
});
|
|
31
31
|
|
|
@@ -56,7 +56,7 @@ process.on('message', async (msg) => {
|
|
|
56
56
|
case 'start':
|
|
57
57
|
const bundler = await run(
|
|
58
58
|
process.cwd(),
|
|
59
|
-
msg.
|
|
59
|
+
msg.piralInstances,
|
|
60
60
|
msg.emulator,
|
|
61
61
|
msg.standalone,
|
|
62
62
|
msg.sourceMaps,
|
|
@@ -8,7 +8,7 @@ function run(
|
|
|
8
8
|
root: string,
|
|
9
9
|
outFile: string,
|
|
10
10
|
outDir: string,
|
|
11
|
-
|
|
11
|
+
piralInstances: Array<string>,
|
|
12
12
|
hmr: boolean,
|
|
13
13
|
externals: Array<string>,
|
|
14
14
|
publicUrl: string,
|
|
@@ -19,7 +19,7 @@ function run(
|
|
|
19
19
|
progress(`Preparing supplied Piral instance ...`);
|
|
20
20
|
|
|
21
21
|
setStandardEnvs({
|
|
22
|
-
|
|
22
|
+
piralInstances,
|
|
23
23
|
dependencies: externals,
|
|
24
24
|
publicPath: publicUrl,
|
|
25
25
|
production: false,
|
|
@@ -59,7 +59,7 @@ process.on('message', async (msg) => {
|
|
|
59
59
|
root,
|
|
60
60
|
msg.outFile,
|
|
61
61
|
outDir,
|
|
62
|
-
msg.
|
|
62
|
+
msg.piralInstances,
|
|
63
63
|
true,
|
|
64
64
|
msg.externals,
|
|
65
65
|
msg.publicUrl,
|
|
@@ -15,7 +15,7 @@ function run(
|
|
|
15
15
|
targetDir: string,
|
|
16
16
|
outDir: string,
|
|
17
17
|
outFile: string,
|
|
18
|
-
|
|
18
|
+
piralInstances: Array<string>,
|
|
19
19
|
externals: Array<string>,
|
|
20
20
|
importmap: Array<SharedDependency>,
|
|
21
21
|
entryModule: string,
|
|
@@ -25,12 +25,13 @@ function run(
|
|
|
25
25
|
) {
|
|
26
26
|
setStandardEnvs({
|
|
27
27
|
production: false,
|
|
28
|
-
|
|
28
|
+
piralInstances,
|
|
29
29
|
root,
|
|
30
30
|
});
|
|
31
|
+
|
|
31
32
|
return handler.create({
|
|
32
33
|
root,
|
|
33
|
-
|
|
34
|
+
piralInstances,
|
|
34
35
|
entryModule,
|
|
35
36
|
targetDir,
|
|
36
37
|
outDir,
|
|
@@ -68,7 +69,7 @@ process.on('message', async (msg) => {
|
|
|
68
69
|
msg.targetDir,
|
|
69
70
|
msg.outDir,
|
|
70
71
|
msg.outFile,
|
|
71
|
-
msg.
|
|
72
|
+
msg.piralInstances,
|
|
72
73
|
msg.externals,
|
|
73
74
|
msg.importmap,
|
|
74
75
|
msg.entryModule,
|
|
@@ -8,7 +8,7 @@ function run(
|
|
|
8
8
|
root: string,
|
|
9
9
|
outFile: string,
|
|
10
10
|
outDir: string,
|
|
11
|
-
|
|
11
|
+
piralInstances: Array<string>,
|
|
12
12
|
hmr: boolean,
|
|
13
13
|
externals: Array<string>,
|
|
14
14
|
publicUrl: string,
|
|
@@ -21,7 +21,7 @@ function run(
|
|
|
21
21
|
debugPiral: true,
|
|
22
22
|
dependencies: externals,
|
|
23
23
|
publicPath: publicUrl,
|
|
24
|
-
|
|
24
|
+
piralInstances,
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
return handler.create({
|
|
@@ -61,7 +61,7 @@ process.on('message', async (msg) => {
|
|
|
61
61
|
root,
|
|
62
62
|
msg.outFile,
|
|
63
63
|
msg.outDir,
|
|
64
|
-
msg.
|
|
64
|
+
msg.piralInstances,
|
|
65
65
|
msg.hmr,
|
|
66
66
|
msg.externals,
|
|
67
67
|
msg.publicUrl,
|
|
@@ -124,6 +124,7 @@ export async function createPiletDeclaration(
|
|
|
124
124
|
types: [...types, ...files],
|
|
125
125
|
plugins: [createExcludePlugin([name])],
|
|
126
126
|
apis: [],
|
|
127
|
+
noModuleDeclaration: true,
|
|
127
128
|
imports: allowedImports,
|
|
128
129
|
logLevel,
|
|
129
130
|
logger: createLogger(),
|
|
@@ -149,6 +150,7 @@ export async function createPiralDeclaration(
|
|
|
149
150
|
files,
|
|
150
151
|
types: findDeclaredTypings(root),
|
|
151
152
|
apis: findPiralBaseApi(root),
|
|
153
|
+
noModuleDeclaration: true,
|
|
152
154
|
imports: externals,
|
|
153
155
|
logLevel,
|
|
154
156
|
logger: createLogger(),
|
package/src/common/envs.ts
CHANGED
|
@@ -47,12 +47,14 @@ export function setStandardEnvs(options: StandardEnvProps) {
|
|
|
47
47
|
process.env.NODE_ENV = 'development';
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
if (options.
|
|
51
|
-
process.env.PIRAL_INSTANCE = options.
|
|
50
|
+
if (Array.isArray(options.piralInstances) && options.piralInstances.length) {
|
|
51
|
+
process.env.PIRAL_INSTANCE = options.piralInstances.join(',');
|
|
52
|
+
} else {
|
|
53
|
+
options.piralInstances = [];
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
if (options.dependencies && options.dependencies.length) {
|
|
55
|
-
const excludedDependencies = [...frameworkLibs, options.
|
|
56
|
+
if (Array.isArray(options.dependencies) && options.dependencies.length) {
|
|
57
|
+
const excludedDependencies = [...frameworkLibs, ...options.piralInstances];
|
|
56
58
|
const dependencies = options.dependencies.filter((m) => !excludedDependencies.includes(m));
|
|
57
59
|
process.env.SHARED_DEPENDENCIES = dependencies.join(',');
|
|
58
60
|
} else {
|
package/src/common/index.ts
CHANGED
package/src/common/package.ts
CHANGED
|
@@ -574,7 +574,7 @@ export async function patchPiletPackage(
|
|
|
574
574
|
log('generalDebug_0003', `Succesfully patched the pilet.json.`);
|
|
575
575
|
}
|
|
576
576
|
|
|
577
|
-
|
|
577
|
+
async function getPiletPackage(
|
|
578
578
|
root: string,
|
|
579
579
|
name: string,
|
|
580
580
|
version: string,
|
|
@@ -582,11 +582,13 @@ export async function getPiletPackage(
|
|
|
582
582
|
fromEmulator: boolean,
|
|
583
583
|
newInfo?: { language: SourceLanguage; bundler: string },
|
|
584
584
|
) {
|
|
585
|
+
const { piralCLI = { version: cliVersion } } = piralInfo;
|
|
585
586
|
const { externals, packageOverrides, ...info } = getPiletsInfo(piralInfo);
|
|
586
587
|
const piralDependencies = {
|
|
587
588
|
...piralInfo.devDependencies,
|
|
588
589
|
...piralInfo.dependencies,
|
|
589
590
|
};
|
|
591
|
+
const toolVersion = piralCLI.version;
|
|
590
592
|
const typeDependencies = newInfo ? getDevDependencies(newInfo.language) : {};
|
|
591
593
|
const scripts = newInfo
|
|
592
594
|
? {
|
|
@@ -617,13 +619,11 @@ export async function getPiletPackage(
|
|
|
617
619
|
return deps;
|
|
618
620
|
}, {}),
|
|
619
621
|
[name]: `${version || piralInfo.version}`,
|
|
622
|
+
['piral-cli']: toolVersion,
|
|
620
623
|
};
|
|
621
624
|
|
|
622
625
|
if (newInfo) {
|
|
623
|
-
|
|
624
|
-
const version = `^${cliVersion}`;
|
|
625
|
-
devDependencies['piral-cli'] = version;
|
|
626
|
-
await appendBundler(devDependencies, bundler, version);
|
|
626
|
+
await appendBundler(devDependencies, newInfo.bundler, toolVersion);
|
|
627
627
|
}
|
|
628
628
|
|
|
629
629
|
return deepMerge(packageOverrides, {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface WatcherContext {
|
|
2
|
+
onClean(dispose: () => void): void;
|
|
3
|
+
watch(file: string): void;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function watcherTask(cb: (watcherContext: WatcherContext) => Promise<void>) {
|
|
7
|
+
return new Promise<void>((resolve, reject) => {
|
|
8
|
+
const disposers: Array<() => void> = [];
|
|
9
|
+
const context: WatcherContext = {
|
|
10
|
+
onClean(dispose) {
|
|
11
|
+
disposers.push(dispose);
|
|
12
|
+
},
|
|
13
|
+
watch(file) {},
|
|
14
|
+
};
|
|
15
|
+
cb(context).then(
|
|
16
|
+
() => {
|
|
17
|
+
resolve();
|
|
18
|
+
},
|
|
19
|
+
(err) => {
|
|
20
|
+
reject(err);
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
}
|
package/src/types/public.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface BaseBundleParameters {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export interface DebugPiralParameters extends BaseBundleParameters {
|
|
70
|
-
|
|
70
|
+
piralInstances: Array<string>;
|
|
71
71
|
hmr: boolean;
|
|
72
72
|
externals: Array<string>;
|
|
73
73
|
publicUrl: string;
|
|
@@ -78,7 +78,7 @@ export interface DebugPiralParameters extends BaseBundleParameters {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export interface WatchPiralParameters extends BaseBundleParameters {
|
|
81
|
-
|
|
81
|
+
piralInstances: Array<string>;
|
|
82
82
|
externals: Array<string>;
|
|
83
83
|
publicUrl: string;
|
|
84
84
|
entryFiles: string;
|
|
@@ -86,7 +86,7 @@ export interface WatchPiralParameters extends BaseBundleParameters {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export interface BuildPiralParameters extends BaseBundleParameters {
|
|
89
|
-
|
|
89
|
+
piralInstances: Array<string>;
|
|
90
90
|
emulator: boolean;
|
|
91
91
|
standalone: boolean;
|
|
92
92
|
sourceMaps: boolean;
|
|
@@ -101,7 +101,7 @@ export interface BuildPiralParameters extends BaseBundleParameters {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
export interface DebugPiletParameters extends BaseBundleParameters {
|
|
104
|
-
|
|
104
|
+
piralInstances: Array<string>;
|
|
105
105
|
hmr: boolean;
|
|
106
106
|
externals: Array<string>;
|
|
107
107
|
importmap: Array<SharedDependency>;
|
|
@@ -114,7 +114,7 @@ export interface DebugPiletParameters extends BaseBundleParameters {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export interface BuildPiletParameters extends BaseBundleParameters {
|
|
117
|
-
|
|
117
|
+
piralInstances: Array<string>;
|
|
118
118
|
sourceMaps: boolean;
|
|
119
119
|
contentHash: boolean;
|
|
120
120
|
minify: boolean;
|
|
@@ -177,7 +177,7 @@ export interface PiralBuildHandler {
|
|
|
177
177
|
export interface PiletBuildHandler {
|
|
178
178
|
create(config: {
|
|
179
179
|
root: string;
|
|
180
|
-
|
|
180
|
+
piralInstances: Array<string>;
|
|
181
181
|
entryModule: string;
|
|
182
182
|
targetDir: string;
|
|
183
183
|
outDir: string;
|
|
@@ -241,6 +241,6 @@ export interface StandardEnvProps {
|
|
|
241
241
|
debugPilet?: boolean;
|
|
242
242
|
root: string;
|
|
243
243
|
publicPath?: string;
|
|
244
|
-
|
|
244
|
+
piralInstances?: Array<string>;
|
|
245
245
|
dependencies?: Array<string>;
|
|
246
246
|
}
|