extension 1.4.5 → 1.5.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 +15 -15
- package/dist/cli.js +29 -29
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[fossa-image]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension.svg?type=shield&issueType=license
|
|
13
13
|
[fossa-url]: https://app.fossa.com/projects/git%2Bgithub.com%2Fcezaraugusto%2Fextension?ref=badge_shield&issueType=license
|
|
14
14
|
|
|
15
|
-
# Extension [![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]
|
|
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
17
|
> Plug-and-play, zero-config, cross-browser extension development tool.
|
|
18
18
|
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
|
|
27
27
|
- [Create A New Extension](#create-a-new-extension) — How to create a new extension.
|
|
28
28
|
- [Get Started Immediately](#get-started-immediately) — Get work done in no time.
|
|
29
|
-
- [I have An Extension](#i-have-an-extension) - Use only specific parts of `
|
|
29
|
+
- [I have An Extension](#i-have-an-extension) - Use only specific parts of `Extension.js`.
|
|
30
30
|
|
|
31
|
-
<!-- `
|
|
31
|
+
<!-- `Extension.js` is a development tool for browser extensions with built-in support for TypeScript, WebAssembly, React, and modern JavaScript. -->
|
|
32
32
|
|
|
33
|
-
`
|
|
33
|
+
`Extension.js` is a plug-and-play, zero-config, cross-browser extension development tool with built-in support for TypeScript, WebAssembly, React, and modern JavaScript.
|
|
34
34
|
|
|
35
35
|
## Create A New Extension
|
|
36
36
|
|
|
@@ -70,7 +70,7 @@ https://github.com/cezaraugusto/extension/assets/4672033/ee221a94-6ec7-4e04-8553
|
|
|
70
70
|
|
|
71
71
|
### Use `Microsoft Edge` to kickstart any sample from [chrome-extesions-sample](https://github.com/GoogleChrome/chrome-extensions-samples/)
|
|
72
72
|
|
|
73
|
-
`
|
|
73
|
+
`Extension.js` supports a variety of browsers, including Microsoft Edge. To start an Edge-compatible extension, simply:
|
|
74
74
|
|
|
75
75
|
1. Open your terminal.
|
|
76
76
|
2. Navigate to your desired project directory.
|
|
@@ -111,7 +111,7 @@ https://github.com/cezaraugusto/extension/assets/4672033/130cb430-1567-419c-8c90
|
|
|
111
111
|
|
|
112
112
|
https://github.com/cezaraugusto/extension/assets/4672033/48694a23-b7f1-4098-9c5d-eff49983739c
|
|
113
113
|
|
|
114
|
-
If you have an existing extension which is using a package manager, you can install the `
|
|
114
|
+
If you have an existing extension which is using a package manager, you can install the `Extension.js` package and manually create the scripts used to run your extension. See the demo above or follow these instructions to get it done:
|
|
115
115
|
|
|
116
116
|
**Step 1 - Install extension as a `devDependency`**
|
|
117
117
|
|
|
@@ -119,7 +119,7 @@ If you have an existing extension which is using a package manager, you can inst
|
|
|
119
119
|
npm install extension --save-dev
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
**Step 2 - Link your npm scripts with the executable `
|
|
122
|
+
**Step 2 - Link your npm scripts with the executable `Extension.js` commands**
|
|
123
123
|
|
|
124
124
|
```json
|
|
125
125
|
{
|
|
@@ -147,17 +147,17 @@ Done. You are all set!
|
|
|
147
147
|
|
|
148
148
|
☑️ = Likely works but no browser runner support yet.
|
|
149
149
|
|
|
150
|
-
| <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/brave/brave.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera.svg" width="100" height="100"> | <img width="100" height="100" src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari.svg"
|
|
151
|
-
|
|
152
|
-
| Brave Browser
|
|
153
|
-
| ☑️
|
|
150
|
+
| <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/brave/brave.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera.svg" width="100" height="100"> | <img width="100" height="100" src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari.svg"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/vivaldi/vivaldi.svg" width="100" height="100"> |
|
|
151
|
+
| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
152
|
+
| Brave Browser | Google Chrome | Microsoft Edge | Mozilla Firefox | Opera Browser | Apple Safari | Vivaldi Browser |
|
|
153
|
+
| ☑️ | ✅ | ✅ | ✅ | ☑️ | ⛔️ | ☑️ |
|
|
154
154
|
|
|
155
155
|
### Mobile Browsers
|
|
156
156
|
|
|
157
|
-
| <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari-ios/safari-ios.svg" width="100" height="100"> |
|
|
158
|
-
|
|
159
|
-
| Firefox For Android
|
|
160
|
-
| ⛔️
|
|
157
|
+
| <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox.svg" width="100" height="100"> | <img src="https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari-ios/safari-ios.svg" width="100" height="100"> |
|
|
158
|
+
| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
159
|
+
| Firefox For Android | Safari On iOS |
|
|
160
|
+
| ⛔️ | ⛔️ |
|
|
161
161
|
|
|
162
162
|
If you want to target a specific browser, just pass the `--browser` flag to the `dev`/`start` command (based on the list available above), like `npx extension dev path/to/extension --browser=edge`.
|
|
163
163
|
|
package/dist/cli.js
CHANGED
|
@@ -46,10 +46,12 @@ async function checkUpdates(packageJson) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
if (update) {
|
|
49
|
-
console.log(
|
|
50
|
-
|
|
49
|
+
console.log(
|
|
50
|
+
`
|
|
51
|
+
Your \u{1F9E9} ${(0, import_safe.bold)("Extension")} version is ${(0, import_safe.red)("outdated")}.
|
|
51
52
|
The latest version is ${(0, import_safe.bold)(update.latest)}. Please update!
|
|
52
|
-
`
|
|
53
|
+
`
|
|
54
|
+
);
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
|
|
@@ -72,7 +74,7 @@ function noURLWithoutStart(argument) {
|
|
|
72
74
|
The default \`create\` command does not accept URLs.
|
|
73
75
|
Are you forgetting a \`start\` command? Maybe:
|
|
74
76
|
|
|
75
|
-
npx extension
|
|
77
|
+
npx extension \`start\` ${argument}
|
|
76
78
|
`;
|
|
77
79
|
}
|
|
78
80
|
function notImplemented(argument) {
|
|
@@ -82,9 +84,9 @@ function notImplemented(argument) {
|
|
|
82
84
|
// messages/programHelp.ts
|
|
83
85
|
function programHelp() {
|
|
84
86
|
return `
|
|
85
|
-
# Help center for the
|
|
87
|
+
# Help center for the \u{1F9E9} Extension program
|
|
86
88
|
|
|
87
|
-
## Usage: \`extension
|
|
89
|
+
## Usage: \`extension [command] [options]\`
|
|
88
90
|
|
|
89
91
|
**Note:** If you are looking for a specific list of options,
|
|
90
92
|
all high-level commands offer their own \`--help\` file with
|
|
@@ -92,31 +94,31 @@ information about usage and a list of command flags available.
|
|
|
92
94
|
|
|
93
95
|
For example:
|
|
94
96
|
|
|
95
|
-
\`extension
|
|
97
|
+
\`extension create --help\`
|
|
96
98
|
outputs information about the \`create\` command.
|
|
97
99
|
|
|
98
100
|
## Options available
|
|
99
101
|
|
|
100
|
-
\`extension
|
|
102
|
+
\`extension create <extension-name>\`
|
|
101
103
|
Creates a new extension from template. The "create" command
|
|
102
104
|
is optional and can be ommitted.
|
|
103
105
|
|
|
104
|
-
\`extension
|
|
106
|
+
\`extension dev <extension-path>\`
|
|
105
107
|
Starts a new browser instance in development mode, with the target
|
|
106
108
|
extension loaded and auto-reloaded based on file changes.
|
|
107
109
|
|
|
108
|
-
\`extension
|
|
110
|
+
\`extension start <extension-path>\`
|
|
109
111
|
Starts a new browser instance in production mode, with the target
|
|
110
112
|
extension compiled based on the browser choice.
|
|
111
113
|
|
|
112
|
-
\`extension
|
|
114
|
+
\`extension build <extension-path>\`
|
|
113
115
|
Builds the target extension with browser defaults, ready for packaging.
|
|
114
116
|
|
|
115
|
-
\`extension
|
|
117
|
+
\`extension --help\`
|
|
116
118
|
This command ;) Outputs a help file with key command options.
|
|
117
119
|
|
|
118
120
|
Feels something is wrong? Help by reporting a bug:
|
|
119
|
-
https://github.com/cezaraugusto/extension
|
|
121
|
+
https://github.com/cezaraugusto/extension/issues/new
|
|
120
122
|
`;
|
|
121
123
|
}
|
|
122
124
|
|
|
@@ -132,14 +134,14 @@ var package_default = {
|
|
|
132
134
|
license: "MIT",
|
|
133
135
|
repository: {
|
|
134
136
|
type: "git",
|
|
135
|
-
url: "https://github.com/cezaraugusto/extension
|
|
137
|
+
url: "https://github.com/cezaraugusto/extension.git",
|
|
136
138
|
directory: "programs/cli"
|
|
137
139
|
},
|
|
138
140
|
engines: {
|
|
139
141
|
node: ">=18"
|
|
140
142
|
},
|
|
141
143
|
name: "extension",
|
|
142
|
-
version: "1.
|
|
144
|
+
version: "1.5.0",
|
|
143
145
|
description: "Create cross-browser extensions with no build configuration.",
|
|
144
146
|
main: "./dist/cli.js",
|
|
145
147
|
types: "./dist/cli.d.ts",
|
|
@@ -148,8 +150,7 @@ var package_default = {
|
|
|
148
150
|
"README.md"
|
|
149
151
|
],
|
|
150
152
|
bin: {
|
|
151
|
-
extension: "./dist/cli.js"
|
|
152
|
-
"extension-create": "./dist/cli.js"
|
|
153
|
+
extension: "./dist/cli.js"
|
|
153
154
|
},
|
|
154
155
|
author: {
|
|
155
156
|
name: "Cezar Augusto",
|
|
@@ -206,14 +207,13 @@ if (import_semver.default.lte(process.version, "18.0.0")) {
|
|
|
206
207
|
messages_default.unsupportedNodeVersion();
|
|
207
208
|
process.exit(1);
|
|
208
209
|
}
|
|
209
|
-
var
|
|
210
|
-
var isExtensionCreateNamespace = package_default.name !== "extension";
|
|
210
|
+
var extensionJs = import_commander.program;
|
|
211
211
|
if (process.env.EXTENSION_ENV === "development") {
|
|
212
|
-
console.log(`Running extension
|
|
212
|
+
console.log(`Running extension via ${package_default.name}...`);
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
var vendors = (browser) => browser === "all" ? "chrome,edge".split(",") : browser.split(",");
|
|
216
|
-
|
|
214
|
+
extensionJs.name(package_default.name).description(package_default.description).version(package_default.version).addHelpText("after", messages_default.programHelp());
|
|
215
|
+
var vendors = (browser) => browser === "all" ? "chrome,edge,firefox".split(",") : browser.split(",");
|
|
216
|
+
extensionJs.command("create").arguments("<project-name|project-path>").usage("create <project-name|project-path> [options]").description("Creates a new extension.").option(
|
|
217
217
|
"-t, --template <template-name>",
|
|
218
218
|
"specify a template for the created project"
|
|
219
219
|
).action(async function(pathOrRemoteUrl, {
|
|
@@ -253,7 +253,7 @@ extensionCreate.command("create", { isDefault: isExtensionCreateNamespace }).arg
|
|
|
253
253
|
break;
|
|
254
254
|
}
|
|
255
255
|
});
|
|
256
|
-
|
|
256
|
+
extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [project-path|remote-url] [options]").description("Starts the development server (development mode)").option(
|
|
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(
|
|
@@ -264,7 +264,7 @@ extensionCreate.command("dev").arguments("[project-path|remote-url]").usage("dev
|
|
|
264
264
|
"whether or not to apply the cross-browser polyfill. Defaults to `true`"
|
|
265
265
|
).option(
|
|
266
266
|
"-p, --port <number>",
|
|
267
|
-
"what port should
|
|
267
|
+
"what port should Extension run. Defaults to `3000`"
|
|
268
268
|
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...devOptions }) {
|
|
269
269
|
for (const vendor of vendors(browser)) {
|
|
270
270
|
await (0, import_develop.extensionDev)(pathOrRemoteUrl, {
|
|
@@ -274,7 +274,7 @@ extensionCreate.command("dev").arguments("[project-path|remote-url]").usage("dev
|
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
});
|
|
277
|
-
|
|
277
|
+
extensionJs.command("start").arguments("[project-path|remote-url]").usage("start [project-path|remote-url] [options]").description("Starts the development server (production mode)").option(
|
|
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(
|
|
@@ -285,7 +285,7 @@ extensionCreate.command("start").arguments("[project-path|remote-url]").usage("s
|
|
|
285
285
|
"whether or not to apply the cross-browser polyfill. Defaults to `true`"
|
|
286
286
|
).option(
|
|
287
287
|
"-p, --port <number>",
|
|
288
|
-
"what port should
|
|
288
|
+
"what port should Extension run. Defaults to `3000`"
|
|
289
289
|
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...startOptions }) {
|
|
290
290
|
for (const vendor of vendors(browser)) {
|
|
291
291
|
await (0, import_develop.extensionStart)(pathOrRemoteUrl, {
|
|
@@ -295,7 +295,7 @@ extensionCreate.command("start").arguments("[project-path|remote-url]").usage("s
|
|
|
295
295
|
});
|
|
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
299
|
"-b, --browser <chrome | edge>",
|
|
300
300
|
"specify a browser to run your extension in development mode"
|
|
301
301
|
).option(
|
|
@@ -309,4 +309,4 @@ extensionCreate.command("build").arguments("[project-name]").usage("build [path-
|
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
});
|
|
312
|
-
|
|
312
|
+
extensionJs.parse();
|
package/package.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"license": "MIT",
|
|
3
3
|
"repository": {
|
|
4
4
|
"type": "git",
|
|
5
|
-
"url": "https://github.com/cezaraugusto/extension
|
|
5
|
+
"url": "https://github.com/cezaraugusto/extension.git",
|
|
6
6
|
"directory": "programs/cli"
|
|
7
7
|
},
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
11
|
"name": "extension",
|
|
12
|
-
"version": "1.
|
|
12
|
+
"version": "1.5.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",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"README.md"
|
|
19
19
|
],
|
|
20
20
|
"bin": {
|
|
21
|
-
"extension": "./dist/cli.js"
|
|
22
|
-
"extension-create": "./dist/cli.js"
|
|
21
|
+
"extension": "./dist/cli.js"
|
|
23
22
|
},
|
|
24
23
|
"author": {
|
|
25
24
|
"name": "Cezar Augusto",
|