Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 14 additions & 3 deletions .github/workflows/coveralls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,32 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [22.x]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node.js 18 and 20 are EOL


steps:
- uses: actions/checkout@v4

# Work around pnpm/action-setup v6 resolving the wrong version from package.json
# https://github.com/pnpm/action-setup/issues/227
- name: Read pnpm version
id: pnpm-version
run: 'echo "version=$(jq --raw-output ''.devEngines.packageManager.version | split("+")[0]'' package.json)" >> "$GITHUB_OUTPUT"'

- uses: pnpm/action-setup@v6
Comment thread
coderabbitai[bot] marked this conversation as resolved.
with:
version: ${{ steps.pnpm-version.outputs.version }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm

- name: Install
run: yarn install --ignore-scripts
run: pnpm install --ignore-scripts

- name: Test
run: yarn test --coverage
run: pnpm run test -- --coverage

- name: Coveralls GitHub Action
uses: coverallsapp/github-action@1.1.3
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/webpack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,41 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [22.x]

steps:
- uses: actions/checkout@v4

# Work around pnpm/action-setup v6 resolving the wrong version from package.json
# https://github.com/pnpm/action-setup/issues/227
- name: Read pnpm version
id: pnpm-version
run: 'echo "version=$(jq --raw-output ''.devEngines.packageManager.version | split("+")[0]'' package.json)" >> "$GITHUB_OUTPUT"'
Comment thread
nene marked this conversation as resolved.

- uses: pnpm/action-setup@v6
with:
version: ${{ steps.pnpm-version.outputs.version }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm

- name: Install
run: yarn install --ignore-scripts
run: pnpm install --ignore-scripts

- name: Format
run: yarn pretty:check
run: pnpm run pretty:check

- name: Lint
run: yarn lint
run: pnpm run lint

- name: Test
run: yarn test
run: pnpm run test

- name: Build
run: yarn build
run: pnpm run build

- name: Typecheck
run: yarn ts:check
run: pnpm run ts:check
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
/dist
/lib
/node_modules
yarn.lock
pnpm-lock.yaml
LICENSE
/src/parser/grammar.ts
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ as SQL Formatter is mostly in maintenance mode.

## Setup

Run `yarn` after checkout to install all dependencies.
Run `pnpm install` after checkout to install all dependencies.

## Tests

Tests can be run with `yarn test`.
Tests can be run with `pnpm test`.

Please add new tests for any new features and bug fixes.
Language-specific tests should be included in their respective `sqldialect.test.ts` files.
Expand All @@ -19,7 +19,7 @@ Tests that apply to all languages should be in `behavesLikeSqlFormatter.ts`.

For those who have admin access on the repo, the new release publish flow is as such:

- `npm run release` (bumps version, git tag, git release, npm release) (does not work with `yarn`).
- `pnpm run release` (bumps version, git tag, git release, npm release).
- `git subtree push --prefix static origin gh-pages` (pushes demo page to GH pages)

[prettier-plugin-sql-cst]: https://github.com/nene/prettier-plugin-sql-cst
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@ It does not support:

## Install

Get the latest version from NPM:
Get the latest version using your package manager of choice:

```sh
npm install sql-formatter
```

Also available with yarn:

```sh
yarn add sql-formatter
npm install sql-formatter # or yarn, pnpm, bun, etc
```

## Usage
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,21 @@
"ts:check": "tsc --noEmit",
"ts:changes": "tsc --noEmit --incremental",
"lint": "eslint --cache .",
"lint:changes": "sh -c eslint --cache $(yarn git:changes)",
"lint:changes": "sh -c 'eslint --cache $(pnpm run --silent git:changes)'",
"pretty": "prettier --write .",
"pretty:check": "prettier --check .",
"fix": "yarn pretty && eslint --fix .",
"test": "yarn grammar && jest",
"test:watch": "yarn test -- --watch",
"test:perf": "yarn grammar && jest --testMatch '<rootDir>/test/perftest.ts' --coverage=false",
"check": "yarn ts:check && yarn pretty:check && yarn lint && yarn test",
"prepare": "yarn clean && yarn grammar && yarn fix && yarn check && yarn build",
"fix": "pnpm run pretty && eslint --fix .",
"test": "pnpm run grammar && jest",
"test:watch": "pnpm run test -- --watch",
"test:perf": "pnpm run grammar && jest --testMatch '<rootDir>/test/perftest.ts' --coverage=false",
"check": "pnpm run ts:check && pnpm run pretty:check && pnpm run lint && pnpm run test",
"prepare": "pnpm run clean && pnpm run grammar && pnpm run fix && pnpm run check && pnpm run build",
"pre-commit": "npm-run-all --parallel ts:changes lint:changes",
"grammar": "nearleyc src/parser/grammar.ne -o src/parser/grammar.ts",
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
"build:esm": "tsc -p tsconfig.esm.json",
"build:webpack": "webpack --config webpack.prod.js && cp dist/sql-formatter.min.cjs dist/sql-formatter.min.js",
"build": "yarn grammar && npm-run-all --parallel build:cjs build:esm build:webpack",
"build": "pnpm run grammar && npm-run-all --parallel build:cjs build:esm build:webpack",
"release": "release-it"
},
"repository": {
Expand All @@ -92,6 +92,7 @@
"@types/babel__core": "^7.1.15",
"@types/jest": "^29.5.14",
"@types/nearley": "^2.11.2",
"@types/node": "22.9.0",
Comment thread
karlhorky marked this conversation as resolved.
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"babel-eslint": "^10.1.0",
Expand Down Expand Up @@ -133,8 +134,8 @@
},
"devEngines": {
"packageManager": {
"name": "yarn",
"version": "1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"name": "pnpm",
"version": "11.0.8+sha512.4c4097e1dd2d42372c4e7fa5a791ff28fc75a484c7ac192e64b1df0fdef17594ba982f9b4fed9adfb3c757846f565b799b2763fb3733d1de1bcb82cf46684912"
Comment thread
nene marked this conversation as resolved.
Comment thread
karlhorky marked this conversation as resolved.
}
}
}
Loading
Loading