@serwist/cli 8.3.0 → 8.4.1
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/dist/bin.js +14 -13
- package/package.json +5 -4
package/dist/bin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
import meow from 'meow';
|
|
3
3
|
import updateNotifier from 'update-notifier';
|
|
4
|
-
import { injectManifest } from '@serwist/build';
|
|
5
4
|
import assert from 'assert';
|
|
5
|
+
import { injectManifest } from '@serwist/build';
|
|
6
6
|
import chokidar from 'chokidar';
|
|
7
7
|
import prettyBytes from 'pretty-bytes';
|
|
8
8
|
import upath from 'upath';
|
|
@@ -36,17 +36,17 @@ import ora from 'ora';
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const errors = {
|
|
39
|
-
"missing-input":
|
|
39
|
+
"missing-input": "params.input value was not set properly.",
|
|
40
40
|
"missing-dest-dir-param": oneLine`Please provide the path to a directory in which
|
|
41
41
|
the libraries will be copied.`,
|
|
42
42
|
"invalid-common-js-module": oneLine`Please pass in a valid CommonJS module that
|
|
43
43
|
exports your configuration.`,
|
|
44
|
-
"config-validation-failed":
|
|
45
|
-
"serwist-build-runtime-error":
|
|
46
|
-
"unknown-command":
|
|
44
|
+
"config-validation-failed": "Your configuration is invalid:",
|
|
45
|
+
"serwist-build-runtime-error": "Service worker generation failed:",
|
|
46
|
+
"unknown-command": "Unknown command:",
|
|
47
47
|
"no-file-extensions-found": oneLine`No files could be found that are suitable for
|
|
48
48
|
caching.`,
|
|
49
|
-
"no-file-extensions-selected":
|
|
49
|
+
"no-file-extensions-selected": "Please select at least one file extension.",
|
|
50
50
|
"invalid-sw-dest": oneLine`Please enter a valid path to use for the service worker
|
|
51
51
|
file that's created.`,
|
|
52
52
|
"glob-directory-invalid": oneLine`The path you entered isn't a valid directory.`,
|
|
@@ -266,7 +266,7 @@ const name$1 = "swDest";
|
|
|
266
266
|
return inquirer.prompt([
|
|
267
267
|
{
|
|
268
268
|
name: name$1,
|
|
269
|
-
message:
|
|
269
|
+
message: "Where would you like your service worker file to be saved?",
|
|
270
270
|
type: "input",
|
|
271
271
|
default: upath.join(defaultDir, "sw.js")
|
|
272
272
|
}
|
|
@@ -355,12 +355,12 @@ as part of a build process. See https://goo.gl/fdTQBf for details.`);
|
|
|
355
355
|
if (filePaths.length === 1) {
|
|
356
356
|
logger.log(`The service worker file was written to ${config.swDest}`);
|
|
357
357
|
} else {
|
|
358
|
-
const message = filePaths.sort().map((filePath)=>` • ${filePath}`).join(
|
|
358
|
+
const message = filePaths.sort().map((filePath)=>` • ${filePath}`).join("\n");
|
|
359
359
|
logger.log(`The service worker files were written to:\n${message}`);
|
|
360
360
|
}
|
|
361
361
|
logger.log(`The service worker will precache ${count} URLs, ` + `totaling ${prettyBytes(size)}.`);
|
|
362
362
|
if (watch) {
|
|
363
|
-
logger.log(
|
|
363
|
+
logger.log("\nWatching for changes...");
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
const app = async (params)=>{
|
|
@@ -432,13 +432,14 @@ const app = async (params)=>{
|
|
|
432
432
|
}
|
|
433
433
|
break;
|
|
434
434
|
}
|
|
435
|
+
// biome-ignore lint/suspicious/noFallthroughSwitchClause: Biome.js doesn't handle functions that return `never`... yet.
|
|
435
436
|
case "help":
|
|
436
437
|
{
|
|
437
438
|
params.showHelp();
|
|
438
439
|
}
|
|
439
440
|
default:
|
|
440
441
|
{
|
|
441
|
-
throw new Error(errors["unknown-command"]
|
|
442
|
+
throw new Error(`${errors["unknown-command"]} ${command}`);
|
|
442
443
|
}
|
|
443
444
|
}
|
|
444
445
|
};
|
|
@@ -457,18 +458,18 @@ function cleanupStackTrace(error, moduleName) {
|
|
|
457
458
|
if (!error.stack) {
|
|
458
459
|
return "";
|
|
459
460
|
}
|
|
460
|
-
const frames = error.stack.split(
|
|
461
|
+
const frames = error.stack.split("\n");
|
|
461
462
|
let startFrame;
|
|
462
463
|
let lastFrame = 0;
|
|
463
464
|
frames.forEach((frame, index)=>{
|
|
464
|
-
if (startFrame === undefined && frame.includes(
|
|
465
|
+
if (startFrame === undefined && frame.includes(" at ")) {
|
|
465
466
|
startFrame = index;
|
|
466
467
|
}
|
|
467
468
|
if (frame.includes(`${moduleName}:`)) {
|
|
468
469
|
lastFrame = index;
|
|
469
470
|
}
|
|
470
471
|
});
|
|
471
|
-
return frames.slice(startFrame, lastFrame + 1).join(
|
|
472
|
+
return frames.slice(startFrame, lastFrame + 1).join("\n");
|
|
472
473
|
}
|
|
473
474
|
|
|
474
475
|
/*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "@serwist/cli is the command line interface for Serwist.",
|
|
6
6
|
"files": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"stringify-object": "5.0.0",
|
|
40
40
|
"upath": "2.0.1",
|
|
41
41
|
"update-notifier": "7.0.0",
|
|
42
|
-
"@serwist/build": "8.
|
|
42
|
+
"@serwist/build": "8.4.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/common-tags": "1.8.4",
|
|
@@ -48,11 +48,12 @@
|
|
|
48
48
|
"@types/stringify-object": "4.0.5",
|
|
49
49
|
"@types/update-notifier": "6.0.8",
|
|
50
50
|
"rollup": "4.9.1",
|
|
51
|
-
"@serwist/constants": "8.
|
|
51
|
+
"@serwist/constants": "8.4.1"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "rimraf dist && cross-env NODE_ENV=production rollup --config rollup.config.js",
|
|
55
|
-
"
|
|
55
|
+
"dev": "rollup --config rollup.config.js --watch",
|
|
56
|
+
"lint": "biome lint ./src",
|
|
56
57
|
"typecheck": "tsc"
|
|
57
58
|
}
|
|
58
59
|
}
|