extension 2.0.0-rc.24 → 2.0.0-rc.26
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/dist/cli.js +55 -26
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1,80 +1,105 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.n = (module)=>{
|
|
6
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
7
|
+
__webpack_require__.d(getter, {
|
|
8
|
+
a: getter
|
|
9
|
+
});
|
|
10
|
+
return getter;
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
(()=>{
|
|
14
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
15
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: definition[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
})();
|
|
21
|
+
(()=>{
|
|
22
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
const external_commander_namespaceObject = require("commander");
|
|
26
|
+
const external_extension_create_namespaceObject = require("extension-create");
|
|
27
|
+
const external_extension_develop_namespaceObject = require("extension-develop");
|
|
28
|
+
const external_chalk_namespaceObject = require("chalk");
|
|
29
|
+
var external_chalk_default = /*#__PURE__*/ __webpack_require__.n(external_chalk_namespaceObject);
|
|
7
30
|
function updateFailed(err) {
|
|
8
|
-
return "\uD83E\uDDE9\n" +
|
|
31
|
+
return "\uD83E\uDDE9\n" + external_chalk_default().red(`Failed to check for updates: ${err.message}`);
|
|
9
32
|
}
|
|
10
33
|
function checkUpdates(packageJson, update) {
|
|
11
|
-
return `\u{1F9E9}\n${
|
|
34
|
+
return `\u{1F9E9}\n${external_chalk_default().yellow('Notice:')} A new version of ${external_chalk_default().green('Extension.js')} is available!\nYou are currently using version ${external_chalk_default().yellow(packageJson.version)}.\nThe latest stable version is ${external_chalk_default().yellow(update.latest)}.\nPlease update to the latest version to enjoy new features and improvements.\n`;
|
|
12
35
|
}
|
|
13
36
|
function programHelp() {
|
|
14
37
|
return `\u{1F9E9}
|
|
15
|
-
${
|
|
38
|
+
${external_chalk_default().underline('Help center for the Extension.js program')}
|
|
16
39
|
|
|
17
|
-
${
|
|
40
|
+
${external_chalk_default().yellow('Usage:')} extension [command] [options]
|
|
18
41
|
|
|
19
|
-
${
|
|
42
|
+
${external_chalk_default().yellow('Note:')} If you are looking for a specific list of options,
|
|
20
43
|
all high-level commands offer their own \`--help\` file with
|
|
21
44
|
information about usage and a list of command flags available.
|
|
22
45
|
|
|
23
46
|
For example:
|
|
24
47
|
|
|
25
|
-
${
|
|
48
|
+
${external_chalk_default().green('extension create --help')}
|
|
26
49
|
outputs information about the "create" command.
|
|
27
50
|
|
|
28
51
|
Options available:
|
|
29
52
|
|
|
30
|
-
${
|
|
53
|
+
${external_chalk_default().green('extension create <extension-name>')}
|
|
31
54
|
Creates a new extension from a template. The "create" command
|
|
32
55
|
is optional and can be omitted.
|
|
33
56
|
|
|
34
|
-
${
|
|
57
|
+
${external_chalk_default().green('extension dev <extension-path>')}
|
|
35
58
|
Starts a new browser instance in development mode, with the target
|
|
36
59
|
extension loaded and auto-reloaded based on file changes.
|
|
37
60
|
|
|
38
|
-
${
|
|
61
|
+
${external_chalk_default().green('extension start <extension-path>')}
|
|
39
62
|
Starts a new browser instance in production mode, with the target
|
|
40
63
|
extension compiled based on the browser choice.
|
|
41
64
|
|
|
42
|
-
${
|
|
65
|
+
${external_chalk_default().green('extension build <extension-path>')}
|
|
43
66
|
Builds the target extension with browser defaults, ready for packaging.
|
|
44
67
|
|
|
45
|
-
${
|
|
68
|
+
${external_chalk_default().green('extension --help')}
|
|
46
69
|
This command ;) Outputs a help file with key command options.
|
|
47
70
|
|
|
48
|
-
${
|
|
49
|
-
${
|
|
71
|
+
${external_chalk_default().yellow('Feels something is wrong? Help by reporting a bug:')}
|
|
72
|
+
${external_chalk_default().underline('https://github.com/cezaraugusto/extension/issues/new')}
|
|
50
73
|
`;
|
|
51
74
|
}
|
|
75
|
+
const external_update_check_namespaceObject = require("update-check");
|
|
76
|
+
var external_update_check_default = /*#__PURE__*/ __webpack_require__.n(external_update_check_namespaceObject);
|
|
52
77
|
function isStableVersion(version) {
|
|
53
78
|
return !/[a-zA-Z]/.test(version);
|
|
54
79
|
}
|
|
55
80
|
async function check_updates_checkUpdates(packageJson) {
|
|
56
81
|
let update = null;
|
|
57
82
|
try {
|
|
58
|
-
update = await (
|
|
83
|
+
update = await external_update_check_default()(packageJson);
|
|
59
84
|
} catch (err) {
|
|
60
85
|
if ('development' === process.env.EXTENSION_ENV) console.error(updateFailed(err));
|
|
61
86
|
}
|
|
62
87
|
if (update && isStableVersion(update.latest)) console.log(checkUpdates(packageJson, update));
|
|
63
88
|
}
|
|
64
|
-
var package_namespaceObject = JSON.parse('{"license":"MIT","repository":{"type":"git","url":"https://github.com/cezaraugusto/extension.git","directory":"programs/cli"},"engines":{"node":">=18"},"
|
|
89
|
+
var package_namespaceObject = JSON.parse('{"license":"MIT","repository":{"type":"git","url":"https://github.com/cezaraugusto/extension.git","directory":"programs/cli"},"engines":{"node":">=18"},"exports":{".":{"types":"./dist/cli.d.ts","import":"./dist/cli.js","require":"./dist/cli.js"}},"main":"./dist/cli.js","types":"./dist/cli.d.ts","files":["dist"],"bin":{"extension":"./dist/cli.js"},"name":"extension","version":"2.0.0-rc.26","description":"Create cross-browser extensions with no build configuration.","author":{"name":"Cezar Augusto","email":"boss@cezaraugusto.net","url":"https://cezaraugusto.com"},"scripts":{"watch":"rslib build --watch","compile:types":"bash install_scripts.sh","compile:readme-files":"node ./scripts/copyMarkdownFilesToCli.js","compile:cli":"rslib build","compile":"pnpm compile:readme-files && pnpm compile:cli && pnpm compile:types","clean":"rm -rf dist","test":"echo \\"Note: no test specified\\" && exit 0","test:cli":"vitest run"},"keywords":["zero-config","build","develop","browser","extension","chrome extension","edge extension","firefox extension","safari extension","web","react","typescript"],"dependencies":{"chalk":"^5.3.0","@types/chrome":"^0.0.287","@types/firefox-webext-browser":"^120.0.4","@types/node":"^22.10.1","@types/react":"^19.0.1","@types/react-dom":"^19.0.1","commander":"^12.1.0","extension-create":"workspace:*","extension-develop":"workspace:*","semver":"^7.6.3","update-check":"^1.5.4","webextension-polyfill":"^0.12.0"},"devDependencies":{"@rslib/core":"^0.6.9","@types/mock-fs":"^4.13.4","@types/semver":"^7.5.8","mock-fs":"^5.4.1","tsconfig":"*","typescript":"5.7.2"}}');
|
|
65
90
|
check_updates_checkUpdates(package_namespaceObject);
|
|
66
|
-
const extensionJs =
|
|
91
|
+
const extensionJs = external_commander_namespaceObject.program;
|
|
67
92
|
const vendors = (browser)=>'all' === browser ? 'chrome,edge,firefox'.split(',') : browser.split(',');
|
|
68
93
|
extensionJs.name(package_namespaceObject.name).description(package_namespaceObject.description).version(package_namespaceObject.version).addHelpText('after', programHelp());
|
|
69
94
|
extensionJs.command('create').arguments('<project-name|project-path>').usage('create <project-name|project-path> [options]').description('Creates a new extension.').option('-t, --template <template-name>', 'specify a template for the created project').option('--install', 'whether or not to install the dependencies after creating the project').action(async function(pathOrRemoteUrl, { template, install }) {
|
|
70
|
-
await (0,
|
|
95
|
+
await (0, external_extension_create_namespaceObject.extensionCreate)(pathOrRemoteUrl, {
|
|
71
96
|
template,
|
|
72
97
|
install,
|
|
73
98
|
cliVersion: package_namespaceObject.version
|
|
74
99
|
});
|
|
75
100
|
});
|
|
76
101
|
extensionJs.command('dev').arguments('[project-path|remote-url]').usage('dev [project-path|remote-url] [options]').description('Starts the development server (development mode)').option('--profile <path-to-file | boolean>', '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').option('--browser <chrome | edge | firefox>', 'specify a browser to preview your extension in production mode. Defaults to `chrome`').option('--chromium-binary <path-to-binary>', 'specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default').option('--gecko-binary <path-to-binary>', 'specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default').option('--polyfill [boolean]', 'whether or not to apply the cross-browser polyfill. Defaults to `false`').option('--open [boolean]', 'whether or not to open the browser automatically. Defaults to `true`').option('--starting-url <url>', 'specify the starting URL for the browser. Defaults to `undefined`').option('--port <port>', 'specify the port to use for the development server. Defaults to `8080`').action(async function(pathOrRemoteUrl, { browser = 'chrome', ...devOptions }) {
|
|
77
|
-
for (const vendor of vendors(browser))await (0,
|
|
102
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionDev)(pathOrRemoteUrl, {
|
|
78
103
|
...devOptions,
|
|
79
104
|
profile: devOptions.profile,
|
|
80
105
|
browser: vendor,
|
|
@@ -86,7 +111,7 @@ extensionJs.command('dev').arguments('[project-path|remote-url]').usage('dev [pr
|
|
|
86
111
|
});
|
|
87
112
|
});
|
|
88
113
|
extensionJs.command('start').arguments('[project-path|remote-url]').usage('start [project-path|remote-url] [options]').description('Starts the development server (production mode)').option('--profile <path-to-file | boolean>', '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').option('--browser <chrome | edge | firefox>', 'specify a browser to preview your extension in production mode. Defaults to `chrome`').option('--polyfill [boolean]', 'whether or not to apply the cross-browser polyfill. Defaults to `true`').option('--chromium-binary <path-to-binary>', 'specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default').option('--gecko-binary <path-to-binary>', 'specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default').option('--starting-url <url>', 'specify the starting URL for the browser. Defaults to `undefined`').option('--port <port>', 'specify the port to use for the development server. Defaults to `8080`').action(async function(pathOrRemoteUrl, { browser = 'chrome', ...startOptions }) {
|
|
89
|
-
for (const vendor of vendors(browser))await (0,
|
|
114
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionStart)(pathOrRemoteUrl, {
|
|
90
115
|
mode: 'production',
|
|
91
116
|
profile: startOptions.profile,
|
|
92
117
|
browser: vendor,
|
|
@@ -96,7 +121,7 @@ extensionJs.command('start').arguments('[project-path|remote-url]').usage('start
|
|
|
96
121
|
});
|
|
97
122
|
});
|
|
98
123
|
extensionJs.command('preview').arguments('[project-name]').usage('preview [path-to-remote-extension] [options]').description('Preview the extension in production mode').option('--profile <path-to-file | boolean>', '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').option('--browser <chrome | edge | firefox>', 'specify a browser to preview your extension in production mode. Defaults to `chrome`').option('--chromium-binary <path-to-binary>', 'specify a path to the Chromium binary. This option overrides the --browser setting. Defaults to the system default').option('--gecko-binary <path-to-binary>', 'specify a path to the Gecko binary. This option overrides the --browser setting. Defaults to the system default').option('--starting-url <url>', 'specify the starting URL for the browser. Defaults to `undefined`').option('--port <port>', 'specify the port to use for the development server. Defaults to `8080`').action(async function(pathOrRemoteUrl, { browser = 'chrome', ...previewOptions }) {
|
|
99
|
-
for (const vendor of vendors(browser))await (0,
|
|
124
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionPreview)(pathOrRemoteUrl, {
|
|
100
125
|
mode: 'production',
|
|
101
126
|
profile: previewOptions.profile,
|
|
102
127
|
browser: vendor,
|
|
@@ -106,7 +131,7 @@ extensionJs.command('preview').arguments('[project-name]').usage('preview [path-
|
|
|
106
131
|
});
|
|
107
132
|
});
|
|
108
133
|
extensionJs.command('build').arguments('[project-name]').usage('build [path-to-remote-extension] [options]').description('Builds the extension for production').option('--browser <chrome | edge | firefox>', 'specify a browser to preview your extension in production mode. Defaults to `chrome`').option('--polyfill [boolean]', 'whether or not to apply the cross-browser polyfill. Defaults to `false`').option('--zip [boolean]', 'whether or not to compress the extension into a ZIP file. Defaults to `false`').option('--zip-source [boolean]', 'whether or not to include the source files in the ZIP file. Defaults to `false`').option('--zip-filename <string>', 'specify the name of the ZIP file. Defaults to the extension name and version').option('--silent [boolean]', 'whether or not to open the browser automatically. Defaults to `false`').action(async function(pathOrRemoteUrl, { browser = 'chrome', ...buildOptions }) {
|
|
109
|
-
for (const vendor of vendors(browser))await (0,
|
|
134
|
+
for (const vendor of vendors(browser))await (0, external_extension_develop_namespaceObject.extensionBuild)(pathOrRemoteUrl, {
|
|
110
135
|
browser: vendor,
|
|
111
136
|
polyfill: buildOptions.polyfill,
|
|
112
137
|
zip: buildOptions.zip,
|
|
@@ -116,3 +141,7 @@ extensionJs.command('build').arguments('[project-name]').usage('build [path-to-r
|
|
|
116
141
|
});
|
|
117
142
|
});
|
|
118
143
|
extensionJs.parse();
|
|
144
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
145
|
+
Object.defineProperty(exports, '__esModule', {
|
|
146
|
+
value: true
|
|
147
|
+
});
|
package/package.json
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
|
-
"type": "module",
|
|
12
11
|
"exports": {
|
|
13
12
|
".": {
|
|
14
13
|
"types": "./dist/cli.d.ts",
|
|
15
|
-
"import": "./dist/cli.js"
|
|
14
|
+
"import": "./dist/cli.js",
|
|
15
|
+
"require": "./dist/cli.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"main": "./dist/cli.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"extension": "./dist/cli.js"
|
|
25
25
|
},
|
|
26
26
|
"name": "extension",
|
|
27
|
-
"version": "2.0.0-rc.
|
|
27
|
+
"version": "2.0.0-rc.26",
|
|
28
28
|
"description": "Create cross-browser extensions with no build configuration.",
|
|
29
29
|
"author": {
|
|
30
30
|
"name": "Cezar Augusto",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"semver": "^7.6.3",
|
|
57
57
|
"update-check": "^1.5.4",
|
|
58
58
|
"webextension-polyfill": "^0.12.0",
|
|
59
|
-
"extension-create": "2.0.0-rc.
|
|
60
|
-
"extension-develop": "2.0.0-rc.
|
|
59
|
+
"extension-create": "2.0.0-rc.26",
|
|
60
|
+
"extension-develop": "2.0.0-rc.26"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@rslib/core": "^0.6.9",
|