Skip to content
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

feat: implemented check:types script to ensure TS types correctness #222

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check Types

on:
pull_request:
branches: [ master ]

jobs:
run_linter:

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:
run_linter:

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:
run_linter:

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
Loading