zotero-plugin-scaffold 0.3.0 → 0.3.2
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/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import {
|
|
4
|
-
import { readFile
|
|
5
|
-
import { pathExists
|
|
3
|
+
import { l as logger, E as ExitSignals, C as Config, B as Build, S as Serve, T as Test, R as Release } from './shared/zotero-plugin-scaffold.BivfUAGX.mjs';
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
5
|
+
import { pathExists } from 'fs-extra';
|
|
6
6
|
import tinyUpdateNotifier from 'tiny-update-notifier';
|
|
7
7
|
import 'c12';
|
|
8
8
|
import 'es-toolkit';
|
|
@@ -31,7 +31,7 @@ import 'node:http';
|
|
|
31
31
|
import 'xvfb-ts';
|
|
32
32
|
|
|
33
33
|
const name = "zotero-plugin-scaffold";
|
|
34
|
-
const version = "0.3.
|
|
34
|
+
const version = "0.3.2";
|
|
35
35
|
const pkg = {
|
|
36
36
|
name: name,
|
|
37
37
|
version: version};
|
|
@@ -39,14 +39,15 @@ const pkg = {
|
|
|
39
39
|
async function checkGitIgnore() {
|
|
40
40
|
if (!pathExists(".git"))
|
|
41
41
|
return;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
if (!pathExists(".gitignore")) {
|
|
43
|
+
logger.warn("No .gitignore file found");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const contents = await readFile(".gitignore", "utf-8");
|
|
44
47
|
const ignores = ["node_modules", ".env", ".scaffold"];
|
|
45
|
-
ignores.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
await writeFile(".gitignore", contents.join("\n"));
|
|
48
|
+
const miss = ignores.filter((ignore) => !contents.match(ignore));
|
|
49
|
+
if (miss.length !== 0)
|
|
50
|
+
logger.warn(`We recommend adding the following to your .gitignore file: ${miss.join(", ")}`);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
function updateNotifier(name, version) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.
|
|
1
|
+
export { B as Build, C as Config, R as Release, S as Serve, T as Test, d as defineConfig } from './shared/zotero-plugin-scaffold.BivfUAGX.mjs';
|
|
2
2
|
import 'c12';
|
|
3
3
|
import 'es-toolkit';
|
|
4
4
|
import 'fs-extra/esm';
|
package/dist/shared/{zotero-plugin-scaffold.DWzaUAX4.mjs → zotero-plugin-scaffold.BivfUAGX.mjs}
RENAMED
|
@@ -7,9 +7,9 @@ import readline from 'node:readline';
|
|
|
7
7
|
import util from 'node:util';
|
|
8
8
|
import { isDebug, isCI, isWindows, isMacOS, isLinux } from 'std-env';
|
|
9
9
|
import { p as parseRepoUrl, d as dateFormat, t as template, b as toArray, a as replaceInFile } from './zotero-plugin-scaffold.v8dJZZ-v.mjs';
|
|
10
|
-
import { createReadStream, existsSync } from 'node:fs';
|
|
10
|
+
import { createReadStream, writeFileSync, existsSync } from 'node:fs';
|
|
11
11
|
import { readFile, writeFile, stat } from 'node:fs/promises';
|
|
12
|
-
import { basename, dirname, join,
|
|
12
|
+
import { basename, dirname, join, resolve, extname } from 'node:path';
|
|
13
13
|
import AdmZip from 'adm-zip';
|
|
14
14
|
import { build } from 'esbuild';
|
|
15
15
|
import { glob, globSync } from 'tinyglobby';
|
|
@@ -369,6 +369,7 @@ class PrefsManager {
|
|
|
369
369
|
parse(content) {
|
|
370
370
|
const _map = {};
|
|
371
371
|
const ast = parseSync(content, { syntax: "ecmascript" });
|
|
372
|
+
writeFileSync("ast.json", JSON.stringify(ast, null, 2));
|
|
372
373
|
for (const node of ast.body) {
|
|
373
374
|
if (node.type !== "ExpressionStatement" || node.expression.type !== "CallExpression" || node.expression.callee.type !== "Identifier" || node.expression.callee.value !== this.namespace || node.expression.arguments.length !== 2) {
|
|
374
375
|
throw new Error("Invalid prefs.js file.");
|
|
@@ -448,7 +449,7 @@ class PrefsManager {
|
|
|
448
449
|
}
|
|
449
450
|
render() {
|
|
450
451
|
return Object.entries(this.prefs).map(([key, value]) => {
|
|
451
|
-
const _v = typeof value === "string" ? `"${value}"` : value;
|
|
452
|
+
const _v = typeof value === "string" ? `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"` : value;
|
|
452
453
|
return `${this.namespace}("${key}", ${_v});`;
|
|
453
454
|
}).join("\n");
|
|
454
455
|
}
|
|
@@ -749,14 +750,15 @@ class Build extends Base {
|
|
|
749
750
|
}
|
|
750
751
|
esbuild() {
|
|
751
752
|
const { dist, build: { esbuildOptions } } = this.ctx;
|
|
753
|
+
const distAbsolute = resolve(dist);
|
|
752
754
|
if (esbuildOptions.length === 0)
|
|
753
755
|
return;
|
|
754
756
|
esbuildOptions.map((option, i) => {
|
|
755
|
-
if (option.outfile && !option.outfile.startsWith(
|
|
757
|
+
if (option.outfile && !resolve(option.outfile).startsWith(distAbsolute)) {
|
|
756
758
|
this.logger.debug(`'outfile' of esbuildOptions[${i}] is not in dist folder, it will be overwritten.`);
|
|
757
759
|
option.outfile = `${dist}/${option.outfile}`;
|
|
758
760
|
}
|
|
759
|
-
if (option.outdir && !option.outdir.startsWith(
|
|
761
|
+
if (option.outdir && !resolve(option.outdir).startsWith(distAbsolute)) {
|
|
760
762
|
this.logger.debug(`'outdir' of esbuildOptions[${i}] is not in dist folder, it will be overwritten.`);
|
|
761
763
|
option.outdir = `${dist}/${option.outdir}`;
|
|
762
764
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zotero-plugin-scaffold",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"description": "A scaffold for Zotero plugin development.",
|
|
6
6
|
"author": "northword",
|
|
7
7
|
"license": "AGPL-3.0-or-later",
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@swc/core": "^1.11.
|
|
66
|
+
"@swc/core": "^1.11.8",
|
|
67
67
|
"adm-zip": "^0.5.16",
|
|
68
68
|
"bumpp": "^10.0.3",
|
|
69
69
|
"c12": "^3.0.2",
|
|
70
70
|
"chokidar": "^4.0.3",
|
|
71
71
|
"commander": "^13.1.0",
|
|
72
|
-
"es-toolkit": "^1.
|
|
72
|
+
"es-toolkit": "^1.33.0",
|
|
73
73
|
"esbuild": "^0.25.0",
|
|
74
74
|
"fs-extra": "^11.3.0",
|
|
75
75
|
"hookable": "^5.5.3",
|
|
76
76
|
"octokit": "^4.1.2",
|
|
77
|
-
"std-env": "^3.8.
|
|
77
|
+
"std-env": "^3.8.1",
|
|
78
78
|
"tiny-update-notifier": "^2.0.0",
|
|
79
79
|
"tinyglobby": "^0.2.12",
|
|
80
80
|
"xvfb-ts": "^1.1.0"
|