extension 1.8.0-beta.2 → 2.0.0-alpha.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 +8 -6
- package/dist/cli.js +60 -128
- package/package.json +6 -4
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,15 +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://img.shields.io/discord/1253608412890271755?label=Discord&logo=discord&style=flat
|
|
15
|
+
[discord-url]: https://discord.gg/1253608412890271755
|
|
14
16
|
|
|
15
|
-
# 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]
|
|
16
18
|
|
|
17
19
|
<!-- > Plug-and-play, zero-config, cross-browser extension development tool. -->
|
|
18
20
|
|
|
19
|
-
> Make it very easy to develop cross-browser extensions.
|
|
21
|
+
<!-- > Make it very easy to develop cross-browser extensions. -->
|
|
20
22
|
|
|
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">
|
|
22
|
-
<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> -->
|
|
23
25
|
|
|
24
26
|
<img alt="Logo" align="right" src="https://user-images.githubusercontent.com/4672033/102850460-4d22aa80-43f8-11eb-82db-9efce586f73e.png" width="25%" />
|
|
25
27
|
|
|
@@ -53,7 +55,7 @@ For a preview of extensions running these technologies, see documentation about
|
|
|
53
55
|
|
|
54
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"> |
|
|
55
57
|
| :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: |
|
|
56
|
-
| 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>✅ |
|
|
57
59
|
|
|
58
60
|
👋 = PR Welcome!
|
|
59
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))
|
|
@@ -28,106 +24,83 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
24
|
));
|
|
29
25
|
|
|
30
26
|
// cli.ts
|
|
31
|
-
var import_semver = __toESM(require("semver"));
|
|
32
27
|
var import_commander = require("commander");
|
|
33
|
-
var
|
|
34
|
-
var
|
|
28
|
+
var import_extension_create = require("extension-create");
|
|
29
|
+
var import_extension_develop = require("extension-develop");
|
|
35
30
|
|
|
36
|
-
//
|
|
37
|
-
var import_update_check = __toESM(require("update-check"));
|
|
31
|
+
// cli-lib/messages.ts
|
|
38
32
|
var import_safe = require("@colors/colors/safe");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
update = await (0, import_update_check.default)(packageJson);
|
|
43
|
-
} catch (err) {
|
|
44
|
-
if (process.env.EXTENSION_ENV === "development") {
|
|
45
|
-
console.error((0, import_safe.bold)((0, import_safe.red)(`Failed to check for updates: ${err}`)));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (update) {
|
|
49
|
-
console.log(
|
|
50
|
-
`
|
|
51
|
-
Your \u{1F9E9} ${(0, import_safe.bold)("Extension.js")} version is ${(0, import_safe.red)("outdated")}.
|
|
52
|
-
The latest version is ${(0, import_safe.bold)(update.latest)}. Please update!
|
|
53
|
-
`
|
|
54
|
-
);
|
|
55
|
-
}
|
|
33
|
+
function updateFailed(err) {
|
|
34
|
+
return "\u{1F9E9}\n" + (0, import_safe.red)(`Failed to check for updates: ${err.message}`);
|
|
56
35
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return `
|
|
67
|
-
You are using an unsupported Node version (${process.version}).
|
|
68
|
-
|
|
69
|
-
Please update to a version higher than 18.
|
|
70
|
-
`;
|
|
71
|
-
}
|
|
72
|
-
function noURLWithoutStart(argument) {
|
|
73
|
-
return `
|
|
74
|
-
The default \`create\` command does not accept URLs.
|
|
75
|
-
Are you forgetting a \`start\` command? Maybe:
|
|
76
|
-
|
|
77
|
-
npx extension \`start\` ${argument}
|
|
78
|
-
`;
|
|
79
|
-
}
|
|
80
|
-
function notImplemented(argument) {
|
|
81
|
-
return `${argument} command not implemented yet.`;
|
|
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
|
+
`;
|
|
82
45
|
}
|
|
83
|
-
|
|
84
|
-
// messages/programHelp.ts
|
|
85
46
|
function programHelp() {
|
|
86
|
-
return
|
|
87
|
-
|
|
47
|
+
return `\u{1F9E9}
|
|
48
|
+
${(0, import_safe.brightGreen)("Help center for the Extension.js program")}
|
|
88
49
|
|
|
89
|
-
|
|
50
|
+
${(0, import_safe.brightYellow)("Usage:")} extension [command] [options]
|
|
90
51
|
|
|
91
|
-
|
|
52
|
+
${(0, import_safe.brightBlue)("Note:")} If you are looking for a specific list of options,
|
|
92
53
|
all high-level commands offer their own \`--help\` file with
|
|
93
54
|
information about usage and a list of command flags available.
|
|
94
55
|
|
|
95
56
|
For example:
|
|
96
57
|
|
|
97
|
-
|
|
58
|
+
${(0, import_safe.brightBlue)("extension create --help")}
|
|
98
59
|
outputs information about the \`create\` command.
|
|
99
60
|
|
|
100
|
-
|
|
61
|
+
Options available:
|
|
101
62
|
|
|
102
|
-
|
|
103
|
-
Creates a new extension from template. The "create" command
|
|
104
|
-
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.
|
|
105
66
|
|
|
106
|
-
|
|
67
|
+
${(0, import_safe.brightBlue)("extension dev <extension-path>")}
|
|
107
68
|
Starts a new browser instance in development mode, with the target
|
|
108
69
|
extension loaded and auto-reloaded based on file changes.
|
|
109
70
|
|
|
110
|
-
|
|
71
|
+
${(0, import_safe.brightBlue)("extension start <extension-path>")}
|
|
111
72
|
Starts a new browser instance in production mode, with the target
|
|
112
73
|
extension compiled based on the browser choice.
|
|
113
74
|
|
|
114
|
-
|
|
75
|
+
${(0, import_safe.brightBlue)("extension build <extension-path>")}
|
|
115
76
|
Builds the target extension with browser defaults, ready for packaging.
|
|
116
77
|
|
|
117
|
-
|
|
78
|
+
${(0, import_safe.brightBlue)("extension --help")}
|
|
118
79
|
This command ;) Outputs a help file with key command options.
|
|
119
80
|
|
|
120
|
-
Feels something is wrong? Help by reporting a bug:
|
|
121
|
-
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")}
|
|
122
83
|
`;
|
|
123
84
|
}
|
|
124
85
|
|
|
125
|
-
//
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
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
|
+
}
|
|
131
104
|
|
|
132
105
|
// package.json
|
|
133
106
|
var package_default = {
|
|
@@ -141,7 +114,7 @@ var package_default = {
|
|
|
141
114
|
node: ">=18"
|
|
142
115
|
},
|
|
143
116
|
name: "extension",
|
|
144
|
-
version: "
|
|
117
|
+
version: "2.0.0-alpha.0",
|
|
145
118
|
description: "Create cross-browser extensions with no build configuration.",
|
|
146
119
|
main: "./dist/cli.js",
|
|
147
120
|
types: "./dist/cli.d.ts",
|
|
@@ -158,13 +131,15 @@ var package_default = {
|
|
|
158
131
|
url: "https://cezaraugusto.com"
|
|
159
132
|
},
|
|
160
133
|
scripts: {
|
|
134
|
+
watch: "yarn compile --watch",
|
|
161
135
|
"compile:readme-files": "node ./scripts/copyMarkdownFilesToCli.js",
|
|
162
136
|
"compile:tailwind-config": "node ./scripts/copyTailwindConfig.js",
|
|
163
137
|
"compile:stylelint-config": "node ./scripts/copyStylelintConfig.js",
|
|
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
|
-
test: "
|
|
141
|
+
test: 'echo "Note: no test specified" && exit 0',
|
|
142
|
+
"test:cli": "jest __spec__/cli.spec.ts"
|
|
168
143
|
},
|
|
169
144
|
keywords: [
|
|
170
145
|
"zero-config",
|
|
@@ -181,8 +156,8 @@ var package_default = {
|
|
|
181
156
|
],
|
|
182
157
|
dependencies: {
|
|
183
158
|
"@colors/colors": "^1.6.0",
|
|
184
|
-
"
|
|
185
|
-
"
|
|
159
|
+
"extension-create": "2.0.0-alpha.0",
|
|
160
|
+
"extension-develop": "2.0.0-alpha.0",
|
|
186
161
|
commander: "^11.1.0",
|
|
187
162
|
semver: "^7.5.4",
|
|
188
163
|
"update-check": "^1.5.4"
|
|
@@ -202,56 +177,15 @@ var package_default = {
|
|
|
202
177
|
};
|
|
203
178
|
|
|
204
179
|
// cli.ts
|
|
205
|
-
|
|
206
|
-
if (import_semver.default.lte(process.version, "18.0.0")) {
|
|
207
|
-
messages_default.unsupportedNodeVersion();
|
|
208
|
-
process.exit(1);
|
|
209
|
-
}
|
|
180
|
+
checkUpdates2(package_default);
|
|
210
181
|
var extensionJs = import_commander.program;
|
|
211
|
-
|
|
212
|
-
console.log(`Running extension via ${package_default.name}...`);
|
|
213
|
-
}
|
|
214
|
-
extensionJs.name(package_default.name).description(package_default.description).version(package_default.version).addHelpText("after", messages_default.programHelp());
|
|
182
|
+
extensionJs.name(package_default.name).description(package_default.description).version(package_default.version).addHelpText("after", programHelp());
|
|
215
183
|
var vendors = (browser) => browser === "all" ? "chrome,edge,firefox".split(",") : browser.split(",");
|
|
216
184
|
extensionJs.command("create").arguments("<project-name|project-path>").usage("create <project-name|project-path> [options]").description("Creates a new extension.").option(
|
|
217
185
|
"-t, --template <template-name>",
|
|
218
186
|
"specify a template for the created project"
|
|
219
|
-
).action(async function(pathOrRemoteUrl, {
|
|
220
|
-
|
|
221
|
-
template,
|
|
222
|
-
...otherCommandOptions
|
|
223
|
-
}) {
|
|
224
|
-
switch (pathOrRemoteUrl) {
|
|
225
|
-
case "dev":
|
|
226
|
-
for (const vendor of vendors(browser)) {
|
|
227
|
-
await (0, import_develop.extensionDev)(pathOrRemoteUrl, {
|
|
228
|
-
mode: "development",
|
|
229
|
-
browser: vendor,
|
|
230
|
-
...otherCommandOptions
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
break;
|
|
234
|
-
case "start":
|
|
235
|
-
for (const vendor of vendors(browser)) {
|
|
236
|
-
await (0, import_develop.extensionStart)(pathOrRemoteUrl, {
|
|
237
|
-
mode: "production",
|
|
238
|
-
browser: vendor,
|
|
239
|
-
...otherCommandOptions
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
break;
|
|
243
|
-
case "build":
|
|
244
|
-
for (const vendor of vendors(browser)) {
|
|
245
|
-
await (0, import_develop.extensionBuild)(pathOrRemoteUrl, {
|
|
246
|
-
browser: vendor,
|
|
247
|
-
...otherCommandOptions
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
break;
|
|
251
|
-
default:
|
|
252
|
-
await (0, import_create.default)(pathOrRemoteUrl, { template });
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
187
|
+
).action(async function(pathOrRemoteUrl, { template }) {
|
|
188
|
+
await (0, import_extension_create.extensionCreate)(pathOrRemoteUrl, { template });
|
|
255
189
|
});
|
|
256
190
|
extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [project-path|remote-url] [options]").description("Starts the development server (development mode)").option(
|
|
257
191
|
"-u, --user-data-dir <path-to-file | boolean>",
|
|
@@ -267,8 +201,7 @@ extensionJs.command("dev").arguments("[project-path|remote-url]").usage("dev [pr
|
|
|
267
201
|
"what port should Extension.js run. Defaults to `3000`"
|
|
268
202
|
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...devOptions }) {
|
|
269
203
|
for (const vendor of vendors(browser)) {
|
|
270
|
-
await (0,
|
|
271
|
-
mode: "development",
|
|
204
|
+
await (0, import_extension_develop.extensionDev)(pathOrRemoteUrl, {
|
|
272
205
|
browser: vendor,
|
|
273
206
|
...devOptions
|
|
274
207
|
});
|
|
@@ -288,8 +221,7 @@ extensionJs.command("start").arguments("[project-path|remote-url]").usage("start
|
|
|
288
221
|
"what port should Extension.js run. Defaults to `3000`"
|
|
289
222
|
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...startOptions }) {
|
|
290
223
|
for (const vendor of vendors(browser)) {
|
|
291
|
-
await (0,
|
|
292
|
-
mode: "production",
|
|
224
|
+
await (0, import_extension_develop.extensionStart)(pathOrRemoteUrl, {
|
|
293
225
|
browser: vendor,
|
|
294
226
|
...startOptions
|
|
295
227
|
});
|
|
@@ -312,7 +244,7 @@ extensionJs.command("build").arguments("[project-name]").usage("build [path-to-r
|
|
|
312
244
|
"specify the name of the ZIP file. Defaults to the extension name and version"
|
|
313
245
|
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...buildOptions }) {
|
|
314
246
|
for (const vendor of vendors(browser)) {
|
|
315
|
-
await (0,
|
|
247
|
+
await (0, import_extension_develop.extensionBuild)(pathOrRemoteUrl, {
|
|
316
248
|
browser: vendor,
|
|
317
249
|
...buildOptions
|
|
318
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.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",
|
|
@@ -26,13 +26,15 @@
|
|
|
26
26
|
"url": "https://cezaraugusto.com"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
+
"watch": "yarn compile --watch",
|
|
29
30
|
"compile:readme-files": "node ./scripts/copyMarkdownFilesToCli.js",
|
|
30
31
|
"compile:tailwind-config": "node ./scripts/copyTailwindConfig.js",
|
|
31
32
|
"compile:stylelint-config": "node ./scripts/copyStylelintConfig.js",
|
|
32
33
|
"compile:cli": "tsup-node ./cli.ts --format cjs --dts --target=node18",
|
|
33
34
|
"compile": "yarn compile:readme-files && yarn compile:tailwind-config && yarn compile:stylelint-config &&yarn compile:cli",
|
|
34
35
|
"clean": "rm -rf dist",
|
|
35
|
-
"test": "
|
|
36
|
+
"test": "echo \"Note: no test specified\" && exit 0",
|
|
37
|
+
"test:cli": "jest __spec__/cli.spec.ts"
|
|
36
38
|
},
|
|
37
39
|
"keywords": [
|
|
38
40
|
"zero-config",
|
|
@@ -49,8 +51,8 @@
|
|
|
49
51
|
],
|
|
50
52
|
"dependencies": {
|
|
51
53
|
"@colors/colors": "^1.6.0",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
+
"extension-create": "2.0.0-alpha.0",
|
|
55
|
+
"extension-develop": "2.0.0-alpha.0",
|
|
54
56
|
"commander": "^11.1.0",
|
|
55
57
|
"semver": "^7.5.4",
|
|
56
58
|
"update-check": "^1.5.4"
|