@mlaursen/release-script 0.0.4 → 0.0.6

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/README.md CHANGED
@@ -49,7 +49,7 @@ await release({
49
49
  // If there is a custom build command for releases. `build` is the default
50
50
  // buildCommand: "build",
51
51
 
52
- // An optional flag if the build step should be skipped. `false` by default
52
+ // An optional flag if the build step should be skipped. `!buildCommand` by default
53
53
  // skipBuild: process.argv.includes("--skip-build"),
54
54
 
55
55
  // This is useful for monorepos where only a single Github release needs to
@@ -98,3 +98,17 @@ Finally, run the release script whenever a new release should go out:
98
98
  ```sh
99
99
  pnpm release
100
100
  ```
101
+
102
+ ## Alpha Releases
103
+
104
+ Use the changesets api to enter the pre-release flow:
105
+
106
+ ```sh
107
+ pnpm changeset enter pre
108
+ ```
109
+
110
+ Once ready to do a real release:
111
+
112
+ ```sh
113
+ pnpm changeset exit pre
114
+ ```
@@ -1,6 +1,6 @@
1
1
  import confirm from "@inquirer/confirm";
2
2
  export async function continueRelease() {
3
- const confirmed = confirm({ message: "Continue the release?" });
3
+ const confirmed = await confirm({ message: "Continue the release?" });
4
4
  if (!confirmed) {
5
5
  process.exit(1);
6
6
  }
@@ -5,11 +5,15 @@ export interface ConfigurableCreateReleaseOptions {
5
5
  */
6
6
  owner?: string;
7
7
  /**
8
- * The `.env` file to load to get the `GITHUB_TOKEN` environment variable.
8
+ * The `.env` file to load to get the {@link tokenName} environment variable.
9
9
  *
10
10
  * @defaultValue `".env.local"`
11
11
  */
12
12
  envPath?: string;
13
+ /**
14
+ * @defaultValue `"GITHUB_RELEASE_TOKEN"`
15
+ */
16
+ tokenName?: string;
13
17
  }
14
18
  export interface CreateReleaseOptions extends ConfigurableCreateReleaseOptions {
15
19
  body: string;
@@ -2,9 +2,9 @@ import confirm from "@inquirer/confirm";
2
2
  import { Octokit } from "@octokit/core";
3
3
  import dotenv from "dotenv";
4
4
  export async function createRelease(options) {
5
- const { body, override, owner = "mlaursen", repo, prerelease, envPath = ".env.local", tagName, } = options;
5
+ const { body, override, owner = "mlaursen", repo, prerelease, envPath = ".env.local", tagName, tokenName = "GITHUB_RELEASE_TOKEN", } = options;
6
6
  dotenv.config({ path: envPath, override, quiet: true });
7
- const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
7
+ const octokit = new Octokit({ auth: process.env[tokenName] });
8
8
  try {
9
9
  const response = await octokit.request("POST /repos/{owner}/{repo}/releases", {
10
10
  owner,
package/dist/release.d.ts CHANGED
@@ -1,9 +1,21 @@
1
1
  import { ConfigurableCreateReleaseOptions } from "./createRelease.js";
2
2
  export interface ReleaseOptions extends ConfigurableCreateReleaseOptions {
3
+ /**
4
+ * @defaultValue `!buildCommand`
5
+ */
3
6
  skipBuild?: boolean;
7
+ /**
8
+ * @defaultValue `"clean"`
9
+ */
4
10
  cleanCommand?: string;
11
+ /**
12
+ * @defaultValue `"build"`
13
+ */
5
14
  buildCommand?: string;
6
15
  mainPackage?: string;
16
+ /**
17
+ * @defaultValue `"build(version): version package"`
18
+ */
7
19
  versionMessage?: string;
8
20
  getTagName?: () => Promise<string>;
9
21
  }
package/dist/release.js CHANGED
@@ -9,7 +9,7 @@ const exec = (command, opts) => {
9
9
  execSync(command, opts);
10
10
  };
11
11
  export async function release(options) {
12
- const { owner, repo, envPath, skipBuild, cleanCommand = "clean", buildCommand = "build", mainPackage, getTagName = createGetTagName(mainPackage), versionMessage = "build(version): version package", } = options;
12
+ const { owner, repo, envPath, cleanCommand = "clean", buildCommand = "build", skipBuild = !buildCommand, mainPackage, getTagName = createGetTagName(mainPackage), versionMessage = "build(version): version package", } = options;
13
13
  const pkgManager = await getPackageManager();
14
14
  if (!skipBuild) {
15
15
  exec(`${pkgManager} ${cleanCommand}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mlaursen/release-script",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "description": "The release script I normally use for packages I publish to npm",
6
6
  "repository": "https://github.com/mlaursen/release-script.git",
7
7
  "author": "Mikkel Laursen <mlaursen03@gmail.com>",
@@ -22,20 +22,20 @@
22
22
  "npm"
23
23
  ],
24
24
  "dependencies": {
25
- "@changesets/cli": "^2.29.5",
26
- "@inquirer/confirm": "^5.1.14",
27
- "@inquirer/input": "^4.2.1",
28
- "@inquirer/rawlist": "^4.1.5",
29
- "@octokit/core": "^7.0.3",
30
- "dotenv": "^17.2.1"
25
+ "@changesets/cli": "^2.29.7",
26
+ "@inquirer/confirm": "^5.1.19",
27
+ "@inquirer/input": "^4.2.5",
28
+ "@inquirer/rawlist": "^4.1.9",
29
+ "@octokit/core": "^7.0.6",
30
+ "dotenv": "^17.2.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/node": "^22.15.29",
33
+ "@types/node": "^24.9.2",
34
34
  "husky": "^9.1.7",
35
- "lint-staged": "^16.1.2",
35
+ "lint-staged": "^16.2.6",
36
36
  "prettier": "^3.6.2",
37
- "tsx": "^4.20.3",
38
- "typescript": "^5.8.3"
37
+ "tsx": "^4.20.6",
38
+ "typescript": "^5.9.3"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -46,8 +46,8 @@
46
46
  ]
47
47
  },
48
48
  "volta": {
49
- "node": "22.17.1",
50
- "pnpm": "10.13.1"
49
+ "node": "24.11.0",
50
+ "pnpm": "10.20.0"
51
51
  },
52
52
  "scripts": {
53
53
  "typecheck": "tsc --noEmit",