onreza-release 2.1.1 → 2.2.0

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 CHANGED
@@ -2454,6 +2454,9 @@ function compareVersions(a, b) {
2454
2454
  return 0;
2455
2455
  }
2456
2456
 
2457
+ // src/binaries.ts
2458
+ import { spawn } from "node:child_process";
2459
+
2457
2460
  // src/utils/binary-distribution-provider.ts
2458
2461
  import { stat as stat3 } from "node:fs/promises";
2459
2462
  import { basename, extname } from "node:path";
@@ -2938,6 +2941,21 @@ async function updatePackageJsonForBinaries(options) {
2938
2941
  function sleep2(ms) {
2939
2942
  return new Promise((resolve3) => setTimeout(resolve3, ms));
2940
2943
  }
2944
+ function runCommand(command) {
2945
+ return new Promise((resolve3) => {
2946
+ const child = spawn(command, { shell: true, stdio: "inherit" });
2947
+ child.on("close", (code) => {
2948
+ if (code === 0) {
2949
+ resolve3({ output: "", success: true });
2950
+ } else {
2951
+ resolve3({ error: `Exit code: ${code}`, output: "", success: false });
2952
+ }
2953
+ });
2954
+ child.on("error", (err) => {
2955
+ resolve3({ error: err.message, output: "", success: false });
2956
+ });
2957
+ });
2958
+ }
2941
2959
  function calculateDelay2(attempt, initialDelay = 2000, maxDelay = 30000) {
2942
2960
  const delay = initialDelay * 2 ** attempt;
2943
2961
  return Math.min(delay, maxDelay);
@@ -3083,11 +3101,22 @@ async function publishBinaries(options = {}) {
3083
3101
  manifest,
3084
3102
  npmConfig
3085
3103
  });
3086
- console.log(`
3104
+ if (options.npmPublish) {
3105
+ console.log(`
3106
+ \uD83D\uDCE4 Publishing to npm: ${options.npmPublish}`);
3107
+ const publishResult = await runCommand(options.npmPublish);
3108
+ if (!publishResult.success) {
3109
+ result.errors.push(`npm publish failed: ${publishResult.error}`);
3110
+ return result;
3111
+ }
3112
+ console.log("✅ npm package published successfully!");
3113
+ } else {
3114
+ console.log(`
3087
3115
  \uD83D\uDCA1 Next steps:`);
3088
- console.log(" 1. Review generated files in scripts/ and bin/");
3089
- console.log(" 2. Run: npm publish (or bun publish)");
3090
- console.log(` 3. Users install with: npm install ${binariesConfig.name}`);
3116
+ console.log(" 1. Review generated files in scripts/ and bin/");
3117
+ console.log(" 2. Run: npm publish (or bun publish)");
3118
+ console.log(` 3. Users install with: npm install ${binariesConfig.name}`);
3119
+ }
3091
3120
  } else {
3092
3121
  console.log(`
3093
3122
  \uD83D\uDCDD Generated manifest:`);
@@ -3810,6 +3839,7 @@ Generate Commitlint Options:
3810
3839
  Binary Distribution Options:
3811
3840
  --platforms <list> Platforms to upload (comma-separated: linux-x64,darwin-arm64,...)
3812
3841
  --tag <tag> Use existing release tag (default: creates new release)
3842
+ --npm-publish [cmd] Run npm publish after upload (default: "npm publish")
3813
3843
 
3814
3844
  Examples:
3815
3845
  # Initialize config file
@@ -3847,6 +3877,8 @@ Examples:
3847
3877
  onreza-release publish-binaries --version 1.2.3
3848
3878
  onreza-release publish-binaries --platforms linux-x64,darwin-arm64
3849
3879
  onreza-release publish-binaries --tag v1.2.3 # Use existing release
3880
+ onreza-release publish-binaries --npm-publish # Also run npm publish
3881
+ onreza-release publish-binaries --npm-publish "bun publish" # Custom command
3850
3882
 
3851
3883
  Environment Variables:
3852
3884
  GVR_TOKEN GitVerse API token (required for release creation)
@@ -3871,6 +3903,7 @@ async function main() {
3871
3903
  "no-push": { type: "boolean" },
3872
3904
  "no-release": { type: "boolean" },
3873
3905
  "no-tag": { type: "boolean" },
3906
+ "npm-publish": { type: "string" },
3874
3907
  output: { type: "string" },
3875
3908
  package: { type: "string" },
3876
3909
  platforms: { type: "string" },
@@ -3933,6 +3966,7 @@ async function main() {
3933
3966
  const binaryOptions = {
3934
3967
  config: values.config,
3935
3968
  dryRun: values["dry-run"],
3969
+ npmPublish: values["npm-publish"],
3936
3970
  platforms: values.platforms ? parsePlatforms(values.platforms) : undefined,
3937
3971
  tag: values.tag,
3938
3972
  verbose: values.verbose,
@@ -4030,4 +4064,4 @@ Usage: onreza-release create-only --tag <tag> [--package <name>]`);
4030
4064
  }
4031
4065
  main();
4032
4066
 
4033
- //# debugId=D119E5942A72D46964756E2164756E21
4067
+ //# debugId=D9FF3B262025ABC764756E2164756E21