extension-create 1.2.1 → 1.2.2
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 +1 -1
- package/package.json +2 -2
- package/dist/module.d.ts +0 -3
- package/dist/module.js +0 -255
package/dist/cli.js
CHANGED
|
@@ -117,7 +117,7 @@ var package_default = {
|
|
|
117
117
|
node: ">=18"
|
|
118
118
|
},
|
|
119
119
|
name: "extension-create",
|
|
120
|
-
version: "1.2.
|
|
120
|
+
version: "1.2.2",
|
|
121
121
|
description: "Create cross-browser extensions with no build configuration.",
|
|
122
122
|
main: "./dist/cli.js",
|
|
123
123
|
types: "./dist/cli.d.ts",
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"node": ">=18"
|
|
10
10
|
},
|
|
11
11
|
"name": "extension-create",
|
|
12
|
-
"version": "1.2.
|
|
12
|
+
"version": "1.2.2",
|
|
13
13
|
"description": "Create cross-browser extensions with no build configuration.",
|
|
14
14
|
"main": "./dist/cli.js",
|
|
15
15
|
"types": "./dist/cli.d.ts",
|
|
@@ -64,4 +64,4 @@
|
|
|
64
64
|
"tsup": "^8.0.1",
|
|
65
65
|
"typescript": "5.3.3"
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|
package/dist/module.d.ts
DELETED
package/dist/module.js
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// module.ts
|
|
31
|
-
var module_exports = {};
|
|
32
|
-
__export(module_exports, {
|
|
33
|
-
default: () => cli
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(module_exports);
|
|
36
|
-
var import_semver = __toESM(require("semver"));
|
|
37
|
-
var import_commander = require("commander");
|
|
38
|
-
|
|
39
|
-
// messages/blockingErrors.ts
|
|
40
|
-
var blockingErrors_exports = {};
|
|
41
|
-
__export(blockingErrors_exports, {
|
|
42
|
-
noURLWithoutStart: () => noURLWithoutStart,
|
|
43
|
-
notImplemented: () => notImplemented,
|
|
44
|
-
unsupportedNodeVersion: () => unsupportedNodeVersion
|
|
45
|
-
});
|
|
46
|
-
function unsupportedNodeVersion() {
|
|
47
|
-
return `
|
|
48
|
-
You are using an unsupported Node version (${process.version}).
|
|
49
|
-
|
|
50
|
-
Please update to a version higher than 18.
|
|
51
|
-
`;
|
|
52
|
-
}
|
|
53
|
-
function noURLWithoutStart(argument) {
|
|
54
|
-
return `
|
|
55
|
-
The default \`create\` command does not accept URLs.
|
|
56
|
-
Are you forgetting a \`start\` command? Maybe:
|
|
57
|
-
|
|
58
|
-
npx extension-create \`start\` ${argument}
|
|
59
|
-
`;
|
|
60
|
-
}
|
|
61
|
-
function notImplemented(argument) {
|
|
62
|
-
return `${argument} command not implemented yet.`;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// messages/programHelp.ts
|
|
66
|
-
function programHelp() {
|
|
67
|
-
return `
|
|
68
|
-
# Help center for the extension-create program
|
|
69
|
-
|
|
70
|
-
## Usage: \`extension-create [command] [options]\`
|
|
71
|
-
|
|
72
|
-
**Note:** If you are looking for a specific list of options,
|
|
73
|
-
all high-level commands offer their own \`--help\` file with
|
|
74
|
-
information about usage and a list of command flags available.
|
|
75
|
-
|
|
76
|
-
For example:
|
|
77
|
-
|
|
78
|
-
\`extension-create create --help\`
|
|
79
|
-
outputs information about the \`create\` command.
|
|
80
|
-
|
|
81
|
-
## Options available
|
|
82
|
-
|
|
83
|
-
\`extension-create create <extension-name>\`
|
|
84
|
-
Creates a new extension from template. The "create" command
|
|
85
|
-
is optional and can be ommitted.
|
|
86
|
-
|
|
87
|
-
\`extension-create dev <extension-path>\`
|
|
88
|
-
Starts a new browser instance in development mode, with the target
|
|
89
|
-
extension loaded and auto-reloaded based on file changes.
|
|
90
|
-
|
|
91
|
-
\`extension-create start <extension-path>\`
|
|
92
|
-
Starts a new browser instance in production mode, with the target
|
|
93
|
-
extension compiled based on the browser choice.
|
|
94
|
-
|
|
95
|
-
\`extension-create build <extension-path>\`
|
|
96
|
-
Builds the target extension with browser defaults, ready for packaging.
|
|
97
|
-
|
|
98
|
-
\`extension-create --help\`
|
|
99
|
-
This command ;) Outputs a help file with key command options.
|
|
100
|
-
|
|
101
|
-
Feels something is wrong? Help by reporting a bug:
|
|
102
|
-
https://github.com/cezaraugusto/extension-create/issues/new
|
|
103
|
-
`;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// messages/index.ts
|
|
107
|
-
var messages = {
|
|
108
|
-
...blockingErrors_exports,
|
|
109
|
-
programHelp
|
|
110
|
-
};
|
|
111
|
-
var messages_default = messages;
|
|
112
|
-
|
|
113
|
-
// package.json
|
|
114
|
-
var package_default = {
|
|
115
|
-
license: "MIT",
|
|
116
|
-
repository: {
|
|
117
|
-
type: "git",
|
|
118
|
-
url: "https://github.com/cezaraugusto/extension-create.git",
|
|
119
|
-
directory: "programs/cli"
|
|
120
|
-
},
|
|
121
|
-
engines: {
|
|
122
|
-
node: ">=18"
|
|
123
|
-
},
|
|
124
|
-
name: "@extension-create/cli",
|
|
125
|
-
version: "1.2.0",
|
|
126
|
-
description: "Create cross-browser extensions with no build configuration.",
|
|
127
|
-
main: "./dist/module.js",
|
|
128
|
-
types: "./dist/module.d.ts",
|
|
129
|
-
files: [
|
|
130
|
-
"dist"
|
|
131
|
-
],
|
|
132
|
-
author: {
|
|
133
|
-
name: "Cezar Augusto",
|
|
134
|
-
email: "boss@cezaraugusto.net",
|
|
135
|
-
url: "https://cezaraugusto.com"
|
|
136
|
-
},
|
|
137
|
-
scripts: {
|
|
138
|
-
"compile:tailwind-config": "node ./scripts/copyTailwindConfig.js",
|
|
139
|
-
"compile:stylelint-config": "node ./scripts/copyStylelintConfig.js",
|
|
140
|
-
"compile:module": "tsup-node ./module.ts --format cjs --dts --target=node18",
|
|
141
|
-
compile: "yarn compile:tailwind-config && yarn compile:stylelint-config && yarn compile:module",
|
|
142
|
-
clean: "rm -rf dist",
|
|
143
|
-
test: "jest"
|
|
144
|
-
},
|
|
145
|
-
keywords: [
|
|
146
|
-
"zero-config",
|
|
147
|
-
"build",
|
|
148
|
-
"develop",
|
|
149
|
-
"browser",
|
|
150
|
-
"extension",
|
|
151
|
-
"chrome extension",
|
|
152
|
-
"edge extension",
|
|
153
|
-
"firefox extension",
|
|
154
|
-
"web",
|
|
155
|
-
"react",
|
|
156
|
-
"typescript"
|
|
157
|
-
],
|
|
158
|
-
dependencies: {
|
|
159
|
-
"@extension-create/create": "*",
|
|
160
|
-
"@extension-create/develop": "*",
|
|
161
|
-
commander: "^11.1.0",
|
|
162
|
-
semver: "^7.5.4"
|
|
163
|
-
},
|
|
164
|
-
devDependencies: {
|
|
165
|
-
"@types/jest": "^29.5.11",
|
|
166
|
-
"@types/mock-fs": "^4.13.4",
|
|
167
|
-
"@types/node": "^20.11.5",
|
|
168
|
-
"@types/semver": "^7.5.6",
|
|
169
|
-
jest: "^29.7.0",
|
|
170
|
-
"mock-fs": "^5.2.0",
|
|
171
|
-
"ts-jest": "^29.1.2",
|
|
172
|
-
tsconfig: "*",
|
|
173
|
-
tsup: "^8.0.1",
|
|
174
|
-
typescript: "5.3.3"
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// module.ts
|
|
179
|
-
var import_create = __toESM(require("@extension-create/create"));
|
|
180
|
-
var import_develop = require("@extension-create/develop");
|
|
181
|
-
if (import_semver.default.lte(process.version, "18.0.0")) {
|
|
182
|
-
messages_default.unsupportedNodeVersion();
|
|
183
|
-
process.exit(1);
|
|
184
|
-
}
|
|
185
|
-
var extensionCreate = import_commander.program;
|
|
186
|
-
var isExtensionCreateNamespace = package_default.name === "extension-create";
|
|
187
|
-
extensionCreate.name(package_default.name).description(package_default.description).version(package_default.version).addHelpText("after", messages_default.programHelp());
|
|
188
|
-
extensionCreate.command("create", { isDefault: isExtensionCreateNamespace }).arguments("<project-name|project-path>").usage("create <project-name|project-path> [options]").description("Creates a new extension.").option(
|
|
189
|
-
"-t, --template <template-name>",
|
|
190
|
-
"specify a template for the created project"
|
|
191
|
-
).action(async function(projectName, { template, targetDir }) {
|
|
192
|
-
await (0, import_create.default)(projectName, { targetDir, template });
|
|
193
|
-
});
|
|
194
|
-
extensionCreate.command("dev").arguments("[project-path|remote-url]").usage("dev [project-path|remote-url] [options]").description("Starts the development server (development mode)").option(
|
|
195
|
-
"-u, --user-data-dir <path-to-file | boolean>",
|
|
196
|
-
"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"
|
|
197
|
-
).option(
|
|
198
|
-
"-b, --browser <chrome | edge>",
|
|
199
|
-
"specify a browser to run your extension in development mode"
|
|
200
|
-
).option(
|
|
201
|
-
"--polyfill <boolean>",
|
|
202
|
-
"whether or not to apply the cross-browser polyfill. Defaults to `true`"
|
|
203
|
-
).option(
|
|
204
|
-
"-p, --port <number>",
|
|
205
|
-
"what port should extension-create/develop run. Defaults to `3000`"
|
|
206
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...devOptions }) {
|
|
207
|
-
const vendors = browser.split(",");
|
|
208
|
-
for (const vendor of vendors) {
|
|
209
|
-
await (0, import_develop.extensionDev)(pathOrRemoteUrl, {
|
|
210
|
-
mode: "development",
|
|
211
|
-
browser: vendor,
|
|
212
|
-
...devOptions
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
extensionCreate.command("start").arguments("[project-path|remote-url]").usage("start [project-path|remote-url] [options]").description("Starts the development server (production mode)").option(
|
|
217
|
-
"-u, --user-data-dir <path-to-file | boolean>",
|
|
218
|
-
"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"
|
|
219
|
-
).option(
|
|
220
|
-
"-b, --browser <chrome | edge>",
|
|
221
|
-
"specify a browser to run your extension in development mode"
|
|
222
|
-
).option(
|
|
223
|
-
"--polyfill <boolean>",
|
|
224
|
-
"whether or not to apply the cross-browser polyfill. Defaults to `true`"
|
|
225
|
-
).option(
|
|
226
|
-
"-p, --port <number>",
|
|
227
|
-
"what port should extension-create/develop run. Defaults to `3000`"
|
|
228
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...startOptions }) {
|
|
229
|
-
const vendors = browser.split(",");
|
|
230
|
-
for (const vendor of vendors) {
|
|
231
|
-
await (0, import_develop.extensionStart)(pathOrRemoteUrl, {
|
|
232
|
-
mode: "production",
|
|
233
|
-
browser: vendor,
|
|
234
|
-
...startOptions
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
extensionCreate.command("build").arguments("[project-name]").usage("build [path-to-remote-extension] [options]").description("Builds the extension for production").option(
|
|
239
|
-
"-b, --browser <chrome | edge>",
|
|
240
|
-
"specify a browser to run your extension in development mode"
|
|
241
|
-
).option(
|
|
242
|
-
"--polyfill <boolean>",
|
|
243
|
-
"whether or not to apply the cross-browser polyfill. Defaults to `false`"
|
|
244
|
-
).action(async function(pathOrRemoteUrl, { browser = "chrome", ...buildOptions }) {
|
|
245
|
-
const vendors = browser.split(",");
|
|
246
|
-
for (const vendor of vendors) {
|
|
247
|
-
await (0, import_develop.extensionBuild)(pathOrRemoteUrl, {
|
|
248
|
-
browser: vendor,
|
|
249
|
-
...buildOptions
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
function cli() {
|
|
254
|
-
extensionCreate.parse();
|
|
255
|
-
}
|