@blastlauncher/cli 1.0.1 → 1.0.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/index.js +15 -7
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @blastlauncher/cli
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Run build in publish command
8
+
3
9
  ## 1.0.1
4
10
 
5
11
  ### Patch Changes
package/index.js CHANGED
@@ -86,20 +86,24 @@ class PackageVersionHelper {
86
86
  * @param {string} extensionFolder
87
87
  * @param {string} npmOrganization
88
88
  * @param {string} npmRegistry
89
+ * @param {string} distDir
89
90
  */
90
- async function publishExtensions(extensionFolder, npmOrganization, npmRegistry) {
91
+ async function publishExtensions(extensionFolder, npmOrganization, npmRegistry, distDir) {
91
92
  const versionHelper = new PackageVersionHelper(npmOrganization, npmRegistry);
92
93
 
93
94
  console.log(`\nEntering ${extensionFolder}\n`);
94
95
  execSync(`cd "${extensionFolder}"`);
95
96
 
96
- const distDir = path.resolve(extensionFolder, "dist");
97
+ if (!distDir) {
98
+ distDir = path.resolve(extensionFolder, "dist");
99
+ }
97
100
 
98
101
  if (!fs.existsSync(distDir)) {
99
- console.error(`dist directory does not exist at ${distDir}`);
100
- process.exit(1);
102
+ fs.mkdirSync(distDir);
101
103
  }
102
104
 
105
+ await buildExtension(extensionFolder, distDir);
106
+
103
107
  const packageName = versionHelper.getPackageName(extensionFolder);
104
108
  let version = await versionHelper.getPackageVersion(packageName);
105
109
  if (version) {
@@ -137,6 +141,9 @@ function getTSConfigPath(extensionDir) {
137
141
  async function buildExtension(extensionDir, outputFolder) {
138
142
  // Gather entry points from target extension's packages.json
139
143
  const packageJson = JSON.parse(fs.readFileSync(path.resolve(extensionDir, "package.json"), "utf8"));
144
+ if (!outputFolder) {
145
+ outputFolder = path.resolve(extensionDir, "dist");
146
+ }
140
147
 
141
148
  const commandNames = packageJson.commands.map((command) => command.name);
142
149
 
@@ -165,7 +172,7 @@ async function buildExtension(extensionDir, outputFolder) {
165
172
  };
166
173
  });
167
174
 
168
- console.info(`entry points [${esbuildConfigs.map((config) => config.input).join(", ")}]`);
175
+ console.info(`entry points [${esbuildConfigs.map((config) => config.input).join(" ")}]`);
169
176
 
170
177
  // Build each entry point
171
178
  for (const config of esbuildConfigs) {
@@ -233,15 +240,16 @@ program
233
240
  .argument("<path>", "Path to extensions folder")
234
241
  .argument("<organization>", "NPM organization to publish to, e.g. blast-extensions")
235
242
  .option("-r, --registry <registry>", "NPM registry to publish to", "https://registry.npmjs.org")
243
+ .option("-o, --output <output>", "Output directory, default to ./dist folder relative to extension path")
236
244
  .action((dir, organization, options) => {
237
- return publishExtensions(dir, organization, options.registry);
245
+ return publishExtensions(dir, organization, options.registry, options.output);
238
246
  });
239
247
 
240
248
  program
241
249
  .command("build")
242
250
  .description("Build extensions")
243
251
  .argument("<path>", "Path to extension")
244
- .option("-o, --output <output>", "Output directory")
252
+ .option("-o, --output <output>", "Output directory, default to ./dist folder relative to extension path")
245
253
  .action((path, options) => {
246
254
  return buildExtension(path, options.output);
247
255
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blastlauncher/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Blast CLI Tools",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {