@jterrazz/typescript 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENCE +1 -1
- package/README.md +9 -9
- package/bin/swc-compile.sh +12 -5
- package/bin/swc-watch.sh +11 -2
- package/package.json +2 -2
- package/tsconfig/expo.json +14 -13
- package/tsconfig/node-esm.json +13 -12
package/LICENCE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2O25 Jean-Baptiste Terrazzoni <jterrazzoni@gmail.com>. All rights reserved.
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ This package provides a consistent TypeScript configuration for projects. It inc
|
|
|
7
7
|
Install the package globally or locally:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install @jterrazz/
|
|
10
|
+
npm install @jterrazz/typescript
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
@@ -19,21 +19,21 @@ Use the provided `tsconfig.json` in your project:
|
|
|
19
19
|
```json5
|
|
20
20
|
// tsconfig.json
|
|
21
21
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
extends: '@jterrazz/typescript/tsconfig/node-esm',
|
|
23
|
+
compilerOptions: {
|
|
24
|
+
// Your custom compiler options here
|
|
25
|
+
},
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
### Commands
|
|
30
30
|
|
|
31
|
-
-
|
|
32
|
-
-
|
|
31
|
+
- `swc-compiler`: Compile TypeScript files using SWC.
|
|
32
|
+
- `swc-runner`: Execute TypeScript files using SWC.
|
|
33
33
|
|
|
34
34
|
## Implementation Details
|
|
35
35
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
36
|
+
- The package reads directly from the `tsconfig.json` file, keeping the implementation details hidden.
|
|
37
|
+
- Consumers don't need to worry about the underlying scripts.
|
|
38
38
|
|
|
39
39
|
Happy coding!
|
package/bin/swc-compile.sh
CHANGED
|
@@ -8,13 +8,20 @@ if [ $? -ne 0 ]; then
|
|
|
8
8
|
echo "$0: Can't create temporary .swcrc file"
|
|
9
9
|
exit 1
|
|
10
10
|
fi
|
|
11
|
-
tsconfig-to-swcconfig --output="$TMP_SWCRC"
|
|
11
|
+
npx tsconfig-to-swcconfig --output="$TMP_SWCRC"
|
|
12
12
|
|
|
13
13
|
# Create typescript declaration files
|
|
14
|
-
tsc --declaration --emitDeclarationOnly --outDir "$OUT_PATH"
|
|
14
|
+
npx tsc --rootDir "$IN_PATH" --declaration --emitDeclarationOnly --outDir "$OUT_PATH"
|
|
15
15
|
|
|
16
|
-
# Create javascript ESM files
|
|
17
|
-
swc "$IN_PATH"
|
|
16
|
+
# Create javascript ESM files with improved source maps
|
|
17
|
+
npx swc "$IN_PATH" \
|
|
18
|
+
--source-maps \
|
|
19
|
+
--copy-files \
|
|
20
|
+
--config-file "$TMP_SWCRC" \
|
|
21
|
+
--out-dir "$OUT_PATH" \
|
|
22
|
+
--strip-leading-paths \
|
|
23
|
+
--log-watch-compilation \
|
|
24
|
+
"$@"
|
|
18
25
|
|
|
19
26
|
# Create javascript CJS files
|
|
20
|
-
rollup $OUT_PATH/index.js --format cjs --
|
|
27
|
+
npx rollup "$OUT_PATH/index.js" --format cjs --file "$OUT_PATH/index.cjs"
|
package/bin/swc-watch.sh
CHANGED
|
@@ -8,7 +8,16 @@ if [ $? -ne 0 ]; then
|
|
|
8
8
|
echo "$0: Can't create temporary .swcrc file"
|
|
9
9
|
exit 1
|
|
10
10
|
fi
|
|
11
|
-
tsconfig-to-swcconfig --output="$TMP_SWCRC"
|
|
11
|
+
npx tsconfig-to-swcconfig --output="$TMP_SWCRC"
|
|
12
12
|
|
|
13
13
|
# Watch for changes in the src directory, compile and run
|
|
14
|
-
nodemon --quiet
|
|
14
|
+
npx nodemon --quiet \
|
|
15
|
+
--watch src \
|
|
16
|
+
--ext '*' \
|
|
17
|
+
--exec "npx swc $IN_PATH \
|
|
18
|
+
--source-maps \
|
|
19
|
+
--copy-files \
|
|
20
|
+
--config-file $TMP_SWCRC \
|
|
21
|
+
--out-dir $OUT_PATH \
|
|
22
|
+
--strip-leading-paths \
|
|
23
|
+
&& node --enable-source-maps $OUT_PATH/index.js"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jterrazz/typescript",
|
|
3
3
|
"author": "Jean-Baptiste Terrazzoni <jterrazzoni@gmail.com>",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.3",
|
|
5
5
|
"files": [
|
|
6
6
|
"tsconfig",
|
|
7
7
|
"bin"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@jterrazz/
|
|
16
|
+
"@jterrazz/quality": "^1.6.1"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@swc/cli": "0.6.0",
|
package/tsconfig/expo.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
2
|
+
"display": "Expo",
|
|
3
|
+
"include": ["./src/"],
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"jsx": "react-native",
|
|
9
|
+
"lib": ["DOM", "ESNext"],
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"target": "ESNext"
|
|
15
|
+
},
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
|
|
17
18
|
}
|
package/tsconfig/node-esm.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
2
|
+
"display": "ESM",
|
|
3
|
+
"include": ["./src/"],
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"types": ["node", "jest"],
|
|
9
|
+
"strict": true,
|
|
10
|
+
"experimentalDecorators": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"skipLibCheck": true
|
|
14
|
+
},
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
|
|
16
17
|
}
|