Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: rename release.ts to release.mts #8204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"lint": "npx nx run-many --target=lint --parallel",
"postinstall": "npx nx run repo-tools:postinstall-script",
"pre-commit": "yarn lint-staged",
"release": "tsx tools/release/release.ts",
"release": "tsx tools/release/release.mts",
"start": "npx nx run website:start",
"test": "npx nx run-many --target=test --parallel --exclude integration-tests --exclude website --exclude website-eslint",
"test-integration": "npx nx run integration-tests:test",
Expand Down
67 changes: 67 additions & 0 deletions tools/release/release.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { execaSync } from 'execa';
import {
releaseChangelog,
releasePublish,
releaseVersion,
} from 'nx/src/command-line/release';
import yargs from 'yargs';

const options = await yargs
.version(false)
.option('version', {
description:
'Explicit version specifier to use, if overriding conventional commits',
type: 'string',
})
.option('dryRun', {
alias: 'd',
description:
'Whether to perform a dry-run of the release process, defaults to true',
type: 'boolean',
default: true,
})
.option('verbose', {
description: 'Whether or not to enable verbose logging, defaults to false',
type: 'boolean',
default: false,
})
.parseAsync();

const { workspaceVersion, projectsVersionData } = await releaseVersion({
specifier: options.version,
// stage package.json updates to be committed later by the changelog command
stageChanges: true,
dryRun: options.dryRun,
verbose: options.verbose,
});

// Update the lock file after the version bumps and stage it ready to be committed by the changelog step
if (!options.dryRun) {
console.log('⏳ Updating yarn.lock...');
execaSync(`yarn`, [`install`], {
env: { ...process.env, SKIP_POSTINSTALL: 'true' },
});
execaSync(`git`, [`add`, `yarn.lock`]);
console.log('✅ Updated and staged yarn.lock\n');
}

// This will create a release on GitHub
await releaseChangelog({
versionData: projectsVersionData,
version: workspaceVersion,
dryRun: options.dryRun,
verbose: options.verbose,
});

// An explicit null value here means that no changes were detected across any package
// eslint-disable-next-line eqeqeq
if (workspaceVersion === null) {
console.log(
'⏭️ No changes detected across any package, skipping publish step altogether',
);
} else {
await releasePublish({
dryRun: options.dryRun,
verbose: options.verbose,
});
}
79 changes: 0 additions & 79 deletions tools/release/release.ts

This file was deleted.

1 change: 1 addition & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"extends": "./tsconfig.base.json",
"include": [
"tools/**/*.ts",
"tools/**/*.mts",
".eslintrc.js",
"jest.config.base.js",
"jest.config.js",
Expand Down