webhanger 1.0.6 ā 1.0.8
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/bin/cli.js +0 -65
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -345,70 +345,6 @@ switch (command) {
|
|
|
345
345
|
console.log(chalk.gray(` "cdn": { "url": "https://webhanger-edge.your-subdomain.workers.dev" }`));
|
|
346
346
|
break;
|
|
347
347
|
}
|
|
348
|
-
case "release": {
|
|
349
|
-
const releaseType = args[1] || "patch"; // patch | minor | major
|
|
350
|
-
const { execSync } = await import("child_process");
|
|
351
|
-
const { default: fsExtra } = await import("fs-extra");
|
|
352
|
-
const { default: pathMod } = await import("path");
|
|
353
|
-
|
|
354
|
-
console.log(chalk.cyan(`\nš Releasing webhanger + webhanger-front (${releaseType})...\n`));
|
|
355
|
-
|
|
356
|
-
try {
|
|
357
|
-
// 1. Bump + publish webhanger
|
|
358
|
-
console.log(chalk.white(" [1/4] Publishing webhanger..."));
|
|
359
|
-
execSync(`npm version ${releaseType} --no-git-tag-version`, { stdio: "inherit" });
|
|
360
|
-
execSync("npm publish --access public", { stdio: "inherit" });
|
|
361
|
-
const whPkg = await fsExtra.readJson("./package.json");
|
|
362
|
-
console.log(chalk.green(` ā
webhanger@${whPkg.version} published`));
|
|
363
|
-
|
|
364
|
-
// 2. Build + bump + publish webhanger-front
|
|
365
|
-
console.log(chalk.white("\n [2/4] Building webhanger-front..."));
|
|
366
|
-
execSync("npm run build", { cwd: "./webhanger-front", stdio: "inherit" });
|
|
367
|
-
execSync(`npm version ${releaseType} --no-git-tag-version`, { cwd: "./webhanger-front", stdio: "inherit" });
|
|
368
|
-
execSync("npm publish --access public", { cwd: "./webhanger-front", stdio: "inherit" });
|
|
369
|
-
const whfPkg = await fsExtra.readJson("./webhanger-front/package.json");
|
|
370
|
-
console.log(chalk.green(` ā
webhanger-front@${whfPkg.version} published`));
|
|
371
|
-
|
|
372
|
-
// 3. Update all HTML files to use new unpkg version
|
|
373
|
-
console.log(chalk.white("\n [3/4] Updating unpkg references..."));
|
|
374
|
-
const newUrl = `https://unpkg.com/webhanger-front@${whfPkg.version}/browser.min.js`;
|
|
375
|
-
const oldPattern = /https:\/\/unpkg\.com\/webhanger-front@[^/]+\/browser(?:\.min)?\.js/g;
|
|
376
|
-
|
|
377
|
-
const htmlFiles = [];
|
|
378
|
-
async function findHtml(dir) {
|
|
379
|
-
const entries = await fsExtra.readdir(dir, { withFileTypes: true });
|
|
380
|
-
for (const e of entries) {
|
|
381
|
-
if (e.name === "node_modules" || e.name === ".git") continue;
|
|
382
|
-
const full = pathMod.join(dir, e.name);
|
|
383
|
-
if (e.isDirectory()) await findHtml(full);
|
|
384
|
-
else if (e.name.endsWith(".html") || e.name.endsWith(".js")) htmlFiles.push(full);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
await findHtml(".");
|
|
388
|
-
|
|
389
|
-
let updated = 0;
|
|
390
|
-
for (const file of htmlFiles) {
|
|
391
|
-
const content = await fsExtra.readFile(file, "utf-8");
|
|
392
|
-
if (oldPattern.test(content)) {
|
|
393
|
-
await fsExtra.writeFile(file, content.replace(oldPattern, newUrl), "utf-8");
|
|
394
|
-
console.log(chalk.gray(` ā ${file}`));
|
|
395
|
-
updated++;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
console.log(chalk.green(` ā
Updated ${updated} files to ${newUrl}`));
|
|
399
|
-
|
|
400
|
-
// 4. Summary
|
|
401
|
-
console.log(chalk.green(`\nā
Release complete!`));
|
|
402
|
-
console.log(chalk.white(` webhanger : v${whPkg.version}`));
|
|
403
|
-
console.log(chalk.white(` webhanger-front : v${whfPkg.version}`));
|
|
404
|
-
console.log(chalk.gray(` unpkg URL : ${newUrl}\n`));
|
|
405
|
-
|
|
406
|
-
} catch (err) {
|
|
407
|
-
console.log(chalk.red(`\nā Release failed: ${err.message}`));
|
|
408
|
-
process.exit(1);
|
|
409
|
-
}
|
|
410
|
-
break;
|
|
411
|
-
}
|
|
412
348
|
case "atomize": {
|
|
413
349
|
const atomFile = args[1];
|
|
414
350
|
const atomOut = args[2] || "./atomized";
|
|
@@ -924,7 +860,6 @@ ${mounts}
|
|
|
924
860
|
console.log(chalk.cyan(BANNER));
|
|
925
861
|
console.log(chalk.white("Commands:"));
|
|
926
862
|
console.log(chalk.gray(" wh init ā setup your project"));
|
|
927
|
-
console.log(chalk.gray(" wh release [patch|minor|major] ā publish both packages + update all unpkg refs"));
|
|
928
863
|
console.log(chalk.gray(" wh ship <comp-dir> <site-dir> [version] [out-dir] ā deploy + build + zip in one shot"));
|
|
929
864
|
console.log(chalk.gray(" wh deploy <dir> <name> <version> ā deploy a single component"));
|
|
930
865
|
console.log(chalk.gray(" wh graph-deploy <comp-dir> [version] [out-dir] ā deploy all + resolve dep graph"));
|