piral-cli 1.4.0-beta.6250 → 1.4.0-beta.6252
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.js +8 -17
- package/lib/api.js.map +1 -1
- package/lib/apps/add-piral-instance-pilet.js +20 -31
- package/lib/apps/add-piral-instance-pilet.js.map +1 -1
- package/lib/apps/build-pilet.js +139 -147
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.js +130 -144
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.js +107 -119
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.js +62 -70
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/declaration-piral.js +6 -17
- package/lib/apps/declaration-piral.js.map +1 -1
- package/lib/apps/new-pilet.js +71 -82
- package/lib/apps/new-pilet.js.map +1 -1
- package/lib/apps/new-piral.js +42 -53
- package/lib/apps/new-piral.js.map +1 -1
- package/lib/apps/pack-pilet.js +7 -18
- package/lib/apps/pack-pilet.js.map +1 -1
- package/lib/apps/publish-pilet.js +127 -141
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/publish-piral.js +48 -63
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/remove-piral-instance-pilet.js +30 -35
- package/lib/apps/remove-piral-instance-pilet.js.map +1 -1
- package/lib/apps/run-emulator-piral.js +49 -61
- package/lib/apps/run-emulator-piral.js.map +1 -1
- package/lib/apps/upgrade-pilet.js +64 -76
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/apps/upgrade-piral.js +31 -43
- package/lib/apps/upgrade-piral.js.map +1 -1
- package/lib/apps/validate-pilet.js +34 -45
- package/lib/apps/validate-pilet.js.map +1 -1
- package/lib/apps/validate-piral.js +29 -51
- package/lib/apps/validate-piral.js.map +1 -1
- package/lib/build/bundler-calls.js +12 -3
- package/lib/build/bundler-calls.js.map +1 -1
- package/lib/build/run-build-pilet.js +5 -14
- package/lib/build/run-build-pilet.js.map +1 -1
- package/lib/build/run-build-piral.js +5 -14
- package/lib/build/run-build-piral.js.map +1 -1
- package/lib/build/run-debug-mono-piral.js +5 -14
- package/lib/build/run-debug-mono-piral.js.map +1 -1
- package/lib/build/run-debug-pilet.js +5 -14
- package/lib/build/run-debug-pilet.js.map +1 -1
- package/lib/build/run-debug-piral.js +5 -14
- package/lib/build/run-debug-piral.js.map +1 -1
- package/lib/bundler.js +100 -127
- package/lib/bundler.js.map +1 -1
- package/lib/commands.js +5 -1
- package/lib/commands.js.map +1 -1
- package/lib/common/browser.js +13 -26
- package/lib/common/browser.js.map +1 -1
- package/lib/common/compatibility.js +10 -21
- package/lib/common/compatibility.js.map +1 -1
- package/lib/common/declaration.js +80 -101
- package/lib/common/declaration.js.map +1 -1
- package/lib/common/emulator.js +186 -182
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/http.js +7 -4
- package/lib/common/http.js.map +1 -1
- package/lib/common/importmap.js +172 -187
- package/lib/common/importmap.js.map +1 -1
- package/lib/common/injectors.js +4 -1
- package/lib/common/injectors.js.map +1 -1
- package/lib/common/inspect.js +5 -2
- package/lib/common/inspect.js.map +1 -1
- package/lib/common/interactive.js +9 -15
- package/lib/common/interactive.js.map +1 -1
- package/lib/common/io.js +256 -299
- package/lib/common/io.js.map +1 -1
- package/lib/common/language.js +21 -5
- package/lib/common/language.js.map +1 -1
- package/lib/common/npm.js +193 -228
- package/lib/common/npm.js.map +1 -1
- package/lib/common/pack.js +71 -86
- package/lib/common/pack.js.map +1 -1
- package/lib/common/package.js +426 -448
- package/lib/common/package.js.map +1 -1
- package/lib/common/parallel.js +12 -23
- package/lib/common/parallel.js.map +1 -1
- package/lib/common/patcher.js +54 -71
- package/lib/common/patcher.js.map +1 -1
- package/lib/common/platform.js +1 -12
- package/lib/common/platform.js.map +1 -1
- package/lib/common/port.js +11 -24
- package/lib/common/port.js.map +1 -1
- package/lib/common/rules.js +6 -17
- package/lib/common/rules.js.map +1 -1
- package/lib/common/scaffold.js +52 -59
- package/lib/common/scaffold.js.map +1 -1
- package/lib/common/shell.js +49 -58
- package/lib/common/shell.js.map +1 -1
- package/lib/common/spec.js +1 -1
- package/lib/common/spec.js.map +1 -1
- package/lib/common/template.js +3 -14
- package/lib/common/template.js.map +1 -1
- package/lib/common/watcher.js +7 -16
- package/lib/common/watcher.js.map +1 -1
- package/lib/common/website.d.ts +1 -0
- package/lib/common/website.js +67 -57
- package/lib/common/website.js.map +1 -1
- package/lib/injectors/pilet-injector.js +138 -145
- package/lib/injectors/pilet-injector.js.map +1 -1
- package/lib/injectors/piral-injector.js +55 -67
- package/lib/injectors/piral-injector.js.map +1 -1
- package/lib/messages.d.ts +81 -0
- package/lib/messages.js +94 -1
- package/lib/messages.js.map +1 -1
- package/lib/npm-clients/bun.js +36 -60
- package/lib/npm-clients/bun.js.map +1 -1
- package/lib/npm-clients/index.js +10 -21
- package/lib/npm-clients/index.js.map +1 -1
- package/lib/npm-clients/lerna.js +48 -72
- package/lib/npm-clients/lerna.js.map +1 -1
- package/lib/npm-clients/npm.js +69 -105
- package/lib/npm-clients/npm.js.map +1 -1
- package/lib/npm-clients/pnp.js +35 -59
- package/lib/npm-clients/pnp.js.map +1 -1
- package/lib/npm-clients/pnpm.js +35 -59
- package/lib/npm-clients/pnpm.js.map +1 -1
- package/lib/npm-clients/rush.js +53 -77
- package/lib/npm-clients/rush.js.map +1 -1
- package/lib/npm-clients/yarn.js +35 -59
- package/lib/npm-clients/yarn.js.map +1 -1
- package/lib/platforms/node.js +4 -17
- package/lib/platforms/node.js.map +1 -1
- package/lib/platforms/web.js +81 -96
- package/lib/platforms/web.js.map +1 -1
- package/lib/plugin.js +56 -75
- package/lib/plugin.js.map +1 -1
- package/lib/questionnaire.js +46 -12
- package/lib/questionnaire.js.map +1 -1
- package/lib/release.js +32 -47
- package/lib/release.js.map +1 -1
- package/lib/rules/index.js +10 -23
- package/lib/rules/index.js.map +1 -1
- package/lib/rules/pilet-has-externals-as-peers.js +34 -45
- package/lib/rules/pilet-has-externals-as-peers.js.map +1 -1
- package/lib/rules/pilet-has-no-self-reference.js +16 -27
- package/lib/rules/pilet-has-no-self-reference.js.map +1 -1
- package/lib/rules/pilet-has-non-conflicting-css.js +27 -42
- package/lib/rules/pilet-has-non-conflicting-css.js.map +1 -1
- package/lib/rules/pilet-stays-small.js +20 -33
- package/lib/rules/pilet-stays-small.js.map +1 -1
- package/lib/rules/pilet-uses-latest-piral.js +17 -28
- package/lib/rules/pilet-uses-latest-piral.js.map +1 -1
- package/lib/rules/piral-has-valid-devDependencies.js +4 -1
- package/lib/rules/piral-has-valid-devDependencies.js.map +1 -1
- package/lib/runner.js +3 -12
- package/lib/runner.js.map +1 -1
- package/lib/select.js +21 -32
- package/lib/select.js.map +1 -1
- package/lib/start.js +6 -17
- package/lib/start.js.map +1 -1
- package/package.json +2 -2
- package/src/apps/build-piral.test.ts +1 -1
- package/src/common/package.ts +9 -2
- package/src/common/website.ts +43 -15
- package/src/injectors/pilet-injector.ts +12 -2
- package/src/messages.ts +93 -0
package/src/common/website.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { join, resolve } from 'path';
|
|
1
|
+
import { join, relative, resolve } from 'path';
|
|
2
2
|
import { createPiralStubIndexIfNotExists } from './template';
|
|
3
3
|
import { packageJson } from './constants';
|
|
4
4
|
import { ForceOverwrite } from './enums';
|
|
5
|
-
import { createDirectory, writeBinary } from './io';
|
|
5
|
+
import { createDirectory, readJson, writeBinary } from './io';
|
|
6
6
|
import { writeJson } from './io';
|
|
7
|
-
import { progress } from './log';
|
|
7
|
+
import { progress, log } from './log';
|
|
8
8
|
import { axios } from '../external';
|
|
9
9
|
import { EmulatorWebsiteManifestFiles, EmulatorWebsiteManifest } from '../types';
|
|
10
10
|
|
|
@@ -21,16 +21,14 @@ async function downloadEmulatorFiles(manifestUrl: string, target: string, files:
|
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const appDirName = 'app';
|
|
24
|
+
async function createEmulatorFiles(
|
|
25
|
+
targetDir: string,
|
|
26
|
+
appDir: string,
|
|
27
|
+
manifestUrl: string,
|
|
28
|
+
emulatorJson: EmulatorWebsiteManifest,
|
|
29
|
+
) {
|
|
31
30
|
const mainFile = 'index.js';
|
|
32
|
-
const
|
|
33
|
-
await createDirectory(appDir);
|
|
31
|
+
const appDirName = relative(targetDir, appDir);
|
|
34
32
|
|
|
35
33
|
await writeJson(
|
|
36
34
|
targetDir,
|
|
@@ -48,9 +46,9 @@ export async function scaffoldFromEmulatorWebsite(rootDir: string, manifestUrl:
|
|
|
48
46
|
generated: true,
|
|
49
47
|
},
|
|
50
48
|
files: emulatorJson.files.assets,
|
|
51
|
-
main:
|
|
52
|
-
typings:
|
|
53
|
-
app:
|
|
49
|
+
main: join(appDirName, mainFile),
|
|
50
|
+
typings: join(appDirName, emulatorJson.files.typings),
|
|
51
|
+
app: join(appDirName, emulatorJson.files.app),
|
|
54
52
|
peerDependencies: {},
|
|
55
53
|
optionalDependencies: emulatorJson.dependencies.optional,
|
|
56
54
|
devDependencies: emulatorJson.dependencies.included,
|
|
@@ -65,5 +63,35 @@ export async function scaffoldFromEmulatorWebsite(rootDir: string, manifestUrl:
|
|
|
65
63
|
});
|
|
66
64
|
|
|
67
65
|
await downloadEmulatorFiles(manifestUrl, appDir, emulatorJson.files);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function updateFromEmulatorWebsite(targetDir: string, manifestUrl: string) {
|
|
69
|
+
progress(`Updating emulator from %s ...`, manifestUrl);
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const response = await axios.default.get(manifestUrl);
|
|
73
|
+
const nextEmulator: EmulatorWebsiteManifest = response.data;
|
|
74
|
+
const currentEmulator = await readJson(targetDir, packageJson);
|
|
75
|
+
|
|
76
|
+
if (currentEmulator.name !== nextEmulator.name) {
|
|
77
|
+
log('remoteEmulatorNameChanged_0121', currentEmulator.name);
|
|
78
|
+
} else if (currentEmulator.piralCLI.timstamp !== nextEmulator.timestamp) {
|
|
79
|
+
const appDir = resolve(targetDir, 'app');
|
|
80
|
+
await createEmulatorFiles(targetDir, appDir, manifestUrl, nextEmulator);
|
|
81
|
+
}
|
|
82
|
+
} catch (ex) {
|
|
83
|
+
log('generalDebug_0003', `HTTP request for emulator update failed: ${ex}`);
|
|
84
|
+
log('skipEmulatorUpdate_0120', manifestUrl);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export async function scaffoldFromEmulatorWebsite(rootDir: string, manifestUrl: string) {
|
|
89
|
+
progress(`Downloading emulator from %s ...`, manifestUrl);
|
|
90
|
+
const response = await axios.default.get(manifestUrl);
|
|
91
|
+
const emulatorJson: EmulatorWebsiteManifest = response.data;
|
|
92
|
+
const targetDir = resolve(rootDir, 'node_modules', emulatorJson.name);
|
|
93
|
+
const appDir = resolve(targetDir, 'app');
|
|
94
|
+
await createDirectory(appDir);
|
|
95
|
+
await createEmulatorFiles(targetDir, appDir, manifestUrl, emulatorJson);
|
|
68
96
|
return emulatorJson.name;
|
|
69
97
|
}
|
|
@@ -343,8 +343,18 @@ export default class PiletInjector implements KrasInjector {
|
|
|
343
343
|
|
|
344
344
|
if (!fileInfo || fileInfo.mtime < this.proxyInfo.date) {
|
|
345
345
|
const url = new URL(path, this.proxyInfo.source);
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
|
|
347
|
+
try {
|
|
348
|
+
const response = await axios.default.get(url.href, { responseType: 'arraybuffer' });
|
|
349
|
+
await writeFile(target, response.data);
|
|
350
|
+
} catch (ex) {
|
|
351
|
+
log('generalDebug_0003', `HTTP request for emulator asset retrieval failed: ${ex}`);
|
|
352
|
+
log(
|
|
353
|
+
fileInfo ? 'optionalEmulatorAssetUpdateSkipped_0122' : 'requiredEmulatorAssetDownloadSkipped_0123',
|
|
354
|
+
url.href,
|
|
355
|
+
);
|
|
356
|
+
return !!fileInfo;
|
|
357
|
+
}
|
|
348
358
|
}
|
|
349
359
|
|
|
350
360
|
return true;
|
package/src/messages.ts
CHANGED
|
@@ -2492,6 +2492,99 @@ export function publishFeedMissingVersion_0116(): QuickMessage {
|
|
|
2492
2492
|
];
|
|
2493
2493
|
}
|
|
2494
2494
|
|
|
2495
|
+
/**
|
|
2496
|
+
* @kind Info
|
|
2497
|
+
*
|
|
2498
|
+
* @summary
|
|
2499
|
+
* The remote emulator could not be updated using its given manifest URL.
|
|
2500
|
+
*
|
|
2501
|
+
* @abstract
|
|
2502
|
+
* The remote emulator could not be retrieved from its specified URL. This could be due to a problem with
|
|
2503
|
+
* the network or due to the emulator website not being available right now.
|
|
2504
|
+
*
|
|
2505
|
+
* This is just an informative message. In the current scenario the emulator has been downloaded previously
|
|
2506
|
+
* already. Therefore, only potential updates are blocked due to the error.
|
|
2507
|
+
*
|
|
2508
|
+
* If the error persists please try to access the emulator's URL in your browser. In case this works make
|
|
2509
|
+
* sure that the browser does not have different proxy settings compared ot the rest of your system.
|
|
2510
|
+
*
|
|
2511
|
+
* @see
|
|
2512
|
+
* - [Chrome proxy settings](https://oxylabs.io/resources/integrations/chrome)
|
|
2513
|
+
* - [Firefox proxy settings](https://support.mozilla.org/en-US/kb/connection-settings-firefox)
|
|
2514
|
+
*/
|
|
2515
|
+
export function skipEmulatorUpdate_0120(manifestUrl: string): QuickMessage {
|
|
2516
|
+
return [LogLevels.info, '0120', `Failed to retrieve current emulator from "${manifestUrl}". Skipping update.`];
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
/**
|
|
2520
|
+
* @kind Warning
|
|
2521
|
+
*
|
|
2522
|
+
* @summary
|
|
2523
|
+
* The remote emulator could not be updated as the given manifest URL returns a differently named emulator.
|
|
2524
|
+
*
|
|
2525
|
+
* @abstract
|
|
2526
|
+
* When a remote emulator is first installed it will be integrated using its specified name as shell name.
|
|
2527
|
+
* The remote emulator is always auto-updated whenever the Piral CLI is running pilet commands. However,
|
|
2528
|
+
* in case the current emulator manifest has a different name the update will be blocked. In this case a
|
|
2529
|
+
* reinstallation of the emulator is necessary.
|
|
2530
|
+
*
|
|
2531
|
+
* Use "pilet remove-piral-instance" and "pilet add-piral-instance" to remove the old instance (by its given
|
|
2532
|
+
* name) and add the new instance (by the manifest URL).
|
|
2533
|
+
*
|
|
2534
|
+
* @see
|
|
2535
|
+
* - [Chrome proxy settings](https://oxylabs.io/resources/integrations/chrome)
|
|
2536
|
+
* - [Firefox proxy settings](https://support.mozilla.org/en-US/kb/connection-settings-firefox)
|
|
2537
|
+
*/
|
|
2538
|
+
export function remoteEmulatorNameChanged_0121(name: string): QuickMessage {
|
|
2539
|
+
return [LogLevels.warning, '0121', `The name of the emulator has changed. Skipping updates for "${name}".`];
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
/**
|
|
2543
|
+
* @kind Info
|
|
2544
|
+
*
|
|
2545
|
+
* @summary
|
|
2546
|
+
* An asset of the remote emulator could not be updated.
|
|
2547
|
+
*
|
|
2548
|
+
* @abstract
|
|
2549
|
+
* The metadata of an remote emulator has been updated, however, one of the asset files could
|
|
2550
|
+
* not be updated. The previously downloaded version of this file will be used as a fallback.
|
|
2551
|
+
*
|
|
2552
|
+
* Using the previously downloaded version of a file might just work, however, for several
|
|
2553
|
+
* reasons this might also break. In any case, if you see this info then any kinds of issues
|
|
2554
|
+
* appearing could potentially be solved by just giving your machine network access again or
|
|
2555
|
+
* waiting for the remote sources to be accessible again.
|
|
2556
|
+
*
|
|
2557
|
+
* @see
|
|
2558
|
+
* - [Chrome proxy settings](https://oxylabs.io/resources/integrations/chrome)
|
|
2559
|
+
* - [Firefox proxy settings](https://support.mozilla.org/en-US/kb/connection-settings-firefox)
|
|
2560
|
+
*/
|
|
2561
|
+
export function optionalEmulatorAssetUpdateSkipped_0122(url: string): QuickMessage {
|
|
2562
|
+
return [LogLevels.info, '0122', ``];
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
/**
|
|
2566
|
+
* @kind Warning
|
|
2567
|
+
*
|
|
2568
|
+
* @summary
|
|
2569
|
+
* An asset of the remote emulator could not be downloaded.
|
|
2570
|
+
*
|
|
2571
|
+
* @abstract
|
|
2572
|
+
* The metadata of an remote emulator has been downloaded, however, one of the asset files
|
|
2573
|
+
* could not be downloaded. Consequently, the fallback (index.html) will be used as
|
|
2574
|
+
* replacement in the dev server.
|
|
2575
|
+
*
|
|
2576
|
+
* If you see this warning then any kinds of issues appearing could potentially be solved by
|
|
2577
|
+
* just giving your machine network access again or waiting for the remote sources to be
|
|
2578
|
+
* accessible again.
|
|
2579
|
+
*
|
|
2580
|
+
* @see
|
|
2581
|
+
* - [Chrome proxy settings](https://oxylabs.io/resources/integrations/chrome)
|
|
2582
|
+
* - [Firefox proxy settings](https://support.mozilla.org/en-US/kb/connection-settings-firefox)
|
|
2583
|
+
*/
|
|
2584
|
+
export function requiredEmulatorAssetDownloadSkipped_0123(url: string): QuickMessage {
|
|
2585
|
+
return [LogLevels.warning, '0123', ``];
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2495
2588
|
/**
|
|
2496
2589
|
* @kind Warning
|
|
2497
2590
|
*
|