Skip to content

Commit 684e23a

Browse files
committed
ci: add quailty checks and run formatter
1 parent 50ab215 commit 684e23a

File tree

3 files changed

+40
-27
lines changed

3 files changed

+40
-27
lines changed

Diff for: .github/workflows/quailty.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: React 18 & 19 Lint Checks
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
quailty:
13+
runs-on: ubuntu-latest
14+
15+
name: Check Formatting and Linting
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Project Base
21+
uses: ./.github/actions/setup-project
22+
23+
- name: Lint Checks
24+
uses: ./.github/actions/lint

Diff for: scripts/common.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { execSync } from "child_process";
1+
import { execSync } from 'child_process';
22

33
export function runCommand(command: string, error?: string) {
44
try {
5-
return (execSync(command, { stdio: "inherit" }) || "").toString().trim();
5+
return (execSync(command, { stdio: 'inherit' }) || '').toString().trim();
66
} catch (err) {
77
console.error(error || `Error while running command: ${command}`);
88
throw err;

Diff for: scripts/releaseCore.ts

+14-25
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,30 @@
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';
44

5-
const grapesJSReactPath = resolve(__dirname, "../packages/grapesjs-react");
5+
const grapesJSReactPath = resolve(__dirname, '../packages/grapesjs-react');
66

77
async function prepareReleaseGrapesJSReact() {
88
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);
1111

1212
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.'
1515
);
1616

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`);
2419

2520
// 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;
2922
const newBranch = `release-v${newVersion}`;
3023
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}"`);
3526

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'`);
3928
} catch (error) {
4029
console.error(error);
4130
process.exit(1);

0 commit comments

Comments
 (0)