zotero-plugin-scaffold 0.9.4 → 1.0.0-beta.0
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/README.md +0 -32
- package/bin/zobuild.mjs +5 -0
- package/bin/zodev.mjs +5 -0
- package/bin/zorelease.mjs +5 -0
- package/bin/zotest.mjs +5 -0
- package/dist/cli.d.ts +8 -6
- package/dist/cli.js +39 -35
- package/dist/index.d.ts +11 -69
- package/dist/index.js +1 -1
- package/dist/shared/src-CW01kL-O.mjs +43 -0
- package/dist/shared/types-DBWYVPm1.d.mts +30 -0
- package/dist/test.d.ts +16 -0
- package/dist/test.js +2 -0
- package/dist/vendor.d.ts +2 -9
- package/dist/vendor.js +1 -1
- package/package.json +25 -46
- package/dist/shared/scaffold-base-BzOO6CRI.d.mts +0 -9
- package/dist/shared/scaffold-index-D-5PZpaP.d.mts +0 -903
- package/dist/shared/scaffold-replace-CI5Lu8Fb.mjs +0 -237
- package/dist/shared/scaffold-src-CZoKPRL3.mjs +0 -4288
package/README.md
CHANGED
|
@@ -18,38 +18,6 @@ For best practices regarding this package, please refer to [zotero-plugin-templa
|
|
|
18
18
|
|
|
19
19
|
[Read the Docs to Learn More](https://zotero-plugin-dev.github.io/zotero-plugin-scaffold).
|
|
20
20
|
|
|
21
|
-
## Contributing
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# Git Clone
|
|
25
|
-
git clone https://github.com/zotero-plugin-dev/zotero-plugin-scaffold.git
|
|
26
|
-
cd zotero-plugin-scaffold/
|
|
27
|
-
|
|
28
|
-
# Install deps
|
|
29
|
-
corepack enable
|
|
30
|
-
pnpm install
|
|
31
|
-
|
|
32
|
-
# Development Mode
|
|
33
|
-
pnpm run dev
|
|
34
|
-
|
|
35
|
-
# link local scaffold to your plugin
|
|
36
|
-
cd your-plugin-work-dir/
|
|
37
|
-
pnpm link ../zotero-plugin-scaffold/
|
|
38
|
-
cd zotero-plugin-scaffold/
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Now you can make changes to Scaffold and test them in your plugin.
|
|
42
|
-
|
|
43
|
-
When you're done modifying, make sure that you can pass the build and that the code style meets the requirements of this repository.
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
# Build
|
|
47
|
-
pnpm run build
|
|
48
|
-
|
|
49
|
-
# ES Lint
|
|
50
|
-
pnpm run lint:fix
|
|
51
|
-
```
|
|
52
|
-
|
|
53
21
|
## License
|
|
54
22
|
|
|
55
23
|
GNU Affero General Public License Version 3.
|
package/bin/zobuild.mjs
ADDED
package/bin/zodev.mjs
ADDED
package/bin/zotest.mjs
ADDED
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { a as UserConfig, n as Context } from "./shared/types-DBWYVPm1.mjs";
|
|
2
|
+
import { Command, CommandFactory } from "@zotero-plugin/config";
|
|
3
|
+
export declare function runCommand<TCommand extends Command>(create: CommandFactory<TCommand, Context>, config: UserConfig): Promise<void>;
|
|
4
|
+
/**
|
|
5
|
+
* @param presetCommand The subcommand implied by the invoked bin name,
|
|
6
|
+
* e.g. `zotest --no-watch` is `zotero-plugin test --no-watch`.
|
|
7
|
+
*/
|
|
8
|
+
export default function mainWithErrorHandler(presetCommand?: string): Promise<void>;
|
package/dist/cli.js
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as logger } from "./shared/scaffold-replace-CI5Lu8Fb.mjs";
|
|
1
|
+
import { c as createDevServer, l as createReleaser, s as createBuilder, u as createTester, y as loadConfig } from "./shared/src-CW01kL-O.mjs";
|
|
3
2
|
import process from "node:process";
|
|
4
|
-
import {
|
|
3
|
+
import { ExitSignals, checkGitIgnore, logger } from "@zotero-plugin/utils";
|
|
5
4
|
import { Command } from "commander";
|
|
6
|
-
import { pathExists } from "fs-extra";
|
|
7
5
|
import tinyUpdateNotifier from "tiny-update-notifier";
|
|
8
6
|
// package.json
|
|
9
7
|
var name = "zotero-plugin-scaffold";
|
|
10
8
|
var version = "0.9.4";
|
|
11
|
-
// src/
|
|
12
|
-
async function checkGitIgnore() {
|
|
13
|
-
if (!pathExists(".git")) return;
|
|
14
|
-
if (!pathExists(".gitignore")) {
|
|
15
|
-
logger.warn("No .gitignore file found");
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const contents = await readFile(".gitignore", "utf-8");
|
|
19
|
-
const miss = [
|
|
20
|
-
"node_modules",
|
|
21
|
-
".env",
|
|
22
|
-
".scaffold"
|
|
23
|
-
].filter((ignore) => !contents.match(ignore));
|
|
24
|
-
if (miss.length !== 0) logger.warn(`We recommend adding the following to your .gitignore file: ${miss.join(", ")}`);
|
|
25
|
-
}
|
|
26
|
-
// src/utils/updater.ts
|
|
9
|
+
// src/updater.ts
|
|
27
10
|
function updateNotifier(name, version) {
|
|
28
11
|
tinyUpdateNotifier({ pkg: {
|
|
29
12
|
name,
|
|
@@ -41,23 +24,25 @@ function updateNotifier(name, version) {
|
|
|
41
24
|
}).catch();
|
|
42
25
|
}
|
|
43
26
|
// src/cli.ts
|
|
44
|
-
async function main() {
|
|
27
|
+
async function main(presetCommand) {
|
|
45
28
|
updateNotifier(name, version);
|
|
46
29
|
process.env.NODE_ENV ??= "development";
|
|
47
30
|
const cli = new Command();
|
|
48
31
|
cli.version(version).usage("<command> [options]");
|
|
32
|
+
if (presetCommand) cli.configureHelp({ commandUsage: (cmd) => `${cli.name()} ${cmd.usage()}`.trim() });
|
|
49
33
|
cli.command("build").description("Build the plugin").option("--dev", "Builds the plugin in dev mode").option("--dist <dir>", "The relative path for the new output directory (default: build)").action(async (options) => {
|
|
50
34
|
process.env.NODE_ENV = options.dev ? "development" : "production";
|
|
51
|
-
await runCommand(
|
|
35
|
+
await runCommand(createBuilder, { dist: options.dist });
|
|
52
36
|
});
|
|
53
|
-
cli.command("
|
|
54
|
-
await runCommand(
|
|
37
|
+
cli.command("dev").alias("serve").description("Start development server").action(async (_options) => {
|
|
38
|
+
await runCommand(createDevServer, {});
|
|
55
39
|
});
|
|
56
|
-
cli.command("test").description("Run tests").option("--abort-on-fail", "Abort the test suite on first failure").option("--exit-on-finish", "Exit the test suite after all tests have run").option("--no-watch", "Exit the test suite after all tests have run").action(async (options) => {
|
|
40
|
+
cli.command("test").description("Run tests").argument("[filters...]", "Only run the test files whose path contains any of the filters").option("--abort-on-fail", "Abort the test suite on first failure").option("--exit-on-finish", "Exit the test suite after all tests have run").option("--no-watch", "Exit the test suite after all tests have run").action(async (filters, options) => {
|
|
57
41
|
process.env.NODE_ENV = "test";
|
|
58
|
-
await runCommand(
|
|
42
|
+
await runCommand(createTester, { test: {
|
|
59
43
|
abortOnFail: options.abortOnFail,
|
|
60
|
-
watch: !options.exitOnFinish && options.watch
|
|
44
|
+
watch: !options.exitOnFinish && options.watch,
|
|
45
|
+
...filters.length > 0 && { filter: filters }
|
|
61
46
|
} });
|
|
62
47
|
});
|
|
63
48
|
cli.command("create").description("Create the plugin template").action(async (_options) => {
|
|
@@ -65,7 +50,7 @@ async function main() {
|
|
|
65
50
|
});
|
|
66
51
|
cli.command("release").description("Release the plugin").argument("[version]", "Target version: major, minor, patch, pre*, or specify version").option("--preid <preid>", "ID for prerelease").option("-y, --yes", "Skip confirmation").action(async (version, options) => {
|
|
67
52
|
process.env.NODE_ENV = "production";
|
|
68
|
-
await runCommand(
|
|
53
|
+
await runCommand(createReleaser, { release: { bumpp: {
|
|
69
54
|
release: version,
|
|
70
55
|
preid: options.preid,
|
|
71
56
|
confirm: !options.yes
|
|
@@ -75,15 +60,34 @@ async function main() {
|
|
|
75
60
|
cli.outputHelp();
|
|
76
61
|
logger.error(`Unknown command name "${cmd}".`);
|
|
77
62
|
});
|
|
78
|
-
cli.parse(
|
|
63
|
+
cli.parse(presetCommand ? [
|
|
64
|
+
...process.argv.slice(0, 2),
|
|
65
|
+
presetCommand,
|
|
66
|
+
...process.argv.slice(2)
|
|
67
|
+
] : void 0);
|
|
79
68
|
}
|
|
80
|
-
async function runCommand(
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
69
|
+
async function runCommand(create, config) {
|
|
70
|
+
const ctx = await loadConfig(config);
|
|
71
|
+
const command = await create(ctx);
|
|
72
|
+
const dispose = command.dispose?.bind(command);
|
|
73
|
+
const onSignal = dispose ? () => {
|
|
74
|
+
ctx.logger.info("Shutting down by user request.");
|
|
75
|
+
Promise.resolve(dispose()).finally(() => process.exit());
|
|
76
|
+
} : void 0;
|
|
77
|
+
if (onSignal) process.once("SIGINT", onSignal);
|
|
78
|
+
try {
|
|
79
|
+
await command.run();
|
|
80
|
+
} finally {
|
|
81
|
+
if (onSignal) process.off("SIGINT", onSignal);
|
|
82
|
+
await dispose?.();
|
|
83
|
+
}
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
/**
|
|
86
|
+
* @param presetCommand The subcommand implied by the invoked bin name,
|
|
87
|
+
* e.g. `zotest --no-watch` is `zotero-plugin test --no-watch`.
|
|
88
|
+
*/
|
|
89
|
+
async function mainWithErrorHandler(presetCommand) {
|
|
90
|
+
main(presetCommand).then(() => {
|
|
87
91
|
checkGitIgnore();
|
|
88
92
|
}).catch(onError);
|
|
89
93
|
process.on("uncaughtException", onError);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,75 +1,17 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
1
|
+
import { a as UserConfig, i as ResolvedConfig, n as Context, r as Hooks, t as AllConfig } from "./shared/types-DBWYVPm1.mjs";
|
|
2
|
+
import { BASE_DIR, BaseConfig, BaseContextFields, BaseUserConfig, CACHE_DIR, Command, CommandFactory, ConfigTransform, ContextOf, LintConfig, Manifest, PluginIdentity, ResolvedBaseConfig, TemplateData, UpdateJSON, UserPackageJson, baseDefaults } from "@zotero-plugin/config";
|
|
3
|
+
import { BuildConfig, BuildHooks, BuildRunOptions, Builder, BuilderContext, DEFAULT_DIST_TEMP_DIR, DevServer, DevServerConfig, DevServerContext, ResolvedBuildConfig, ResolvedDevServerConfig, ServeHooks, buildDefaults, buildTransform, createBuilder, createDevServer, devServerDefaults, replace, replaceInFile } from "@zotero-plugin/core";
|
|
4
|
+
import { GitHubConfig, ReleaseConfig, ReleaseContext, ReleaseHooks, ReleaseProvider, Releaser, ResolvedReleaseConfig, VersionBumpRelease, createReleaser, releaseDefaults, releaseProviders, releaseTransform } from "@zotero-plugin/releaser";
|
|
5
|
+
import { ResolvedTestConfig, TestConfig, TestContext, TestHooks, Tester, createTester, testDefaults } from "@zotero-plugin/tester";
|
|
3
6
|
/**
|
|
4
7
|
* Helper for user define configuration.
|
|
5
8
|
*/
|
|
6
9
|
export declare function defineConfig(userConfig: UserConfig): UserConfig;
|
|
7
10
|
/**
|
|
8
|
-
* Loads config
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
11
|
+
* Loads config.
|
|
12
|
+
*
|
|
13
|
+
* @param overrides Highest priority configuration.
|
|
14
|
+
* @returns Context with user-defined and default configuration merged and resolved.
|
|
11
15
|
*/
|
|
12
|
-
declare function loadConfig(overrides?:
|
|
13
|
-
|
|
14
|
-
private buildTime;
|
|
15
|
-
constructor(ctx: Context);
|
|
16
|
-
/**
|
|
17
|
-
* Default build runner
|
|
18
|
-
*/
|
|
19
|
-
run(): Promise<void>;
|
|
20
|
-
private prepareAssets;
|
|
21
|
-
bundle(): Promise<void>;
|
|
22
|
-
buildInProduction(): Promise<void>;
|
|
23
|
-
exit(): void;
|
|
24
|
-
}
|
|
25
|
-
declare class Release extends Base {
|
|
26
|
-
constructor(ctx: Context);
|
|
27
|
-
/**
|
|
28
|
-
* Runs release
|
|
29
|
-
*
|
|
30
|
-
* if is not CI,bump version, git add (package.json), git commit, git tag, git push;
|
|
31
|
-
* if is CI, do not bump version, do not run git, create release (tag is `v${version}`) and upload xpi,
|
|
32
|
-
* then, create or update release (tag is "release"), update `update.json`.
|
|
33
|
-
*/
|
|
34
|
-
run(): Promise<void>;
|
|
35
|
-
getChangelog(): Promise<string>;
|
|
36
|
-
private isEnabled;
|
|
37
|
-
exit(): void;
|
|
38
|
-
get resolvedCommitMessage(): string;
|
|
39
|
-
}
|
|
40
|
-
declare class Serve extends Base {
|
|
41
|
-
private builder;
|
|
42
|
-
private runner?;
|
|
43
|
-
private _zoteroBinPath?;
|
|
44
|
-
constructor(ctx: Context);
|
|
45
|
-
run(): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* watch source dir and build when file changed
|
|
48
|
-
*/
|
|
49
|
-
watch(): Promise<void>;
|
|
50
|
-
reload(): Promise<void>;
|
|
51
|
-
exit: () => never;
|
|
52
|
-
private onZoteroExit;
|
|
53
|
-
get zoteroBinPath(): string;
|
|
54
|
-
get profilePath(): string | undefined;
|
|
55
|
-
get dataDir(): string | undefined;
|
|
56
|
-
}
|
|
57
|
-
declare class Test extends Base {
|
|
58
|
-
private builder;
|
|
59
|
-
private zotero?;
|
|
60
|
-
private reporter;
|
|
61
|
-
private testBundler?;
|
|
62
|
-
constructor(ctx: Context);
|
|
63
|
-
run(): Promise<void>;
|
|
64
|
-
watch(): Promise<void>;
|
|
65
|
-
startZotero(): Promise<void>;
|
|
66
|
-
private onZoteroExit;
|
|
67
|
-
exit: (code?: string | number) => never;
|
|
68
|
-
private get zoteroBinPath();
|
|
69
|
-
private get prefs();
|
|
70
|
-
}
|
|
71
|
-
declare const Config: {
|
|
72
|
-
defineConfig: typeof defineConfig;
|
|
73
|
-
loadConfig: typeof loadConfig;
|
|
74
|
-
};
|
|
75
|
-
export { Build, Config, Release, Serve, Test };
|
|
16
|
+
export declare function loadConfig(overrides?: UserConfig): Promise<Context>;
|
|
17
|
+
export { type AllConfig, BASE_DIR, type BaseConfig, type BaseContextFields, type BaseUserConfig, type BuildConfig, type BuildHooks, type BuildRunOptions, type Builder, type BuilderContext, CACHE_DIR, type Command, type CommandFactory, type ConfigTransform, type Context, type ContextOf, DEFAULT_DIST_TEMP_DIR, type DevServer, type DevServerConfig, type DevServerContext, type GitHubConfig, type Hooks, type LintConfig, type Manifest, type PluginIdentity, type ReleaseConfig, type ReleaseContext, type ReleaseHooks, type ReleaseProvider, type Releaser, type ResolvedBaseConfig, type ResolvedBuildConfig, type ResolvedConfig, type ResolvedDevServerConfig, type ResolvedReleaseConfig, type ResolvedTestConfig, type ServeHooks, type TemplateData, type TestConfig, type TestContext, type TestHooks, type Tester, type UpdateJSON, type UserConfig, type UserPackageJson, type VersionBumpRelease, baseDefaults, buildDefaults, buildTransform, createBuilder, createDevServer, createReleaser, createTester, devServerDefaults, releaseDefaults, releaseProviders, releaseTransform, replace, replaceInFile, testDefaults };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { t as BASE_DIR, n as CACHE_DIR, r as DEFAULT_DIST_TEMP_DIR, i as baseDefaults, a as buildDefaults, o as buildTransform, s as createBuilder, c as createDevServer, l as createReleaser, u as createTester, v as defineConfig, d as devServerDefaults, y as loadConfig, f as releaseDefaults, p as releaseProviders, m as releaseTransform, h as replace, g as replaceInFile, _ as testDefaults } from "./shared/src-CW01kL-O.mjs";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BASE_DIR, CACHE_DIR, baseDefaults, baseDefaults as baseDefaults$1, loadConfig } from "@zotero-plugin/config";
|
|
2
|
+
import { DEFAULT_DIST_TEMP_DIR, buildDefaults, buildDefaults as buildDefaults$1, buildTransform, buildTransform as buildTransform$1, createBuilder, createDevServer, devServerDefaults, devServerDefaults as devServerDefaults$1, replace, replaceInFile } from "@zotero-plugin/core";
|
|
3
|
+
import { createReleaser, releaseDefaults, releaseDefaults as releaseDefaults$1, releaseProviders, releaseTransform, releaseTransform as releaseTransform$1 } from "@zotero-plugin/releaser";
|
|
4
|
+
import { createTester, testDefaults, testDefaults as testDefaults$1, testTransform } from "@zotero-plugin/tester";
|
|
5
|
+
// src/config.ts
|
|
6
|
+
/**
|
|
7
|
+
* Default values of all command configs.
|
|
8
|
+
*/
|
|
9
|
+
const defaults = {
|
|
10
|
+
...baseDefaults,
|
|
11
|
+
...buildDefaults,
|
|
12
|
+
...devServerDefaults,
|
|
13
|
+
...testDefaults,
|
|
14
|
+
...releaseDefaults
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Configuration transforms injected into the engine.
|
|
18
|
+
*/
|
|
19
|
+
const transforms = [
|
|
20
|
+
buildTransform,
|
|
21
|
+
testTransform,
|
|
22
|
+
releaseTransform
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Helper for user define configuration.
|
|
26
|
+
*/
|
|
27
|
+
function defineConfig(userConfig) {
|
|
28
|
+
return userConfig;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Loads config.
|
|
32
|
+
*
|
|
33
|
+
* @param overrides Highest priority configuration.
|
|
34
|
+
* @returns Context with user-defined and default configuration merged and resolved.
|
|
35
|
+
*/
|
|
36
|
+
function loadConfig$1(overrides) {
|
|
37
|
+
return loadConfig({
|
|
38
|
+
defaults,
|
|
39
|
+
overrides,
|
|
40
|
+
transforms
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export { testDefaults$1 as _, buildDefaults$1 as a, createDevServer as c, devServerDefaults$1 as d, releaseDefaults$1 as f, replaceInFile as g, replace as h, baseDefaults$1 as i, createReleaser as l, releaseTransform$1 as m, CACHE_DIR as n, buildTransform$1 as o, releaseProviders as p, DEFAULT_DIST_TEMP_DIR as r, createBuilder as s, BASE_DIR as t, createTester as u, defineConfig as v, loadConfig$1 as y };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseConfig, ContextOf, ResolvedBaseConfig } from "@zotero-plugin/config";
|
|
2
|
+
import { BuildConfig, BuildHooks, DevServerConfig, ResolvedBuildConfig, ResolvedDevServerConfig, ServeHooks } from "@zotero-plugin/core";
|
|
3
|
+
import { ReleaseConfig, ReleaseContext, ReleaseHooks, ResolvedReleaseConfig } from "@zotero-plugin/releaser";
|
|
4
|
+
import { ResolvedTestConfig, TestConfig, TestHooks } from "@zotero-plugin/tester";
|
|
5
|
+
import { DeepPartial } from "@zotero-plugin/utils";
|
|
6
|
+
import { Hookable } from "hookable";
|
|
7
|
+
type AllConfig = BaseConfig & BuildConfig & DevServerConfig & TestConfig & ReleaseConfig;
|
|
8
|
+
/**
|
|
9
|
+
* The user-facing configuration of scaffold.
|
|
10
|
+
*
|
|
11
|
+
* It is the composition of the base configuration and all command slices, and
|
|
12
|
+
* every field is deeply optional.
|
|
13
|
+
*/
|
|
14
|
+
type UserConfig = DeepPartial<AllConfig>;
|
|
15
|
+
/**
|
|
16
|
+
* All hook events exposed by scaffold.
|
|
17
|
+
*/
|
|
18
|
+
interface Hooks extends BuildHooks, ServeHooks, TestHooks, ReleaseHooks {}
|
|
19
|
+
/**
|
|
20
|
+
* The fully resolved configuration, i.e. the base configuration plus every
|
|
21
|
+
* command slice.
|
|
22
|
+
*/
|
|
23
|
+
type ResolvedConfig = ResolvedBaseConfig & ResolvedBuildConfig & ResolvedDevServerConfig & ResolvedTestConfig & ResolvedReleaseConfig;
|
|
24
|
+
/**
|
|
25
|
+
* The fully resolved context handed to every command.
|
|
26
|
+
*/
|
|
27
|
+
type Context = ContextOf<ResolvedConfig, Pick<ReleaseContext, "tag" | "commitMessage" | "changelog">> & {
|
|
28
|
+
hooks: Hookable<Hooks>;
|
|
29
|
+
};
|
|
30
|
+
export { UserConfig as a, ResolvedConfig as i, Context as n, Hooks as r, AllConfig as t };
|
package/dist/test.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The test API of scaffold.
|
|
3
|
+
*
|
|
4
|
+
* Test files import it as:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { describe, expect, it } from "zotero-plugin-scaffold/test";
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* The types come from `@zotero-plugin/tester/api`, while the bundler redirects
|
|
11
|
+
* the specifier above to the tester shim at build time, so nothing of
|
|
12
|
+
* mocha/chai is inlined into the test bundles.
|
|
13
|
+
*/
|
|
14
|
+
import api_default from "@zotero-plugin/tester/api";
|
|
15
|
+
export * from "@zotero-plugin/tester/api";
|
|
16
|
+
export { api_default as default };
|
package/dist/test.js
ADDED
package/dist/vendor.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import { replace, replaceInFile } from "@zotero-plugin/core";
|
|
2
2
|
import * as esToolkit from "es-toolkit";
|
|
3
3
|
import * as fse from "fs-extra/esm";
|
|
4
|
-
export
|
|
5
|
-
export declare function replaceInFile({ files, from, to, isGlob }: {
|
|
6
|
-
files: string | string[];
|
|
7
|
-
from: RegExp | RegExp[];
|
|
8
|
-
to: string | string[];
|
|
9
|
-
isGlob?: boolean;
|
|
10
|
-
}): Promise<void>;
|
|
11
|
-
export { esToolkit, fse };
|
|
4
|
+
export { esToolkit, fse, replace, replaceInFile };
|
package/dist/vendor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { replace, replaceInFile } from "@zotero-plugin/core";
|
|
2
2
|
import * as esToolkit from "es-toolkit";
|
|
3
3
|
import * as fse from "fs-extra/esm";
|
|
4
4
|
export { esToolkit, fse, replace, replaceInFile };
|
package/package.json
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zotero-plugin-scaffold",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0-beta.0",
|
|
5
5
|
"description": "A scaffold for Zotero plugin development.",
|
|
6
6
|
"author": "northword",
|
|
7
7
|
"license": "AGPL-3.0-or-later",
|
|
8
|
-
"homepage": "https://zotero-plugin
|
|
8
|
+
"homepage": "https://scaffold.zotero-plugin.dev",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/zotero-plugin-dev/zotero-plugin-scaffold.git"
|
|
11
|
+
"url": "https://github.com/zotero-plugin-dev/zotero-plugin-scaffold.git",
|
|
12
|
+
"directory": "packages/scaffold"
|
|
12
13
|
},
|
|
13
14
|
"bugs": {
|
|
14
15
|
"url": "https://github.com/zotero-plugin-dev/zotero-plugin-scaffold/issues"
|
|
15
16
|
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public",
|
|
19
|
+
"registry": "https://registry.npmjs.org"
|
|
20
|
+
},
|
|
16
21
|
"keywords": [
|
|
17
22
|
"zotero",
|
|
18
23
|
"plugin",
|
|
@@ -31,13 +36,21 @@
|
|
|
31
36
|
"./vendor": {
|
|
32
37
|
"types": "./dist/vendor.d.ts",
|
|
33
38
|
"import": "./dist/vendor.js"
|
|
39
|
+
},
|
|
40
|
+
"./test": {
|
|
41
|
+
"types": "./dist/test.d.ts",
|
|
42
|
+
"import": "./dist/test.js"
|
|
34
43
|
}
|
|
35
44
|
},
|
|
36
45
|
"main": "./dist/index.js",
|
|
37
46
|
"module": "./dist/index.js",
|
|
38
47
|
"types": "./dist/index.d.ts",
|
|
39
48
|
"bin": {
|
|
40
|
-
"zotero-plugin": "./bin/zotero-plugin.mjs"
|
|
49
|
+
"zotero-plugin": "./bin/zotero-plugin.mjs",
|
|
50
|
+
"zotest": "./bin/zotest.mjs",
|
|
51
|
+
"zodev": "./bin/zodev.mjs",
|
|
52
|
+
"zobuild": "./bin/zobuild.mjs",
|
|
53
|
+
"zorelease": "./bin/zorelease.mjs"
|
|
41
54
|
},
|
|
42
55
|
"files": [
|
|
43
56
|
"bin",
|
|
@@ -46,63 +59,29 @@
|
|
|
46
59
|
"engines": {
|
|
47
60
|
"node": ">=22.8.0"
|
|
48
61
|
},
|
|
49
|
-
"publishConfig": {
|
|
50
|
-
"access": "public",
|
|
51
|
-
"registry": "https://registry.npmjs.org"
|
|
52
|
-
},
|
|
53
62
|
"directories": {
|
|
54
63
|
"lib": "dist"
|
|
55
64
|
},
|
|
56
65
|
"dependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"c12": "4.0.0-rc.4",
|
|
63
|
-
"chokidar": "^6.0.0",
|
|
66
|
+
"@zotero-plugin/config": "1.0.0-beta.0",
|
|
67
|
+
"@zotero-plugin/core": "1.0.0-beta.0",
|
|
68
|
+
"@zotero-plugin/releaser": "1.0.0-beta.0",
|
|
69
|
+
"@zotero-plugin/tester": "1.0.0-beta.0",
|
|
70
|
+
"@zotero-plugin/utils": "1.0.0-beta.0",
|
|
64
71
|
"commander": "^15.0.0",
|
|
65
72
|
"es-toolkit": "^1.53.2",
|
|
66
|
-
"esbuild": "^0.28.2",
|
|
67
73
|
"fs-extra": "^11.4.1",
|
|
68
74
|
"hookable": "^6.1.2",
|
|
69
|
-
"
|
|
70
|
-
"tiny-update-notifier": "^2.0.2",
|
|
71
|
-
"tinyglobby": "^0.2.17",
|
|
72
|
-
"xvfb-ts": "^1.1.1"
|
|
75
|
+
"tiny-update-notifier": "^2.0.2"
|
|
73
76
|
},
|
|
74
77
|
"devDependencies": {
|
|
75
|
-
"@antfu/eslint-config": "^10.0.0",
|
|
76
78
|
"@commander-js/extra-typings": "^15.0.0",
|
|
77
79
|
"@types/fs-extra": "^11.0.4",
|
|
78
80
|
"@types/node": "^26.6.6",
|
|
79
|
-
"@typescript/native": "npm:typescript@^7.0.2",
|
|
80
|
-
"bumpp": "^12.3.0",
|
|
81
|
-
"changelogen": "^0.6.2",
|
|
82
|
-
"eslint": "^10.14.0",
|
|
83
|
-
"eslint-plugin-format": "^2.0.1",
|
|
84
|
-
"husky": "^9.1.7",
|
|
85
|
-
"lint-staged": "^17.6.0",
|
|
86
81
|
"tsdown": "^0.23.7",
|
|
87
|
-
"
|
|
88
|
-
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
89
|
-
"unplugin-raw": "^0.8.0",
|
|
90
|
-
"vitest": "^5.1.0"
|
|
91
|
-
},
|
|
92
|
-
"lint-staged": {
|
|
93
|
-
"*": "eslint --fix"
|
|
82
|
+
"typescript": "~6.0.3"
|
|
94
83
|
},
|
|
95
84
|
"scripts": {
|
|
96
|
-
"
|
|
97
|
-
"build": "pnpm build:tsdown && pnpm build:tsc",
|
|
98
|
-
"build:tsdown": "tsdown",
|
|
99
|
-
"build:tsc": "tsc --noEmit",
|
|
100
|
-
"lint:check": "eslint .",
|
|
101
|
-
"lint:fix": "eslint . --fix",
|
|
102
|
-
"docs:dev": "pnpm -C docs run dev",
|
|
103
|
-
"docs:build": "pnpm -C docs run build",
|
|
104
|
-
"release": "bumpp -r --commit \"chore(release): publish v%s\"",
|
|
105
|
-
"update:deps": "pnpx taze minor -w -f -l -r",
|
|
106
|
-
"test": "vitest"
|
|
85
|
+
"build:tsc": "tsc --noEmit"
|
|
107
86
|
}
|
|
108
87
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { i as Logger, t as Context } from "./scaffold-index-D-5PZpaP.mjs";
|
|
2
|
-
declare abstract class Base {
|
|
3
|
-
ctx: Context;
|
|
4
|
-
constructor(ctx: Context);
|
|
5
|
-
abstract run(): void | Promise<void>;
|
|
6
|
-
abstract exit(): void;
|
|
7
|
-
get logger(): Logger;
|
|
8
|
-
}
|
|
9
|
-
export { Base as t };
|