Skip to content

Commit eb4b32b

Browse files
committed
[*] Add tsconfig
1 parent 99a0376 commit eb4b32b

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

scripts/build/after.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sed "s/\.\//\.\//g; s/dist\///g" ./package.json > ./dist/package.json
2+
cp ./README.md ./dist/README.md

scripts/publish.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ publishCommand="pnpm publish --no-git-checks --access public --tag"
66
baseDir=$PWD
77

88
if [[ "$1" == "--canary" ]]; then
9-
version=$version-canary
109
publishCommand="$publishCommand canary"
1110
else
1211
publishCommand="$publishCommand latest"
@@ -15,6 +14,5 @@ fi
1514

1615
echo "📦 - $name@$version"
1716
cd $baseDir/dist
18-
sed -i "s/\"version\": \".*\"/\"version\": \"$version\"/" package.json
19-
# eval $publishCommand
17+
eval $publishCommand
2018

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ const options = program.opts();
1414

1515
const [publicEnvironmentVariables, privateEnvironmentVariables] =
1616
options.environmentVariable?.reduce(
17-
(acc, env) => {
17+
(acc: string[][], env: string) => {
1818
const [key, value] = env.split("=");
19-
if (key.startsWith("NEXT_PUBLIC_")) {
20-
acc[0].push(`-b ${key}="${value}"`);
19+
if (key?.startsWith("NEXT_PUBLIC_")) {
20+
acc[0]?.push(`-b ${key}="${value}"`);
2121
} else {
22-
acc[1].push(`-e ${key}="${value}"`);
22+
acc[1]?.push(`-e ${key}="${value}"`);
2323
}
2424
return acc;
2525
},

tsconfig.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"esModuleInterop": true,
4+
"skipLibCheck": true,
5+
"target": "es2022",
6+
"allowJs": true,
7+
"resolveJsonModule": true,
8+
"moduleDetection": "force",
9+
"isolatedModules": true,
10+
"verbatimModuleSyntax": true,
11+
"strict": true,
12+
"noUncheckedIndexedAccess": true,
13+
"noImplicitOverride": true,
14+
"module": "preserve",
15+
"outDir": "dist",
16+
"sourceMap": true,
17+
"declaration": true,
18+
"lib": ["es2022"]
19+
}
20+
}

tsup.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { defineConfig } from "tsup";
22

33
export default defineConfig({
4+
clean: true,
5+
dts: true,
46
entry: ["src/index.ts"],
5-
splitting: false,
7+
format: ["esm", "cjs"],
68
sourcemap: true,
7-
clean: true,
9+
target: "esnext",
10+
outDir: "dist",
811
});

0 commit comments

Comments
 (0)