Add `rome ci` command - closes
MODIFY
.github/workflows/ci.yml
.github/workflows/ci.yml
@@ -20,8 +20,8 @@ jobs:
- name: Run TypeScript
run: node ./node_modules/.bin/tsc --noEmit
- lint:
- name: Lint
+ ci:
+ name: Lint & Tests
runs-on: ubuntu-latest
steps:
@@ -31,30 +31,13 @@ jobs:
node-version: '13.x'
- name: Check Prettier formatting
run: ./scripts/prettier-check
- - name: Run Rome lint
- run: ./scripts/dev-rome lint
-
- tests:
- name: Tests
- needs: [lint]
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [ubuntu-latest, windows-latest]
-
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v1
- with:
- node-version: '13.x'
- - name: Run tests
- shell: bash
- run: ./scripts/dev-rome test
+ - name: Run Rome ci
+ run: ./scripts/dev-rome ci
build:
name: Build
runs-on: ubuntu-latest
- needs: [typescript, tests]
+ needs: [typescript, ci]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1

MODIFY
packages/@romejs/core/master/commands/ci.ts
packages/@romejs/core/master/commands/ci.ts
import {commandCategories} from '../../commands';
import {createMasterCommand} from '../../commands';
+import {MasterRequest} from '@romejs/core';
+import Linter from '../linter/Linter';
+import test from './test';
export default createMasterCommand({
category: commandCategories.CODE_QUALITY,
- description: 'install dependencies, run lint and tests',
+ description: 'run lint and tests',
- async default(): Promise<void> {},
+ async default(req: MasterRequest): Promise<void> {
+ const {reporter} = req;
+
+ reporter.heading('Running lint');
+ const linter = new Linter(req);
+ await linter.lint(false);
+
+ reporter.heading('Running tests');
+ await test.default(req, {
+ coverage: true,
+ freezeSnapshots: true,
+ updateSnapshots: false,
+ showAllCoverage: true,
+ });
+ },
});

MODIFY
packages/@romejs/core/master/linter/Linter.ts
packages/@romejs/core/master/linter/Linter.ts
@@ -48,7 +48,7 @@ export default class Linter {
);
}
- async lint() {
+ async lint(throwAlways: boolean = true) {
const {request} = this;
const {reporter} = request;
@@ -124,6 +124,10 @@ export default class Linter {
},
]);
+ if (throwAlways || printer.hasDiagnostics()) {
throw printer;
+ } else {
+ printer.footer();
+ }
}
}

Add `rome ci` command - closes #147