Skip to content

Commit 75add8f

Browse files
committed
feat: sqlformat 0.5.0
1 parent e86e127 commit 75add8f

26 files changed

Lines changed: 601 additions & 238 deletions
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: check_updates
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# do this once per day
7+
- cron: "0 7 * * *"
8+
9+
jobs:
10+
build:
11+
name: check updates
12+
if: github.repository == 'dprint/dprint-plugin-sql'
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 45
15+
16+
steps:
17+
- name: Clone repository
18+
uses: actions/checkout@v6
19+
with:
20+
token: ${{ secrets.GH_DPRINTBOT_PAT }}
21+
22+
- uses: denoland/setup-deno@v2
23+
- uses: dsherret/rust-toolchain-file@v1
24+
25+
- name: Run script
26+
run: |
27+
git config user.email "dprintbot@users.noreply.github.com"
28+
git config user.name "dprintbot"
29+
deno run -A ./scripts/update.ts
30+
# This is necessary to prevent GH automatically disabling this workflow after 60 days.
31+
workflow-keepalive:
32+
if: github.event_name == 'schedule'
33+
runs-on: ubuntu-latest
34+
permissions:
35+
actions: write
36+
steps:
37+
- uses: liskin/gh-workflow-keepalive@f72ff1a1336129f29bf0166c0fd0ca6cf1bcb38c

.github/workflows/ci.yml

Lines changed: 90 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,90 @@
1-
name: CI
2-
3-
on: [push, pull_request]
4-
5-
jobs:
6-
build:
7-
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
8-
runs-on: ${{ matrix.config.os }}
9-
strategy:
10-
matrix:
11-
config:
12-
- os: ubuntu-latest
13-
kind: test_release
14-
- os: ubuntu-latest
15-
kind: test_debug
16-
17-
env:
18-
CARGO_INCREMENTAL: 0
19-
RUST_BACKTRACE: full
20-
21-
steps:
22-
- uses: actions/checkout@v3
23-
- uses: dsherret/rust-toolchain-file@v1
24-
- name: Install wasm32 target
25-
if: matrix.config.kind == 'test_release'
26-
run: rustup target add wasm32-unknown-unknown
27-
28-
- uses: Swatinem/rust-cache@v2
29-
with:
30-
save-if: ${{ github.ref == 'refs/heads/main' }}
31-
32-
- name: Build debug
33-
if: matrix.config.kind == 'test_debug'
34-
run: cargo build --verbose
35-
- name: Build release
36-
if: matrix.config.kind == 'test_release'
37-
run: cargo build --target wasm32-unknown-unknown --features wasm --release --verbose
38-
39-
- name: Test debug
40-
if: matrix.config.kind == 'test_debug'
41-
run: cargo test --verbose
42-
- name: Test release
43-
if: matrix.config.kind == 'test_release'
44-
run: cargo test --release --verbose
45-
46-
- name: Get tag version
47-
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
48-
id: get_tag_version
49-
run: echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}
50-
51-
# NPM
52-
- uses: actions/setup-node@v2
53-
if: matrix.config.kind == 'test_release'
54-
with:
55-
node-version: '18.x'
56-
registry-url: 'https://registry.npmjs.org'
57-
58-
- name: Setup and test npm deployment
59-
if: matrix.config.kind == 'test_release'
60-
run: |
61-
cd deployment/npm
62-
npm install
63-
node setup.js ${{ steps.get_tag_version.outputs.TAG_VERSION }}
64-
npm run test
65-
66-
- name: npm publish
67-
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
68-
env:
69-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
70-
run: |
71-
cd deployment/npm
72-
npm publish --access public
73-
git reset --hard
74-
75-
# CARGO PUBLISH
76-
- name: Cargo login
77-
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
78-
run: cargo login ${{ secrets.CRATES_TOKEN }}
79-
80-
- name: Cargo publish
81-
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
82-
run: cargo publish
83-
84-
# GITHUB RELEASE
85-
- name: Pre-release
86-
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
87-
run: |
88-
# update config schema to have version
89-
sed -i 's/sql\/0.0.0/sql\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/' deployment/schema.json
90-
# rename the wasm file
91-
(cd target/wasm32-unknown-unknown/release/ && mv dprint_plugin_sql.wasm plugin.wasm)
92-
- name: Release
93-
uses: softprops/action-gh-release@v1
94-
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
95-
env:
96-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97-
with:
98-
files: |
99-
target/wasm32-unknown-unknown/release/plugin.wasm
100-
deployment/schema.json
101-
body: |
102-
## Install
103-
104-
[Install](https://dprint.dev/install/) and [setup](https://dprint.dev/setup/) dprint.
105-
106-
Then in your project's dprint configuration file:
107-
108-
1. Specify the plugin url in the `"plugins"` array.
109-
2. Add a `"sql"` configuration property if desired.
110-
```jsonc
111-
{
112-
// ...etc...
113-
"sql": {
114-
// sql config goes here
115-
},
116-
"plugins": [
117-
"https://plugins.dprint.dev/sql-${{ steps.get_tag_version.outputs.TAG_VERSION }}.wasm"
118-
]
119-
}
120-
```
121-
122-
## JS Formatting API
123-
124-
* [JS Formatter](https://github.com/dprint/js-formatter) - Browser/Deno and Node
125-
* [npm package](https://www.npmjs.com/package/@dprint/sql)
126-
draft: false
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
8+
runs-on: ${{ matrix.config.os }}
9+
strategy:
10+
matrix:
11+
config:
12+
- os: ubuntu-latest
13+
kind: test_release
14+
- os: ubuntu-latest
15+
kind: test_debug
16+
17+
env:
18+
CARGO_INCREMENTAL: 0
19+
RUST_BACKTRACE: full
20+
21+
steps:
22+
- uses: actions/checkout@v6
23+
- uses: dsherret/rust-toolchain-file@v1
24+
- name: Install wasm32 target
25+
if: matrix.config.kind == 'test_release'
26+
run: rustup target add wasm32-unknown-unknown
27+
28+
- uses: Swatinem/rust-cache@v2
29+
with:
30+
save-if: ${{ github.ref == 'refs/heads/main' }}
31+
32+
- name: Build debug
33+
if: matrix.config.kind == 'test_debug'
34+
run: cargo build
35+
- name: Build release
36+
if: matrix.config.kind == 'test_release'
37+
run: cargo build --target wasm32-unknown-unknown --features wasm --release
38+
39+
- name: Test debug
40+
if: matrix.config.kind == 'test_debug'
41+
run: cargo test
42+
- name: Test release
43+
if: matrix.config.kind == 'test_release'
44+
run: cargo test --release
45+
46+
- name: Get tag version
47+
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
48+
id: get_tag_version
49+
run: echo "TAG_VERSION=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_OUTPUT"
50+
51+
# NPM
52+
- uses: actions/setup-node@v6
53+
if: matrix.config.kind == 'test_release'
54+
with:
55+
node-version: '24.x'
56+
registry-url: 'https://registry.npmjs.org'
57+
58+
- name: Setup and test npm deployment
59+
if: matrix.config.kind == 'test_release'
60+
run: |
61+
cd deployment/npm
62+
npm install
63+
node setup.js
64+
npm run test
65+
66+
# GITHUB RELEASE
67+
- uses: denoland/setup-deno@v2
68+
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
69+
with:
70+
deno-version: v2.x
71+
- name: Pre-release
72+
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
73+
run: |
74+
# update config schema to have version
75+
sed -i 's/sql\/0.0.0/sql\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/' deployment/schema.json
76+
# rename the wasm file
77+
(cd target/wasm32-unknown-unknown/release/ && mv dprint_plugin_sql.wasm plugin.wasm)
78+
# create release notes
79+
deno run -A ./scripts/generateReleaseNotes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} > ${{ github.workspace }}-CHANGELOG.txt
80+
- name: Release
81+
uses: softprops/action-gh-release@v2
82+
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
with:
86+
files: |
87+
target/wasm32-unknown-unknown/release/plugin.wasm
88+
deployment/schema.json
89+
body_path: ${{ github.workspace }}-CHANGELOG.txt
90+
draft: false

.github/workflows/publish_npm.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: publish npm
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '*'
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
build:
15+
name: publish-npm
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v6
19+
- uses: dsherret/rust-toolchain-file@v1
20+
- name: Install wasm32 target
21+
run: rustup target add wasm32-unknown-unknown
22+
- name: Build release
23+
run: cargo build --target wasm32-unknown-unknown --features wasm --release
24+
25+
- uses: actions/setup-node@v6
26+
with:
27+
node-version: '24.x'
28+
registry-url: 'https://registry.npmjs.org'
29+
- name: Setup and test npm deployment
30+
run: |
31+
cd deployment/npm
32+
npm install
33+
node setup.js sync-version
34+
npm run test
35+
- name: npm publish
36+
run: |
37+
cd deployment/npm
38+
npm publish --access public

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020

2121
steps:
2222
- name: Clone repository
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v6
2424
with:
2525
token: ${{ secrets.GH_DPRINTBOT_PAT }}
2626

27-
- uses: denoland/setup-deno@v1
27+
- uses: denoland/setup-deno@v2
2828
- uses: dsherret/rust-toolchain-file@v1
2929

3030
- name: Bump version and tag
@@ -34,4 +34,4 @@ jobs:
3434
run: |
3535
git config user.email "${{ github.actor }}@users.noreply.github.com"
3636
git config user.name "${{ github.actor }}"
37-
deno run -A https://raw.githubusercontent.com/dprint/automation/0.5.1/tasks/publish_release.ts --${{github.event.inputs.releaseKind}}
37+
deno run -A https://raw.githubusercontent.com/dprint/automation/0.10.0/tasks/publish_release.ts --${{github.event.inputs.releaseKind}}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
.claude
12
/target
23
Cargo.lock
3-
deployment/npm/buffer.generated.js
4+
deployment/npm/plugin.wasm
45
deployment/npm/node_modules

.rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
max_width = 120
22
tab_spaces = 2
3-
edition = "2021"
3+
edition = "2024"

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "dprint-plugin-sql"
33
version = "0.2.0"
44
authors = ["David Sherret <dsherret@gmail.com>"]
5-
edition = "2021"
5+
edition = "2024"
66
homepage = "https://github.com/dprint/dprint-plugin-sql"
77
keywords = ["formatting", "formatter", "sql"]
88
license = "MIT"
@@ -25,11 +25,11 @@ wasm = ["serde_json", "dprint-core/wasm"]
2525

2626
[dependencies]
2727
anyhow = "1.0.51"
28-
dprint-core = { version = "0.62.1", features = ["formatting"] }
28+
dprint-core = { version = "0.67.4", default-features = false }
2929
serde = { version = "1.0.88", features = ["derive"] }
3030
serde_json = { version = "1.0", optional = true }
31-
sqlformat = "0.2.1"
31+
sqlformat = "0.5.0"
3232

3333
[dev-dependencies]
34-
dprint-development = "0.9.3"
34+
dprint-development = "0.10.1"
3535
serde_json = { version = "1.0" }

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2021-2022 David Sherret
3+
Copyright (c) 2021 David Sherret
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

deno.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"imports": {
3+
"automation": "https://raw.githubusercontent.com/dprint/automation/0.10.0/mod.ts",
4+
"automation/": "https://raw.githubusercontent.com/dprint/automation/0.10.0/"
5+
}
6+
}

0 commit comments

Comments
 (0)