@dword-design/base-config-web-extension 3.1.11 → 4.0.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/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 +81 -69
- 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 +33 -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,98 +1,102 @@
|
|
|
1
|
-
import pathLib from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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";
|
|
10
|
+
import outputFiles from "output-files";
|
|
8
11
|
import dev from "./dev.js";
|
|
12
|
+
import lint from "./lint.js";
|
|
9
13
|
import prepublishOnly from "./prepublish-only.js";
|
|
10
|
-
|
|
14
|
+
import typecheck from "./typecheck.js";
|
|
15
|
+
export default defineBaseConfig(function () {
|
|
11
16
|
return {
|
|
12
|
-
allowedMatches:
|
|
17
|
+
allowedMatches: Object.keys({
|
|
18
|
+
assets: true,
|
|
19
|
+
components: true,
|
|
20
|
+
entrypoints: true,
|
|
21
|
+
"index.spec.ts": true,
|
|
22
|
+
public: true
|
|
23
|
+
}),
|
|
13
24
|
commands: {
|
|
14
25
|
dev: {
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
handler: options => dev.call(this, options),
|
|
27
|
+
options: [{
|
|
28
|
+
default: "chrome",
|
|
29
|
+
description: "Specify a browser",
|
|
30
|
+
name: "-b, --browser <browser>"
|
|
31
|
+
}]
|
|
17
32
|
},
|
|
18
33
|
prepublishOnly: {
|
|
19
|
-
|
|
20
|
-
|
|
34
|
+
handler: options => prepublishOnly.call(this, options),
|
|
35
|
+
options: [{
|
|
36
|
+
default: "chrome",
|
|
37
|
+
description: "Specify a browser",
|
|
38
|
+
name: "-b, --browser <browser>"
|
|
39
|
+
}]
|
|
21
40
|
}
|
|
22
41
|
},
|
|
23
42
|
depcheckConfig: {
|
|
24
43
|
parsers: {
|
|
25
|
-
|
|
26
|
-
|
|
44
|
+
"**/*.scss": depcheckParserSass,
|
|
45
|
+
"**/*.vue": depcheck.parser.vue
|
|
27
46
|
}
|
|
28
47
|
},
|
|
29
48
|
deployAssets: [{
|
|
30
|
-
label:
|
|
31
|
-
path:
|
|
49
|
+
label: "Extension",
|
|
50
|
+
path: "extension.zip"
|
|
32
51
|
}],
|
|
33
52
|
deployEnv: {
|
|
34
|
-
CHROME_CLIENT_ID:
|
|
35
|
-
CHROME_CLIENT_SECRET:
|
|
36
|
-
CHROME_EXTENSION_ID:
|
|
37
|
-
CHROME_REFRESH_TOKEN:
|
|
38
|
-
FIREFOX_EXTENSION_ID:
|
|
39
|
-
FIREFOX_JWT_ISSUER:
|
|
40
|
-
FIREFOX_JWT_SECRET:
|
|
53
|
+
CHROME_CLIENT_ID: "${{ secrets.CHROME_CLIENT_ID }}",
|
|
54
|
+
CHROME_CLIENT_SECRET: "${{ secrets.CHROME_CLIENT_SECRET }}",
|
|
55
|
+
CHROME_EXTENSION_ID: "${{ secrets.CHROME_EXTENSION_ID }}",
|
|
56
|
+
CHROME_REFRESH_TOKEN: "${{ secrets.CHROME_REFRESH_TOKEN }}",
|
|
57
|
+
FIREFOX_EXTENSION_ID: "${{ secrets.FIREFOX_EXTENSION_ID }}",
|
|
58
|
+
FIREFOX_JWT_ISSUER: "${{ secrets.FIREFOX_JWT_ISSUER }}",
|
|
59
|
+
FIREFOX_JWT_SECRET: "${{ secrets.FIREFOX_JWT_SECRET }}"
|
|
41
60
|
},
|
|
42
61
|
deployPlugins: [[packageName`@semantic-release/exec`, {
|
|
43
62
|
publishCmd: `pnpm ${binName`publish-extension`} --chrome-zip=dist/chrome.zip --firefox-zip=dist/firefox.zip --firefox-sources-zip=dist/firefox-sources.zip`
|
|
44
63
|
}]],
|
|
45
|
-
editorIgnore: [
|
|
46
|
-
gitignore: [
|
|
64
|
+
editorIgnore: [".wxt", "dist", "userdata"],
|
|
65
|
+
gitignore: ["/.wxt", "/dist", "/userdata"],
|
|
47
66
|
isLockFileFixCommitType: true,
|
|
67
|
+
lint,
|
|
48
68
|
preDeploySteps: [{
|
|
49
|
-
run:
|
|
69
|
+
run: "pnpm prepublishOnly"
|
|
50
70
|
}, {
|
|
51
71
|
env: {
|
|
52
|
-
FIREFOX_EXTENSION_ID:
|
|
72
|
+
FIREFOX_EXTENSION_ID: "${{ secrets.FIREFOX_EXTENSION_ID }}"
|
|
53
73
|
},
|
|
54
|
-
run:
|
|
74
|
+
run: "pnpm prepublishOnly firefox"
|
|
55
75
|
}, {
|
|
56
|
-
run:
|
|
57
|
-
|
|
76
|
+
run: "zip -r ../chrome.zip .",
|
|
77
|
+
"working-directory": "dist/chrome"
|
|
58
78
|
}, {
|
|
59
|
-
run:
|
|
60
|
-
|
|
79
|
+
run: "zip -r ../firefox.zip .",
|
|
80
|
+
"working-directory": "dist/firefox"
|
|
61
81
|
}, {
|
|
62
|
-
run:
|
|
82
|
+
run: "git archive --output=dist/firefox-sources.zip HEAD"
|
|
63
83
|
}],
|
|
64
|
-
prepare: () => Promise.all([fs.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
import svgLoader from '${packageName`vite-svg-loader`}'
|
|
84
|
+
prepare: () => Promise.all([fs.ensureDir(pathLib.join(this.cwd, "userdata")), outputFiles(this.cwd, {
|
|
85
|
+
".wxtrc": stringifyIni({
|
|
86
|
+
modules: [packageName`@wxt-dev/module-vue`],
|
|
87
|
+
outDir: "dist",
|
|
88
|
+
outDirTemplate: "{{browser}}"
|
|
89
|
+
}),
|
|
90
|
+
"web-ext.config.ts": endent`
|
|
91
|
+
import { defineWebExtConfig } from 'wxt';
|
|
73
92
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
plugins: [
|
|
82
|
-
vueBabel(),
|
|
83
|
-
vue(),
|
|
84
|
-
svgLoader(),
|
|
85
|
-
eslint({ fix: true }),
|
|
86
|
-
webExtension({
|
|
87
|
-
browser: process.env.TARGET,
|
|
88
|
-
manifest: () => JSON.parse(process.env.MANIFEST),
|
|
89
|
-
scriptViteConfig: { plugins: [babel(), eslint({ fix: true })] },
|
|
90
|
-
webExtConfig: { keepProfileChanges: true, chromiumProfile: 'userdata' },
|
|
91
|
-
}),
|
|
92
|
-
],
|
|
93
|
-
})\n
|
|
94
|
-
`), fs.ensureDir(pathLib.join(this.cwd, 'userdata'))]),
|
|
95
|
-
readmeInstallString: dedent`
|
|
93
|
+
export default defineWebExtConfig({
|
|
94
|
+
keepProfileChanges: true,
|
|
95
|
+
chromiumProfile: 'userdata', // chromiumArgs: ['--user-data-dir=userdata'] doesn't keep sessions across dev restarts
|
|
96
|
+
});\n
|
|
97
|
+
`
|
|
98
|
+
})]),
|
|
99
|
+
readmeInstallString: endent`
|
|
96
100
|
## Recommended setup
|
|
97
101
|
* Node.js 20.11.1
|
|
98
102
|
* pnpm 9.15.3
|
|
@@ -104,14 +108,22 @@ export default function () {
|
|
|
104
108
|
|
|
105
109
|
## Running a development server
|
|
106
110
|
\`\`\`bash
|
|
107
|
-
$ pnpm dev
|
|
111
|
+
$ pnpm dev -b <browser>
|
|
108
112
|
\`\`\`
|
|
109
113
|
Available browsers are \`firefox\` and \`chrome\`. Default is \`firefox\`.
|
|
110
114
|
|
|
111
115
|
## Building the extension for upload
|
|
112
116
|
\`\`\`bash
|
|
113
|
-
$ pnpm prepublishOnly
|
|
117
|
+
$ pnpm prepublishOnly -b <browser>
|
|
114
118
|
\`\`\`
|
|
115
|
-
|
|
119
|
+
`,
|
|
120
|
+
typecheck,
|
|
121
|
+
typescriptConfig: {
|
|
122
|
+
compilerOptions: {
|
|
123
|
+
declaration: false
|
|
124
|
+
// 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.",
|
|
125
|
+
},
|
|
126
|
+
extends: "./.wxt/tsconfig.json"
|
|
127
|
+
}
|
|
116
128
|
};
|
|
117
|
-
}
|
|
129
|
+
});
|
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.1",
|
|
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,44 +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/
|
|
34
|
+
"@dword-design/base": "^15.2.3",
|
|
35
|
+
"@dword-design/depcheck-parser-sass": "^5.0.0",
|
|
27
36
|
"@semantic-release/exec": "^6.0.3",
|
|
28
|
-
"@
|
|
29
|
-
"
|
|
30
|
-
"depcheck-
|
|
31
|
-
"
|
|
32
|
-
"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",
|
|
33
41
|
"execa": "^9.6.0",
|
|
34
42
|
"fs-extra": "^11.3.0",
|
|
35
|
-
"
|
|
43
|
+
"ini": "^5.0.0",
|
|
36
44
|
"lodash-es": "^4.17.21",
|
|
45
|
+
"output-files": "^3.0.0",
|
|
37
46
|
"publish-browser-extension": "^2.3.1",
|
|
38
|
-
"
|
|
39
|
-
"vite-plugin-babel": "^1.3.1",
|
|
40
|
-
"vite-plugin-eslint": "^1.8.1",
|
|
41
|
-
"vite-plugin-web-extension": "^4.4.3",
|
|
42
|
-
"vite-svg-loader": "^5.1.0",
|
|
43
|
-
"vue": "^3.5.16"
|
|
47
|
+
"wxt": "npm:@dword-design/wxt-fork@^0.0.2"
|
|
44
48
|
},
|
|
45
49
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
"@playwright/browser-chromium": "^1.54.1",
|
|
51
|
+
"@playwright/test": "^1.54.1",
|
|
52
|
+
"@types/express": "^5.0.3",
|
|
53
|
+
"@types/fs-extra": "^11.0.4",
|
|
54
|
+
"@types/ini": "^4.1.1",
|
|
55
|
+
"@types/lodash-es": "^4.17.12",
|
|
56
|
+
"express": "^5.1.0",
|
|
57
|
+
"get-port": "^7.1.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"depcheck": "*"
|
|
56
61
|
},
|
|
57
62
|
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977",
|
|
58
63
|
"engines": {
|
|
59
|
-
"node": ">=
|
|
64
|
+
"node": ">=20"
|
|
60
65
|
},
|
|
61
66
|
"publishConfig": {
|
|
62
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
|
-
};
|