@varlet/release 0.0.1 → 0.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/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 varlet
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ <h1 align="center">Varlet Release</h1>
2
+
3
+ <p align="center">
4
+ <span>English</span> |
5
+ <a href="https://github.com/varletjs/release/blob/main/README.zh-CN.md">中文</a>
6
+ </p>
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@varlet/release" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/npm/v/@varlet/release" alt="NPM Version" /></a>
9
+ <a href="https://github.com/varletjs/release/blob/main/LICENCE" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/github/license/varletjs/release" alt="License" /></a>
10
+ </p>
11
+
12
+ ## Intro
13
+
14
+ `Varlet Release` is a tool to release all packages and generate changelogs.
15
+
16
+ ## Installation
17
+
18
+ ### npm
19
+
20
+ ```shell
21
+ npm i @varlet/release -D
22
+ ```
23
+
24
+ ### yarn
25
+
26
+ ```shell
27
+ yarn add @varlet/release -D
28
+ ```
29
+
30
+ ### pnpm
31
+
32
+ ```shell
33
+ pnpm add @varlet/release -D
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ### Using Command
39
+
40
+ ```shell
41
+ # Release all packages and generate changelogs
42
+ npx vr release
43
+
44
+ # Specify remote name
45
+ npx vr release -r <remote>
46
+ # or
47
+ npx vr release --remote <remote>
48
+
49
+ # Just generate changelogs
50
+ npx vr changelog
51
+
52
+ # Specify changelog filename
53
+ npx vr changelog -f <filename>
54
+ # or
55
+ npx vr changelog --file <filename>
56
+
57
+ ```
58
+
59
+ ### Configuration
60
+
61
+ #### release
62
+
63
+ | Params | Instructions |
64
+ | -------------------- | ------------------- |
65
+ | -r --remote <remote> | Specify remote name |
66
+
67
+ #### changelog
68
+
69
+ | Params | Instructions |
70
+ | --------------------------------- | -------------------------- |
71
+ | -f --file <filename> | Specify changelog filename |
72
+ | -rc --releaseCount <releaseCount> | Release count |
73
+
74
+ ### Custom Handle
75
+
76
+ #### Example
77
+
78
+ ```js
79
+ import { release, changelog } from '@varlet/release'
80
+
81
+ // Do what you want to do...
82
+ release()
83
+ ```
84
+
85
+ You can pass in a task that will be called before the publish after the package version is changed.
86
+
87
+ ```js
88
+ import { release, changelog } from '@varlet/release'
89
+
90
+ async function task() {
91
+ await doSomething1()
92
+ await doSomething2()
93
+ }
94
+
95
+ release({ task })
96
+ ```
97
+
98
+ #### Types
99
+
100
+ ```ts
101
+ interface ReleaseCommandOptions {
102
+ remote?: string
103
+ task?(): Promise<void>
104
+ }
105
+ function release(options: ReleaseCommandOptions): Promise<void>
106
+
107
+ interface ChangelogCommandOptions {
108
+ file?: string
109
+ releaseCount?: number
110
+ }
111
+ function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
112
+ ```
113
+
114
+ ## License
115
+
116
+ [MIT](https://github.com/varletjs/release/blob/main/LICENCE)
@@ -0,0 +1,116 @@
1
+ <h1 align="center">Varlet Release</h1>
2
+
3
+ <p align="center">
4
+ <span>中文</span> |
5
+ <a href="https://github.com/varletjs/release/blob/main/README.md">English</a>
6
+ </p>
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/@varlet/release" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/npm/v/@varlet/release" alt="NPM Version" /></a>
9
+ <a href="https://github.com/valetjs/release/blob/master/LICENSE" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/github/license/varletjs/release" alt="License" /></a>
10
+ </p>
11
+
12
+ ## 介绍
13
+
14
+ `Varlet Release` 是一个用于发布所有包并生成变更日志的工具。
15
+
16
+ ## 安装
17
+
18
+ ### npm
19
+
20
+ ```shell
21
+ npm i @varlet/release -D
22
+ ```
23
+
24
+ ### yarn
25
+
26
+ ```shell
27
+ yarn add @varlet/release -D
28
+ ```
29
+
30
+ ### pnpm
31
+
32
+ ```shell
33
+ pnpm add @varlet/release -D
34
+ ```
35
+
36
+ ## 使用
37
+
38
+ ### 使用命令
39
+
40
+ ```shell
41
+ # 发布所有包并生成变更日志
42
+ npx vr release
43
+
44
+ # 指定远程仓库名称
45
+ npx vr release -r <remote>
46
+ # or
47
+ npx vr release --remote <remote>
48
+
49
+ # 仅生成变更日志
50
+ npx vr changelog
51
+
52
+ # 指定变更日志文件名
53
+ npx vr changelog -f <filename>
54
+ # or
55
+ npx vr changelog --file <filename>
56
+
57
+ ```
58
+
59
+ ### 配置
60
+
61
+ #### release
62
+
63
+ | 参数 | 说明 |
64
+ | -------------------- | ---------------- |
65
+ | -r --remote <remote> | 指定远程仓库名称 |
66
+
67
+ #### changelog
68
+
69
+ | 参数 | 说明 |
70
+ | --------------------------------- | ------------------ |
71
+ | -f --file <filename> | 指定变更日志文件名 |
72
+ | -rc --releaseCount <releaseCount> | 发布数量 |
73
+
74
+ ### 自定义处理
75
+
76
+ #### 示例
77
+
78
+ ```js
79
+ import { release, changelog } from '@varlet/release'
80
+
81
+ // Do what you want to do...
82
+ release()
83
+ ```
84
+
85
+ 你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
86
+
87
+ ```js
88
+ import { release, changelog } from '@varlet/release'
89
+
90
+ async function task() {
91
+ await doSomething1()
92
+ await doSomething2()
93
+ }
94
+
95
+ release({ task })
96
+ ```
97
+
98
+ #### 类型
99
+
100
+ ```ts
101
+ interface ReleaseCommandOptions {
102
+ remote?: string
103
+ task?(): Promise<void>
104
+ }
105
+ function release(options: ReleaseCommandOptions): Promise<void>
106
+
107
+ interface ChangelogCommandOptions {
108
+ file?: string
109
+ releaseCount?: number
110
+ }
111
+ function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
112
+ ```
113
+
114
+ ## License
115
+
116
+ [MIT](https://github.com/varletjs/release/blob/main/LICENSE)
package/bin/index.js CHANGED
@@ -7,7 +7,6 @@ const program = new Command()
7
7
  program
8
8
  .command('release')
9
9
  .option('-r --remote <remote>', 'Remote name')
10
- .option('-o --otp <otp>', 'One-time password')
11
10
  .description('Release all packages and generate changelogs')
12
11
  .action(async (options) => release(options))
13
12
 
package/dist/index.cjs CHANGED
@@ -73,15 +73,12 @@ async function isWorktreeEmpty() {
73
73
  const ret = await (0, import_execa.execa)("git", ["status", "--porcelain"]);
74
74
  return !ret.stdout;
75
75
  }
76
- async function publish(preRelease, otp) {
76
+ async function publish(preRelease) {
77
77
  const s = (0, import_nanospinner2.createSpinner)("Publishing all packages").start();
78
78
  const args = ["-r", "publish", "--no-git-checks", "--access", "public"];
79
79
  if (preRelease) {
80
80
  args.push("--tag", "alpha");
81
81
  }
82
- if (otp) {
83
- args.push(`--otp=${otp}`);
84
- }
85
82
  const ret = await (0, import_execa.execa)("pnpm", args);
86
83
  if (ret.stderr && ret.stderr.includes("npm ERR!")) {
87
84
  throw new Error("\n" + ret.stderr);
@@ -187,7 +184,7 @@ async function release(options) {
187
184
  if (options.task) {
188
185
  await options.task();
189
186
  }
190
- await publish(isPreRelease, options.otp);
187
+ await publish(isPreRelease);
191
188
  if (!isPreRelease) {
192
189
  await changelog();
193
190
  await pushGit(expectVersion, options.remote);
package/dist/index.d.cts CHANGED
@@ -1,6 +1,5 @@
1
1
  interface ReleaseCommandOptions {
2
2
  remote?: string;
3
- otp?: string;
4
3
  task?(): Promise<void>;
5
4
  }
6
5
  declare function release(options: ReleaseCommandOptions): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  interface ReleaseCommandOptions {
2
2
  remote?: string;
3
- otp?: string;
4
3
  task?(): Promise<void>;
5
4
  }
6
5
  declare function release(options: ReleaseCommandOptions): Promise<void>;
package/dist/index.js CHANGED
@@ -36,15 +36,12 @@ async function isWorktreeEmpty() {
36
36
  const ret = await execa("git", ["status", "--porcelain"]);
37
37
  return !ret.stdout;
38
38
  }
39
- async function publish(preRelease, otp) {
39
+ async function publish(preRelease) {
40
40
  const s = createSpinner2("Publishing all packages").start();
41
41
  const args = ["-r", "publish", "--no-git-checks", "--access", "public"];
42
42
  if (preRelease) {
43
43
  args.push("--tag", "alpha");
44
44
  }
45
- if (otp) {
46
- args.push(`--otp=${otp}`);
47
- }
48
45
  const ret = await execa("pnpm", args);
49
46
  if (ret.stderr && ret.stderr.includes("npm ERR!")) {
50
47
  throw new Error("\n" + ret.stderr);
@@ -150,7 +147,7 @@ async function release(options) {
150
147
  if (options.task) {
151
148
  await options.task();
152
149
  }
153
- await publish(isPreRelease, options.otp);
150
+ await publish(isPreRelease);
154
151
  if (!isPreRelease) {
155
152
  await changelog();
156
153
  await pushGit(expectVersion, options.remote);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@varlet/release",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "description": "release all packages and generate changelogs",
6
6
  "keywords": [
7
7
  "varlet",
@@ -62,9 +62,9 @@
62
62
  },
63
63
  "scripts": {
64
64
  "preinstall": "npx only-allow pnpm",
65
- "build": "tsc --noEmit && tsup",
66
65
  "dev": "node bin/index.js",
67
- "release": "pnpm run build && pnpm run dev release",
68
- "checkAll": "tsc --noEmit && eslint --ext .ts,.js"
66
+ "build": "tsc --noEmit && tsup",
67
+ "release": "pnpm build && pnpm dev release",
68
+ "lint": "tsc --noEmit && eslint --ext .ts,.js"
69
69
  }
70
70
  }