autorel 0.0.13 → 0.0.15
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 +183 -70
- package/dist/changelog.d.ts +1 -1
- package/dist/cli.js +10 -10
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -16
- package/dist/config.js +10 -20
- package/dist/config.js.map +1 -1
- package/dist/config.spec.js +3 -26
- package/dist/config.spec.js.map +1 -1
- package/dist/conventionalcommits.d.ts +1 -1
- package/dist/defaults.d.ts +2 -0
- package/dist/defaults.js +22 -0
- package/dist/defaults.js.map +1 -0
- package/dist/index.d.ts +14 -3
- package/dist/index.js +27 -16
- package/dist/index.js.map +1 -1
- package/dist/lib/bash.d.ts +2 -0
- package/dist/lib/bash.js +10 -1
- package/dist/lib/bash.js.map +1 -1
- package/dist/lib/npm.d.ts +1 -1
- package/dist/lib/npm.js +1 -1
- package/dist/lib/npm.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,123 +10,236 @@
|
|
|
10
10
|
[](https://conventionalcommits.org)
|
|
11
11
|
[]()
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Automate releases based on [SemVer](https://semver.org/) and [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). Like `semantic-release` and `release-please` but much simpler and more flexible.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
- Supports both human-readable CLI output and JSON output for log aggregation into services like sumologic, New Relic, DataDog, etc.
|
|
15
|
+
Autorel automatically does the following, if appropriate:
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Simple configurations make it hard to mess up
|
|
23
|
-
- Minimal dependencies
|
|
17
|
+
- Bumps the version based on the commit messages
|
|
18
|
+
- Creates a new release on GitHub with Release Notes
|
|
19
|
+
- Publishes the release to NPM
|
|
20
|
+
- Any other custom release steps you want to add
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
- Out-of-the-box Typescript support
|
|
28
|
-
- Nice human readable output
|
|
22
|
+
**✅ Conventional Commit and SemVer Compliant**
|
|
23
|
+
- Unlike `semantic-release`, `autorel` is 100% compliant with Conventional Commits and SemVer out of the box, including "!" for breaking changes
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
25
|
+
**😃 Simple & Easy to Use**
|
|
26
|
+
- No confusing configuration files
|
|
27
|
+
- Works with any CI/CD system, including GitHub Actions
|
|
28
|
+
- Out of the box TypeScript support
|
|
33
29
|
|
|
34
|
-
|
|
30
|
+
**💪 Flexible & Powerful**
|
|
31
|
+
- Use via `npx`, or import as a library
|
|
32
|
+
- If using CLI, supports `yaml` configuration or arguments
|
|
33
|
+
|
|
34
|
+
# Example Usage (CLI)
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
|
|
37
|
+
npx autorel --publish --run "echo 'Hello, World!'"
|
|
38
38
|
```
|
|
39
|
-
|
|
40
|
-
## Example Usage
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
import {logger} from 'jsout';
|
|
40
|
+
This will:
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
1. Bump the version based on the commit messages, push the new tag, and change the package.json version
|
|
43
|
+
2. Create a new release on GitHub with Release Notes
|
|
44
|
+
3. Publish the release to NPM
|
|
45
|
+
4. Run the command `echo 'Hello, World!'` via `bash` and `child_process`
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
# Example Usage (Library)
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
1. Install `autorel` as a dependency
|
|
53
50
|
|
|
54
|
-
|
|
51
|
+
```bash
|
|
52
|
+
npm i autorel
|
|
53
|
+
```
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
2. Import and use in your project
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
```typescript
|
|
58
|
+
import {autorel} from 'autorel';
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
autorel({
|
|
61
|
+
publish: true
|
|
62
|
+
run: 'echo "Hello, World!"'
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
This will do the same as the CLI example above.
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
# Configuration
|
|
68
|
+
|
|
69
|
+
Unless otherwise noted, configuration can be done via `yaml`, file, CLI arguments, or any combination of the two. CLI arguments take precedence and will override the `yaml` file.
|
|
70
|
+
|
|
71
|
+
You can also use the library in your project, in which case you can pass the options directly to the `autorel` function.
|
|
72
|
+
|
|
73
|
+
All arguments are optional, but setting `branches` is recommended.
|
|
74
|
+
|
|
75
|
+
> If using yaml, the file must be named `autorel.yml` and be in the root of your project.
|
|
76
|
+
|
|
77
|
+
## help (CLI only)
|
|
78
|
+
|
|
79
|
+
Man page for the CLI
|
|
80
|
+
|
|
81
|
+
- CLI: `--help`
|
|
82
|
+
|
|
83
|
+
## publish
|
|
84
|
+
|
|
85
|
+
Whether to publish the release to NPM. If `true`, you must be authenticated with NPM. To do so via GitHub Actions, see [this](https://docs.github.com/en/actions/guides/publishing-nodejs-packages#publishing-packages-to-the-npm-registry).
|
|
86
|
+
|
|
87
|
+
- CLI: `--publish`
|
|
88
|
+
- Argument: `publish: boolean`
|
|
89
|
+
- Default: `false`
|
|
90
|
+
|
|
91
|
+
## dryRun
|
|
92
|
+
|
|
93
|
+
Whether to run in dry-run mode. This will not push the tag, create the release, publish to NPM, or run the command.
|
|
94
|
+
|
|
95
|
+
- CLI: `--dry`
|
|
96
|
+
- Argument: `dryRun: boolean`
|
|
97
|
+
- Default: `false`
|
|
98
|
+
|
|
99
|
+
## noRelease
|
|
100
|
+
|
|
101
|
+
Whether to skip creating a release on GitHub. If `true`, the release will not be created, but the tag will still be pushed and the package on npm will still be updated, if applicable.
|
|
102
|
+
|
|
103
|
+
- CLI: `--no-release`
|
|
104
|
+
- Argument: `noRelease: boolean`
|
|
105
|
+
- Default: `false`
|
|
106
|
+
|
|
107
|
+
## run
|
|
108
|
+
|
|
109
|
+
A command to run after the release is complete. This will be run via `child_process`.
|
|
110
|
+
|
|
111
|
+
- CLI: `--run`
|
|
112
|
+
- Argument: `run: string`
|
|
113
|
+
- Default: `undefined`
|
|
114
|
+
|
|
115
|
+
## runScript (YAML only)
|
|
116
|
+
|
|
117
|
+
A bash script to run after the release is complete. This will be run via `bash` and `child_process`.
|
|
118
|
+
|
|
119
|
+
- Argument: `runScript: string`
|
|
120
|
+
- Default: `undefined`
|
|
121
|
+
|
|
122
|
+
> This requires `bash` to be installed on the system.
|
|
123
|
+
|
|
124
|
+
You can use the multi-line string syntax in YAML to write a script:
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
runScript: |
|
|
128
|
+
echo 'Hello, World!' > hello.txt
|
|
129
|
+
echo 'Goodbye, World!' > goodbye.txt
|
|
64
130
|
```
|
|
65
131
|
|
|
66
|
-
|
|
132
|
+
## tag
|
|
133
|
+
|
|
134
|
+
The tag to use for the release. Note that this will skip the commit message analysis and use the tag verbatim. Always results in a release being created unless `noRelease` is `true`. Advanced usage only.
|
|
67
135
|
|
|
68
|
-
|
|
136
|
+
- CLI: `--tag`
|
|
137
|
+
- Argument: `tag: string`
|
|
138
|
+
- Default: `undefined`
|
|
69
139
|
|
|
70
|
-
|
|
140
|
+
## pre-release
|
|
71
141
|
|
|
72
|
-
|
|
142
|
+
The pre-release channel to use. This will be appended to the version number. For example, if the version is `1.0.0` and the pre-release is `alpha`, the version will be `1.0.0-alpha.1`. For "production" releases, leave this blank. In this case, "latest" will be used for the NPM tag/channel.
|
|
73
143
|
|
|
74
|
-
|
|
144
|
+
- CLI: `--pre`
|
|
145
|
+
- Argument: `pre: string`
|
|
146
|
+
- Default: `undefined`
|
|
75
147
|
|
|
76
|
-
|
|
148
|
+
## breakingChangeTitle (YAML only)
|
|
77
149
|
|
|
78
|
-
|
|
150
|
+
The title to use for the breaking changes section in the release notes.
|
|
79
151
|
|
|
80
|
-
|
|
152
|
+
- Argument: `breakingChangeTitle: string`
|
|
153
|
+
- Default: `"🚨 Breaking Changes 🚨"`
|
|
81
154
|
|
|
82
|
-
|
|
155
|
+
## commitTypes (YAML only)
|
|
83
156
|
|
|
84
|
-
|
|
157
|
+
The commit types to use for both the release notes and version bumping. If not provided, the default is:
|
|
85
158
|
|
|
86
|
-
```
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
159
|
+
```yaml
|
|
160
|
+
- {type: 'feat', title: '✨ Features', release: 'minor'}
|
|
161
|
+
- {type: 'fix', title: '🐛 Bug Fixes', release: 'patch'}
|
|
162
|
+
- {type: 'perf', title: '🚀 Performance Improvements', release: 'patch'}
|
|
163
|
+
- {type: 'revert', title: '⏪ Reverts', release: 'patch'}
|
|
164
|
+
- {type: 'docs', title: '📚 Documentation', release: 'none'}
|
|
165
|
+
- {type: 'style', title: '💅 Styles', release: 'none'}
|
|
166
|
+
- {type: 'refactor', title: '🛠 Code Refactoring', release: 'none'}
|
|
167
|
+
- {type: 'test', title: '🧪 Tests', release: 'none'}
|
|
168
|
+
- {type: 'build', title: '🏗 Build System', release: 'none'}
|
|
169
|
+
- {type: 'ci', title: '🔧 Continuous Integration', release: 'none'}
|
|
93
170
|
```
|
|
94
171
|
|
|
95
|
-
|
|
172
|
+
- Argument: `commitTypes: CommitType[]`
|
|
96
173
|
|
|
97
|
-
|
|
174
|
+
## branches (YAML only)
|
|
98
175
|
|
|
99
|
-
|
|
176
|
+
The branches to use for the release along with their channel. If not provided, the default is:
|
|
100
177
|
|
|
101
|
-
|
|
178
|
+
```yaml
|
|
179
|
+
- {name: 'main'}
|
|
180
|
+
```
|
|
102
181
|
|
|
103
|
-
|
|
104
|
-
- `context` should by any information not necessarily directly related to the error, ie. server request information, app component, configurations, etc. This is where the [verbose metadata](#processenvlog_verbosity) is appended (this will override anything in the context object).
|
|
105
|
-
- `data` any object that might be useful to debug the error, or any pertinant information relating to the log message
|
|
182
|
+
The above will release to the `latest` channel on NPM. If you want to release to a different channel, you can specify it like so:
|
|
106
183
|
|
|
107
|
-
|
|
184
|
+
```yaml
|
|
185
|
+
branches:
|
|
186
|
+
- {name: 'main'}
|
|
187
|
+
- {name: 'develop', channel: 'alpha'}
|
|
188
|
+
- {name: 'staging', channel: 'beta'}
|
|
189
|
+
```
|
|
108
190
|
|
|
109
|
-
|
|
191
|
+
The above will release to the `latest` channel (production) on NPM for the `main` branch, the `alpha` pre-release channel for the `develop` branch, and the `beta` pre-release channel for the `staging` branch.
|
|
110
192
|
|
|
111
|
-
|
|
193
|
+
- Argument: `branches: ReleaseBranch[]`
|
|
112
194
|
|
|
113
|
-
|
|
195
|
+
# Sample YAML Configuration
|
|
114
196
|
|
|
115
|
-
|
|
197
|
+
<sub>_.autorel.yaml_</sub>
|
|
198
|
+
```yaml
|
|
199
|
+
branches:
|
|
200
|
+
- {name: main}
|
|
201
|
+
- {name: next, channel: next}
|
|
202
|
+
- {name: beta, channel: beta}
|
|
203
|
+
publish: true
|
|
204
|
+
run: echo 'Hello, World!'
|
|
205
|
+
```
|
|
116
206
|
|
|
117
|
-
|
|
207
|
+
# Types
|
|
118
208
|
|
|
119
|
-
|
|
209
|
+
## CommitType
|
|
120
210
|
|
|
121
|
-
|
|
211
|
+
```typescript
|
|
212
|
+
type CommitType = {
|
|
213
|
+
type: string;
|
|
214
|
+
title: string;
|
|
215
|
+
release: 'major' | 'minor' | 'patch' | 'none';
|
|
216
|
+
};
|
|
217
|
+
```
|
|
122
218
|
|
|
123
|
-
|
|
219
|
+
## ReleaseBranch
|
|
124
220
|
|
|
125
|
-
|
|
221
|
+
```typescript
|
|
222
|
+
type ReleaseBranch = {
|
|
223
|
+
name: string;
|
|
224
|
+
channel?: string;
|
|
225
|
+
};
|
|
226
|
+
```
|
|
126
227
|
|
|
127
|
-
|
|
228
|
+
## Config
|
|
128
229
|
|
|
129
|
-
|
|
230
|
+
```typescript
|
|
231
|
+
type Config = {
|
|
232
|
+
run?: string;
|
|
233
|
+
publish?: boolean;
|
|
234
|
+
dryRun?: boolean;
|
|
235
|
+
noRelease?: boolean;
|
|
236
|
+
tag?: string;
|
|
237
|
+
pre?: string;
|
|
238
|
+
breakingChangeTitle?: string;
|
|
239
|
+
commitTypes?: CommitType[];
|
|
240
|
+
branches?: ReleaseBranch[];
|
|
241
|
+
};
|
|
242
|
+
```
|
|
130
243
|
|
|
131
244
|
## Contribution
|
|
132
245
|
|
package/dist/changelog.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CommitType } from '
|
|
1
|
+
import { CommitType } from '.';
|
|
2
2
|
import { ConventionalCommit } from './conventionalcommits';
|
|
3
3
|
export declare function generateChangelog(commits: ConventionalCommit[], commitTypeMap: Map<string, CommitType>, breakingTitle?: string): string;
|
package/dist/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ const commander_1 = require("commander");
|
|
|
7
7
|
const colors_1 = require("./lib/colors");
|
|
8
8
|
const _1 = require(".");
|
|
9
9
|
const output_1 = __importDefault(require("./lib/output"));
|
|
10
|
+
const config_1 = require("./config");
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
|
11
12
|
const packageJson = require('../package.json');
|
|
12
13
|
const program = new commander_1.Command();
|
|
@@ -16,23 +17,22 @@ console.log('----------------------------');
|
|
|
16
17
|
program
|
|
17
18
|
.version(packageJson.version, '-v, --version')
|
|
18
19
|
.description('An example CLI for managing a directory')
|
|
19
|
-
.option('--
|
|
20
|
-
.option('--
|
|
21
|
-
.option('
|
|
22
|
-
.option('
|
|
23
|
-
.option('-t, --tag <value>', 'Specify a tag to be used instead of calculating it from commit analysis. Overrides --pre.')
|
|
24
|
-
.option('-r, --run <value>', 'Bash script to run after the release is successful')
|
|
20
|
+
.option('--dry', 'Do a dry run')
|
|
21
|
+
.option('--pre-release <value>', 'Pre-release channel. If specified, the release will be marked as a pre-release. Overrides any other configuration.')
|
|
22
|
+
.option('--tag <value>', 'Specify a tag to be used instead of calculating it from commit analysis. Overrides --pre.')
|
|
23
|
+
.option('--run <value>', 'Command to run after the release is successful')
|
|
25
24
|
.option('--no-release', 'Does not create a release on GitHub (advanced use only)')
|
|
26
25
|
.option('--publish', 'Publish the package to npm, requires passing --npm-token or NPM_TOKEN environment variable')
|
|
27
26
|
.parse(process.argv);
|
|
28
27
|
const options = program.opts();
|
|
28
|
+
const config = (0, config_1.getConfig)();
|
|
29
29
|
output_1.default.debug(`Options: ${JSON.stringify(options, null, 2)}`);
|
|
30
|
+
output_1.default.debug(`Config: ${JSON.stringify(config, null, 2)}`);
|
|
30
31
|
(0, _1.autorel)({
|
|
31
|
-
|
|
32
|
-
npmToken: options.npmToken,
|
|
32
|
+
...config,
|
|
33
33
|
dryRun: options.dry,
|
|
34
|
-
|
|
35
|
-
prereleaseChannel: options.
|
|
34
|
+
run: options.run,
|
|
35
|
+
prereleaseChannel: options.preRelease,
|
|
36
36
|
tag: options.tag,
|
|
37
37
|
publish: options.publish,
|
|
38
38
|
noRelease: options.noRelease,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;AAAA,yCAAkC;AAClC,yCAAkC;AAClC,wBAA0B;AAC1B,0DAAkC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;AAAA,yCAAkC;AAClC,yCAAkC;AAClC,wBAA0B;AAC1B,0DAAkC;AAClC,qCAAmC;AAEnC,qGAAqG;AACrG,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAC5C,OAAO,CAAC,GAAG,CAAC,GAAG,IAAA,aAAI,EAA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title: string;
|
|
4
|
-
release: 'minor' | 'patch' | 'none';
|
|
5
|
-
};
|
|
6
|
-
export type ReleaseBranch = {
|
|
7
|
-
name: string;
|
|
8
|
-
prereleaseChannel?: string;
|
|
9
|
-
};
|
|
10
|
-
export type Config = {
|
|
11
|
-
breakingChangeTitle: string;
|
|
12
|
-
commitTypes: CommitType[];
|
|
13
|
-
branches: ReleaseBranch[];
|
|
14
|
-
};
|
|
15
|
-
export declare const defaultConfig: Config;
|
|
16
|
-
export declare function getConfig(): Config;
|
|
1
|
+
import { Args } from '.';
|
|
2
|
+
export declare function getConfig(): Args;
|
package/dist/config.js
CHANGED
|
@@ -26,31 +26,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getConfig =
|
|
29
|
+
exports.getConfig = void 0;
|
|
30
30
|
const fs = __importStar(require("node:fs"));
|
|
31
31
|
const path = __importStar(require("node:path"));
|
|
32
32
|
const yaml = __importStar(require("js-yaml"));
|
|
33
33
|
const rtype_1 = require("@aeroview-io/rtype");
|
|
34
34
|
const output_1 = __importDefault(require("./lib/output"));
|
|
35
|
-
|
|
36
|
-
breakingChangeTitle: '🚨 Breaking Changes 🚨',
|
|
37
|
-
commitTypes: [
|
|
38
|
-
{ type: 'feat', title: '✨ Features', release: 'minor' },
|
|
39
|
-
{ type: 'fix', title: '🐛 Bug Fixes', release: 'patch' },
|
|
40
|
-
{ type: 'perf', title: '⚡ Performance Improvements', release: 'patch' },
|
|
41
|
-
{ type: 'revert', title: '⏪ Reverts', release: 'patch' },
|
|
42
|
-
{ type: 'docs', title: '📚 Documentation', release: 'none' },
|
|
43
|
-
{ type: 'style', title: '💅 Styles', release: 'none' },
|
|
44
|
-
{ type: 'refactor', title: '🛠 Code Refactoring', release: 'none' },
|
|
45
|
-
{ type: 'test', title: '🧪 Tests', release: 'none' },
|
|
46
|
-
{ type: 'build', title: '🏗 Build System', release: 'none' },
|
|
47
|
-
{ type: 'ci', title: '🔧 Continuous Integration', release: 'none' },
|
|
48
|
-
],
|
|
49
|
-
branches: [
|
|
50
|
-
{ name: 'main' },
|
|
51
|
-
],
|
|
52
|
-
};
|
|
35
|
+
const defaults_1 = require("./defaults");
|
|
53
36
|
const validateConfig = rtype_1.predicates.object({
|
|
37
|
+
dryRun: rtype_1.predicates.optional(rtype_1.predicates.boolean()),
|
|
38
|
+
run: rtype_1.predicates.optional(rtype_1.predicates.string()),
|
|
39
|
+
runScript: rtype_1.predicates.optional(rtype_1.predicates.string()),
|
|
40
|
+
prereleaseChannel: rtype_1.predicates.optional(rtype_1.predicates.string()),
|
|
41
|
+
tag: rtype_1.predicates.optional(rtype_1.predicates.string()),
|
|
42
|
+
noRelease: rtype_1.predicates.optional(rtype_1.predicates.boolean()),
|
|
43
|
+
publish: rtype_1.predicates.optional(rtype_1.predicates.boolean()),
|
|
54
44
|
breakingChangeTitle: rtype_1.predicates.optional(rtype_1.predicates.string()),
|
|
55
45
|
commitTypes: rtype_1.predicates.optional(rtype_1.predicates.array(rtype_1.predicates.object({
|
|
56
46
|
type: rtype_1.predicates.string(),
|
|
@@ -94,7 +84,7 @@ function readAutorelYaml(filePath = '.autorel.yaml') {
|
|
|
94
84
|
function getConfig() {
|
|
95
85
|
const localConfig = readAutorelYaml();
|
|
96
86
|
return {
|
|
97
|
-
...
|
|
87
|
+
...defaults_1.defaultConfig,
|
|
98
88
|
...localConfig,
|
|
99
89
|
};
|
|
100
90
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAClC,8CAAgC;AAChC,8CAA8E;AAC9E,0DAAkC;
|
|
1
|
+
{"version":3,"file":"config.js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O;QACH,GAAG,wBAAa;QAChB,GAAG,WAAW;KACjB,CAAC;AAEN,CAAC;AATD,8BASC"}
|
package/dist/config.spec.js
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
/* eslint-disable max-lines-per-function */
|
|
27
4
|
const hoare_1 = require("hoare");
|
|
28
5
|
const cjs_mock_1 = require("cjs-mock");
|
|
29
|
-
const mod = __importStar(require("./config"));
|
|
30
6
|
const fakeLog_1 = require("./test_fixtures/fakeLog");
|
|
31
7
|
const rtype_1 = require("@aeroview-io/rtype");
|
|
8
|
+
const defaults_1 = require("./defaults");
|
|
32
9
|
(0, hoare_1.test)('readAutorelYaml: happy path, with no .autorel.yaml', async (assert) => {
|
|
33
10
|
const mockFs = {
|
|
34
11
|
existsSync: () => false,
|
|
@@ -41,7 +18,7 @@ const rtype_1 = require("@aeroview-io/rtype");
|
|
|
41
18
|
'node:path': { resolve: (p) => p },
|
|
42
19
|
'./lib/output': fakeLog_1.fakeLogger,
|
|
43
20
|
});
|
|
44
|
-
assert.equal(configMod.getConfig(),
|
|
21
|
+
assert.equal(configMod.getConfig(), defaults_1.defaultConfig, 'should return the default configuration');
|
|
45
22
|
});
|
|
46
23
|
(0, hoare_1.test)('readAutorelYaml: happy path, with .autorel.yaml', async (assert) => {
|
|
47
24
|
const mockFs = {
|
|
@@ -68,7 +45,7 @@ const rtype_1 = require("@aeroview-io/rtype");
|
|
|
68
45
|
{ type: 'test', title: '🧪 Tests', release: 'none' },
|
|
69
46
|
{ type: 'build', title: '🏗 Build System', release: 'none' },
|
|
70
47
|
],
|
|
71
|
-
branches:
|
|
48
|
+
branches: defaults_1.defaultConfig.branches,
|
|
72
49
|
}, 'should return the parsed configuration');
|
|
73
50
|
});
|
|
74
51
|
(0, hoare_1.test)('readAutorelYaml: invalid configuration', async (assert) => {
|
package/dist/config.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.spec.js","sourceRoot":"","sources":["../src/config.spec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.spec.js","sourceRoot":"","sources":["../src/config.spec.ts"],"names":[],"mappings":";;AAAA,2CAA2C;AAC3C,iCAA2B;AAC3B,uCAA8B;AAE9B,qDAAmD;AACnD,8CAA6D;AAC7D,yCAAyC;AAEzC,IAAA,YAAI,EAAC,oDAAoD,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;IAExE,MAAM,MAAM,GAAG;QACX,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK;QACvB,YAAY,EAAE,GAAG,EAAE;YAEf,MAAM,IAAI,KA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M,WAAW,GAAG;;;;CAIvB,CAAC;IACE,MAAM,MAAM,GAAG;QACX,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;QACtB,YAAY,EAAE,GAAG,EAAE,CAAC,WAAW;KAClC,CAAC;IACF,MAAM,SAAS,GAAe,IAAA,eAAI,EAAC,UAAU,EAAE;QAC3C,SAAS,EAAE,MAAM;QACjB,WAAW,EAAE,EAAC,OAAO,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,EAAC;QACxC,cAAc,EAAE,oBAAU;KAC7B,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;IAEpD,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,eAAe,EAAE,uBAAuB,CAAC,CAAC;AAEtE,CAAC,CAAC,CAAC"}
|
package/dist/defaults.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultConfig = void 0;
|
|
4
|
+
exports.defaultConfig = {
|
|
5
|
+
breakingChangeTitle: '🚨 Breaking Changes 🚨',
|
|
6
|
+
commitTypes: [
|
|
7
|
+
{ type: 'feat', title: '✨ Features', release: 'minor' },
|
|
8
|
+
{ type: 'fix', title: '🐛 Bug Fixes', release: 'patch' },
|
|
9
|
+
{ type: 'perf', title: '🚀 Performance Improvements', release: 'patch' },
|
|
10
|
+
{ type: 'revert', title: '⏪ Reverts', release: 'patch' },
|
|
11
|
+
{ type: 'docs', title: '📚 Documentation', release: 'none' },
|
|
12
|
+
{ type: 'style', title: '💅 Styles', release: 'none' },
|
|
13
|
+
{ type: 'refactor', title: '🛠 Code Refactoring', release: 'none' },
|
|
14
|
+
{ type: 'test', title: '🧪 Tests', release: 'none' },
|
|
15
|
+
{ type: 'build', title: '🏗 Build System', release: 'none' },
|
|
16
|
+
{ type: 'ci', title: '🔧 Continuous Integration', release: 'none' },
|
|
17
|
+
],
|
|
18
|
+
branches: [
|
|
19
|
+
{ name: 'main' },
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":";;;AAEa,QAAA,aAAa,GAAS;IAC/B,mBAAmB,EAAE,wBAAwB;IAC7C,WAAW,EAAE;QACT,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAC;QACrD,EAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAC;QACtD,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,6BAA6B,EAAE,OAAO,EAAE,OAAO,EAAC;QACtE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAC;QACtD,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,EAAC;QAC1D,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAC;QACpD,EAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,EAAC;QACjE,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAC;QAClD,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,EAAC;QAC1D,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,2BAA2B,EAAE,OAAO,EAAE,MAAM,EAAC;KACpE;IACD,QAAQ,EAAE;QACN,EAAC,IAAI,EAAE,MAAM,EAAC;KACjB;CACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
+
export type CommitType = {
|
|
2
|
+
type: string;
|
|
3
|
+
title: string;
|
|
4
|
+
release: 'minor' | 'patch' | 'none';
|
|
5
|
+
};
|
|
6
|
+
export type ReleaseBranch = {
|
|
7
|
+
name: string;
|
|
8
|
+
prereleaseChannel?: string;
|
|
9
|
+
};
|
|
1
10
|
export type Args = {
|
|
2
|
-
githubToken?: string;
|
|
3
|
-
npmToken?: string;
|
|
4
11
|
dryRun?: boolean;
|
|
5
|
-
|
|
12
|
+
run?: string;
|
|
13
|
+
runScript?: string;
|
|
6
14
|
prereleaseChannel?: string;
|
|
7
15
|
tag?: string;
|
|
8
16
|
noRelease?: boolean;
|
|
9
17
|
publish?: boolean;
|
|
18
|
+
breakingChangeTitle: string;
|
|
19
|
+
commitTypes: CommitType[];
|
|
20
|
+
branches: ReleaseBranch[];
|
|
10
21
|
};
|
|
11
22
|
export declare function getPrereleaseChannel(args: Args): string | undefined;
|
|
12
23
|
export declare function autorel(args: Args): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ const github = __importStar(require("./services/github"));
|
|
|
38
38
|
const output_1 = __importDefault(require("./lib/output"));
|
|
39
39
|
const config_1 = require("./config");
|
|
40
40
|
const versionBump_1 = require("./versionBump");
|
|
41
|
+
const bash_1 = require("./lib/bash");
|
|
41
42
|
function getPrereleaseChannel(args) {
|
|
42
43
|
if (args.prereleaseChannel)
|
|
43
44
|
return args.prereleaseChannel;
|
|
@@ -49,30 +50,19 @@ function getPrereleaseChannel(args) {
|
|
|
49
50
|
throw new Error('Branches are not defined in the configuration.');
|
|
50
51
|
const matchingBranch = config.branches.find((b) => b.name === branch);
|
|
51
52
|
if (!matchingBranch)
|
|
52
|
-
|
|
53
|
+
return undefined;
|
|
53
54
|
return matchingBranch.prereleaseChannel || undefined;
|
|
54
55
|
}
|
|
55
56
|
exports.getPrereleaseChannel = getPrereleaseChannel;
|
|
56
57
|
async function autorel(args) {
|
|
57
|
-
const gitHubToken = args.githubToken || process.env.GITHUB_TOKEN;
|
|
58
|
-
const npmtoken = args.npmToken || process.env.NPM_TOKEN;
|
|
59
58
|
const prereleaseChannel = getPrereleaseChannel(args);
|
|
60
|
-
if (!gitHubToken) {
|
|
61
|
-
output_1.default.error('GitHub Token is required for creating releases. Set the GITHUB_TOKEN environment variable or pass it via --github-token.');
|
|
62
|
-
throw new Error('INVALID_CONFIGURATION');
|
|
63
|
-
}
|
|
64
|
-
if (!npmtoken && args.publish) {
|
|
65
|
-
output_1.default.error('NPM Token is required for publishing to npm. Set the NPM_TOKEN environment variable or pass it via --npm-token.');
|
|
66
|
-
throw new Error('INVALID_CONFIGURATION');
|
|
67
|
-
}
|
|
68
59
|
if (args.dryRun) {
|
|
69
60
|
output_1.default.warn('Running in dry-run mode. No changes will be made.');
|
|
70
61
|
}
|
|
71
62
|
if (prereleaseChannel && !args.tag) {
|
|
72
63
|
output_1.default.log(`Using prerelease channel: ${color.bold(prereleaseChannel)}`);
|
|
73
64
|
}
|
|
74
|
-
const
|
|
75
|
-
const commitTypeMap = new Map(config.commitTypes.map((type) => [type.type, type]));
|
|
65
|
+
const commitTypeMap = new Map(args.commitTypes.map((type) => [type.type, type]));
|
|
76
66
|
const lastTag = git.getLastTag();
|
|
77
67
|
const lastProdTag = git.getLastProdTag();
|
|
78
68
|
output_1.default.log(`The last tag is: ${lastTag ? lastTag : color.grey('none')}`);
|
|
@@ -99,14 +89,14 @@ async function autorel(args) {
|
|
|
99
89
|
else {
|
|
100
90
|
output_1.default.log(`The next version is: ${color.bold(nextTag)}`);
|
|
101
91
|
}
|
|
102
|
-
const changelog = (0, changelog_1.generateChangelog)(parsedCommits, commitTypeMap,
|
|
92
|
+
const changelog = (0, changelog_1.generateChangelog)(parsedCommits, commitTypeMap, args.breakingChangeTitle);
|
|
103
93
|
output_1.default.debug(`The changelog is:\n${changelog}`);
|
|
104
94
|
if (args.dryRun)
|
|
105
95
|
return;
|
|
106
96
|
git.createAndPushTag(args.tag ? args.tag : nextTag);
|
|
107
97
|
const { owner, repository } = git.getRepo();
|
|
108
98
|
!args.noRelease && github.createRelease({
|
|
109
|
-
token:
|
|
99
|
+
token: process.env.GITHUB_TOKEN,
|
|
110
100
|
owner,
|
|
111
101
|
repository,
|
|
112
102
|
tag: args.tag ? args.tag : nextTag,
|
|
@@ -116,7 +106,28 @@ async function autorel(args) {
|
|
|
116
106
|
// update package.json
|
|
117
107
|
(0, versionBump_1.versionBump)(nextTag);
|
|
118
108
|
// publish package
|
|
119
|
-
args.publish && npm.publishPackage(
|
|
109
|
+
args.publish && npm.publishPackage(prereleaseChannel);
|
|
110
|
+
process.env.NEXT_VERSION = nextTag.replace('v', '');
|
|
111
|
+
process.env.NEXT_TAG = nextTag;
|
|
112
|
+
// run post-release script
|
|
113
|
+
if (args.run) {
|
|
114
|
+
output_1.default.log('Running post-release command:');
|
|
115
|
+
output_1.default.log('');
|
|
116
|
+
output_1.default.log('----------------------------');
|
|
117
|
+
output_1.default.log(args.run);
|
|
118
|
+
output_1.default.log('----------------------------');
|
|
119
|
+
output_1.default.log('');
|
|
120
|
+
(0, bash_1.cmd)(args.run);
|
|
121
|
+
}
|
|
122
|
+
else if (args.runScript) {
|
|
123
|
+
output_1.default.log('Running post-release bash script:');
|
|
124
|
+
output_1.default.log('');
|
|
125
|
+
output_1.default.log('----------------------------');
|
|
126
|
+
output_1.default.log(args.runScript);
|
|
127
|
+
output_1.default.log('----------------------------');
|
|
128
|
+
output_1.default.log('');
|
|
129
|
+
(0, bash_1.bash)(args.runScript);
|
|
130
|
+
}
|
|
120
131
|
}
|
|
121
132
|
exports.autorel = autorel;
|
|
122
133
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"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AAC,CAAC;QACrB,gBAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAC3C,gBAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACf,IAAA,UAAG,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KAEjB;SAAM,IAAI,IAAI,CAAC,SAAS,EAAE;QAEvB,gBAAM,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QAChD,gBAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACf,gBAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAC3C,gBAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,gBAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAC3C,gBAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACf,IAAA,WAAI,EAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAExB;AAEL,CAAC;AAnHD,0BAmHC"}
|
package/dist/lib/bash.d.ts
CHANGED
package/dist/lib/bash.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.$ = void 0;
|
|
6
|
+
exports.cmd = exports.bash = exports.$ = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const output_1 = __importDefault(require("./output"));
|
|
9
9
|
function $(strings, ...values) {
|
|
@@ -14,4 +14,13 @@ function $(strings, ...values) {
|
|
|
14
14
|
return output.trim();
|
|
15
15
|
}
|
|
16
16
|
exports.$ = $;
|
|
17
|
+
function bash(cmd) {
|
|
18
|
+
const escapedCommand = cmd.replace(/(["$`\\])/g, '\\$1').replace(/\n/g, '\\n');
|
|
19
|
+
(0, child_process_1.execSync)(`bash -c "${escapedCommand}"`, { encoding: 'utf8', stdio: 'inherit' });
|
|
20
|
+
}
|
|
21
|
+
exports.bash = bash;
|
|
22
|
+
function cmd(cmd) {
|
|
23
|
+
(0, child_process_1.execSync)(cmd, { encoding: 'utf8', stdio: 'inherit' });
|
|
24
|
+
}
|
|
25
|
+
exports.cmd = cmd;
|
|
17
26
|
//# sourceMappingURL=bash.js.map
|
package/dist/lib/bash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/lib/bash.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAuC;AACvC,sDAA2B;AAE3B,SAAgB,CAAC,CAAC,OAA6B,EAAE,GAAG,MAAa;IAE7D,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEnF,gBAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEnB,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACnF,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,YAAY,cAAc,GAAG,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;IAE3E,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AAEzB,CAAC;AAXD,cAWC"}
|
|
1
|
+
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/lib/bash.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAuC;AACvC,sDAA2B;AAE3B,SAAgB,CAAC,CAAC,OAA6B,EAAE,GAAG,MAAa;IAE7D,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEnF,gBAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEnB,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACnF,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,YAAY,cAAc,GAAG,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;IAE3E,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AAEzB,CAAC;AAXD,cAWC;AAED,SAAgB,IAAI,CAAC,GAAW;IAE5B,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAE/E,IAAA,wBAAQ,EAAC,YAAY,cAAc,GAAG,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC,CAAC;AAElF,CAAC;AAND,oBAMC;AAED,SAAgB,GAAG,CAAC,GAAW;IAE3B,IAAA,wBAAQ,EAAC,GAAG,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC,CAAC;AAExD,CAAC;AAJD,kBAIC"}
|
package/dist/lib/npm.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function publishPackage(
|
|
1
|
+
export declare function publishPackage(channel?: string): void;
|
package/dist/lib/npm.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.publishPackage = void 0;
|
|
4
4
|
const bash_1 = require("./bash");
|
|
5
|
-
function publishPackage(
|
|
5
|
+
function publishPackage(channel) {
|
|
6
6
|
(0, bash_1.$) `npm publish --tag ${channel || 'latest'}`;
|
|
7
7
|
}
|
|
8
8
|
exports.publishPackage = publishPackage;
|
package/dist/lib/npm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../src/lib/npm.ts"],"names":[],"mappings":";;;AAAA,iCAAyB;AAEzB,SAAgB,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../src/lib/npm.ts"],"names":[],"mappings":";;;AAAA,iCAAyB;AAEzB,SAAgB,cAAc,CAAC,OAAgB;IAE3C,IAAA,QAAC,EAAA,qBAAqB,OAAO,IAAI,QAAQ,EAAE,CAAC;AAEhD,CAAC;AAJD,wCAIC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autorel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Automate semantic releases based on conventional commits. Similar to semantic-release but much simpler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc H. Weiner <mhweiner234@gmail.com> (https://mhweiner.com)",
|