Skip to content

Commit 958feca

Browse files
chore: rename release.ts to release.mts (typescript-eslint#8204)
* chore: rename release.ts to release.mts * Update tsconfig.eslint.json Co-authored-by: auvred <61150013+auvred@users.noreply.github.com> --------- Co-authored-by: auvred <61150013+auvred@users.noreply.github.com>
1 parent ce6143b commit 958feca

File tree

4 files changed

+69
-80
lines changed

4 files changed

+69
-80
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"lint": "npx nx run-many --target=lint --parallel",
4444
"postinstall": "npx nx run repo-tools:postinstall-script",
4545
"pre-commit": "yarn lint-staged",
46-
"release": "tsx tools/release/release.ts",
46+
"release": "tsx tools/release/release.mts",
4747
"start": "npx nx run website:start",
4848
"test": "npx nx run-many --target=test --parallel --exclude integration-tests --exclude website --exclude website-eslint",
4949
"test-integration": "npx nx run integration-tests:test",

tools/release/release.mts

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { execaSync } from 'execa';
2+
import {
3+
releaseChangelog,
4+
releasePublish,
5+
releaseVersion,
6+
} from 'nx/src/command-line/release';
7+
import yargs from 'yargs';
8+
9+
const options = await yargs
10+
.version(false)
11+
.option('version', {
12+
description:
13+
'Explicit version specifier to use, if overriding conventional commits',
14+
type: 'string',
15+
})
16+
.option('dryRun', {
17+
alias: 'd',
18+
description:
19+
'Whether to perform a dry-run of the release process, defaults to true',
20+
type: 'boolean',
21+
default: true,
22+
})
23+
.option('verbose', {
24+
description: 'Whether or not to enable verbose logging, defaults to false',
25+
type: 'boolean',
26+
default: false,
27+
})
28+
.parseAsync();
29+
30+
const { workspaceVersion, projectsVersionData } = await releaseVersion({
31+
specifier: options.version,
32+
// stage package.json updates to be committed later by the changelog command
33+
stageChanges: true,
34+
dryRun: options.dryRun,
35+
verbose: options.verbose,
36+
});
37+
38+
// Update the lock file after the version bumps and stage it ready to be committed by the changelog step
39+
if (!options.dryRun) {
40+
console.log('⏳ Updating yarn.lock...');
41+
execaSync(`yarn`, [`install`], {
42+
env: { ...process.env, SKIP_POSTINSTALL: 'true' },
43+
});
44+
execaSync(`git`, [`add`, `yarn.lock`]);
45+
console.log('✅ Updated and staged yarn.lock\n');
46+
}
47+
48+
// This will create a release on GitHub
49+
await releaseChangelog({
50+
versionData: projectsVersionData,
51+
version: workspaceVersion,
52+
dryRun: options.dryRun,
53+
verbose: options.verbose,
54+
});
55+
56+
// An explicit null value here means that no changes were detected across any package
57+
// eslint-disable-next-line eqeqeq
58+
if (workspaceVersion === null) {
59+
console.log(
60+
'⏭️ No changes detected across any package, skipping publish step altogether',
61+
);
62+
} else {
63+
await releasePublish({
64+
dryRun: options.dryRun,
65+
verbose: options.verbose,
66+
});
67+
}

tools/release/release.ts

-79
This file was deleted.

tsconfig.eslint.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"extends": "./tsconfig.base.json",
88
"include": [
99
"tools/**/*.ts",
10+
"tools/**/*.mts",
1011
".eslintrc.js",
1112
"jest.config.base.js",
1213
"jest.config.js",

0 commit comments

Comments
 (0)