Skip to content

Commit

Permalink
chore: maintenance, CI and misc improvements (#106)
Browse files Browse the repository at this point in the history
* chore: upgrade packages, cleanup configs, use ts for scripts

* chore: update textmate grammars and api schema

* ci: test on ubuntu, windows and mac on node 18, 20 and 22

* chore: stray comment, tsconfig tweaks

* chore: fix lint, ci, tests

* ci: macos 13 runs on apple silicon

* ci: only run e2e on ubuntu for the moment

* fix: fast-glob, move check in deleteProject

* ci: enable logger debug output in tests when debugging
  • Loading branch information
cyyynthia authored Sep 12, 2024
1 parent c128d1d commit 2e30591
Show file tree
Hide file tree
Showing 196 changed files with 26,666 additions and 45,463 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ root = true
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

Expand Down
26 changes: 0 additions & 26 deletions .eslintrc.json

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
prerelease:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: cache-node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: cache-node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
Expand Down
44 changes: 27 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ on:

jobs:
eslint:
name: Eslint
name: ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: cache-node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -25,15 +25,20 @@ jobs:
run: npm run eslint

test-unit:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [18, 20, 22]

name: Unit Tests
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: ${{ matrix.node }}
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: cache-node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -44,15 +49,20 @@ jobs:
run: npm run test:unit

test-e2e:
strategy:
matrix:
os: [ubuntu-latest] # TODO: windows-latest, macos-12 (or latest if M3-powered) -- broken Docker support... :(
node: [18, 20, 22]

name: E2E Tests
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: ${{ matrix.node }}
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: cache-node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -73,12 +83,12 @@ jobs:
name: Package integrity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.npm
key: cache-node-modules-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
Expand Down
8 changes: 4 additions & 4 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ These are the runnable scripts with `npm run`:

General:

- `run-dev`: Run the CLI (with `ts-node`). Use `--` to pass arguments to the CLI rather than NPM: \
- `run-dev`: Run the CLI (with [`tsx`](https://github.com/privatenumber/tsx)). Use `--` to pass arguments to the CLI rather than NPM: \
`npm run run-dev -- extract print --extractor react src/**/*.tsx`
- `build`: Build the CLI.
- `prettier`: Run Prettier.
- `lint`: Run Prettier but does not update files (report-only).
- `eslint`: Run ESLint.
- `format`: Run ESLint with --fix.
- `schema`: Generate REST API schemas (see [REST Client](#rest-client))

Tests:
Expand Down Expand Up @@ -69,7 +69,7 @@ The Tolgee Extractor/Code Analyzer is one of the biggest components of the CLI,

#### Adding new TextMate grammars

To add new TextMate grammars, **do not do it manually**! Modify the `scripts/grammars.js` file following these
To add new TextMate grammars, **do not do it manually**! Modify the `scripts/grammars.ts` file following these
steps:

- Add the URL to the grammar file to the `Grammars` dictionary.
Expand Down
36 changes: 36 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettierRecommended from 'eslint-plugin-prettier/recommended';

export default tseslint.config({
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
files: [
'src/**/*.{js,ts,mjs,cjs,tsx,jsx}',
'test/**/*.{js,ts,mjs,cjs,tsx,jsx}',
'scripts/**/*.{js,ts,mjs,cjs,tsx,jsx}',
'*.config.{js,ts}',
],
ignores: ['**/*.generated.ts', 'dist/**/*', 'dist-types/**/*'],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
prettierRecommended,
],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'none',
varsIgnorePattern: '^_',
},
],
},
});
Loading

0 comments on commit 2e30591

Please sign in to comment.