Skip to content

Commit 1882ff2

Browse files
committed
Merge PR: Run typechecking in CI (#843)
2 parents e8061c7 + 8e3f637 commit 1882ff2

7 files changed

+1022
-1552
lines changed

Diff for: 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/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');

Diff for: package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "sql-formatter",
3-
"version": "15.4.11",
3+
"version": "15.5.0-beta.2",
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": "^29.2.6",
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",

Diff for: tsconfig.cjs.json

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

Diff for: tsconfig.esm.json

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

Diff for: tsconfig.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"compilerOptions": {
33
"module": "NodeNext",
4+
"moduleResolution": "NodeNext",
45
"target": "es6",
56
"lib": ["es6", "dom"],
67
"rootDirs": ["src"],
7-
"outDir": "lib",
88
"baseUrl": "./",
99
"sourceMap": true,
1010
"declaration": true,
1111
"esModuleInterop": true,
12-
"strict": true /* enable all strict type-checking options */,
13-
/* Additional Checks */
14-
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */
12+
// Enable all strict type-checking options.
13+
"strict": true,
14+
// Report error when not all code paths in function return a value.
15+
"noImplicitReturns": true
1516
},
1617
"include": ["src", "test", "static"],
1718
"exclude": ["node_modules"]

Diff for: webpack.common.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,18 @@ export default {
2020
{
2121
test: /\.ts$/u,
2222
exclude: /node_modules/u,
23-
use: ['babel-loader', 'ts-loader'],
23+
use: [
24+
'babel-loader',
25+
{
26+
loader: 'ts-loader',
27+
options: {
28+
// Prevent `ts-loader` from emitting types to the `lib` directory.
29+
// This also disables type-checking, which is already performed
30+
// independently of the webpack build process.
31+
transpileOnly: true,
32+
},
33+
},
34+
],
2435
},
2536
{
2637
test: /\.js$/u,

0 commit comments

Comments
 (0)