@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 +15 -1
- package/dist/continueRelease.js +1 -1
- package/dist/createRelease.d.ts +5 -1
- package/dist/createRelease.js +2 -2
- package/dist/release.d.ts +12 -0
- package/dist/release.js +1 -1
- package/package.json +13 -13
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. `
|
|
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
|
+
```
|
package/dist/continueRelease.js
CHANGED
package/dist/createRelease.d.ts
CHANGED
|
@@ -5,11 +5,15 @@ export interface ConfigurableCreateReleaseOptions {
|
|
|
5
5
|
*/
|
|
6
6
|
owner?: string;
|
|
7
7
|
/**
|
|
8
|
-
* The `.env` file to load to get the
|
|
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;
|
package/dist/createRelease.js
CHANGED
|
@@ -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
|
|
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,
|
|
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
|
+
"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.
|
|
26
|
-
"@inquirer/confirm": "^5.1.
|
|
27
|
-
"@inquirer/input": "^4.2.
|
|
28
|
-
"@inquirer/rawlist": "^4.1.
|
|
29
|
-
"@octokit/core": "^7.0.
|
|
30
|
-
"dotenv": "^17.2.
|
|
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": "^
|
|
33
|
+
"@types/node": "^24.9.2",
|
|
34
34
|
"husky": "^9.1.7",
|
|
35
|
-
"lint-staged": "^16.
|
|
35
|
+
"lint-staged": "^16.2.6",
|
|
36
36
|
"prettier": "^3.6.2",
|
|
37
|
-
"tsx": "^4.20.
|
|
38
|
-
"typescript": "^5.
|
|
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": "
|
|
50
|
-
"pnpm": "10.
|
|
49
|
+
"node": "24.11.0",
|
|
50
|
+
"pnpm": "10.20.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"typecheck": "tsc --noEmit",
|