Skip to content

Commit 5a9486f

Browse files
committed
Build with tsc instead of tsup
1 parent eb187fe commit 5a9486f

File tree

6 files changed

+33
-584
lines changed

6 files changed

+33
-584
lines changed

bin/sql-formatter-cli.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
'use strict';
44

5-
const { format, supportedDialects } = require('../dist/index.cjs');
5+
const { format, supportedDialects } = require('../dist/cjs/index.js');
66
const fs = require('fs');
77
const path = require('path');
88
const tty = require('tty');

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"version": "15.4.11",
44
"description": "Format whitespace in a SQL query to make it more readable",
55
"license": "MIT",
6-
"main": "dist/index.cjs",
7-
"module": "dist/index.js",
6+
"main": "dist/cjs/index.cjs",
7+
"module": "dist/esm/index.js",
88
"unpkg": "dist/sql-formatter.min.js",
99
"exports": {
1010
"./package.json": "./package.json",
1111
".": {
12-
"import": "./dist/index.js",
13-
"require": "./dist/index.cjs"
12+
"import": "./dist/esm/index.js",
13+
"require": "./dist/cjs/index.cjs"
1414
}
1515
},
1616
"bin": {
@@ -63,9 +63,10 @@
6363
"prepare": "yarn clean && yarn grammar && yarn fix && yarn check && yarn build",
6464
"pre-commit": "npm-run-all --parallel ts:changes lint:changes",
6565
"grammar": "nearleyc src/parser/grammar.ne -o src/parser/grammar.ts",
66-
"build:tsup": "tsup src/index.ts --format cjs,esm --sourcemap --dts",
66+
"build:cjs": "tsc -p tsconfig.cjs.json && echo \"{\"type\": \"commonjs\"}\" > dist/cjs/package.json",
67+
"build:esm": "tsc -p tsconfig.esm.json",
6768
"build:webpack": "webpack --config webpack.prod.js && cp dist/sql-formatter.min.cjs dist/sql-formatter.min.js",
68-
"build": "yarn grammar && npm-run-all --parallel build:tsup build:webpack",
69+
"build": "yarn grammar && npm-run-all --parallel build:cjs build:esm build:webpack",
6970
"release": "release-it"
7071
},
7172
"repository": {
@@ -111,7 +112,6 @@
111112
"rimraf": "^3.0.2",
112113
"ts-jest": "^28.0.5",
113114
"ts-loader": "^9.3.1",
114-
"tsup": "^8.0.1",
115115
"typescript": "^4.7.4",
116116
"webpack": "^5.74.0",
117117
"webpack-cli": "^4.9.1",

tsconfig.cjs.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist/cjs",
5+
"module": "CommonJS",
6+
"moduleResolution": "NodeNext"
7+
},
8+
"include": ["src"]
9+
}

tsconfig.esm.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist/esm",
5+
"module": "NodeNext",
6+
"moduleResolution": "NodeNext"
7+
},
8+
"include": ["src"]
9+
}

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"compilerOptions": {
33
"module": "NodeNext",
4+
"moduleResolution": "NodeNext",
45
"target": "es6",
56
"lib": ["es6", "dom"],
67
"rootDirs": ["src"],

0 commit comments

Comments
 (0)