-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: typescript 빌드 설정 수정 및 빌드 스크립트 작성
- Loading branch information
1 parent
7665f02
commit b7d4a9e
Showing
7 changed files
with
66 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"module": "CommonJS", | ||
"outDir": "./" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"module": "ES2020", | ||
"moduleResolution": "node16", | ||
"outDir": "./" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import fs from "node:fs"; | ||
import path from "node:path"; | ||
import url from "node:url"; | ||
|
||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); | ||
|
||
const packageJsonPath = path.resolve(__dirname, `../package.json`); | ||
const packageJsonBackupPath = path.resolve(__dirname, `../package.json.backup`); | ||
fs.copyFileSync( | ||
packageJsonPath, | ||
packageJsonBackupPath, | ||
fs.constants.COPYFILE_EXCL, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import fs from "node:fs"; | ||
import path from "node:path"; | ||
import url from "node:url"; | ||
|
||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); | ||
|
||
const packageJsonBackupPath = path.resolve(__dirname, `../package.json.backup`); | ||
const packageJsonPath = path.resolve(__dirname, `../package.json`); | ||
let packageJson = fs | ||
.readFileSync(packageJsonBackupPath, { | ||
encoding: `utf-8`, | ||
}) | ||
.trim(); | ||
packageJson = `${packageJson}\n`; | ||
fs.writeFileSync(packageJsonPath, packageJson, { | ||
encoding: `utf-8`, | ||
flag: `w`, | ||
}); | ||
fs.rmSync(packageJsonBackupPath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import fs from "node:fs"; | ||
import path from "node:path"; | ||
import url from "node:url"; | ||
|
||
const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); | ||
|
||
const COMMON_JS = `commonjs`; | ||
const MODULE = `module`; | ||
|
||
const packageJsonType = process.argv.at(2) ?? null; | ||
if (packageJsonType !== COMMON_JS && packageJsonType !== MODULE) { | ||
throw new Error( | ||
`invalid arguments. use one of "${COMMON_JS}" or "${MODULE}".`, | ||
); | ||
} | ||
|
||
const packageJsonPath = path.resolve(__dirname, `../package.json`); | ||
const packageJson = JSON.parse( | ||
fs.readFileSync(packageJsonPath, { encoding: `utf-8` }), | ||
); | ||
packageJson.type = packageJsonType; | ||
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), { | ||
encoding: `utf-8`, | ||
flag: `w`, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters