@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.
- package/CHANGELOG.md +6 -0
- package/index.js +15 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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
|
-
|
|
97
|
+
if (!distDir) {
|
|
98
|
+
distDir = path.resolve(extensionFolder, "dist");
|
|
99
|
+
}
|
|
97
100
|
|
|
98
101
|
if (!fs.existsSync(distDir)) {
|
|
99
|
-
|
|
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
|
});
|