@blastlauncher/cli 1.0.2 → 1.0.3
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +13 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -257,17 +257,19 @@ var PackageVersionHelper = class {
|
|
|
257
257
|
return packageName;
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
|
-
async function publishExtensions(extensionFolder, npmOrganization, npmRegistry) {
|
|
260
|
+
async function publishExtensions(extensionFolder, npmOrganization, npmRegistry, distDir) {
|
|
261
261
|
const versionHelper = new PackageVersionHelper(npmOrganization, npmRegistry);
|
|
262
262
|
console.log(`
|
|
263
263
|
Entering ${extensionFolder}
|
|
264
264
|
`);
|
|
265
265
|
(0, import_child_process.execSync)(`cd "${extensionFolder}"`);
|
|
266
|
-
|
|
266
|
+
if (!distDir) {
|
|
267
|
+
distDir = import_path.default.resolve(extensionFolder, "dist");
|
|
268
|
+
}
|
|
267
269
|
if (!import_fs_extra.default.existsSync(distDir)) {
|
|
268
|
-
|
|
269
|
-
process.exit(1);
|
|
270
|
+
import_fs_extra.default.mkdirSync(distDir);
|
|
270
271
|
}
|
|
272
|
+
await buildExtension(extensionFolder, distDir);
|
|
271
273
|
const packageName = versionHelper.getPackageName(extensionFolder);
|
|
272
274
|
let version = await versionHelper.getPackageVersion(packageName);
|
|
273
275
|
if (version) {
|
|
@@ -294,6 +296,9 @@ function getTSConfigPath(extensionDir) {
|
|
|
294
296
|
}
|
|
295
297
|
async function buildExtension(extensionDir, outputFolder) {
|
|
296
298
|
const packageJson = JSON.parse(import_fs_extra.default.readFileSync(import_path.default.resolve(extensionDir, "package.json"), "utf8"));
|
|
299
|
+
if (!outputFolder) {
|
|
300
|
+
outputFolder = import_path.default.resolve(extensionDir, "dist");
|
|
301
|
+
}
|
|
297
302
|
const commandNames = packageJson.commands.map((command) => command.name);
|
|
298
303
|
const supportedExts = [".js", ".ts", ".tsx", ".jsx"];
|
|
299
304
|
const tsconfigPath = getTSConfigPath(extensionDir);
|
|
@@ -313,7 +318,7 @@ async function buildExtension(extensionDir, outputFolder) {
|
|
|
313
318
|
output: outputPath
|
|
314
319
|
};
|
|
315
320
|
});
|
|
316
|
-
console.info(`entry points [${esbuildConfigs.map((config) => config.input).join("
|
|
321
|
+
console.info(`entry points [${esbuildConfigs.map((config) => config.input).join(" ")}]`);
|
|
317
322
|
for (const config of esbuildConfigs) {
|
|
318
323
|
await import_esbuild.default.build({
|
|
319
324
|
entryPoints: [config.input],
|
|
@@ -350,10 +355,10 @@ program.name("blast-cli").description(`CLI for Blast Launcher
|
|
|
350
355
|
Example Usage:
|
|
351
356
|
blast build ./extensions/todo-list -o ./extensions/todo-list/dist
|
|
352
357
|
blast publish ./extensions/todo-list blast-extensions`);
|
|
353
|
-
program.command("publish").description("Publish extensions").argument("<path>", "Path to extensions folder").argument("<organization>", "NPM organization to publish to, e.g. blast-extensions").option("-r, --registry <registry>", "NPM registry to publish to", "https://registry.npmjs.org").action((dir, organization, options) => {
|
|
354
|
-
return publishExtensions(dir, organization, options.registry);
|
|
358
|
+
program.command("publish").description("Publish extensions").argument("<path>", "Path to extensions folder").argument("<organization>", "NPM organization to publish to, e.g. blast-extensions").option("-r, --registry <registry>", "NPM registry to publish to", "https://registry.npmjs.org").option("-o, --output <output>", "Output directory, default to ./dist folder relative to extension path").action((dir, organization, options) => {
|
|
359
|
+
return publishExtensions(dir, organization, options.registry, options.output);
|
|
355
360
|
});
|
|
356
|
-
program.command("build").description("Build extensions").argument("<path>", "Path to extension").option("-o, --output <output>", "Output directory").action((path3, options) => {
|
|
361
|
+
program.command("build").description("Build extensions").argument("<path>", "Path to extension").option("-o, --output <output>", "Output directory, default to ./dist folder relative to extension path").action((path3, options) => {
|
|
357
362
|
return buildExtension(path3, options.output);
|
|
358
363
|
});
|
|
359
364
|
program.parse();
|