@dword-design/base-config-web-extension 3.1.7 → 3.1.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/LICENSE.md +14 -5
- package/dist/dev.js +24 -9
- package/dist/get-manifest.js +8 -6
- package/dist/index.js +76 -81
- package/dist/prepublish-only.js +28 -9
- package/package.json +23 -25
- package/dist/lint.js +0 -10
package/LICENSE.md
CHANGED
|
@@ -14,8 +14,17 @@ MIT License
|
|
|
14
14
|
|
|
15
15
|
Copyright (c) <year> <copyright holders>
|
|
16
16
|
|
|
17
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
18
|
+
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
|
19
|
+
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
|
21
|
+
following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
24
|
+
portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
27
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
28
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
29
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
30
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/dev.js
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import { execaCommand } from 'execa';
|
|
2
2
|
import getManifest from "./get-manifest.js";
|
|
3
|
-
export default
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export default async function (browser = 'chrome', options) {
|
|
4
|
+
options = {
|
|
5
|
+
env: {},
|
|
6
|
+
log: process.env.NODE_ENV !== 'test',
|
|
7
|
+
stderr: 'inherit',
|
|
8
|
+
...options
|
|
9
|
+
};
|
|
10
|
+
return execaCommand('vite', {
|
|
11
|
+
env: {
|
|
12
|
+
...options.env,
|
|
13
|
+
MANIFEST: JSON.stringify(await getManifest({
|
|
14
|
+
browser,
|
|
15
|
+
cwd: this.cwd
|
|
16
|
+
})),
|
|
17
|
+
TARGET: browser
|
|
18
|
+
},
|
|
19
|
+
...(options.log && {
|
|
20
|
+
stdout: 'inherit'
|
|
21
|
+
}),
|
|
22
|
+
cwd: this.cwd,
|
|
23
|
+
reject: process.env.NODE_ENV !== 'test',
|
|
24
|
+
stderr: options.stderr
|
|
25
|
+
});
|
|
26
|
+
}
|
package/dist/get-manifest.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import pathLib from 'node:path';
|
|
1
2
|
import fs from 'fs-extra';
|
|
2
3
|
import loadPkg from 'load-pkg';
|
|
3
4
|
import { pick } from 'lodash-es';
|
|
4
5
|
export default async ({
|
|
6
|
+
cwd,
|
|
5
7
|
browser
|
|
6
8
|
}) => {
|
|
7
|
-
const packageConfig = await loadPkg();
|
|
8
|
-
const config = await fs.readJson('config.json').catch(() => ({}));
|
|
9
|
-
const iconExists = await fs.exists('public
|
|
10
|
-
const popupExists = await fs.exists('popup.html');
|
|
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'));
|
|
11
13
|
return {
|
|
12
14
|
name: config.name,
|
|
13
15
|
...pick(packageConfig, ['version', 'description']),
|
|
@@ -30,7 +32,7 @@ export default async ({
|
|
|
30
32
|
...(typeof config.action === 'object' && config.action)
|
|
31
33
|
}
|
|
32
34
|
}),
|
|
33
|
-
...(((await fs.exists('content.js')) || config.css?.length > 0) && {
|
|
35
|
+
...(((await fs.exists(pathLib.join(cwd, 'content.js'))) || config.css?.length > 0) && {
|
|
34
36
|
content_scripts: [{
|
|
35
37
|
js: ['content.js'],
|
|
36
38
|
...(config.css?.length > 0 && {
|
|
@@ -39,7 +41,7 @@ export default async ({
|
|
|
39
41
|
matches: config.matches || ['<all_urls>']
|
|
40
42
|
}]
|
|
41
43
|
}),
|
|
42
|
-
...((await fs.exists('background.js')) && {
|
|
44
|
+
...((await fs.exists(pathLib.join(cwd, 'background.js'))) && {
|
|
43
45
|
background: {
|
|
44
46
|
...(browser === 'firefox' ? {
|
|
45
47
|
scripts: ['background.js']
|
package/dist/index.js
CHANGED
|
@@ -1,72 +1,67 @@
|
|
|
1
|
+
import pathLib from 'node:path';
|
|
1
2
|
import depcheckParserSass from '@dword-design/depcheck-parser-sass';
|
|
2
|
-
import
|
|
3
|
+
import dedent from 'dedent';
|
|
3
4
|
import binName from 'depcheck-bin-name';
|
|
4
5
|
import packageName from 'depcheck-package-name';
|
|
5
6
|
import depcheckParserVue from 'depcheck-parser-vue';
|
|
6
7
|
import fs from 'fs-extra';
|
|
7
|
-
import outputFiles from 'output-files';
|
|
8
8
|
import dev from "./dev.js";
|
|
9
|
-
import lint from "./lint.js";
|
|
10
9
|
import prepublishOnly from "./prepublish-only.js";
|
|
11
|
-
export default
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export default function () {
|
|
11
|
+
return {
|
|
12
|
+
allowedMatches: ['assets', 'components', 'public', 'background.js', 'content.js', 'config.json', 'index.spec.js', 'options.html', 'popup.html', 'popup.js', 'popup.vue', 'options.js', 'popup.js', 'model'],
|
|
13
|
+
commands: {
|
|
14
|
+
dev: {
|
|
15
|
+
arguments: '[browser]',
|
|
16
|
+
handler: (...args) => dev.call(this, ...args)
|
|
17
|
+
},
|
|
18
|
+
prepublishOnly: {
|
|
19
|
+
arguments: '[browser]',
|
|
20
|
+
handler: (...args) => prepublishOnly.call(this, ...args)
|
|
21
|
+
}
|
|
17
22
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
depcheckConfig: {
|
|
24
|
-
parsers: {
|
|
25
|
-
'**/*.scss': depcheckParserSass,
|
|
26
|
-
'**/*.vue': depcheckParserVue
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
deployAssets: [{
|
|
30
|
-
label: 'Extension',
|
|
31
|
-
path: 'extension.zip'
|
|
32
|
-
}],
|
|
33
|
-
deployEnv: {
|
|
34
|
-
CHROME_CLIENT_ID: '${{ secrets.CHROME_CLIENT_ID }}',
|
|
35
|
-
CHROME_CLIENT_SECRET: '${{ secrets.CHROME_CLIENT_SECRET }}',
|
|
36
|
-
CHROME_EXTENSION_ID: '${{ secrets.CHROME_EXTENSION_ID }}',
|
|
37
|
-
CHROME_REFRESH_TOKEN: '${{ secrets.CHROME_REFRESH_TOKEN }}',
|
|
38
|
-
FIREFOX_EXTENSION_ID: '${{ secrets.FIREFOX_EXTENSION_ID }}',
|
|
39
|
-
FIREFOX_JWT_ISSUER: '${{ secrets.FIREFOX_JWT_ISSUER }}',
|
|
40
|
-
FIREFOX_JWT_SECRET: '${{ secrets.FIREFOX_JWT_SECRET }}'
|
|
41
|
-
},
|
|
42
|
-
deployPlugins: [[packageName`@semantic-release/exec`, {
|
|
43
|
-
publishCmd: `pnpm ${binName`publish-extension`} --chrome-zip=dist/chrome.zip --firefox-zip=dist/firefox.zip --firefox-sources-zip=dist/firefox-sources.zip`
|
|
44
|
-
}]],
|
|
45
|
-
editorIgnore: ['.eslintrc.json', 'dist', 'userdata', 'vite.config.js'],
|
|
46
|
-
gitignore: ['/.eslintrc.json', '/dist', '/userdata', '/vite.config.js'],
|
|
47
|
-
isLockFileFixCommitType: true,
|
|
48
|
-
lint,
|
|
49
|
-
preDeploySteps: [{
|
|
50
|
-
run: 'pnpm prepublishOnly'
|
|
51
|
-
}, {
|
|
52
|
-
env: {
|
|
53
|
-
FIREFOX_EXTENSION_ID: '${{ secrets.FIREFOX_EXTENSION_ID }}'
|
|
23
|
+
depcheckConfig: {
|
|
24
|
+
parsers: {
|
|
25
|
+
'**/*.scss': depcheckParserSass,
|
|
26
|
+
'**/*.vue': depcheckParserVue
|
|
27
|
+
}
|
|
54
28
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
29
|
+
deployAssets: [{
|
|
30
|
+
label: 'Extension',
|
|
31
|
+
path: 'extension.zip'
|
|
32
|
+
}],
|
|
33
|
+
deployEnv: {
|
|
34
|
+
CHROME_CLIENT_ID: '${{ secrets.CHROME_CLIENT_ID }}',
|
|
35
|
+
CHROME_CLIENT_SECRET: '${{ secrets.CHROME_CLIENT_SECRET }}',
|
|
36
|
+
CHROME_EXTENSION_ID: '${{ secrets.CHROME_EXTENSION_ID }}',
|
|
37
|
+
CHROME_REFRESH_TOKEN: '${{ secrets.CHROME_REFRESH_TOKEN }}',
|
|
38
|
+
FIREFOX_EXTENSION_ID: '${{ secrets.FIREFOX_EXTENSION_ID }}',
|
|
39
|
+
FIREFOX_JWT_ISSUER: '${{ secrets.FIREFOX_JWT_ISSUER }}',
|
|
40
|
+
FIREFOX_JWT_SECRET: '${{ secrets.FIREFOX_JWT_SECRET }}'
|
|
41
|
+
},
|
|
42
|
+
deployPlugins: [[packageName`@semantic-release/exec`, {
|
|
43
|
+
publishCmd: `pnpm ${binName`publish-extension`} --chrome-zip=dist/chrome.zip --firefox-zip=dist/firefox.zip --firefox-sources-zip=dist/firefox-sources.zip`
|
|
44
|
+
}]],
|
|
45
|
+
editorIgnore: ['dist', 'userdata', 'vite.config.js'],
|
|
46
|
+
gitignore: ['/dist', '/userdata', '/vite.config.js'],
|
|
47
|
+
isLockFileFixCommitType: true,
|
|
48
|
+
preDeploySteps: [{
|
|
49
|
+
run: 'pnpm prepublishOnly'
|
|
50
|
+
}, {
|
|
51
|
+
env: {
|
|
52
|
+
FIREFOX_EXTENSION_ID: '${{ secrets.FIREFOX_EXTENSION_ID }}'
|
|
53
|
+
},
|
|
54
|
+
run: 'pnpm prepublishOnly firefox'
|
|
55
|
+
}, {
|
|
56
|
+
run: 'zip -r ../chrome.zip .',
|
|
57
|
+
'working-directory': 'dist/chrome'
|
|
58
|
+
}, {
|
|
59
|
+
run: 'zip -r ../firefox.zip .',
|
|
60
|
+
'working-directory': 'dist/firefox'
|
|
61
|
+
}, {
|
|
62
|
+
run: 'git archive --output=dist/firefox-sources.zip HEAD'
|
|
63
|
+
}],
|
|
64
|
+
prepare: () => Promise.all([fs.outputFile(pathLib.join(this.cwd, 'vite.config.js'), dedent`
|
|
70
65
|
import vue from '${packageName`@vitejs/plugin-vue`}'
|
|
71
66
|
import P from 'path'
|
|
72
67
|
import { defineConfig } from '${packageName`vite`}'
|
|
@@ -93,27 +88,27 @@ export default config => ({
|
|
|
93
88
|
}),
|
|
94
89
|
],
|
|
95
90
|
})\n
|
|
96
|
-
`
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
* pnpm 9.15.3
|
|
91
|
+
`), fs.ensureDir(pathLib.join(this.cwd, 'userdata'))]),
|
|
92
|
+
readmeInstallString: dedent`
|
|
93
|
+
## Recommended setup
|
|
94
|
+
* Node.js 20.11.1
|
|
95
|
+
* pnpm 9.15.3
|
|
102
96
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
97
|
+
## Install
|
|
98
|
+
\`\`\`bash
|
|
99
|
+
$ pnpm install --frozen-lockfile
|
|
100
|
+
\`\`\`
|
|
107
101
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
## Running a development server
|
|
103
|
+
\`\`\`bash
|
|
104
|
+
$ pnpm dev [browser]
|
|
105
|
+
\`\`\`
|
|
106
|
+
Available browsers are \`firefox\` and \`chrome\`. Default is \`firefox\`.
|
|
113
107
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
108
|
+
## Building the extension for upload
|
|
109
|
+
\`\`\`bash
|
|
110
|
+
$ pnpm prepublishOnly [browser]
|
|
111
|
+
\`\`\`
|
|
112
|
+
`
|
|
113
|
+
};
|
|
114
|
+
}
|
package/dist/prepublish-only.js
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import { execaCommand } from 'execa';
|
|
2
2
|
import getManifest from "./get-manifest.js";
|
|
3
|
-
export default
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export default async function (...args) {
|
|
4
|
+
let options = typeof args[0] === 'string' ? args[1] : args[0];
|
|
5
|
+
options = {
|
|
6
|
+
browser: 'chrome',
|
|
7
|
+
env: {},
|
|
8
|
+
log: process.env.NODE_ENV !== 'test',
|
|
9
|
+
stderr: 'inherit',
|
|
10
|
+
...(typeof args[0] === 'string' && {
|
|
11
|
+
browser: args[0]
|
|
12
|
+
}),
|
|
13
|
+
...options
|
|
14
|
+
};
|
|
15
|
+
return execaCommand('vite build', {
|
|
16
|
+
env: {
|
|
17
|
+
...options.env,
|
|
18
|
+
MANIFEST: JSON.stringify(await getManifest({
|
|
19
|
+
browser: options.browser,
|
|
20
|
+
cwd: this.cwd
|
|
21
|
+
})),
|
|
22
|
+
TARGET: options.browser
|
|
23
|
+
},
|
|
24
|
+
...(options.log && {
|
|
25
|
+
stdout: 'inherit'
|
|
26
|
+
}),
|
|
27
|
+
cwd: this.cwd,
|
|
28
|
+
stderr: options.stderr
|
|
29
|
+
});
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dword-design/base-config-web-extension",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8",
|
|
4
4
|
"repository": "dword-design/base-config-web-extension",
|
|
5
5
|
"funding": "https://github.com/sponsors/dword-design",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,44 +19,42 @@
|
|
|
19
19
|
"lint": "base lint",
|
|
20
20
|
"prepare": "base prepare",
|
|
21
21
|
"prepublishOnly": "base prepublishOnly",
|
|
22
|
-
"test": "base test"
|
|
23
|
-
"test:raw": "base test:raw"
|
|
22
|
+
"test": "base test"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
25
|
"@dword-design/depcheck-parser-sass": "^4.0.4",
|
|
27
|
-
"@dword-design/
|
|
28
|
-
"@dword-design/functions": "^6.0.0",
|
|
29
|
-
"@dword-design/vite-plugin-vue-babel": "^1.0.0",
|
|
26
|
+
"@dword-design/vite-plugin-vue-babel": "^1.0.2",
|
|
30
27
|
"@semantic-release/exec": "^6.0.3",
|
|
31
|
-
"@vitejs/plugin-vue": "^5.
|
|
32
|
-
"
|
|
28
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
29
|
+
"dedent": "^1.6.0",
|
|
30
|
+
"depcheck-bin-name": "^1.0.1",
|
|
33
31
|
"depcheck-package-name": "^3.0.1",
|
|
34
32
|
"depcheck-parser-vue": "^5.0.0",
|
|
35
|
-
"execa": "^9.
|
|
36
|
-
"fs-extra": "^11.
|
|
33
|
+
"execa": "^9.6.0",
|
|
34
|
+
"fs-extra": "^11.3.0",
|
|
37
35
|
"load-pkg": "^4.0.0",
|
|
38
36
|
"lodash-es": "^4.17.21",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"vite": "^
|
|
42
|
-
"vite-plugin-babel": "^1.2.0",
|
|
37
|
+
"publish-browser-extension": "^2.3.1",
|
|
38
|
+
"vite": "^5.4.19",
|
|
39
|
+
"vite-plugin-babel": "^1.3.1",
|
|
43
40
|
"vite-plugin-eslint": "^1.8.1",
|
|
44
|
-
"vite-plugin-web-extension": "^4.
|
|
41
|
+
"vite-plugin-web-extension": "^4.4.3",
|
|
45
42
|
"vite-svg-loader": "^5.1.0",
|
|
46
|
-
"vue": "^3.
|
|
43
|
+
"vue": "^3.5.16"
|
|
47
44
|
},
|
|
48
45
|
"devDependencies": {
|
|
49
|
-
"@dword-design/base": "^
|
|
50
|
-
"@dword-design/puppeteer": "^7.0.0",
|
|
51
|
-
"@dword-design/tester": "^2.0.4",
|
|
52
|
-
"@dword-design/tester-plugin-tmp-dir": "^2.0.3",
|
|
46
|
+
"@dword-design/base": "^12.0.18",
|
|
53
47
|
"@mdi/svg": "^7.4.47",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
48
|
+
"@playwright/test": "^1.52.0",
|
|
49
|
+
"express": "^4.21.2",
|
|
50
|
+
"get-port": "^7.1.0",
|
|
51
|
+
"globby": "^14.1.0",
|
|
52
|
+
"output-files": "^2.0.32",
|
|
53
|
+
"playwright": "^1.52.0",
|
|
54
|
+
"playwright-chromium": "^1.52.0",
|
|
55
|
+
"webextension-polyfill": "^0.12.0"
|
|
58
56
|
},
|
|
59
|
-
"packageManager": "pnpm@
|
|
57
|
+
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977",
|
|
60
58
|
"engines": {
|
|
61
59
|
"node": ">=18"
|
|
62
60
|
},
|
package/dist/lint.js
DELETED