diff --git a/build/cjs/index.js b/build/cjs/index.js new file mode 100644 index 0000000..8f7f832 --- /dev/null +++ b/build/cjs/index.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.deeplyCopy = void 0; +function deeplyCopy(target) { } +exports.deeplyCopy = deeplyCopy; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/package.json b/package.json index 96f03b5..d035a4b 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,10 @@ }, "scripts": { "test": "jest", - "build": "npm run build:cjs && npm run build:esm && npm run rename", + "build": "npm run build:cjs && npm run build:esm && npm run build:rename && npm run rename", "build:cjs": "tsc --p ./cjs/tsconfig.json", "build:esm": "tsc --p ./esm/tsconfig.json", + "build:rename": "npx tsc renameFiles.ts", "build:clean": "rm -rf ./build", "rename": "node renameFiles.js", "lint": "pnpm eslint", @@ -49,6 +50,7 @@ "@jest/globals": "^29.7.0", "@types/eslint__js": "^8.42.3", "@types/jest": "^29.5.12", + "@types/node": "^20.14.9", "babel-jest": "^29.7.0", "eslint": "^9.5.0", "eslint-config-prettier": "^9.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b8c5b89..d2c7c30 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,9 @@ importers: '@types/jest': specifier: ^29.5.12 version: 29.5.12 + '@types/node': + specifier: ^20.14.9 + version: 20.14.9 babel-jest: specifier: ^29.7.0 version: 29.7.0(@babel/core@7.24.7) @@ -46,13 +49,13 @@ importers: version: 5.1.3(@types/eslint@8.56.10)(eslint-config-prettier@9.1.0(eslint@9.5.0))(eslint@9.5.0)(prettier@3.3.2) jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@20.14.8) + version: 29.7.0(@types/node@20.14.9) prettier: specifier: 3.3.2 version: 3.3.2 ts-jest: specifier: ^29.1.5 - version: 29.1.5(@babel/core@7.24.7)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.7))(jest@29.7.0(@types/node@20.14.8))(typescript@5.4.5) + version: 29.1.5(@babel/core@7.24.7)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.7))(jest@29.7.0(@types/node@20.14.9))(typescript@5.4.5) typescript: specifier: ^5.4.5 version: 5.4.5 @@ -868,8 +871,8 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/node@20.14.8': - resolution: {integrity: sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==} + '@types/node@20.14.9': + resolution: {integrity: sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==} '@types/stack-utils@2.0.3': resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} @@ -2992,7 +2995,7 @@ snapshots: '@jest/console@29.7.0': dependencies: '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -3005,14 +3008,14 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 ansi-escapes: 4.3.2 chalk: 4.1.2 ci-info: 3.9.0 exit: 0.1.2 graceful-fs: 4.2.11 jest-changed-files: 29.7.0 - jest-config: 29.7.0(@types/node@20.14.8) + jest-config: 29.7.0(@types/node@20.14.9) jest-haste-map: 29.7.0 jest-message-util: 29.7.0 jest-regex-util: 29.6.3 @@ -3037,7 +3040,7 @@ snapshots: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 jest-mock: 29.7.0 '@jest/expect-utils@29.7.0': @@ -3055,7 +3058,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.14.8 + '@types/node': 20.14.9 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -3077,7 +3080,7 @@ snapshots: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.25 - '@types/node': 20.14.8 + '@types/node': 20.14.9 chalk: 4.1.2 collect-v8-coverage: 1.0.2 exit: 0.1.2 @@ -3147,7 +3150,7 @@ snapshots: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 20.14.8 + '@types/node': 20.14.9 '@types/yargs': 17.0.32 chalk: 4.1.2 @@ -3226,7 +3229,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: - '@types/node': 20.14.8 + '@types/node': 20.14.9 '@types/istanbul-lib-coverage@2.0.6': {} @@ -3245,7 +3248,7 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/node@20.14.8': + '@types/node@20.14.9': dependencies: undici-types: 5.26.5 @@ -3543,13 +3546,13 @@ snapshots: dependencies: browserslist: 4.23.1 - create-jest@29.7.0(@types/node@20.14.8): + create-jest@29.7.0(@types/node@20.14.9): dependencies: '@jest/types': 29.6.3 chalk: 4.1.2 exit: 0.1.2 graceful-fs: 4.2.11 - jest-config: 29.7.0(@types/node@20.14.8) + jest-config: 29.7.0(@types/node@20.14.9) jest-util: 29.7.0 prompts: 2.4.2 transitivePeerDependencies: @@ -3912,7 +3915,7 @@ snapshots: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 chalk: 4.1.2 co: 4.6.0 dedent: 1.5.3 @@ -3932,16 +3935,16 @@ snapshots: - babel-plugin-macros - supports-color - jest-cli@29.7.0(@types/node@20.14.8): + jest-cli@29.7.0(@types/node@20.14.9): dependencies: '@jest/core': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 chalk: 4.1.2 - create-jest: 29.7.0(@types/node@20.14.8) + create-jest: 29.7.0(@types/node@20.14.9) exit: 0.1.2 import-local: 3.1.0 - jest-config: 29.7.0(@types/node@20.14.8) + jest-config: 29.7.0(@types/node@20.14.9) jest-util: 29.7.0 jest-validate: 29.7.0 yargs: 17.7.2 @@ -3951,7 +3954,7 @@ snapshots: - supports-color - ts-node - jest-config@29.7.0(@types/node@20.14.8): + jest-config@29.7.0(@types/node@20.14.9): dependencies: '@babel/core': 7.24.7 '@jest/test-sequencer': 29.7.0 @@ -3976,7 +3979,7 @@ snapshots: slash: 3.0.0 strip-json-comments: 3.1.1 optionalDependencies: - '@types/node': 20.14.8 + '@types/node': 20.14.9 transitivePeerDependencies: - babel-plugin-macros - supports-color @@ -4005,7 +4008,7 @@ snapshots: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -4015,7 +4018,7 @@ snapshots: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.9 - '@types/node': 20.14.8 + '@types/node': 20.14.9 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -4054,7 +4057,7 @@ snapshots: jest-mock@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 jest-util: 29.7.0 jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): @@ -4089,7 +4092,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.11 @@ -4117,7 +4120,7 @@ snapshots: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 chalk: 4.1.2 cjs-module-lexer: 1.3.1 collect-v8-coverage: 1.0.2 @@ -4163,7 +4166,7 @@ snapshots: jest-util@29.7.0: dependencies: '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -4182,7 +4185,7 @@ snapshots: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.14.8 + '@types/node': 20.14.9 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -4191,17 +4194,17 @@ snapshots: jest-worker@29.7.0: dependencies: - '@types/node': 20.14.8 + '@types/node': 20.14.9 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 - jest@29.7.0(@types/node@20.14.8): + jest@29.7.0(@types/node@20.14.9): dependencies: '@jest/core': 29.7.0 '@jest/types': 29.6.3 import-local: 3.1.0 - jest-cli: 29.7.0(@types/node@20.14.8) + jest-cli: 29.7.0(@types/node@20.14.9) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -4540,11 +4543,11 @@ snapshots: dependencies: typescript: 5.4.5 - ts-jest@29.1.5(@babel/core@7.24.7)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.7))(jest@29.7.0(@types/node@20.14.8))(typescript@5.4.5): + ts-jest@29.1.5(@babel/core@7.24.7)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.7))(jest@29.7.0(@types/node@20.14.9))(typescript@5.4.5): dependencies: bs-logger: 0.2.6 fast-json-stable-stringify: 2.1.0 - jest: 29.7.0(@types/node@20.14.8) + jest: 29.7.0(@types/node@20.14.9) jest-util: 29.7.0 json5: 2.2.3 lodash.memoize: 4.1.2 diff --git a/renameFiles.js b/renameFiles.js index 834fc47..49af3d7 100644 --- a/renameFiles.js +++ b/renameFiles.js @@ -1,24 +1,29 @@ -import fs from 'fs'; -import path from 'path'; - +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var fs = require("fs"); +var path = require("path"); +/** + * 주어진 디렉토리에서 특정 확장자의 파일을 다른 확장자로 변경하는 함수 + * @param directory - 파일이 있는 디렉토리 경로 + * @param oldExt - 변경할 기존 파일 확장자 + * @param newExt - 변경될 새로운 파일 확장자 + */ function renameFiles(directory, oldExt, newExt) { - fs.readdir(directory, (err, files) => { - if (err) throw err; - - files.forEach((file) => { - if (path.extname(file) === oldExt) { - const oldPath = path.join(directory, file); - const newPath = path.join( - directory, - path.basename(file, oldExt) + newExt, - ); - fs.rename(oldPath, newPath, (err) => { - if (err) throw err; - console.log(`Renamed: ${file} -> ${path.basename(newPath)}`); + fs.readdir(directory, function (err, files) { + if (err) + throw err; + files.forEach(function (file) { + if (path.extname(file) === oldExt) { + var oldPath = path.join(directory, file); + var newPath_1 = path.join(directory, path.basename(file, oldExt) + newExt); + fs.rename(oldPath, newPath_1, function (err) { + if (err) + throw err; + console.log("Renamed: ".concat(file, " -> ").concat(path.basename(newPath_1))); // 변경된 파일 로그 출력 + }); + } }); - } }); - }); } - +// dist 디렉토리의 .js 파일을 .cjs 파일로 변경 renameFiles('./build/cjs', '.js', '.cjs'); diff --git a/renameFiles.ts b/renameFiles.ts new file mode 100644 index 0000000..a3b1a16 --- /dev/null +++ b/renameFiles.ts @@ -0,0 +1,31 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +/** + * 주어진 디렉토리에서 특정 확장자의 파일을 다른 확장자로 변경하는 함수 + * @param directory - 파일이 있는 디렉토리 경로 + * @param oldExt - 변경할 기존 파일 확장자 + * @param newExt - 변경될 새로운 파일 확장자 + */ +function renameFiles(directory: string, oldExt: string, newExt: string): void { + fs.readdir(directory, (err, files) => { + if (err) throw err; + + files.forEach((file) => { + if (path.extname(file) === oldExt) { + const oldPath = path.join(directory, file); + const newPath = path.join( + directory, + path.basename(file, oldExt) + newExt, + ); + fs.rename(oldPath, newPath, (err) => { + if (err) throw err; + console.log(`Renamed: ${file} -> ${path.basename(newPath)}`); // 변경된 파일 로그 출력 + }); + } + }); + }); +} + +// dist 디렉토리의 .js 파일을 .cjs 파일로 변경 +renameFiles('./build/cjs', '.js', '.cjs');