extension 1.8.0 → 2.0.0-alpha.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 +8 -8
- package/dist/cli.js +58 -88
- package/package.json +5 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[action-image]: https://github.com/cezaraugusto/extension/actions/workflows/
|
|
1
|
+
[action-image]: https://github.com/cezaraugusto/extension/actions/workflows/build.yml/badge.svg?branch=main
|
|
2
2
|
[action-url]: https://github.com/cezaraugusto/extension/actions
|
|
3
3
|
[npm-image]: https://img.shields.io/npm/v/extension.svg
|
|
4
4
|
[npm-url]: https://npmjs.org/package/extension
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
[vunlerabilities]: https://snyk.io/test/github/cezaraugusto/extension/badge.svg
|
|
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
|
-
[discord-image]: https://
|
|
15
|
-
[discord-url]: https://discord.gg/
|
|
14
|
+
[discord-image]: https://img.shields.io/discord/1253608412890271755?label=Discord&logo=discord&style=flat
|
|
15
|
+
[discord-url]: https://discord.gg/1253608412890271755
|
|
16
16
|
|
|
17
|
-
# Extension.js [![npm][npm-image]][npm-url] [![fossa][fossa-image]][fossa-url] [![workflow][action-image]][action-url] [![downloads][downloads-image]][downloads-url] [![
|
|
17
|
+
# Extension.js [![npm][npm-image]][npm-url] [![fossa][fossa-image]][fossa-url] [![workflow][action-image]][action-url] [![downloads][downloads-image]][downloads-url] [![discord][discord-image]][discord-url]
|
|
18
18
|
|
|
19
19
|
<!-- > Plug-and-play, zero-config, cross-browser extension development tool. -->
|
|
20
20
|
|
|
21
|
-
> Make it very easy to develop cross-browser extensions.
|
|
21
|
+
<!-- > Make it very easy to develop cross-browser extensions. -->
|
|
22
22
|
|
|
23
|
-
<img alt="Extension.js with all the browser runners open" src="https://github.com/cezaraugusto/extension.js/assets/4672033/f0f5bbfc-e873-4856-9fdd-db2b42d9ab96">
|
|
24
|
-
<hr>
|
|
23
|
+
<!-- <img alt="Extension.js with all the browser runners open" src="https://github.com/cezaraugusto/extension.js/assets/4672033/f0f5bbfc-e873-4856-9fdd-db2b42d9ab96">
|
|
24
|
+
<hr> -->
|
|
25
25
|
|
|
26
26
|
<img alt="Logo" align="right" src="https://user-images.githubusercontent.com/4672033/102850460-4d22aa80-43f8-11eb-82db-9efce586f73e.png" width="25%" />
|
|
27
27
|
|
|
@@ -55,7 +55,7 @@ For a preview of extensions running these technologies, see documentation about
|
|
|
55
55
|
|
|
56
56
|
| <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/a9e2541a-96f0-4caa-9fc9-5fc5c3e901c8" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/b42c5330-9e2a-4045-99c3-1f7d264dfaf4" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/f19edff3-9005-4f50-b05c-fba615896a7f" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/ff64721d-d145-4213-930d-e70193f8d57e" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/15f1314a-aa65-4ce2-a3f3-cf53c4f730cf" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/c5f8a127-3c2a-4ceb-bb46-948cf2c8bd89" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/de1082fd-7cf6-4202-8c12-a5c3cd3e5b42" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/78e5fe3d-dc79-4aa2-954e-1a5973d1d9db" width="70"> | <img src="https://github.com/cezaraugusto/extension.js/assets/4672033/8807efd9-93e5-4db5-a1d2-9ac524f7ecc2" width="70"> |
|
|
57
57
|
| :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: |
|
|
58
|
-
| ESNext<br>✅ | TypeScript<br>✅ | WASM<br>✅ | React<br>✅ | Vue<br>✅ | Angular<br>👋 | Svelte<br>👋 | Solid<br>👋 | Preact<br
|
|
58
|
+
| ESNext<br>✅ | TypeScript<br>✅ | WASM<br>✅ | React<br>✅ | Vue<br>✅ | Angular<br>👋 | Svelte<br>👋 | Solid<br>👋 | Preact<br>✅ |
|
|
59
59
|
|
|
60
60
|
👋 = PR Welcome!
|
|
61
61
|
|
package/dist/cli.js
CHANGED
|
@@ -6,10 +6,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
9
|
var __copyProps = (to, from, except, desc) => {
|
|
14
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
11
|
for (let key of __getOwnPropNames(from))
|
|
@@ -29,104 +25,82 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
25
|
|
|
30
26
|
// cli.ts
|
|
31
27
|
var import_commander = require("commander");
|
|
32
|
-
var
|
|
33
|
-
var
|
|
28
|
+
var import_extension_create = require("extension-create");
|
|
29
|
+
var import_extension_develop = require("extension-develop");
|
|
34
30
|
|
|
35
|
-
//
|
|
36
|
-
var import_update_check = __toESM(require("update-check"));
|
|
31
|
+
// cli-lib/messages.ts
|
|
37
32
|
var import_safe = require("@colors/colors/safe");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
update = await (0, import_update_check.default)(packageJson);
|
|
42
|
-
} catch (err) {
|
|
43
|
-
if (process.env.EXTENSION_ENV === "development") {
|
|
44
|
-
console.error((0, import_safe.bold)((0, import_safe.red)(`Failed to check for updates: ${err}`)));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (update) {
|
|
48
|
-
console.log(
|
|
49
|
-
`
|
|
50
|
-
Your \u{1F9E9} ${(0, import_safe.bold)("Extension.js")} version is ${(0, import_safe.red)("outdated")}.
|
|
51
|
-
The latest version is ${(0, import_safe.bold)(update.latest)}. Please update!
|
|
52
|
-
`
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// messages/blockingErrors.ts
|
|
58
|
-
var blockingErrors_exports = {};
|
|
59
|
-
__export(blockingErrors_exports, {
|
|
60
|
-
noURLWithoutStart: () => noURLWithoutStart,
|
|
61
|
-
notImplemented: () => notImplemented,
|
|
62
|
-
unsupportedNodeVersion: () => unsupportedNodeVersion
|
|
63
|
-
});
|
|
64
|
-
function unsupportedNodeVersion() {
|
|
65
|
-
return `
|
|
66
|
-
You are using an unsupported Node version (${process.version}).
|
|
67
|
-
|
|
68
|
-
Please update to a version higher than 18.
|
|
69
|
-
`;
|
|
70
|
-
}
|
|
71
|
-
function noURLWithoutStart(argument) {
|
|
72
|
-
return `
|
|
73
|
-
The default \`create\` command does not accept URLs.
|
|
74
|
-
Are you forgetting a \`start\` command? Maybe:
|
|
75
|
-
|
|
76
|
-
npx extension \`start\` ${argument}
|
|
77
|
-
`;
|
|
33
|
+
function updateFailed(err) {
|
|
34
|
+
return "\u{1F9E9}\n" + (0, import_safe.red)(`Failed to check for updates: ${err.message}`);
|
|
78
35
|
}
|
|
79
|
-
function
|
|
80
|
-
return
|
|
36
|
+
function checkUpdates(packageJson, update) {
|
|
37
|
+
return `\u{1F9E9}
|
|
38
|
+
${(0, import_safe.brightYellow)("Notice:")} A new version of ${(0, import_safe.brightGreen)(
|
|
39
|
+
"Extension.js"
|
|
40
|
+
)} is available!
|
|
41
|
+
You are currently using version ${(0, import_safe.brightYellow)(packageJson.version)}.
|
|
42
|
+
The latest stable version is ${(0, import_safe.brightYellow)(update.latest)}.
|
|
43
|
+
Please update to the latest version to enjoy new features and improvements.
|
|
44
|
+
`;
|
|
81
45
|
}
|
|
82
|
-
|
|
83
|
-
// messages/programHelp.ts
|
|
84
46
|
function programHelp() {
|
|
85
|
-
return
|
|
86
|
-
|
|
47
|
+
return `\u{1F9E9}
|
|
48
|
+
${(0, import_safe.brightGreen)("Help center for the Extension.js program")}
|
|
87
49
|
|
|
88
|
-
|
|
50
|
+
${(0, import_safe.brightYellow)("Usage:")} extension [command] [options]
|
|
89
51
|
|
|
90
|
-
|
|
52
|
+
${(0, import_safe.brightBlue)("Note:")} If you are looking for a specific list of options,
|
|
91
53
|
all high-level commands offer their own \`--help\` file with
|
|
92
54
|
information about usage and a list of command flags available.
|
|
93
55
|
|
|
94
56
|
For example:
|
|
95
57
|
|
|
96
|
-
|
|
58
|
+
${(0, import_safe.brightBlue)("extension create --help")}
|
|
97
59
|
outputs information about the \`create\` command.
|
|
98
60
|
|
|
99
|
-
|
|
61
|
+
Options available:
|
|
100
62
|
|
|
101
|
-
|
|
102
|
-
Creates a new extension from template. The "create" command
|
|
103
|
-
is optional and can be
|
|
63
|
+
${(0, import_safe.brightBlue)("extension create <extension-name>")}
|
|
64
|
+
Creates a new extension from a template. The "create" command
|
|
65
|
+
is optional and can be omitted.
|
|
104
66
|
|
|
105
|
-
|
|
67
|
+
${(0, import_safe.brightBlue)("extension dev <extension-path>")}
|
|
106
68
|
Starts a new browser instance in development mode, with the target
|
|
107
69
|
extension loaded and auto-reloaded based on file changes.
|
|
108
70
|
|
|
109
|
-
|
|
71
|
+
${(0, import_safe.brightBlue)("extension start <extension-path>")}
|
|
110
72
|
Starts a new browser instance in production mode, with the target
|
|
111
73
|
extension compiled based on the browser choice.
|
|
112
74
|
|
|
113
|
-
|
|
75
|
+
${(0, import_safe.brightBlue)("extension build <extension-path>")}
|
|
114
76
|
Builds the target extension with browser defaults, ready for packaging.
|
|
115
77
|
|
|
116
|
-
|
|
78
|
+
${(0, import_safe.brightBlue)("extension --help")}
|
|
117
79
|
This command ;) Outputs a help file with key command options.
|
|
118
80
|
|
|
119
|
-
Feels something is wrong? Help by reporting a bug:
|
|
120
|
-
https://github.com/cezaraugusto/extension/issues/new
|
|
81
|
+
${(0, import_safe.brightYellow)("Feels something is wrong? Help by reporting a bug:")}
|
|
82
|
+
${(0, import_safe.underline)("https://github.com/cezaraugusto/extension/issues/new")}
|
|
121
83
|
`;
|
|
122
84
|
}
|
|
123
85
|
|
|
124
|
-
//
|
|
125
|
-
var
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
86
|
+
// check-updates.ts
|
|
87
|
+
var import_update_check = __toESM(require("update-check"));
|
|
88
|
+
function isStableVersion(version) {
|
|
89
|
+
return !/[a-zA-Z]/.test(version);
|
|
90
|
+
}
|
|
91
|
+
async function checkUpdates2(packageJson) {
|
|
92
|
+
let update = null;
|
|
93
|
+
try {
|
|
94
|
+
update = await (0, import_update_check.default)(packageJson);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
if (process.env.EXTENSION_ENV === "development") {
|
|
97
|
+
console.error(updateFailed(err));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (update && isStableVersion(update.latest)) {
|
|
101
|
+
console.log(checkUpdates(packageJson, update));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
130
104
|
|
|
131
105
|
// package.json
|
|
132
106
|
var package_default = {
|
|
@@ -140,7 +114,7 @@ var package_default = {
|
|
|
140
114
|
node: ">=18"
|
|
141
115
|
},
|
|
142
116
|
name: "extension",
|
|
143
|
-
version: "
|
|
117
|
+
version: "2.0.0-alpha.1",
|
|
144
118
|
description: "Create cross-browser extensions with no build configuration.",
|
|
145
119
|
main: "./dist/cli.js",
|
|
146
120
|
types: "./dist/cli.d.ts",
|
|
@@ -164,10 +138,8 @@ var package_default = {
|
|
|
164
138
|
"compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18",
|
|
165
139
|
compile: "yarn compile:readme-files && yarn compile:tailwind-config && yarn compile:stylelint-config &&yarn compile:cli",
|
|
166
140
|
clean: "rm -rf dist",
|
|
167
|
-
"
|
|
168
|
-
"test:
|
|
169
|
-
"test:cli": "npm run before:test && jest spec/cli.spec.ts",
|
|
170
|
-
"test:create": "npm run before:test && jest spec/create.spec.ts"
|
|
141
|
+
test: 'echo "Note: no test specified" && exit 0',
|
|
142
|
+
"test:cli": "jest __spec__/cli.spec.ts"
|
|
171
143
|
},
|
|
172
144
|
keywords: [
|
|
173
145
|
"zero-config",
|
|
@@ -184,8 +156,8 @@ var package_default = {
|
|
|
184
156
|
],
|
|
185
157
|
dependencies: {
|
|
186
158
|
"@colors/colors": "^1.6.0",
|
|
187
|
-
"
|
|
188
|
-
"
|
|
159
|
+
"extension-create": "*",
|
|
160
|
+
"extension-develop": "*",
|
|
189
161
|
commander: "^11.1.0",
|
|
190
162
|
semver: "^7.5.4",
|
|
191
163
|
"update-check": "^1.5.4"
|
|
@@ -205,15 +177,15 @@ var package_default = {
|
|
|
205
177
|
};
|
|
206
178
|
|
|
207
179
|
// cli.ts
|
|
208
|
-
|
|
180
|
+
checkUpdates2(package_default);
|
|
209
181
|
var extensionJs = import_commander.program;
|
|
210
|
-
extensionJs.name(package_default.name).description(package_default.description).version(package_default.version).addHelpText("after",
|
|
182
|
+
extensionJs.name(package_default.name).description(package_default.description).version(package_default.version).addHelpText("after", programHelp());
|
|
211
183
|
var vendors = (browser) => browser === "all" ? "chrome,edge,firefox".split(",") : browser.split(",");
|
|
212
184
|
extensionJs.command("create").arguments("<project-name|project-path>").usage("create <project-name|project-path> [options]").description("Creates a new extension.").option(
|
|
213
185
|
"-t, --template <template-name>",
|
|
214
186
|
"specify a template for the created project"
|
|
215
187
|
).action(async function(pathOrRemoteUrl, { template }) {
|
|
216
|
-
await (0,
|
|
188
|
+
await (0, import_extension_create.extensionCreate)(pathOrRemoteUrl, { template });
|
|
217
189
|
});
|
|
218
190
|
extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [project-path|remote-url] [options]").description("Starts the development server (development mode)").option(
|
|
219
191
|
"-u, --user-data-dir <path-to-file | boolean>",
|
|
@@ -229,8 +201,7 @@ extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [pr
|
|
|
229
201
|
"what port should Extension.js run. Defaults to `3000`"
|
|
230
202
|
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...devOptions }) {
|
|
231
203
|
for (const vendor of vendors(browser)) {
|
|
232
|
-
await (0,
|
|
233
|
-
mode: "development",
|
|
204
|
+
await (0, import_extension_develop.extensionDev)(pathOrRemoteUrl, {
|
|
234
205
|
browser: vendor,
|
|
235
206
|
...devOptions
|
|
236
207
|
});
|
|
@@ -250,8 +221,7 @@ extensionJs.command("start").arguments("[project-path|remote-url]").usage("start
|
|
|
250
221
|
"what port should Extension.js run. Defaults to `3000`"
|
|
251
222
|
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...startOptions }) {
|
|
252
223
|
for (const vendor of vendors(browser)) {
|
|
253
|
-
await (0,
|
|
254
|
-
mode: "production",
|
|
224
|
+
await (0, import_extension_develop.extensionStart)(pathOrRemoteUrl, {
|
|
255
225
|
browser: vendor,
|
|
256
226
|
...startOptions
|
|
257
227
|
});
|
|
@@ -274,7 +244,7 @@ extensionJs.command("build").arguments("[project-name]").usage("build [path-to-r
|
|
|
274
244
|
"specify the name of the ZIP file. Defaults to the extension name and version"
|
|
275
245
|
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...buildOptions }) {
|
|
276
246
|
for (const vendor of vendors(browser)) {
|
|
277
|
-
await (0,
|
|
247
|
+
await (0, import_extension_develop.extensionBuild)(pathOrRemoteUrl, {
|
|
278
248
|
browser: vendor,
|
|
279
249
|
...buildOptions
|
|
280
250
|
});
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
11
|
"name": "extension",
|
|
12
|
-
"version": "
|
|
12
|
+
"version": "2.0.0-alpha.1",
|
|
13
13
|
"description": "Create cross-browser extensions with no build configuration.",
|
|
14
14
|
"main": "./dist/cli.js",
|
|
15
15
|
"types": "./dist/cli.d.ts",
|
|
@@ -33,10 +33,8 @@
|
|
|
33
33
|
"compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18",
|
|
34
34
|
"compile": "yarn compile:readme-files && yarn compile:tailwind-config && yarn compile:stylelint-config &&yarn compile:cli",
|
|
35
35
|
"clean": "rm -rf dist",
|
|
36
|
-
"
|
|
37
|
-
"test:
|
|
38
|
-
"test:cli": "npm run before:test && jest spec/cli.spec.ts",
|
|
39
|
-
"test:create": "npm run before:test && jest spec/create.spec.ts"
|
|
36
|
+
"test": "echo \"Note: no test specified\" && exit 0",
|
|
37
|
+
"test:cli": "jest __spec__/cli.spec.ts"
|
|
40
38
|
},
|
|
41
39
|
"keywords": [
|
|
42
40
|
"zero-config",
|
|
@@ -53,8 +51,8 @@
|
|
|
53
51
|
],
|
|
54
52
|
"dependencies": {
|
|
55
53
|
"@colors/colors": "^1.6.0",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
54
|
+
"extension-create": "*",
|
|
55
|
+
"extension-develop": "*",
|
|
58
56
|
"commander": "^11.1.0",
|
|
59
57
|
"semver": "^7.5.4",
|
|
60
58
|
"update-check": "^1.5.4"
|