|
1 |
| -import fs from "fs"; |
2 |
| -import { resolve } from "path"; |
3 |
| -import { runCommand } from "./common"; |
| 1 | +import fs from 'fs'; |
| 2 | +import { resolve } from 'path'; |
| 3 | +import { runCommand } from './common'; |
4 | 4 |
|
5 |
| -const grapesJSReactPath = resolve(__dirname, "../packages/grapesjs-react"); |
| 5 | +const grapesJSReactPath = resolve(__dirname, '../packages/grapesjs-react'); |
6 | 6 |
|
7 | 7 | async function prepareReleaseGrapesJSReact() {
|
8 | 8 | try {
|
9 |
| - const releaseTag = process.argv[2] || "rc"; |
10 |
| - console.log("Prepare release GrapesJS tag:", releaseTag); |
| 9 | + const releaseTag = process.argv[2] || 'rc'; |
| 10 | + console.log('Prepare release GrapesJS tag:', releaseTag); |
11 | 11 |
|
12 | 12 | runCommand(
|
13 |
| - "git diff-index --quiet HEAD --", |
14 |
| - "You have uncommitted changes. Please commit or stash them before running the release script." |
| 13 | + 'git diff-index --quiet HEAD --', |
| 14 | + 'You have uncommitted changes. Please commit or stash them before running the release script.' |
15 | 15 | );
|
16 | 16 |
|
17 |
| - const versionCmd = |
18 |
| - releaseTag === "latest" |
19 |
| - ? "--patch" |
20 |
| - : `--prerelease --preid ${releaseTag}`; |
21 |
| - runCommand( |
22 |
| - `yarn workspace @grapesjs/react version ${versionCmd} --no-git-tag-version --no-commit-hooks` |
23 |
| - ); |
| 17 | + const versionCmd = releaseTag === 'latest' ? '--patch' : `--prerelease --preid ${releaseTag}`; |
| 18 | + runCommand(`yarn workspace @grapesjs/react version ${versionCmd} --no-git-tag-version --no-commit-hooks`); |
24 | 19 |
|
25 | 20 | // Create a new release branch
|
26 |
| - const newVersion = JSON.parse( |
27 |
| - fs.readFileSync(`${grapesJSReactPath}/package.json`, "utf8") |
28 |
| - ).version; |
| 21 | + const newVersion = JSON.parse(fs.readFileSync(`${grapesJSReactPath}/package.json`, 'utf8')).version; |
29 | 22 | const newBranch = `release-v${newVersion}`;
|
30 | 23 | runCommand(`git checkout -b ${newBranch}`);
|
31 |
| - runCommand("git add ."); |
32 |
| - runCommand( |
33 |
| - `git commit -m "Release GrapesJS React ${releaseTag}: v${newVersion}"` |
34 |
| - ); |
| 24 | + runCommand('git add .'); |
| 25 | + runCommand(`git commit -m "Release GrapesJS React ${releaseTag}: v${newVersion}"`); |
35 | 26 |
|
36 |
| - console.log( |
37 |
| - `Release prepared! Push the current "${newBranch}" branch and open a new PR targeting 'main'` |
38 |
| - ); |
| 27 | + console.log(`Release prepared! Push the current "${newBranch}" branch and open a new PR targeting 'main'`); |
39 | 28 | } catch (error) {
|
40 | 29 | console.error(error);
|
41 | 30 | process.exit(1);
|
|
0 commit comments