Skip to content

Commit

Permalink
Merge pull request #222 from Ayzrian/feat/implement-check-types-script
Browse files Browse the repository at this point in the history
feat: implemented check:types script to ensure TS types correctness
  • Loading branch information
alenatovstukha authored Jan 24, 2025
2 parents f4fb63d + 812a4aa commit daaa78e
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check Types

on:
pull_request:
branches: [ master ]

jobs:
check_types:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run check:types
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check Types

on:
pull_request:
branches: [ master ]

jobs:
check_types:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run check:types
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check Types

on:
pull_request:
branches: [ master ]

jobs:
check_types:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run check:types
1 change: 1 addition & 0 deletions mate-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"lint": "eslint ./src",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rm -rf ./bin && rollup -c && node ./shebangify.js && chmod +x ./bin/mateScripts.js",
"build:windows": "rollup -c && node ./shebangify.js",
"prepublishOnly": "npm run build",
"postpublish": "rm -rf ./bin",
"patch": "npm version patch && npm publish",
Expand Down
28 changes: 28 additions & 0 deletions mate-scripts/src/commands/CheckTypes.command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Command } from './Command';
import { execBashCodeSilent } from '../tools';

export type CheckTypesOptions = Record<string, unknown>;

export class CheckTypesCommand extends Command {
protected common(): void {
// do nothing
}

protected reactTypescript = () => {
this.checkTypes();
};

protected vueTypescript = () => {
this.checkTypes();
};

protected typescript = () => {
this.checkTypes();
};

private checkTypes() {
execBashCodeSilent(
`${this.binDir}tsc --noEmit`,
);
}
}
1 change: 1 addition & 0 deletions mate-scripts/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from './Build.command';
export * from './Deploy.command';
export * from './Update.command';
export * from './Migrate.command';
export * from './CheckTypes.command';
6 changes: 6 additions & 0 deletions mate-scripts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
TestCommand,
UpdateCommand,
MigrateCommand,
CheckTypesCommand,
} from './commands';
import {
deployController,
Expand Down Expand Up @@ -50,6 +51,11 @@ program
.description('lint html, css and js files')
.action(commandFactory.make(LintCommand, lintController));

program
.command('check:types')
.description('validates TS types')
.action(commandFactory.make(CheckTypesCommand));

program
.command('test')
.option('-n, --not-open', 'should open test report in browser', false)
Expand Down

0 comments on commit daaa78e

Please sign in to comment.