@serwist/cli 9.0.6 → 9.0.8
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/app.d.ts.map +1 -1
- package/dist/bin.js +17 -15
- package/dist/lib/ask-questions.d.ts.map +1 -1
- package/package.json +9 -11
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAyC/C,eAAO,MAAM,GAAG,WAAkB,UAAU,CAAC,cAAc,CAAC,KAAG,OAAO,CAAC,IAAI,CAiF1E,CAAC"}
|
package/dist/bin.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import meow from 'meow';
|
|
3
3
|
import updateNotifier from 'update-notifier';
|
|
4
4
|
import assert from 'node:assert';
|
|
5
|
+
import path from 'node:path';
|
|
5
6
|
import { injectManifest } from '@serwist/build';
|
|
6
7
|
import chokidar from 'chokidar';
|
|
8
|
+
import { glob } from 'glob';
|
|
7
9
|
import prettyBytes from 'pretty-bytes';
|
|
8
|
-
import upath from 'upath';
|
|
9
10
|
import { oneLine } from 'common-tags';
|
|
10
11
|
import chalk from 'chalk';
|
|
11
12
|
import { statSync, writeFileSync } from 'node:fs';
|
|
12
13
|
import stringifyObject from 'stringify-object';
|
|
13
|
-
import { glob } from 'glob';
|
|
14
14
|
import { input, checkbox, select, Separator } from '@inquirer/prompts';
|
|
15
15
|
|
|
16
16
|
const constants = {
|
|
@@ -60,6 +60,10 @@ const readConfig = async (configFile)=>{
|
|
|
60
60
|
return (await import(configFile)).default;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
const toUnix = (p)=>{
|
|
64
|
+
return p.replace(/\\/g, "/").replace(/(?<!^)\/+/g, "/");
|
|
65
|
+
};
|
|
66
|
+
|
|
63
67
|
const getSubdirectories = async ()=>{
|
|
64
68
|
return await glob("*/", {
|
|
65
69
|
ignore: constants.ignoredDirectories.map((directory)=>`${directory}/`)
|
|
@@ -117,7 +121,7 @@ const getAllFileExtensions = async (globDirectory)=>{
|
|
|
117
121
|
});
|
|
118
122
|
const extensions = new Set();
|
|
119
123
|
for (const file of files){
|
|
120
|
-
const extension =
|
|
124
|
+
const extension = path.extname(file);
|
|
121
125
|
if (extension) {
|
|
122
126
|
extensions.add(extension.replace(/^\./, ""));
|
|
123
127
|
}
|
|
@@ -146,7 +150,7 @@ const askQuestions = async ()=>{
|
|
|
146
150
|
});
|
|
147
151
|
const swDest = await input({
|
|
148
152
|
message: "Where would you like your service worker file to be saved?",
|
|
149
|
-
default:
|
|
153
|
+
default: toUnix(path.join(globDirectory, "sw.js")),
|
|
150
154
|
validate (input) {
|
|
151
155
|
if (typeof input !== "string") {
|
|
152
156
|
return "You must provide a valid 'swDest'!";
|
|
@@ -234,7 +238,7 @@ const app = async (params)=>{
|
|
|
234
238
|
}
|
|
235
239
|
case "inject-manifest":
|
|
236
240
|
{
|
|
237
|
-
const configPath =
|
|
241
|
+
const configPath = path.resolve(process.cwd(), option || constants.defaultConfigFile);
|
|
238
242
|
let config;
|
|
239
243
|
try {
|
|
240
244
|
config = await readConfig(configPath);
|
|
@@ -250,17 +254,15 @@ const app = async (params)=>{
|
|
|
250
254
|
}
|
|
251
255
|
logger.log(`Using configuration from ${configPath}.`);
|
|
252
256
|
if (params?.flags?.watch) {
|
|
253
|
-
const options = {
|
|
254
|
-
ignoreInitial: true
|
|
255
|
-
};
|
|
256
|
-
if (config.globIgnores) {
|
|
257
|
-
options.ignored = config.globIgnores;
|
|
258
|
-
}
|
|
259
|
-
if (config.globDirectory) {
|
|
260
|
-
options.cwd = config.globDirectory;
|
|
261
|
-
}
|
|
262
257
|
if (config.globPatterns) {
|
|
263
|
-
chokidar.watch(config.globPatterns,
|
|
258
|
+
chokidar.watch(await glob(config.globPatterns, {
|
|
259
|
+
cwd: config.globDirectory,
|
|
260
|
+
follow: config.globFollow,
|
|
261
|
+
ignore: config.globIgnores
|
|
262
|
+
}), {
|
|
263
|
+
ignoreInitial: true,
|
|
264
|
+
cwd: config.globDirectory
|
|
265
|
+
}).on("all", async ()=>{
|
|
264
266
|
if (config === null) return;
|
|
265
267
|
await runBuildCommand({
|
|
266
268
|
config,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-questions.d.ts","sourceRoot":"","sources":["../../src/lib/ask-questions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ask-questions.d.ts","sourceRoot":"","sources":["../../src/lib/ask-questions.ts"],"names":[],"mappings":"AAoFA,UAAU,wBAAwB;IAChC,MAAM,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,YAAY,QAAa,OAAO,CAAC,wBAAwB,CAuErE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/cli",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The command line interface of Serwist.",
|
|
6
6
|
"files": [
|
|
@@ -31,28 +31,26 @@
|
|
|
31
31
|
"serwist": "cli.js"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@inquirer/prompts": "
|
|
34
|
+
"@inquirer/prompts": "6.0.1",
|
|
35
35
|
"chalk": "5.3.0",
|
|
36
|
-
"chokidar": "
|
|
36
|
+
"chokidar": "4.0.0",
|
|
37
37
|
"common-tags": "1.8.2",
|
|
38
|
-
"fs-extra": "11.2.0",
|
|
39
38
|
"glob": "10.4.5",
|
|
40
39
|
"meow": "13.2.0",
|
|
41
40
|
"pretty-bytes": "6.1.1",
|
|
42
41
|
"stringify-object": "5.0.0",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"@serwist/build": "9.0.6"
|
|
42
|
+
"update-notifier": "7.3.1",
|
|
43
|
+
"@serwist/build": "9.0.8"
|
|
46
44
|
},
|
|
47
45
|
"devDependencies": {
|
|
48
46
|
"@types/common-tags": "1.8.4",
|
|
49
|
-
"@types/fs-extra": "11.0.4",
|
|
50
47
|
"@types/inquirer": "9.0.7",
|
|
51
48
|
"@types/stringify-object": "4.0.5",
|
|
52
49
|
"@types/update-notifier": "6.0.8",
|
|
53
|
-
"rollup": "4.21.
|
|
54
|
-
"typescript": "5.
|
|
55
|
-
"@serwist/configs": "9.0.
|
|
50
|
+
"rollup": "4.21.3",
|
|
51
|
+
"typescript": "5.6.2",
|
|
52
|
+
"@serwist/configs": "9.0.8",
|
|
53
|
+
"@serwist/utils": "9.0.8"
|
|
56
54
|
},
|
|
57
55
|
"scripts": {
|
|
58
56
|
"build": "rimraf dist && NODE_ENV=production rollup --config rollup.config.js",
|