Skip to content

Commit 9d30c4b

Browse files
v5.0.0-beta.1
* add pre-commit * add pre-commit hook * rename to prettier-sql package.json * update index.html * update README * rename webpack * add release-it * release-it json * add webpack workflow * add --ignore-scripts flag to skip prepare * remove travis config * move test step before build * add workflow to develop and master push * add coveralls * update README.md * update version
1 parent 84b513e commit 9d30c4b

File tree

10 files changed

+1361
-81
lines changed

10 files changed

+1361
-81
lines changed

.github/workflows/coveralls.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Coveralls
2+
3+
on:
4+
push:
5+
branches: [master, develop]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
node-version: [16.x]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
23+
- name: Install
24+
run: yarn install --ignore-scripts
25+
26+
- name: Test
27+
run: yarn test --coverage
28+
29+
- name: Coveralls GitHub Action
30+
uses: coverallsapp/[email protected]
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/webpack.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: NodeJS with Webpack
2+
3+
on:
4+
pull_request:
5+
branches: [master, develop]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
matrix:
13+
node-version: [12.x, 14.x, 16.x]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
23+
- name: Install
24+
run: yarn install --ignore-scripts
25+
26+
- name: Test
27+
run: yarn test
28+
29+
- name: Build
30+
run: yarn build

.release-it.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"hooks": {},
3+
"git": {
4+
"changelog": "git log --pretty=format:\"* %s (%h)\" ${latestTag}...HEAD",
5+
"requireCleanWorkingDir": true,
6+
"requireBranch": "master",
7+
"requireUpstream": true,
8+
"requireCommits": false,
9+
"addUntrackedFiles": false,
10+
"commit": false,
11+
"tag": true,
12+
"tagAnnotation": "${version}",
13+
"push": true,
14+
"pushArgs": ["--follow-tags"],
15+
"pushRepo": ""
16+
},
17+
"npm": {
18+
"publish": true,
19+
"publishPath": ".",
20+
"publishArgs": [],
21+
"tag": null,
22+
"otp": null,
23+
"ignoreVersion": true,
24+
"skipChecks": false,
25+
"timeout": 10
26+
},
27+
"github": {
28+
"release": true,
29+
"releaseName": "${version}",
30+
"releaseNotes": "git log --pretty=format:\"* %s (%h)\" ${latestTag}...HEAD",
31+
"preRelease": true,
32+
"draft": false,
33+
"skipChecks": false,
34+
"web": true
35+
}
36+
}

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SQL Formatter [![NPM version](https://img.shields.io/npm/v/sql-formatter.svg)](https://npmjs.com/package/sql-formatter) [![Build Status](https://travis-ci.org/zeroturnaround/sql-formatter.svg?branch=master)](https://travis-ci.org/zeroturnaround/sql-formatter) [![Coverage Status](https://coveralls.io/repos/github/zeroturnaround/sql-formatter/badge.svg?branch=master)](https://coveralls.io/github/zeroturnaround/sql-formatter?branch=master)
1+
# SQL Formatter [![NPM version](https://img.shields.io/npm/v/prettier-sql.svg)](https://npmjs.com/package/prettier-sql) ![Dev Build](https://github.com/github/docs/actions/workflows/webpack.yaml/badge.svg?event=push&branch=develop) ![Prod Build](https://github.com/github/docs/actions/workflows/webpack.yaml/badge.svg?event=push&branch=master) [![Coverage Status](https://coveralls.io/repos/github/inferrinizzard/prettier-sql/badge.svg?branch=master)](https://coveralls.io/github/inferrrinizzard/prettier-sql?branch=master)
22

33
**SQL Formatter** is a JavaScript library for pretty-printing SQL queries.
44
It started as a port of a [PHP Library][], but has since considerably diverged.
@@ -21,7 +21,7 @@ It does not support:
2121
- Stored procedures.
2222
- Changing of the delimiter type to something else than `;`.
2323

24-
[Try the demo.](https://zeroturnaround.github.io/sql-formatter/)
24+
[Try the demo.](https://inferrinizzard.github.io/prettier-sql/)
2525

2626
# Table of contents
2727

@@ -37,15 +37,15 @@ It does not support:
3737
Get the latest version from NPM:
3838

3939
```sh
40-
npm install sql-formatter
40+
npm install prettier-sql
4141
```
4242

4343
## Usage
4444

4545
### Usage as library
4646

4747
```js
48-
import { format } from 'sql-formatter';
48+
import { format } from 'prettier-sql';
4949

5050
console.log(format('SELECT * FROM tbl'));
5151
```
@@ -97,11 +97,11 @@ WHERE
9797

9898
### Usage from command line
9999

100-
The CLI tool will be installed under `sql-formatter`
101-
and may be invoked via `npx sql-formatter`:
100+
The CLI tool will be installed under `prettier-sql`
101+
and may be invoked via `npx prettier-sql`:
102102

103103
```sh
104-
sql-formatter -h
104+
prettier-sql -h
105105
```
106106

107107
```
@@ -128,7 +128,7 @@ By default, the tool takes queries from stdin and processes them to stdout but
128128
one can also name an input file name or use the `--output` option.
129129

130130
```sh
131-
echo 'select * from tbl where id = 3' | sql-formatter
131+
echo 'select * from tbl where id = 3' | prettier-sql
132132
```
133133

134134
```sql
@@ -184,7 +184,7 @@ npm run check
184184

185185
## License
186186

187-
[MIT](https://github.com/zeroturnaround/sql-formatter/blob/master/LICENSE)
187+
[MIT](https://github.com/inferrinizzard/prettier-sql/blob/master/LICENSE)
188188

189189
[php library]: https://github.com/jdorn/sql-formatter
190190
[standard sql]: https://en.wikipedia.org/wiki/SQL:2011

index.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
<head>
55
<meta charset="utf-8" />
66

7-
<title>SQL formatter</title>
8-
<meta name="description" content="A whitespace formatter for different query languages" />
7+
<title>Prettier SQL Formatter</title>
8+
<meta property="og:title" content="Prettier SQL" />
99

10-
<meta property="og:title" content="SQL Formatter" />
10+
<meta name="description" content="A whitespace formatter for different query languages" />
1111
<meta
1212
property="og:description"
1313
content="A whitespace formatter for different query languages"
1414
/>
15-
<meta property="og:url" content="https://zeroturnaround.github.io/sql-formatter" />
15+
<meta property="og:url" content="https://inferrinizzard.github.io/prettier-sql" />
1616

17-
<link rel="shortcut icon" href="https://static.zeroturnaround.com/theme55/images/favicon.ico" />
17+
<!-- <link rel="shortcut icon" href="https://static.inferrinizzard.com/theme55/images/favicon.ico" /> -->
1818

1919
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet" />
2020

@@ -81,14 +81,14 @@
8181

8282
<body>
8383
<header>
84-
<h1>SQL Formatter</h1>
84+
<h1>Prettier SQL Formatter</h1>
8585

8686
<div class="buttons">
87-
<a href="https://www.npmjs.com/package/sql-formatter">
88-
<img src="https://img.shields.io/npm/v/sql-formatter.svg" height="18" />
87+
<a href="https://www.npmjs.com/package/prettier-sql">
88+
<img src="https://img.shields.io/npm/v/prettier-sql.svg" height="18" />
8989
</a>
9090
<iframe
91-
src="https://ghbtns.com/github-btn.html?user=zeroturnaround&repo=sql-formatter&type=star&count=true"
91+
src="https://ghbtns.com/github-btn.html?user=inferrinizzard&repo=prettier-sql&type=star&count=true"
9292
frameborder="0"
9393
scrolling="0"
9494
width="120px"
@@ -134,13 +134,13 @@ <h1>SQL Formatter</h1>
134134
</main>
135135

136136
<!-- Load from local (for development) -->
137-
<script type="text/javascript" src="dist/sql-formatter.js"></script>
137+
<script type="text/javascript" src="dist/prettier-sql.js"></script>
138138
<!-- Fallback to reading from npm -->
139139
<script>
140140
window.sqlFormatter ||
141141
document.write(
142142
unescape(
143-
'%3Cscript type="text/javascript" src="https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js"%3E%3C/script%3E'
143+
'%3Cscript type="text/javascript" src="https://unpkg.com/prettier-sql@latest/dist/prettier-sql.min.js"%3E%3C/script%3E'
144144
)
145145
);
146146
</script>

package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "sql-formatter",
3-
"version": "5.0.0-beta",
2+
"name": "prettier-sql",
3+
"version": "5.0.0-beta.1",
44
"description": "Format whitespace in a SQL query to make it more readable",
55
"license": "MIT",
66
"main": "lib/sqlFormatter.js",
77
"bin": {
8-
"sql-formatter": "./bin/sqlfmt.js"
8+
"prettier-sql": "./bin/sqlfmt.js"
99
},
1010
"keywords": [
1111
"sql",
@@ -71,12 +71,15 @@
7171
"build:umd:min": "webpack --config webpack.prod.js",
7272
"build": "npm run build:commonjs && npm run build:umd && npm run build:umd:min"
7373
},
74+
"pre-commit": [
75+
"fix"
76+
],
7477
"repository": {
7578
"type": "git",
76-
"url": "https://github.com/zeroturnaround/sql-formatter.git"
79+
"url": "https://github.com/inferrinizzard/prettier-sql.git"
7780
},
7881
"bugs": {
79-
"url": "https://github.com/zeroturnaround/sql-formatter/issues"
82+
"url": "https://github.com/inferrinizzard/prettier-sql/issues"
8083
},
8184
"dependencies": {
8285
"argparse": "^2.0.1"
@@ -102,7 +105,9 @@
102105
"eslint-plugin-import": "^2.22.0",
103106
"eslint-plugin-prettier": "^3.1.4",
104107
"jest": "^26.1.0",
108+
"pre-commit": "^1.2.2",
105109
"prettier": "^2.0.5",
110+
"release-it": "^14.11.7",
106111
"rimraf": "^3.0.2",
107112
"typescript": "^4.3.5",
108113
"webpack": "^4.43.0",

webpack.common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
entry: './src/sqlFormatter.ts',
55
output: {
66
path: path.join(__dirname, 'dist'),
7-
filename: 'sql-formatter.js',
7+
filename: 'prettier-sql.js',
88
library: 'sqlFormatter',
99
libraryTarget: 'umd',
1010
},

webpack.prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ module.exports = merge(common, {
55
mode: 'production',
66
devtool: 'source-map',
77
output: {
8-
filename: 'sql-formatter.min.js',
8+
filename: 'prettier-sql.min.js',
99
},
1010
});

0 commit comments

Comments
 (0)