piral-cli 1.5.0-beta.6684 → 1.5.0-beta.6690
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api.d.ts +1 -2
- package/lib/api.js +1 -18
- package/lib/api.js.map +1 -1
- package/lib/apps/build-pilet.js +14 -37
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.js +29 -104
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.js +3 -2
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/publish-pilet.d.ts +11 -2
- package/lib/apps/publish-pilet.js +16 -43
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/publish-piral.d.ts +37 -7
- package/lib/apps/publish-piral.js +62 -47
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/commands.js +31 -12
- package/lib/commands.js.map +1 -1
- package/lib/common/constants.d.ts +7 -0
- package/lib/common/constants.js +8 -1
- package/lib/common/constants.js.map +1 -1
- package/lib/common/emulator.js +1 -1
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/http.d.ts +3 -3
- package/lib/common/http.js.map +1 -1
- package/lib/common/index.d.ts +3 -0
- package/lib/common/index.js +3 -0
- package/lib/common/index.js.map +1 -1
- package/lib/common/interactive.d.ts +2 -2
- package/lib/common/pilet.d.ts +31 -0
- package/lib/common/pilet.js +79 -0
- package/lib/common/pilet.js.map +1 -0
- package/lib/common/piral.d.ts +35 -0
- package/lib/common/piral.js +125 -0
- package/lib/common/piral.js.map +1 -0
- package/lib/common/release.d.ts +4 -0
- package/lib/common/release.js +43 -0
- package/lib/common/release.js.map +1 -0
- package/lib/helpers.d.ts +2 -2
- package/lib/helpers.js.map +1 -1
- package/lib/messages.d.ts +19 -0
- package/lib/messages.js +23 -1
- package/lib/messages.js.map +1 -1
- package/lib/types/public.d.ts +2 -3
- package/package.json +2 -2
- package/src/api.ts +0 -17
- package/src/apps/build-pilet.ts +17 -59
- package/src/apps/build-piral.ts +37 -140
- package/src/apps/debug-pilet.ts +5 -4
- package/src/apps/publish-pilet.ts +35 -62
- package/src/apps/publish-piral.ts +150 -80
- package/src/commands.ts +34 -15
- package/src/common/constants.ts +7 -0
- package/src/common/emulator.ts +2 -2
- package/src/common/http.ts +3 -3
- package/src/common/index.ts +3 -0
- package/src/common/interactive.ts +2 -2
- package/src/common/pilet.ts +140 -0
- package/src/common/piral.ts +227 -0
- package/src/common/release.ts +62 -0
- package/src/helpers.ts +2 -2
- package/src/messages.ts +22 -0
- package/src/types/public.ts +2 -3
- package/lib/release.d.ts +0 -7
- package/lib/release.js +0 -67
- package/lib/release.js.map +0 -1
- package/src/release.ts +0 -91
package/src/apps/build-pilet.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
validateSharedDependencies,
|
|
28
28
|
defaultSchemaVersion,
|
|
29
29
|
flattenExternals,
|
|
30
|
+
triggerBuildPilet,
|
|
30
31
|
} from '../common';
|
|
31
32
|
|
|
32
33
|
interface PiletData {
|
|
@@ -217,66 +218,23 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
|
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
const pilets = await concurrentWorkers(allEntries, concurrency, async (entryModule) => {
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const schemaVersion = originalSchemaVersion || schema || config.schemaVersion || defaultSchemaVersion;
|
|
224
|
-
const piralInstances = apps.map((m) => m.appPackage.name);
|
|
225
|
-
const externals = combinePiletExternals(piralInstances, peerDependencies, peerModules, importmap);
|
|
226
|
-
const dest = resolve(root, target);
|
|
227
|
-
const outDir = dirname(dest);
|
|
228
|
-
const outFile = basename(dest);
|
|
229
|
-
|
|
230
|
-
validateSharedDependencies(importmap);
|
|
231
|
-
|
|
232
|
-
if (fresh) {
|
|
233
|
-
progress('Removing output directory ...');
|
|
234
|
-
await removeDirectory(outDir);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
logInfo('Bundle pilet ...');
|
|
238
|
-
|
|
239
|
-
await hooks.beforeBuild?.({ root, outDir, importmap, entryModule, schemaVersion, piletPackage });
|
|
240
|
-
|
|
241
|
-
await callPiletBuild(
|
|
242
|
-
{
|
|
243
|
-
root,
|
|
244
|
-
piralInstances,
|
|
245
|
-
optimizeModules,
|
|
246
|
-
sourceMaps,
|
|
247
|
-
watch,
|
|
248
|
-
contentHash,
|
|
249
|
-
minify,
|
|
250
|
-
externals,
|
|
251
|
-
targetDir,
|
|
252
|
-
importmap,
|
|
253
|
-
outFile,
|
|
254
|
-
outDir,
|
|
255
|
-
entryModule: `./${relative(root, entryModule)}`,
|
|
256
|
-
logLevel,
|
|
257
|
-
version: schemaVersion,
|
|
258
|
-
ignored,
|
|
259
|
-
_,
|
|
260
|
-
},
|
|
221
|
+
const { piletPackage, root, outDir, apps, outFile, dest } = await triggerBuildPilet({
|
|
222
|
+
_,
|
|
223
|
+
app,
|
|
261
224
|
bundlerName,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
ForceOverwrite.yes,
|
|
276
|
-
logLevel,
|
|
277
|
-
);
|
|
278
|
-
await hooks.afterDeclaration?.({ root, outDir, entryModule, piletPackage });
|
|
279
|
-
}
|
|
225
|
+
contentHash,
|
|
226
|
+
entryModule,
|
|
227
|
+
fresh,
|
|
228
|
+
logLevel,
|
|
229
|
+
minify,
|
|
230
|
+
optimizeModules,
|
|
231
|
+
originalSchemaVersion,
|
|
232
|
+
sourceMaps,
|
|
233
|
+
target,
|
|
234
|
+
watch,
|
|
235
|
+
hooks,
|
|
236
|
+
declaration,
|
|
237
|
+
});
|
|
280
238
|
|
|
281
239
|
logDone(`Pilet "${piletPackage.name}" built successfully!`);
|
|
282
240
|
|
package/src/apps/build-piral.ts
CHANGED
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
import { join, resolve } from 'path';
|
|
2
|
-
import { callPiralBuild } from '../bundler';
|
|
3
2
|
import { LogLevels, PiralBuildType } from '../types';
|
|
4
3
|
import {
|
|
5
4
|
retrievePiletsInfo,
|
|
6
5
|
retrievePiralRoot,
|
|
7
6
|
removeDirectory,
|
|
8
|
-
logDone,
|
|
9
7
|
checkCliCompatibility,
|
|
10
8
|
progress,
|
|
11
9
|
setLogLevel,
|
|
12
10
|
logReset,
|
|
13
|
-
createEmulatorSources,
|
|
14
|
-
log,
|
|
15
|
-
logInfo,
|
|
16
|
-
runScript,
|
|
17
|
-
packageEmulator,
|
|
18
11
|
normalizePublicUrl,
|
|
19
12
|
getDestination,
|
|
20
13
|
validateSharedDependencies,
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
allName,
|
|
15
|
+
emulatorPackageName,
|
|
16
|
+
emulatorName,
|
|
17
|
+
emulatorWebsiteName,
|
|
18
|
+
emulatorSourcesName,
|
|
19
|
+
releaseName,
|
|
20
|
+
triggerBuildEmulator,
|
|
21
|
+
triggerBuildShell,
|
|
23
22
|
} from '../common';
|
|
24
23
|
|
|
25
|
-
const allName = 'all';
|
|
26
|
-
const releaseName = 'release';
|
|
27
|
-
const emulatorName = 'emulator';
|
|
28
|
-
const emulatorPackageName = 'package';
|
|
29
|
-
const emulatorSourcesName = 'sources';
|
|
30
|
-
const emulatorWebsiteName = 'website';
|
|
31
|
-
|
|
32
24
|
export interface BuildPiralOptions {
|
|
33
25
|
/**
|
|
34
26
|
* The location of the piral
|
|
@@ -130,18 +122,6 @@ export const buildPiralDefaults: BuildPiralOptions = {
|
|
|
130
122
|
optimizeModules: false,
|
|
131
123
|
};
|
|
132
124
|
|
|
133
|
-
async function runLifecycle(root: string, scripts: Record<string, string>, type: string) {
|
|
134
|
-
const script = scripts?.[type];
|
|
135
|
-
|
|
136
|
-
if (script) {
|
|
137
|
-
log('generalDebug_0003', `Running "${type}" ("${script}") ...`);
|
|
138
|
-
await runScript(script, root);
|
|
139
|
-
log('generalDebug_0003', `Finished running "${type}".`);
|
|
140
|
-
} else {
|
|
141
|
-
log('generalDebug_0003', `No script for "${type}" found ...`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
125
|
export async function buildPiral(baseDir = process.cwd(), options: BuildPiralOptions = {}) {
|
|
146
126
|
const {
|
|
147
127
|
entry = buildPiralDefaults.entry,
|
|
@@ -193,139 +173,56 @@ export async function buildPiral(baseDir = process.cwd(), options: BuildPiralOpt
|
|
|
193
173
|
|
|
194
174
|
// only applies to an explicit emulator target (e.g., "emulator-website") or to "all" / "emulator" with the setting from the piral.json
|
|
195
175
|
if ([emulatorSourcesName, emulatorPackageName, emulatorWebsiteName].includes(emulatorType)) {
|
|
196
|
-
const emulatorPublicUrl = '/';
|
|
197
176
|
const targetDir = useSubdir ? join(dest.outDir, emulatorName) : dest.outDir;
|
|
198
|
-
const appDir = emulatorType !== emulatorWebsiteName ? join(targetDir, 'app') : targetDir;
|
|
199
|
-
progress('Starting emulator build ...');
|
|
200
|
-
|
|
201
|
-
// since we create this anyway let's just pretend we want to have it clean!
|
|
202
|
-
await removeDirectory(targetDir);
|
|
203
|
-
|
|
204
|
-
await hooks.beforeBuild?.({ root, publicUrl: emulatorPublicUrl, externals, entryFiles, targetDir, piralInstances });
|
|
205
177
|
|
|
206
|
-
|
|
207
|
-
const {
|
|
208
|
-
dir: outDir,
|
|
209
|
-
name: outFile,
|
|
210
|
-
hash,
|
|
211
|
-
} = await callPiralBuild(
|
|
212
|
-
{
|
|
213
|
-
root,
|
|
214
|
-
piralInstances,
|
|
215
|
-
emulator: true,
|
|
216
|
-
standalone: false,
|
|
217
|
-
optimizeModules,
|
|
218
|
-
sourceMaps,
|
|
219
|
-
watch,
|
|
220
|
-
contentHash,
|
|
221
|
-
minify: false,
|
|
222
|
-
externals: flattenExternals(externals),
|
|
223
|
-
publicUrl: emulatorPublicUrl,
|
|
224
|
-
entryFiles,
|
|
225
|
-
logLevel,
|
|
226
|
-
ignored,
|
|
227
|
-
outDir: appDir,
|
|
228
|
-
outFile: dest.outFile,
|
|
229
|
-
_,
|
|
230
|
-
},
|
|
231
|
-
bundlerName,
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
await hooks.afterBuild?.({
|
|
178
|
+
await triggerBuildEmulator({
|
|
235
179
|
root,
|
|
236
|
-
|
|
180
|
+
logLevel,
|
|
181
|
+
bundlerName,
|
|
182
|
+
emulatorType,
|
|
183
|
+
hooks,
|
|
184
|
+
targetDir,
|
|
185
|
+
ignored,
|
|
237
186
|
externals,
|
|
238
187
|
entryFiles,
|
|
239
|
-
targetDir,
|
|
240
188
|
piralInstances,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
189
|
+
optimizeModules,
|
|
190
|
+
sourceMaps,
|
|
191
|
+
watch,
|
|
192
|
+
scripts,
|
|
193
|
+
contentHash,
|
|
194
|
+
outFile: dest.outFile,
|
|
195
|
+
_,
|
|
244
196
|
});
|
|
245
197
|
|
|
246
|
-
await runLifecycle(root, scripts, 'piral:postbuild');
|
|
247
|
-
await runLifecycle(root, scripts, `piral:postbuild-${emulatorName}`);
|
|
248
|
-
|
|
249
|
-
await hooks.beforeEmulator?.({ root, externals, targetDir, outDir });
|
|
250
|
-
|
|
251
|
-
let rootDir = root;
|
|
252
|
-
|
|
253
|
-
switch (emulatorType) {
|
|
254
|
-
case emulatorPackageName:
|
|
255
|
-
rootDir = await createEmulatorSources(root, externals, outDir, outFile, logLevel);
|
|
256
|
-
await hooks.beforePackage?.({ root, externals, targetDir, outDir, rootDir });
|
|
257
|
-
await packageEmulator(rootDir);
|
|
258
|
-
await hooks.afterPackage?.({ root, externals, targetDir, outDir, rootDir });
|
|
259
|
-
break;
|
|
260
|
-
case emulatorSourcesName:
|
|
261
|
-
rootDir = await createEmulatorSources(root, externals, outDir, outFile, logLevel);
|
|
262
|
-
logDone(`Emulator package sources available in "${rootDir}".`);
|
|
263
|
-
break;
|
|
264
|
-
case emulatorWebsiteName:
|
|
265
|
-
rootDir = await createEmulatorWebsite(root, externals, outDir, outFile, logLevel);
|
|
266
|
-
logDone(`Emulator website available in "${rootDir}".`);
|
|
267
|
-
break;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
await hooks.afterEmulator?.({ root, externals, targetDir, outDir, rootDir });
|
|
271
198
|
logReset();
|
|
272
199
|
}
|
|
273
200
|
|
|
274
201
|
// either 'release' or 'all'
|
|
275
202
|
if (type === releaseName || type === allName) {
|
|
276
203
|
const targetDir = useSubdir ? join(dest.outDir, releaseName) : dest.outDir;
|
|
277
|
-
progress('Starting release build ...');
|
|
278
|
-
|
|
279
|
-
// since we create this anyway let's just pretend we want to have it clean!
|
|
280
|
-
await removeDirectory(targetDir);
|
|
281
|
-
|
|
282
|
-
logInfo(`Bundle ${releaseName} ...`);
|
|
283
204
|
|
|
284
|
-
await
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
dir: outDir,
|
|
288
|
-
name: outFile,
|
|
289
|
-
hash,
|
|
290
|
-
} = await callPiralBuild(
|
|
291
|
-
{
|
|
292
|
-
root,
|
|
293
|
-
piralInstances,
|
|
294
|
-
emulator: false,
|
|
295
|
-
standalone: false,
|
|
296
|
-
optimizeModules,
|
|
297
|
-
sourceMaps,
|
|
298
|
-
watch,
|
|
299
|
-
contentHash,
|
|
300
|
-
minify,
|
|
301
|
-
externals: flattenExternals(externals),
|
|
302
|
-
publicUrl,
|
|
303
|
-
outFile: dest.outFile,
|
|
304
|
-
outDir: targetDir,
|
|
305
|
-
entryFiles,
|
|
306
|
-
logLevel,
|
|
307
|
-
ignored,
|
|
308
|
-
_,
|
|
309
|
-
},
|
|
205
|
+
await triggerBuildShell({
|
|
206
|
+
targetDir,
|
|
207
|
+
logLevel,
|
|
310
208
|
bundlerName,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
await hooks.afterBuild?.({
|
|
314
|
-
root,
|
|
315
|
-
publicUrl,
|
|
209
|
+
contentHash,
|
|
316
210
|
externals,
|
|
211
|
+
ignored,
|
|
212
|
+
minify,
|
|
213
|
+
optimizeModules,
|
|
214
|
+
publicUrl,
|
|
215
|
+
outFile: dest.outFile,
|
|
216
|
+
root,
|
|
217
|
+
sourceMaps,
|
|
218
|
+
watch,
|
|
219
|
+
hooks,
|
|
317
220
|
entryFiles,
|
|
318
|
-
targetDir,
|
|
319
221
|
piralInstances,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
hash,
|
|
222
|
+
scripts,
|
|
223
|
+
_,
|
|
323
224
|
});
|
|
324
225
|
|
|
325
|
-
await runLifecycle(root, scripts, 'piral:postbuild');
|
|
326
|
-
await runLifecycle(root, scripts, `piral:postbuild-${releaseName}`);
|
|
327
|
-
|
|
328
|
-
logDone(`Files for publication available in "${outDir}".`);
|
|
329
226
|
logReset();
|
|
330
227
|
}
|
|
331
228
|
|
package/src/apps/debug-pilet.ts
CHANGED
|
@@ -275,9 +275,6 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
|
|
|
275
275
|
|
|
276
276
|
await hooks.beforeBuild?.({ root, publicUrl, importmap, entryModule, schemaVersion });
|
|
277
277
|
|
|
278
|
-
watcherContext.watch(join(root, packageJson));
|
|
279
|
-
watcherContext.watch(join(root, piletJson));
|
|
280
|
-
|
|
281
278
|
const bundler = await callPiletDebug(
|
|
282
279
|
{
|
|
283
280
|
root,
|
|
@@ -298,6 +295,10 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
|
|
|
298
295
|
bundlerName,
|
|
299
296
|
);
|
|
300
297
|
|
|
298
|
+
watcherContext.watch(join(root, packageJson));
|
|
299
|
+
watcherContext.watch(join(root, piletJson));
|
|
300
|
+
watcherContext.onClean(() => bundler.stop());
|
|
301
|
+
|
|
301
302
|
bundler.on((args) => {
|
|
302
303
|
hooks.afterBuild?.({
|
|
303
304
|
...args,
|
|
@@ -342,7 +343,7 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
|
|
|
342
343
|
await Promise.all(
|
|
343
344
|
appInstances.sort(byPort).map(async ([appDir, appPort], i) => {
|
|
344
345
|
const platform = configurePlatform();
|
|
345
|
-
|
|
346
|
+
|
|
346
347
|
if (networks.length === i) {
|
|
347
348
|
networks.push({
|
|
348
349
|
port: appPort || originalPort + i,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { relative, dirname, basename, resolve
|
|
2
|
-
import {
|
|
3
|
-
import { LogLevels, PiletSchemaVersion, PiletPublishSource, PiletPublishScheme } from '../types';
|
|
1
|
+
import { relative, dirname, basename, resolve } from 'path';
|
|
2
|
+
import { LogLevels, PiletSchemaVersion, PiletPublishSource, PublishScheme } from '../types';
|
|
4
3
|
import {
|
|
5
4
|
postFile,
|
|
6
5
|
readBinary,
|
|
@@ -16,11 +15,7 @@ import {
|
|
|
16
15
|
findNpmTarball,
|
|
17
16
|
downloadFile,
|
|
18
17
|
matchAnyPilet,
|
|
19
|
-
|
|
20
|
-
removeDirectory,
|
|
21
|
-
logInfo,
|
|
22
|
-
combinePiletExternals,
|
|
23
|
-
defaultSchemaVersion,
|
|
18
|
+
triggerBuildPilet,
|
|
24
19
|
} from '../common';
|
|
25
20
|
|
|
26
21
|
export interface PublishPiletOptions {
|
|
@@ -92,12 +87,22 @@ export interface PublishPiletOptions {
|
|
|
92
87
|
/**
|
|
93
88
|
* Sets the authorization scheme to use.
|
|
94
89
|
*/
|
|
95
|
-
mode?:
|
|
90
|
+
mode?: PublishScheme;
|
|
96
91
|
|
|
97
92
|
/**
|
|
98
93
|
* Additional arguments for a specific bundler.
|
|
99
94
|
*/
|
|
100
95
|
_?: Record<string, any>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Hooks to be triggered at various stages.
|
|
99
|
+
*/
|
|
100
|
+
hooks?: {
|
|
101
|
+
beforeBuild?(e: any): Promise<void>;
|
|
102
|
+
afterBuild?(e: any): Promise<void>;
|
|
103
|
+
beforeDeclaration?(e: any): Promise<void>;
|
|
104
|
+
afterDeclaration?(e: any): Promise<void>;
|
|
105
|
+
};
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
export const publishPiletDefaults: PublishPiletOptions = {
|
|
@@ -114,11 +119,6 @@ export const publishPiletDefaults: PublishPiletOptions = {
|
|
|
114
119
|
interactive: false,
|
|
115
120
|
};
|
|
116
121
|
|
|
117
|
-
function isSubDir(parent: string, dir: string) {
|
|
118
|
-
const rel = relative(parent, dir);
|
|
119
|
-
return rel && !rel.startsWith('..') && !isAbsolute(rel);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
122
|
async function getFiles(
|
|
123
123
|
baseDir: string,
|
|
124
124
|
sources: Array<string>,
|
|
@@ -129,6 +129,7 @@ async function getFiles(
|
|
|
129
129
|
bundlerName: string,
|
|
130
130
|
_?: Record<string, any>,
|
|
131
131
|
ca?: Buffer,
|
|
132
|
+
hooks?: PublishPiletOptions['hooks'],
|
|
132
133
|
): Promise<Array<string>> {
|
|
133
134
|
if (fresh) {
|
|
134
135
|
log('generalDebug_0003', 'Detected "--fresh". Trying to resolve the package.json.');
|
|
@@ -140,54 +141,25 @@ async function getFiles(
|
|
|
140
141
|
|
|
141
142
|
return await Promise.all(
|
|
142
143
|
allEntries.map(async (entryModule) => {
|
|
143
|
-
const targetDir = dirname(entryModule);
|
|
144
|
-
|
|
145
144
|
progress('Triggering pilet build ...');
|
|
146
|
-
const { root, piletPackage, importmap, peerDependencies, peerModules, apps, schema } = await retrievePiletData(
|
|
147
|
-
targetDir,
|
|
148
|
-
);
|
|
149
|
-
const schemaVersion = originalSchemaVersion || schema || config.schemaVersion || defaultSchemaVersion;
|
|
150
|
-
const piralInstances = apps.map((m) => m.appPackage.name);
|
|
151
|
-
const defaultOutput = 'dist/index.js';
|
|
152
|
-
const { main = defaultOutput, name = 'pilet' } = piletPackage;
|
|
153
|
-
const propDest = resolve(root, main);
|
|
154
|
-
const propDestDir = dirname(propDest);
|
|
155
|
-
log('generalDebug_0003', `Pilet "${name}" is supposed to generate artifact in "${propDest}".`);
|
|
156
|
-
const usePropDest = propDestDir !== root && propDestDir !== targetDir && isSubDir(root, propDest);
|
|
157
|
-
const dest = usePropDest ? propDest : resolve(root, defaultOutput);
|
|
158
|
-
log('generalDebug_0003', `Pilet "${name}" is generating artifact in "${dest}".`);
|
|
159
|
-
const outDir = dirname(dest);
|
|
160
|
-
const outFile = basename(dest);
|
|
161
|
-
const externals = combinePiletExternals(piralInstances, peerDependencies, peerModules, importmap);
|
|
162
|
-
log('generalDebug_0003', `Pilet "${name}" uses externals: ${externals.join(', ')}.`);
|
|
163
|
-
|
|
164
|
-
progress('Removing output directory ...');
|
|
165
|
-
await removeDirectory(outDir);
|
|
166
|
-
|
|
167
|
-
logInfo('Bundle pilet ...');
|
|
168
|
-
await callPiletBuild(
|
|
169
|
-
{
|
|
170
|
-
root,
|
|
171
|
-
piralInstances,
|
|
172
|
-
optimizeModules: false,
|
|
173
|
-
sourceMaps: true,
|
|
174
|
-
watch: false,
|
|
175
|
-
contentHash: true,
|
|
176
|
-
minify: true,
|
|
177
|
-
externals,
|
|
178
|
-
targetDir,
|
|
179
|
-
importmap,
|
|
180
|
-
outFile,
|
|
181
|
-
outDir,
|
|
182
|
-
entryModule: `./${relative(root, entryModule)}`,
|
|
183
|
-
logLevel,
|
|
184
|
-
version: schemaVersion,
|
|
185
|
-
ignored: [],
|
|
186
|
-
_,
|
|
187
|
-
},
|
|
188
|
-
bundlerName,
|
|
189
|
-
);
|
|
190
145
|
|
|
146
|
+
const { root, piletPackage } = await triggerBuildPilet({
|
|
147
|
+
_,
|
|
148
|
+
bundlerName,
|
|
149
|
+
entryModule,
|
|
150
|
+
fresh,
|
|
151
|
+
logLevel,
|
|
152
|
+
originalSchemaVersion,
|
|
153
|
+
watch: false,
|
|
154
|
+
optimizeModules: false,
|
|
155
|
+
sourceMaps: true,
|
|
156
|
+
declaration: true,
|
|
157
|
+
contentHash: true,
|
|
158
|
+
minify: true,
|
|
159
|
+
hooks,
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const name = piletPackage.name;
|
|
191
163
|
log('generalDebug_0003', `Pilet "${name}" built successfully!`);
|
|
192
164
|
progress('Triggering pilet pack ...');
|
|
193
165
|
|
|
@@ -237,6 +209,7 @@ export async function publishPilet(baseDir = process.cwd(), options: PublishPile
|
|
|
237
209
|
mode = publishPiletDefaults.mode,
|
|
238
210
|
interactive = publishPiletDefaults.interactive,
|
|
239
211
|
_ = {},
|
|
212
|
+
hooks = {},
|
|
240
213
|
bundlerName,
|
|
241
214
|
} = options;
|
|
242
215
|
const fullBase = resolve(process.cwd(), baseDir);
|
|
@@ -259,7 +232,7 @@ export async function publishPilet(baseDir = process.cwd(), options: PublishPile
|
|
|
259
232
|
|
|
260
233
|
log('generalDebug_0003', 'Getting the tgz files ...');
|
|
261
234
|
const sources = Array.isArray(source) ? source : [source];
|
|
262
|
-
const files = await getFiles(fullBase, sources, from, fresh, schemaVersion, logLevel, bundlerName, _, ca);
|
|
235
|
+
const files = await getFiles(fullBase, sources, from, fresh, schemaVersion, logLevel, bundlerName, _, ca, hooks);
|
|
263
236
|
const successfulUploads: Array<string> = [];
|
|
264
237
|
log('generalDebug_0003', 'Received available tgz files.');
|
|
265
238
|
|
|
@@ -275,7 +248,7 @@ export async function publishPilet(baseDir = process.cwd(), options: PublishPile
|
|
|
275
248
|
const content = await readBinary(fullBase, fileName);
|
|
276
249
|
|
|
277
250
|
if (content) {
|
|
278
|
-
progress(`Publishing "%s" ...`, file, url);
|
|
251
|
+
progress(`Publishing "%s" to "%s" ...`, file, url);
|
|
279
252
|
const result = await postFile(url, mode, apiKey, content, fields, headers, ca, interactive);
|
|
280
253
|
|
|
281
254
|
if (result.success) {
|