Skip to content

Commit 654dcd3

Browse files
committed
Use tsup to bundle code and generate type declarations
1 parent 78c28b7 commit 654dcd3

File tree

3 files changed

+396
-15
lines changed

3 files changed

+396
-15
lines changed

bin/sql-formatter-cli.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
'use strict';
44

5-
const { format, supportedDialects } = require('../dist/sql-formatter.min.cjs');
5+
const { format, supportedDialects } = require('../dist/index.cjs');
66
const fs = require('fs');
77
const tty = require('tty');
88
const { version } = require('../package.json');

package.json

+8-10
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
"version": "14.0.0",
44
"description": "Format whitespace in a SQL query to make it more readable",
55
"license": "MIT",
6-
"main": "dist/sql-formatter.min.cjs",
6+
"main": "dist/index.cjs",
7+
"module": "dist/index.js",
78
"unpkg": "dist/sql-formatter.min.js",
8-
"module": "lib/index.js",
9-
"types": "lib/src/index.d.ts",
109
"exports": {
1110
"./package.json": "./package.json",
1211
".": {
13-
"types": "./lib/src/index.d.ts",
14-
"import": "./lib/index.js",
15-
"require": "./dist/sql-formatter.min.cjs"
12+
"import": "./dist/index.js",
13+
"require": "./dist/index.cjs"
1614
}
1715
},
1816
"bin": {
@@ -64,10 +62,9 @@
6462
"prepare": "yarn clean && yarn grammar && yarn fix && yarn check && yarn build",
6563
"pre-commit": "npm-run-all --parallel ts:changes lint:changes",
6664
"grammar": "nearleyc src/parser/grammar.ne -o src/parser/grammar.ts",
67-
"build:babel": "babel src --out-dir lib --extensions .ts --source-maps",
68-
"build:types": "tsc --emitDeclarationOnly --isolatedModules",
69-
"build:minified": "webpack --config webpack.prod.js && cp dist/sql-formatter.min.cjs dist/sql-formatter.min.js",
70-
"build": "yarn grammar && npm-run-all --parallel build:babel build:types build:minified",
65+
"build:tsup": "tsup src/index.ts --format cjs,esm --sourcemap --dts",
66+
"build:webpack": "webpack --config webpack.prod.js && cp dist/sql-formatter.min.cjs dist/sql-formatter.min.js",
67+
"build": "yarn grammar && npm-run-all --parallel build:tsup build:webpack",
7168
"release": "release-it"
7269
},
7370
"repository": {
@@ -113,6 +110,7 @@
113110
"rimraf": "^3.0.2",
114111
"ts-jest": "^28.0.5",
115112
"ts-loader": "^9.3.1",
113+
"tsup": "^8.0.1",
116114
"typescript": "^4.7.4",
117115
"webpack": "^5.74.0",
118116
"webpack-cli": "^4.9.1",

0 commit comments

Comments
 (0)