extension 1.6.0 → 1.7.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 +32 -51
- package/dist/cli.js +16 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,15 +14,18 @@
|
|
|
14
14
|
|
|
15
15
|
# Extension.js [![npm][npm-image]][npm-url] [![fossa][fossa-image]][fossa-url] [![workflow][action-image]][action-url] [![downloads][downloads-image]][downloads-url] [![PR's welcome][prs]][prs-url]
|
|
16
16
|
|
|
17
|
-
> Plug-and-play, zero-config, cross-browser extension development tool.
|
|
17
|
+
<!-- > Plug-and-play, zero-config, cross-browser extension development tool. -->
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
> Make it very easy to develop cross-browser extensions.
|
|
20
20
|
|
|
21
|
+
<img alt="Extension.js with all the browser runners open" src="https://github.com/cezaraugusto/extension.js/assets/4672033/f0f5bbfc-e873-4856-9fdd-db2b42d9ab96">
|
|
21
22
|
<hr>
|
|
22
23
|
|
|
23
24
|
<img alt="Logo" align="right" src="https://user-images.githubusercontent.com/4672033/102850460-4d22aa80-43f8-11eb-82db-9efce586f73e.png" width="25%" />
|
|
24
25
|
|
|
25
|
-
**Create cross-browser extensions with no build configuration.**
|
|
26
|
+
<!-- **Create cross-browser extensions with no build configuration.** -->
|
|
27
|
+
|
|
28
|
+
> Create cross-browser extensions with no build configuration.
|
|
26
29
|
|
|
27
30
|
- [Create A New Extension](#create-a-new-extension) — How to create a new extension.
|
|
28
31
|
- [Get Started Immediately](#get-started-immediately) — Get work done in no time.
|
|
@@ -32,7 +35,7 @@ Extension.js is a plug-and-play, zero-config, cross-browser extension developmen
|
|
|
32
35
|
|
|
33
36
|
## Create A New Extension
|
|
34
37
|
|
|
35
|
-
```
|
|
38
|
+
```bash
|
|
36
39
|
npx extension create my-extension
|
|
37
40
|
cd my-extension
|
|
38
41
|
npm run dev
|
|
@@ -56,85 +59,63 @@ For a preview of extensions running these technologies, see documentation about
|
|
|
56
59
|
|
|
57
60
|
## Get Started Immediately
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Dive right into development by starting with a sample from the Chrome Extension Samples repository. It's a great way to get acquainted with best practices and save time:
|
|
62
|
+
### Use Chrome to start developing an extension from Chrome Extension Samples
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
2. Navigate to the directory where you want your project.
|
|
65
|
-
3. Run the command:
|
|
66
|
-
```bash
|
|
67
|
-
npx extension dev <sample-name>
|
|
68
|
-
```
|
|
69
|
-
Replace `<sample-name>` with the name of the sample you wish to use from [Chrome Extension Samples](https://github.com/GoogleChrome/chrome-extensions-samples).
|
|
64
|
+
> See the example below where we request the sample [page-redder](https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder) from [Google Chrome Extension Samples](https://github.com/GoogleChrome/chrome-extensions-samples).
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```sh
|
|
66
|
+
```bash
|
|
74
67
|
npx extension dev https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/functional-samples/sample.page-redder --browser=edge
|
|
75
68
|
```
|
|
76
69
|
|
|
77
70
|
https://github.com/cezaraugusto/extension/assets/4672033/ee221a94-6ec7-4e04-8553-8812288927f1
|
|
78
71
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Extension.js supports a variety of browsers, including Microsoft Edge. To start an Edge-compatible extension, simply:
|
|
72
|
+
</details>
|
|
82
73
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
npx extension dev <sample-name> --browser=edge
|
|
88
|
-
```
|
|
89
|
-
Tailor your command by replacing `<sample-name>` with the specific sample you're interested in.
|
|
74
|
+
<details>
|
|
75
|
+
<summary>
|
|
76
|
+
🔥 Use Edge to start developing an extension from Chrome Extension Samples
|
|
77
|
+
</summary>
|
|
90
78
|
|
|
91
|
-
> See the example below where we request the sample [magic8ball](https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/topSites/magic8ball) from from [Google Chrome Extension Samples](https://github.com/GoogleChrome/chrome-extensions-samples)
|
|
79
|
+
> See the example below where we request the sample [magic8ball](https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/topSites/magic8ball) from from [Google Chrome Extension Samples](https://github.com/GoogleChrome/chrome-extensions-samples) with Edge as the runtime browser.
|
|
92
80
|
|
|
93
|
-
```
|
|
81
|
+
```bash
|
|
94
82
|
npx extension dev https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/topSites/magic8ball --browser=edge
|
|
95
83
|
```
|
|
96
84
|
|
|
97
85
|
https://github.com/cezaraugusto/extension/assets/4672033/2db2a1f6-3110-4380-9a49-dc9d034146aa
|
|
98
86
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Bridge the gap between Firefox and Edge by running Mozilla Add-Ons using Edge:
|
|
87
|
+
</details>
|
|
102
88
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
This will fetch a Mozilla Add-On and adapt it for Edge.
|
|
89
|
+
<details>
|
|
90
|
+
<summary>
|
|
91
|
+
🔥🔥 Use Edge to start developing a Mozilla Add-On from MDN WebExtensions Examples
|
|
92
|
+
</summary>
|
|
109
93
|
|
|
110
94
|
> See the example below where we request the sample [Apply CSS](https://github.com/mdn/webextensions-examples/tree/main/apply-css) from [MDN WebExtensions Examples](https://github.com/mdn/webextensions-examples) using Edge as the runtime browser.
|
|
111
95
|
|
|
112
|
-
```
|
|
96
|
+
```bash
|
|
113
97
|
npx extension dev https://github.com/mdn/webextensions-examples/tree/main/apply-css --browser=edge --polyfill=true
|
|
114
98
|
```
|
|
115
99
|
|
|
116
100
|
https://github.com/cezaraugusto/extension/assets/4672033/130cb430-1567-419c-8c90-23fddcf20f00
|
|
117
101
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Need to run Firefox and Chrome at once? _Sem problemas_.
|
|
102
|
+
</details>
|
|
121
103
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
npx extension dev <addon-name> --browser=chrome,firefox --polyfill=true
|
|
127
|
-
```
|
|
128
|
-
This will fetch a Mozilla Add-On and adapt it for Chrome, or vice-versa.
|
|
104
|
+
<details>
|
|
105
|
+
<summary>
|
|
106
|
+
🔥🔥🔥 Use Chrome and Firefox to start developing a Mozilla Add-On from MDN WebExtensions Examples
|
|
107
|
+
</summary>
|
|
129
108
|
|
|
130
109
|
> See the example below where we request the sample [firefox-code-search](https://github.com/mdn/webextensions-examples/tree/main/firefox-code-search) from [MDN WebExtensions Examples](https://github.com/mdn/webextensions-examples) using Chrome and Firefox as the runtime browsers.
|
|
131
110
|
|
|
132
|
-
```
|
|
111
|
+
```bash
|
|
133
112
|
npx extension dev https://github.com/mdn/webextensions-examples/tree/main/firefox-code-search --browser=chrome,firefox --polyfill=true
|
|
134
113
|
```
|
|
135
114
|
|
|
136
115
|
https://github.com/cezaraugusto/extension.js/assets/4672033/ac94b608-c936-40df-bce7-63ffd7fe31c5
|
|
137
116
|
|
|
117
|
+
</details>
|
|
118
|
+
|
|
138
119
|
## I have An Extension
|
|
139
120
|
|
|
140
121
|
https://github.com/cezaraugusto/extension/assets/4672033/48694a23-b7f1-4098-9c5d-eff49983739c
|
|
@@ -143,7 +124,7 @@ If you have an existing extension which is using a package manager, you can inst
|
|
|
143
124
|
|
|
144
125
|
**Step 1 - Install extension as a `devDependency`**
|
|
145
126
|
|
|
146
|
-
```
|
|
127
|
+
```bash
|
|
147
128
|
npm install extension --save-dev
|
|
148
129
|
```
|
|
149
130
|
|
package/dist/cli.js
CHANGED
|
@@ -141,7 +141,7 @@ var package_default = {
|
|
|
141
141
|
node: ">=18"
|
|
142
142
|
},
|
|
143
143
|
name: "extension",
|
|
144
|
-
version: "1.
|
|
144
|
+
version: "1.7.0-beta.0",
|
|
145
145
|
description: "Create cross-browser extensions with no build configuration.",
|
|
146
146
|
main: "./dist/cli.js",
|
|
147
147
|
types: "./dist/cli.d.ts",
|
|
@@ -257,10 +257,10 @@ extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [pr
|
|
|
257
257
|
"-u, --user-data-dir <path-to-file | boolean>",
|
|
258
258
|
"what path to use for the browser profile. A boolean value of false sets the profile to the default user profile. Defaults to a fresh profile"
|
|
259
259
|
).option(
|
|
260
|
-
"-b, --browser <chrome | edge>",
|
|
260
|
+
"-b, --browser <chrome | edge | firefox>",
|
|
261
261
|
"specify a browser to run your extension in development mode"
|
|
262
262
|
).option(
|
|
263
|
-
"--polyfill
|
|
263
|
+
"--polyfill [boolean]",
|
|
264
264
|
"whether or not to apply the cross-browser polyfill. Defaults to `true`"
|
|
265
265
|
).option(
|
|
266
266
|
"-p, --port <number>",
|
|
@@ -278,10 +278,10 @@ extensionJs.command("start").arguments("[project-path|remote-url]").usage("start
|
|
|
278
278
|
"-u, --user-data-dir <path-to-file | boolean>",
|
|
279
279
|
"what path to use for the browser profile. A boolean value of false sets the profile to the default user profile. Defaults to a fresh profile"
|
|
280
280
|
).option(
|
|
281
|
-
"-b, --browser <chrome | edge>",
|
|
281
|
+
"-b, --browser <chrome | edge | firefox>",
|
|
282
282
|
"specify a browser to run your extension in development mode"
|
|
283
283
|
).option(
|
|
284
|
-
"--polyfill
|
|
284
|
+
"--polyfill [boolean]",
|
|
285
285
|
"whether or not to apply the cross-browser polyfill. Defaults to `true`"
|
|
286
286
|
).option(
|
|
287
287
|
"-p, --port <number>",
|
|
@@ -296,11 +296,20 @@ extensionJs.command("start").arguments("[project-path|remote-url]").usage("start
|
|
|
296
296
|
}
|
|
297
297
|
});
|
|
298
298
|
extensionJs.command("build").arguments("[project-name]").usage("build [path-to-remote-extension] [options]").description("Builds the extension for production").option(
|
|
299
|
-
"-b, --browser <chrome | edge>",
|
|
299
|
+
"-b, --browser <chrome | edge | firefox>",
|
|
300
300
|
"specify a browser to run your extension in development mode"
|
|
301
301
|
).option(
|
|
302
|
-
"--polyfill
|
|
302
|
+
"--polyfill [boolean]",
|
|
303
303
|
"whether or not to apply the cross-browser polyfill. Defaults to `false`"
|
|
304
|
+
).option(
|
|
305
|
+
"--zip [boolean]",
|
|
306
|
+
"whether or not to compress the extension into a ZIP file. Defaults to `false`"
|
|
307
|
+
).option(
|
|
308
|
+
"--zip-source [boolean]",
|
|
309
|
+
"whether or not to include the source files in the ZIP file. Defaults to `false`"
|
|
310
|
+
).option(
|
|
311
|
+
"--zip-filename <string>",
|
|
312
|
+
"specify the name of the ZIP file. Defaults to the extension name and version"
|
|
304
313
|
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...buildOptions }) {
|
|
305
314
|
for (const vendor of vendors(browser)) {
|
|
306
315
|
await (0, import_develop.extensionBuild)(pathOrRemoteUrl, {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
11
|
"name": "extension",
|
|
12
|
-
"version": "1.
|
|
12
|
+
"version": "1.7.0-beta.0",
|
|
13
13
|
"description": "Create cross-browser extensions with no build configuration.",
|
|
14
14
|
"main": "./dist/cli.js",
|
|
15
15
|
"types": "./dist/cli.d.ts",
|
|
@@ -67,4 +67,4 @@
|
|
|
67
67
|
"tsup": "^8.0.1",
|
|
68
68
|
"typescript": "5.3.3"
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|