Skip to content

Commit e733d3d

Browse files
authored
Merge pull request #1 from function-artisans/feat/format-sql
feat: format SQL
2 parents 40078c3 + 0c45212 commit e733d3d

25 files changed

+296
-88
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v5
15+
16+
- name: Use Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: "22"
20+
cache: "npm"
21+
22+
- name: Cache node modules
23+
uses: actions/cache@v4
24+
with:
25+
path: node_modules
26+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-node-
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Run ESLint
34+
run: npm run eslint
35+
36+
- name: Run lint
37+
run: npm run lint
38+
39+
- name: Run build
40+
run: npm run build

package-lock.json

Lines changed: 89 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
"description": "Format code on the clipboard",
66
"icon": "icon.png",
77
"author": "ikaraszi",
8-
"categories": [
9-
"Developer Tools"
10-
],
8+
"categories": ["Developer Tools"],
119
"license": "MIT",
1210
"commands": [
1311
{
@@ -105,6 +103,12 @@
105103
"title": "Format YAML",
106104
"description": "Formats YAML on the clipboard",
107105
"mode": "view"
106+
},
107+
{
108+
"name": "format-sql",
109+
"title": "Format SQL",
110+
"description": "Formats SQL on the clipboard",
111+
"mode": "view"
108112
}
109113
],
110114
"preferences": [
@@ -115,12 +119,41 @@
115119
"description": "Specify the line length that the printer will wrap on.",
116120
"placeholder": "100",
117121
"required": false
122+
},
123+
{
124+
"name": "sqlDialect",
125+
"title": "SQL dialect",
126+
"type": "dropdown",
127+
"description": "Set the SQL dialect",
128+
"data": [
129+
{ "value": "sql", "title": "Standard SQL" },
130+
{ "value": "bigquery", "title": "GCP BigQuery" },
131+
{ "value": "db2", "title": "IBM DB2" },
132+
{ "value": "db2i", "title": "IBM DB2i (experimental)" },
133+
{ "value": "duckdb", "title": "DuckDB" },
134+
{ "value": "hive", "title": "Apache Hive" },
135+
{ "value": "mariadb", "title": "MariaDB" },
136+
{ "value": "mysql", "title": "MySQL" },
137+
{ "value": "tidb", "title": "TiDB" },
138+
{ "value": "n1ql", "title": "Couchbase N1QL" },
139+
{ "value": "plsql", "title": "Oracle PL/SQL" },
140+
{ "value": "postgresql", "title": "PostgreSQL" },
141+
{ "value": "redshift", "title": "Amazon Redshift" },
142+
{ "value": "singlestoredb", "title": "SingleStoreDB" },
143+
{ "value": "snowflake", "title": "Snowflake" },
144+
{ "value": "spark", "title": "Spark" },
145+
{ "value": "sqlite", "title": "SQLite" },
146+
{ "value": "transactsql", "title": "SQL Server Transact-SQL" },
147+
{ "value": "trino", "title": "Trino / Presto" }
148+
],
149+
"required": false
118150
}
119151
],
120152
"dependencies": {
121153
"@raycast/api": "^1.55.2",
122154
"@raycast/utils": "^1.8.0",
123-
"prettier": "^2.8.8"
155+
"prettier": "^2.8.8",
156+
"sql-formatter": "^15.6.2"
124157
},
125158
"devDependencies": {
126159
"@raycast/eslint-config": "1.0.5",
@@ -134,6 +167,7 @@
134167
"build": "ray build -e dist",
135168
"dev": "ray develop",
136169
"fix-lint": "ray lint --fix",
170+
"eslint": "eslint src",
137171
"lint": "ray lint",
138172
"publish": "npx @raycast/api@latest publish"
139173
}

src/format-angular.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import format from "./format";
1+
import prettier from "./prettier";
22

3-
export default format.angular;
3+
export default prettier.angular;

src/format-css.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import format from "./format";
1+
import prettier from "./prettier";
22

3-
export default format.css;
3+
export default prettier.css;

src/format-glimmer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import format from "./format";
1+
import prettier from "./prettier";
22

3-
export default format.glimmer;
3+
export default prettier.glimmer;

src/format-graphql.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import format from "./format";
1+
import prettier from "./prettier";
22

3-
export default format.graphql;
3+
export default prettier.graphql;

src/format-html.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import format from "./format";
1+
import prettier from "./prettier";
22

3-
export default format.html;
3+
export default prettier.html;

src/format-javascript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import format from "./format";
1+
import prettier from "./prettier";
22

3-
export default format.javascript;
3+
export default prettier.javascript;

src/format-json.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import format from "./format";
1+
import prettier from "./prettier";
22

3-
export default format.json;
3+
export default prettier.json;

0 commit comments

Comments
 (0)