@dword-design/base-config-web-extension 3.1.10 → 4.0.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 +43 -43
- package/dist/dev.d.ts +9 -0
- package/dist/dev.js +8 -16
- package/dist/index.d.ts +77 -0
- package/dist/index.js +71 -80
- package/dist/lint.d.ts +6 -0
- package/dist/lint.js +16 -0
- package/dist/prepublish-only.d.ts +8 -0
- package/dist/prepublish-only.js +10 -20
- package/dist/typecheck.d.ts +2 -0
- package/dist/typecheck.js +15 -0
- package/package.json +32 -28
- package/dist/get-manifest.js +0 -69
package/README.md
CHANGED
|
@@ -3,49 +3,49 @@
|
|
|
3
3
|
<!-- /TITLE -->
|
|
4
4
|
|
|
5
5
|
<!-- BADGES/ -->
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
6
|
+
<p>
|
|
7
|
+
<a href="https://npmjs.org/package/@dword-design/base-config-web-extension">
|
|
8
|
+
<img
|
|
9
|
+
src="https://img.shields.io/npm/v/@dword-design/base-config-web-extension.svg"
|
|
10
|
+
alt="npm version"
|
|
11
|
+
>
|
|
12
|
+
</a><img src="https://img.shields.io/badge/os-linux%20%7C%C2%A0macos%20%7C%C2%A0windows-blue" alt="Linux macOS Windows compatible"><a href="https://github.com/dword-design/base-config-web-extension/actions">
|
|
13
|
+
<img
|
|
14
|
+
src="https://github.com/dword-design/base-config-web-extension/workflows/build/badge.svg"
|
|
15
|
+
alt="Build status"
|
|
16
|
+
>
|
|
17
|
+
</a><a href="https://codecov.io/gh/dword-design/base-config-web-extension">
|
|
18
|
+
<img
|
|
19
|
+
src="https://codecov.io/gh/dword-design/base-config-web-extension/branch/master/graph/badge.svg"
|
|
20
|
+
alt="Coverage status"
|
|
21
|
+
>
|
|
22
|
+
</a><a href="https://david-dm.org/dword-design/base-config-web-extension">
|
|
23
|
+
<img src="https://img.shields.io/david/dword-design/base-config-web-extension" alt="Dependency status">
|
|
24
|
+
</a><img src="https://img.shields.io/badge/renovate-enabled-brightgreen" alt="Renovate enabled"><br/><a href="https://gitpod.io/#https://github.com/dword-design/base-config-web-extension">
|
|
25
|
+
<img
|
|
26
|
+
src="https://gitpod.io/button/open-in-gitpod.svg"
|
|
27
|
+
alt="Open in Gitpod"
|
|
28
|
+
width="114"
|
|
29
|
+
>
|
|
30
|
+
</a><a href="https://www.buymeacoffee.com/dword">
|
|
31
|
+
<img
|
|
32
|
+
src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"
|
|
33
|
+
alt="Buy Me a Coffee"
|
|
34
|
+
width="114"
|
|
35
|
+
>
|
|
36
|
+
</a><a href="https://paypal.me/SebastianLandwehr">
|
|
37
|
+
<img
|
|
38
|
+
src="https://sebastianlandwehr.com/images/paypal.svg"
|
|
39
|
+
alt="PayPal"
|
|
40
|
+
width="163"
|
|
41
|
+
>
|
|
42
|
+
</a><a href="https://www.patreon.com/dworddesign">
|
|
43
|
+
<img
|
|
44
|
+
src="https://sebastianlandwehr.com/images/patreon.svg"
|
|
45
|
+
alt="Patreon"
|
|
46
|
+
width="163"
|
|
47
|
+
>
|
|
48
|
+
</a>
|
|
49
49
|
</p>
|
|
50
50
|
<!-- /BADGES -->
|
|
51
51
|
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Base, PartialCommandOptions } from '@dword-design/base';
|
|
2
|
+
export default function (this: Base, options: PartialCommandOptions & {
|
|
3
|
+
browser?: string;
|
|
4
|
+
}): import("execa").ResultPromise<{
|
|
5
|
+
cwd: string;
|
|
6
|
+
reject: boolean;
|
|
7
|
+
stderr: any;
|
|
8
|
+
stdout?: "inherit" | undefined;
|
|
9
|
+
}>;
|
package/dist/dev.js
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import { execaCommand } from
|
|
2
|
-
|
|
3
|
-
export default async function (browser = 'chrome', options) {
|
|
1
|
+
import { execaCommand } from "execa";
|
|
2
|
+
export default function (options) {
|
|
4
3
|
options = {
|
|
4
|
+
browser: "chrome",
|
|
5
5
|
env: {},
|
|
6
|
-
log: process.env.NODE_ENV !==
|
|
7
|
-
stderr:
|
|
6
|
+
log: process.env.NODE_ENV !== "test",
|
|
7
|
+
stderr: "inherit",
|
|
8
8
|
...options
|
|
9
9
|
};
|
|
10
|
-
return execaCommand(
|
|
11
|
-
env: {
|
|
12
|
-
...options.env,
|
|
13
|
-
MANIFEST: JSON.stringify(await getManifest({
|
|
14
|
-
browser,
|
|
15
|
-
cwd: this.cwd
|
|
16
|
-
})),
|
|
17
|
-
TARGET: browser
|
|
18
|
-
},
|
|
10
|
+
return execaCommand(`wxt${options.browser ? ` -b ${options.browser}` : ""}`, {
|
|
19
11
|
...(options.log && {
|
|
20
|
-
stdout:
|
|
12
|
+
stdout: "inherit"
|
|
21
13
|
}),
|
|
22
14
|
cwd: this.cwd,
|
|
23
|
-
reject: process.env.NODE_ENV !==
|
|
15
|
+
reject: process.env.NODE_ENV !== "test",
|
|
24
16
|
stderr: options.stderr
|
|
25
17
|
});
|
|
26
18
|
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type Base } from '@dword-design/base';
|
|
2
|
+
import lint from './lint';
|
|
3
|
+
import typecheck from './typecheck';
|
|
4
|
+
declare const _default: (this: Base) => {
|
|
5
|
+
allowedMatches: string[];
|
|
6
|
+
commands: {
|
|
7
|
+
dev: {
|
|
8
|
+
handler: (options: {
|
|
9
|
+
browser: string;
|
|
10
|
+
}) => any;
|
|
11
|
+
options: {
|
|
12
|
+
default: string;
|
|
13
|
+
description: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
prepublishOnly: {
|
|
18
|
+
handler: (options: {
|
|
19
|
+
browser: string;
|
|
20
|
+
}) => any;
|
|
21
|
+
options: {
|
|
22
|
+
default: string;
|
|
23
|
+
description: string;
|
|
24
|
+
name: string;
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
depcheckConfig: {
|
|
29
|
+
parsers: {
|
|
30
|
+
'**/*.scss': (filePath: any) => any;
|
|
31
|
+
'**/*.vue': any;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
deployAssets: {
|
|
35
|
+
label: string;
|
|
36
|
+
path: string;
|
|
37
|
+
}[];
|
|
38
|
+
deployEnv: {
|
|
39
|
+
CHROME_CLIENT_ID: string;
|
|
40
|
+
CHROME_CLIENT_SECRET: string;
|
|
41
|
+
CHROME_EXTENSION_ID: string;
|
|
42
|
+
CHROME_REFRESH_TOKEN: string;
|
|
43
|
+
FIREFOX_EXTENSION_ID: string;
|
|
44
|
+
FIREFOX_JWT_ISSUER: string;
|
|
45
|
+
FIREFOX_JWT_SECRET: string;
|
|
46
|
+
};
|
|
47
|
+
deployPlugins: any[][];
|
|
48
|
+
editorIgnore: string[];
|
|
49
|
+
gitignore: string[];
|
|
50
|
+
isLockFileFixCommitType: boolean;
|
|
51
|
+
lint: typeof lint;
|
|
52
|
+
preDeploySteps: ({
|
|
53
|
+
run: string;
|
|
54
|
+
env?: undefined;
|
|
55
|
+
'working-directory'?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
env: {
|
|
58
|
+
FIREFOX_EXTENSION_ID: string;
|
|
59
|
+
};
|
|
60
|
+
run: string;
|
|
61
|
+
'working-directory'?: undefined;
|
|
62
|
+
} | {
|
|
63
|
+
run: string;
|
|
64
|
+
'working-directory': string;
|
|
65
|
+
env?: undefined;
|
|
66
|
+
})[];
|
|
67
|
+
prepare: () => Promise<any>;
|
|
68
|
+
readmeInstallString: string;
|
|
69
|
+
typecheck: typeof typecheck;
|
|
70
|
+
typescriptConfig: {
|
|
71
|
+
compilerOptions: {
|
|
72
|
+
declaration: boolean;
|
|
73
|
+
};
|
|
74
|
+
extends: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -1,108 +1,91 @@
|
|
|
1
|
-
import pathLib from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import fs from
|
|
1
|
+
import pathLib from "node:path";
|
|
2
|
+
import { defineBaseConfig } from "@dword-design/base";
|
|
3
|
+
import depcheckParserSass from "@dword-design/depcheck-parser-sass";
|
|
4
|
+
import depcheck from "depcheck";
|
|
5
|
+
import binName from "depcheck-bin-name";
|
|
6
|
+
import packageName from "depcheck-package-name";
|
|
7
|
+
import endent from "endent";
|
|
8
|
+
import fs from "fs-extra";
|
|
9
|
+
import { stringify as stringifyIni } from "ini";
|
|
9
10
|
import dev from "./dev.js";
|
|
11
|
+
import lint from "./lint.js";
|
|
10
12
|
import prepublishOnly from "./prepublish-only.js";
|
|
11
|
-
|
|
13
|
+
import typecheck from "./typecheck.js";
|
|
14
|
+
export default defineBaseConfig(function () {
|
|
12
15
|
return {
|
|
13
|
-
allowedMatches:
|
|
16
|
+
allowedMatches: Object.keys({
|
|
17
|
+
assets: true,
|
|
18
|
+
components: true,
|
|
19
|
+
entrypoints: true,
|
|
20
|
+
"index.spec.ts": true,
|
|
21
|
+
public: true
|
|
22
|
+
}),
|
|
14
23
|
commands: {
|
|
15
24
|
dev: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = await execaCommand(`browsers install chrome@116.0.5793.0`);
|
|
23
|
-
const path = stdout.split(' ').slice(1).join(' ');
|
|
24
|
-
await fs.outputFile('.webextrc', `${JSON.stringify({
|
|
25
|
-
chromiumBinary: path
|
|
26
|
-
})}\n`);
|
|
25
|
+
handler: options => dev.call(this, options),
|
|
26
|
+
options: [{
|
|
27
|
+
default: "chrome",
|
|
28
|
+
description: "Specify a browser",
|
|
29
|
+
name: "-b, --browser <browser>"
|
|
30
|
+
}]
|
|
27
31
|
},
|
|
28
32
|
prepublishOnly: {
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
handler: options => prepublishOnly.call(this, options),
|
|
34
|
+
options: [{
|
|
35
|
+
default: "chrome",
|
|
36
|
+
description: "Specify a browser",
|
|
37
|
+
name: "-b, --browser <browser>"
|
|
38
|
+
}]
|
|
31
39
|
}
|
|
32
40
|
},
|
|
33
41
|
depcheckConfig: {
|
|
34
42
|
parsers: {
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
"**/*.scss": depcheckParserSass,
|
|
44
|
+
"**/*.vue": depcheck.parser.vue
|
|
37
45
|
}
|
|
38
46
|
},
|
|
39
47
|
deployAssets: [{
|
|
40
|
-
label:
|
|
41
|
-
path:
|
|
48
|
+
label: "Extension",
|
|
49
|
+
path: "extension.zip"
|
|
42
50
|
}],
|
|
43
51
|
deployEnv: {
|
|
44
|
-
CHROME_CLIENT_ID:
|
|
45
|
-
CHROME_CLIENT_SECRET:
|
|
46
|
-
CHROME_EXTENSION_ID:
|
|
47
|
-
CHROME_REFRESH_TOKEN:
|
|
48
|
-
FIREFOX_EXTENSION_ID:
|
|
49
|
-
FIREFOX_JWT_ISSUER:
|
|
50
|
-
FIREFOX_JWT_SECRET:
|
|
52
|
+
CHROME_CLIENT_ID: "${{ secrets.CHROME_CLIENT_ID }}",
|
|
53
|
+
CHROME_CLIENT_SECRET: "${{ secrets.CHROME_CLIENT_SECRET }}",
|
|
54
|
+
CHROME_EXTENSION_ID: "${{ secrets.CHROME_EXTENSION_ID }}",
|
|
55
|
+
CHROME_REFRESH_TOKEN: "${{ secrets.CHROME_REFRESH_TOKEN }}",
|
|
56
|
+
FIREFOX_EXTENSION_ID: "${{ secrets.FIREFOX_EXTENSION_ID }}",
|
|
57
|
+
FIREFOX_JWT_ISSUER: "${{ secrets.FIREFOX_JWT_ISSUER }}",
|
|
58
|
+
FIREFOX_JWT_SECRET: "${{ secrets.FIREFOX_JWT_SECRET }}"
|
|
51
59
|
},
|
|
52
60
|
deployPlugins: [[packageName`@semantic-release/exec`, {
|
|
53
61
|
publishCmd: `pnpm ${binName`publish-extension`} --chrome-zip=dist/chrome.zip --firefox-zip=dist/firefox.zip --firefox-sources-zip=dist/firefox-sources.zip`
|
|
54
62
|
}]],
|
|
55
|
-
editorIgnore: [
|
|
56
|
-
gitignore: [
|
|
63
|
+
editorIgnore: [".wxt", "dist", "userdata"],
|
|
64
|
+
gitignore: ["/.wxt", "/dist", "/userdata"],
|
|
57
65
|
isLockFileFixCommitType: true,
|
|
66
|
+
lint,
|
|
58
67
|
preDeploySteps: [{
|
|
59
|
-
run:
|
|
68
|
+
run: "pnpm prepublishOnly"
|
|
60
69
|
}, {
|
|
61
70
|
env: {
|
|
62
|
-
FIREFOX_EXTENSION_ID:
|
|
71
|
+
FIREFOX_EXTENSION_ID: "${{ secrets.FIREFOX_EXTENSION_ID }}"
|
|
63
72
|
},
|
|
64
|
-
run:
|
|
73
|
+
run: "pnpm prepublishOnly firefox"
|
|
65
74
|
}, {
|
|
66
|
-
run:
|
|
67
|
-
|
|
75
|
+
run: "zip -r ../chrome.zip .",
|
|
76
|
+
"working-directory": "dist/chrome"
|
|
68
77
|
}, {
|
|
69
|
-
run:
|
|
70
|
-
|
|
78
|
+
run: "zip -r ../firefox.zip .",
|
|
79
|
+
"working-directory": "dist/firefox"
|
|
71
80
|
}, {
|
|
72
|
-
run:
|
|
81
|
+
run: "git archive --output=dist/firefox-sources.zip HEAD"
|
|
73
82
|
}],
|
|
74
|
-
prepare: () => Promise.all([fs.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
import eslint from '${packageName`vite-plugin-eslint`}'
|
|
81
|
-
import webExtension from '${packageName`vite-plugin-web-extension`}'
|
|
82
|
-
import svgLoader from '${packageName`vite-svg-loader`}'
|
|
83
|
-
|
|
84
|
-
export default defineConfig({
|
|
85
|
-
build: {
|
|
86
|
-
outDir: P.join('dist', process.env.TARGET),
|
|
87
|
-
},
|
|
88
|
-
resolve: {
|
|
89
|
-
alias: { '@': '.' },
|
|
90
|
-
},
|
|
91
|
-
plugins: [
|
|
92
|
-
vueBabel(),
|
|
93
|
-
vue(),
|
|
94
|
-
svgLoader(),
|
|
95
|
-
eslint({ fix: true }),
|
|
96
|
-
webExtension({
|
|
97
|
-
browser: process.env.TARGET,
|
|
98
|
-
manifest: () => JSON.parse(process.env.MANIFEST),
|
|
99
|
-
scriptViteConfig: { plugins: [babel(), eslint({ fix: true })] },
|
|
100
|
-
webExtConfig: { keepProfileChanges: true, chromiumProfile: 'userdata' },
|
|
101
|
-
}),
|
|
102
|
-
],
|
|
103
|
-
})\n
|
|
104
|
-
`), fs.ensureDir(pathLib.join(this.cwd, 'userdata'))]),
|
|
105
|
-
readmeInstallString: dedent`
|
|
83
|
+
prepare: () => Promise.all([fs.ensureDir(pathLib.join(this.cwd, "userdata")), fs.outputFile(pathLib.join(this.cwd, ".wxtrc"), stringifyIni({
|
|
84
|
+
modules: [packageName`@wxt-dev/module-vue`],
|
|
85
|
+
outDir: "dist",
|
|
86
|
+
outDirTemplate: "{{browser}}"
|
|
87
|
+
}))]),
|
|
88
|
+
readmeInstallString: endent`
|
|
106
89
|
## Recommended setup
|
|
107
90
|
* Node.js 20.11.1
|
|
108
91
|
* pnpm 9.15.3
|
|
@@ -114,14 +97,22 @@ export default function () {
|
|
|
114
97
|
|
|
115
98
|
## Running a development server
|
|
116
99
|
\`\`\`bash
|
|
117
|
-
$ pnpm dev
|
|
100
|
+
$ pnpm dev -b <browser>
|
|
118
101
|
\`\`\`
|
|
119
102
|
Available browsers are \`firefox\` and \`chrome\`. Default is \`firefox\`.
|
|
120
103
|
|
|
121
104
|
## Building the extension for upload
|
|
122
105
|
\`\`\`bash
|
|
123
|
-
$ pnpm prepublishOnly
|
|
106
|
+
$ pnpm prepublishOnly -b <browser>
|
|
124
107
|
\`\`\`
|
|
125
|
-
|
|
108
|
+
`,
|
|
109
|
+
typecheck,
|
|
110
|
+
typescriptConfig: {
|
|
111
|
+
compilerOptions: {
|
|
112
|
+
declaration: false
|
|
113
|
+
// OtherwiseTypeScript error when declaring a content script via defineContentScript: "The inferred type of 'default' cannot be named without a reference to '@/node_modules/wxt/dist/types'. This is likely not portable. A type annotation is necessary.",
|
|
114
|
+
},
|
|
115
|
+
extends: "./.wxt/tsconfig.json"
|
|
116
|
+
}
|
|
126
117
|
};
|
|
127
|
-
}
|
|
118
|
+
});
|
package/dist/lint.d.ts
ADDED
package/dist/lint.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { execaCommand } from "execa";
|
|
2
|
+
export default function (options) {
|
|
3
|
+
options = {
|
|
4
|
+
env: {},
|
|
5
|
+
log: process.env.NODE_ENV !== "test",
|
|
6
|
+
stderr: "inherit",
|
|
7
|
+
...options
|
|
8
|
+
};
|
|
9
|
+
return execaCommand("wxt prepare", {
|
|
10
|
+
...(options.log && {
|
|
11
|
+
stdout: "inherit"
|
|
12
|
+
}),
|
|
13
|
+
cwd: this.cwd,
|
|
14
|
+
stderr: options.stderr
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Base, PartialCommandOptions } from '@dword-design/base';
|
|
2
|
+
export default function (this: Base, options: PartialCommandOptions & {
|
|
3
|
+
browser?: string;
|
|
4
|
+
}): Promise<import("execa").Result<{
|
|
5
|
+
cwd: string;
|
|
6
|
+
stderr: any;
|
|
7
|
+
stdout?: "inherit" | undefined;
|
|
8
|
+
}>>;
|
package/dist/prepublish-only.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
import { execaCommand } from
|
|
2
|
-
import
|
|
3
|
-
export default async function (
|
|
4
|
-
let options = typeof args[0] === 'string' ? args[1] : args[0];
|
|
1
|
+
import { execaCommand } from "execa";
|
|
2
|
+
import { omit } from "lodash-es";
|
|
3
|
+
export default async function (options) {
|
|
5
4
|
options = {
|
|
6
|
-
browser:
|
|
5
|
+
browser: "chrome",
|
|
7
6
|
env: {},
|
|
8
|
-
log: process.env.NODE_ENV !==
|
|
9
|
-
stderr:
|
|
10
|
-
...(typeof args[0] === 'string' && {
|
|
11
|
-
browser: args[0]
|
|
12
|
-
}),
|
|
7
|
+
log: process.env.NODE_ENV !== "test",
|
|
8
|
+
stderr: "inherit",
|
|
13
9
|
...options
|
|
14
10
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
MANIFEST: JSON.stringify(await getManifest({
|
|
19
|
-
browser: options.browser,
|
|
20
|
-
cwd: this.cwd
|
|
21
|
-
})),
|
|
22
|
-
TARGET: options.browser
|
|
23
|
-
},
|
|
11
|
+
await this.lint(omit(options, ["browser"]));
|
|
12
|
+
await this.typecheck(omit(options, ["browser"]));
|
|
13
|
+
return execaCommand(`wxt build${options.browser ? ` -b ${options.browser}` : ""}`, {
|
|
24
14
|
...(options.log && {
|
|
25
|
-
stdout:
|
|
15
|
+
stdout: "inherit"
|
|
26
16
|
}),
|
|
27
17
|
cwd: this.cwd,
|
|
28
18
|
stderr: options.stderr
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { execaCommand } from "execa";
|
|
2
|
+
export default async function (options = {}) {
|
|
3
|
+
options = {
|
|
4
|
+
log: process.env.NODE_ENV !== "test",
|
|
5
|
+
stderr: "inherit",
|
|
6
|
+
...options
|
|
7
|
+
};
|
|
8
|
+
await execaCommand("wxt prepare", {
|
|
9
|
+
...(options.log && {
|
|
10
|
+
stdout: "inherit"
|
|
11
|
+
}),
|
|
12
|
+
cwd: this.cwd,
|
|
13
|
+
stderr: options.stderr
|
|
14
|
+
});
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dword-design/base-config-web-extension",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"repository": "dword-design/base-config-web-extension",
|
|
5
5
|
"funding": "https://github.com/sponsors/dword-design",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Sebastian Landwehr <info@sebastianlandwehr.com>",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"exports":
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"default": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
10
17
|
"main": "dist/index.js",
|
|
11
18
|
"files": [
|
|
12
19
|
"dist"
|
|
@@ -19,45 +26,42 @@
|
|
|
19
26
|
"lint": "base lint",
|
|
20
27
|
"prepare": "base prepare",
|
|
21
28
|
"prepublishOnly": "base prepublishOnly",
|
|
22
|
-
"test": "base test"
|
|
29
|
+
"test": "base test",
|
|
30
|
+
"typecheck": "base typecheck",
|
|
31
|
+
"verify": "base verify"
|
|
23
32
|
},
|
|
24
33
|
"dependencies": {
|
|
25
|
-
"@dword-design/
|
|
26
|
-
"@dword-design/
|
|
27
|
-
"@puppeteer/browsers": "^2.10.5",
|
|
34
|
+
"@dword-design/base": "^15.2.3",
|
|
35
|
+
"@dword-design/depcheck-parser-sass": "^5.0.0",
|
|
28
36
|
"@semantic-release/exec": "^6.0.3",
|
|
29
|
-
"@
|
|
30
|
-
"
|
|
31
|
-
"depcheck-
|
|
32
|
-
"
|
|
33
|
-
"depcheck-parser-vue": "^5.0.0",
|
|
37
|
+
"@wxt-dev/module-vue": "^1.0.2",
|
|
38
|
+
"depcheck-bin-name": "^2.0.0",
|
|
39
|
+
"depcheck-package-name": "^4.0.0",
|
|
40
|
+
"endent": "npm:@dword-design/endent@^1.4.7",
|
|
34
41
|
"execa": "^9.6.0",
|
|
35
42
|
"fs-extra": "^11.3.0",
|
|
36
|
-
"
|
|
43
|
+
"ini": "^5.0.0",
|
|
37
44
|
"lodash-es": "^4.17.21",
|
|
38
45
|
"publish-browser-extension": "^2.3.1",
|
|
39
|
-
"
|
|
40
|
-
"vite-plugin-babel": "^1.3.1",
|
|
41
|
-
"vite-plugin-eslint": "^1.8.1",
|
|
42
|
-
"vite-plugin-web-extension": "^4.4.3",
|
|
43
|
-
"vite-svg-loader": "^5.1.0",
|
|
44
|
-
"vue": "^3.5.16"
|
|
46
|
+
"wxt": "npm:@dword-design/wxt-fork@^0.0.2"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
49
|
+
"@playwright/browser-chromium": "^1.54.1",
|
|
50
|
+
"@playwright/test": "^1.54.1",
|
|
51
|
+
"@types/express": "^5.0.3",
|
|
52
|
+
"@types/fs-extra": "^11.0.4",
|
|
53
|
+
"@types/ini": "^4.1.1",
|
|
54
|
+
"@types/lodash-es": "^4.17.12",
|
|
55
|
+
"express": "^5.1.0",
|
|
51
56
|
"get-port": "^7.1.0",
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
"webextension-polyfill": "^0.12.0"
|
|
57
|
+
"output-files": "^3.0.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"depcheck": "*"
|
|
57
61
|
},
|
|
58
62
|
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977",
|
|
59
63
|
"engines": {
|
|
60
|
-
"node": ">=
|
|
64
|
+
"node": ">=20"
|
|
61
65
|
},
|
|
62
66
|
"publishConfig": {
|
|
63
67
|
"access": "public"
|
package/dist/get-manifest.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import pathLib from 'node:path';
|
|
2
|
-
import fs from 'fs-extra';
|
|
3
|
-
import loadPkg from 'load-pkg';
|
|
4
|
-
import { pick } from 'lodash-es';
|
|
5
|
-
export default async ({
|
|
6
|
-
cwd,
|
|
7
|
-
browser
|
|
8
|
-
}) => {
|
|
9
|
-
const packageConfig = await loadPkg(cwd);
|
|
10
|
-
const config = await fs.readJson(pathLib.join(cwd, 'config.json')).catch(() => ({}));
|
|
11
|
-
const iconExists = await fs.exists(pathLib.join(cwd, 'public', 'icon.png'));
|
|
12
|
-
const popupExists = await fs.exists(pathLib.join(cwd, 'popup.html'));
|
|
13
|
-
return {
|
|
14
|
-
name: config.name,
|
|
15
|
-
...pick(packageConfig, ['version', 'description']),
|
|
16
|
-
manifest_version: 3,
|
|
17
|
-
...(iconExists && {
|
|
18
|
-
icons: {
|
|
19
|
-
128: 'icon.png'
|
|
20
|
-
}
|
|
21
|
-
}),
|
|
22
|
-
...(('action' in config || popupExists) && {
|
|
23
|
-
action: {
|
|
24
|
-
...(iconExists && {
|
|
25
|
-
default_icon: {
|
|
26
|
-
128: 'icon.png'
|
|
27
|
-
}
|
|
28
|
-
}),
|
|
29
|
-
...(popupExists && {
|
|
30
|
-
default_popup: 'popup.html'
|
|
31
|
-
}),
|
|
32
|
-
...(typeof config.action === 'object' && config.action)
|
|
33
|
-
}
|
|
34
|
-
}),
|
|
35
|
-
...(((await fs.exists(pathLib.join(cwd, 'content.js'))) || config.css?.length > 0) && {
|
|
36
|
-
content_scripts: [{
|
|
37
|
-
js: ['content.js'],
|
|
38
|
-
...(config.css?.length > 0 && {
|
|
39
|
-
css: config.css
|
|
40
|
-
}),
|
|
41
|
-
matches: config.matches || ['<all_urls>']
|
|
42
|
-
}]
|
|
43
|
-
}),
|
|
44
|
-
...((await fs.exists(pathLib.join(cwd, 'background.js'))) && {
|
|
45
|
-
background: {
|
|
46
|
-
...(browser === 'firefox' ? {
|
|
47
|
-
scripts: ['background.js']
|
|
48
|
-
} : {
|
|
49
|
-
service_worker: 'background.js'
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
}),
|
|
53
|
-
...(process.env.FIREFOX_EXTENSION_ID && browser === 'firefox' && {
|
|
54
|
-
browser_specific_settings: {
|
|
55
|
-
gecko: {
|
|
56
|
-
id: process.env.FIREFOX_EXTENSION_ID
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}),
|
|
60
|
-
...pick(config, Object.keys({
|
|
61
|
-
css: true,
|
|
62
|
-
host_permissions: true,
|
|
63
|
-
optional_host_permissions: true,
|
|
64
|
-
optional_permissions: true,
|
|
65
|
-
permissions: true,
|
|
66
|
-
web_accessible_resources: true
|
|
67
|
-
}))
|
|
68
|
-
};
|
|
69
|
-
};
|