refactor!: replace glob with tinyglobby, remove rimraf (#11699)

This commit is contained in:
Lucian Mocanu 2025-10-01 09:52:04 +02:00 committed by GitHub
parent 1894530095
commit a7c387bc14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 66 additions and 122 deletions

View File

@ -84,7 +84,7 @@ You can link (or simply copy/paste) this directory into your project and test Ty
To build the distribution package of TypeORM packed into a `.tgz`, run:
```shell
npm run pack
cd build/package && npm pack
```
This command will generate a distribution package tar in the `build` directory (`build/typeorm-x.x.x.tgz`).

View File

@ -181,21 +181,22 @@ module.exports = {
By default Webpack tries to bundle everything into one file. This can be problematic when your project has migration files which are meant to be executed after bundled code is deployed to production. To make sure all your migrations can be recognized and executed by TypeORM, you may need to use "Object Syntax" for the `entry` configuration for the migration files only.
```javascript
const glob = require("glob")
const path = require("path")
const { globSync } = require("node:fs")
const path = require("node:path")
module.exports = {
// ... your webpack configurations here...
// Dynamically generate a `{ [name]: sourceFileName }` map for the `entry` option
// change `src/db/migrations` to the relative path to your migration folder
entry: glob
.sync(path.resolve("src/db/migrations/*.ts"))
.reduce((entries, filename) => {
entry: globSync(path.resolve("src/db/migrations/*.ts")).reduce(
(entries, filename) => {
const migrationName = path.basename(filename, ".ts")
return Object.assign({}, entries, {
[migrationName]: filename,
})
}, {}),
},
{},
),
resolve: {
// assuming all your migration files are written in TypeScript
extensions: [".ts"],

View File

@ -6,7 +6,6 @@ import shell from "gulp-shell";
import sourcemaps from "gulp-sourcemaps";
import ts from "gulp-typescript";
import { Gulpclass, MergedTask, SequenceTask, Task } from "gulpclass";
import { rimraf } from "rimraf";
@Gulpclass()
export class Gulpfile {
@ -20,16 +19,7 @@ export class Gulpfile {
*/
@Task()
async clean() {
return rimraf(["./build/**"], { glob: true });
}
/**
* Runs typescript files compilation.
*/
@Task()
compile() {
return gulp.src("package.json", { read: false })
.pipe(shell(["npm run compile"]));
await fs.rm("./build", { recursive: true, force: true });
}
// -------------------------------------------------------------------------
@ -84,37 +74,13 @@ export class Gulpfile {
@Task()
async browserClearPackageDirectory() {
return rimraf([
"./build/browser/**"
], { glob: true });
await fs.rm("./build/browser/", { recursive: true, force: true });
}
// -------------------------------------------------------------------------
// Main Packaging and Publishing tasks
// -------------------------------------------------------------------------
/**
* Publishes a package to npm from ./build/package directory.
*/
@Task()
packagePublish() {
return gulp.src("package.json", { read: false })
.pipe(shell([
"cd ./build/package && npm publish"
]));
}
/**
* Packs a .tgz from ./build/package directory.
*/
@Task()
packagePack() {
return gulp.src("package.json", { read: false })
.pipe(shell([
"cd ./build/package && npm pack && mv -f typeorm-*.tgz .."
]));
}
/**
* Publishes a package to npm from ./build/package directory with @next tag.
*/
@ -191,9 +157,7 @@ export class Gulpfile {
*/
@Task()
async packageClearPackageDirectory() {
return rimraf([
"build/package/src/**"
], { glob: true });
await fs.rm("./build/package/src/", { recursive: true, force: true });
}
/**
@ -247,22 +211,6 @@ export class Gulpfile {
];
}
/**
* Creates a package .tgz
*/
@SequenceTask()
pack() {
return ["package", "packagePack"];
}
/**
* Creates a package and publishes it to npm.
*/
@SequenceTask()
publish() {
return ["package", "packagePublish"];
}
/**
* Creates a package and publishes it to npm with @next tag.
*/
@ -270,5 +218,4 @@ export class Gulpfile {
publishNext() {
return ["package", "packagePublishNext"];
}
}

62
package-lock.json generated
View File

@ -17,10 +17,10 @@
"debug": "^4.4.3",
"dedent": "^1.7.0",
"dotenv": "^17.2.3",
"glob": "^10.4.5",
"reflect-metadata": "^0.2.2",
"sha.js": "^2.4.12",
"sql-highlight": "^6.1.0",
"tinyglobby": "^0.2.15",
"tslib": "^2.8.1",
"uuid": "^11.1.0",
"yargs": "^18.0.0"
@ -77,7 +77,6 @@
"prettier": "^2.8.8",
"redis": "^5.8.2",
"remap-istanbul": "^0.13.0",
"rimraf": "^5.0.10",
"sinon": "^21.0.0",
"sinon-chai": "^4.0.1",
"sort-package-json": "^3.4.0",
@ -1691,6 +1690,7 @@
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
"integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
"dev": true,
"license": "ISC",
"dependencies": {
"string-width": "^5.1.2",
@ -2478,6 +2478,7 @@
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
"integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
"dev": true,
"license": "MIT",
"optional": true,
"engines": {
@ -3798,6 +3799,7 @@
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-convert": "^2.0.1"
@ -4245,6 +4247,7 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true,
"license": "MIT"
},
"node_modules/base": {
@ -5291,6 +5294,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-name": "~1.1.4"
@ -5303,6 +5307,7 @@
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"license": "MIT"
},
"node_modules/color-support": {
@ -5545,6 +5550,7 @@
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
"license": "MIT",
"dependencies": {
"path-key": "^3.1.0",
@ -5992,6 +5998,7 @@
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
"dev": true,
"license": "MIT"
},
"node_modules/ecdsa-sig-formatter": {
@ -6015,6 +6022,7 @@
"version": "9.2.2",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
"dev": true,
"license": "MIT"
},
"node_modules/encoding": {
@ -6892,7 +6900,6 @@
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12.0.0"
@ -7154,6 +7161,7 @@
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
"integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
"dev": true,
"license": "ISC",
"dependencies": {
"cross-spawn": "^7.0.6",
@ -7516,6 +7524,7 @@
"version": "10.4.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
"integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
"dev": true,
"license": "ISC",
"dependencies": {
"foreground-child": "^3.1.0",
@ -7636,6 +7645,7 @@
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
@ -7645,6 +7655,7 @@
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
"integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
@ -9324,6 +9335,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
"dev": true,
"license": "ISC"
},
"node_modules/isobject": {
@ -9657,6 +9669,7 @@
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
"integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"@isaacs/cliui": "^8.0.2"
@ -10780,6 +10793,7 @@
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=16 || 14 >=14.17"
@ -12557,6 +12571,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
"dev": true,
"license": "BlueOak-1.0.0"
},
"node_modules/parent-module": {
@ -12678,6 +12693,7 @@
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@ -12717,6 +12733,7 @@
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
"dev": true,
"license": "BlueOak-1.0.0",
"dependencies": {
"lru-cache": "^10.2.0",
@ -12733,6 +12750,7 @@
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"dev": true,
"license": "ISC"
},
"node_modules/path-type": {
@ -12888,7 +12906,6 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
@ -14005,22 +14022,6 @@
"dev": true,
"license": "MIT"
},
"node_modules/rimraf": {
"version": "5.0.10",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz",
"integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==",
"dev": true,
"license": "ISC",
"dependencies": {
"glob": "^10.3.7"
},
"bin": {
"rimraf": "dist/esm/bin.mjs"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/run-applescript": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz",
@ -14221,6 +14222,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
"license": "MIT",
"dependencies": {
"shebang-regex": "^3.0.0"
@ -14233,6 +14235,7 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@ -14242,6 +14245,7 @@
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=14"
@ -15077,6 +15081,7 @@
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
"dev": true,
"license": "MIT",
"dependencies": {
"eastasianwidth": "^0.2.0",
@ -15095,6 +15100,7 @@
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
@ -15109,6 +15115,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@ -15118,12 +15125,14 @@
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true,
"license": "MIT"
},
"node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@ -15133,6 +15142,7 @@
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
@ -15161,6 +15171,7 @@
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
@ -15173,6 +15184,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@ -15625,7 +15637,6 @@
"version": "0.2.15",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
"integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"fdir": "^6.5.0",
@ -16517,6 +16528,7 @@
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"license": "ISC",
"dependencies": {
"isexe": "^2.0.0"
@ -16655,6 +16667,7 @@
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
"integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^6.1.0",
@ -16673,6 +16686,7 @@
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
@ -16690,6 +16704,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@ -16699,12 +16714,14 @@
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true,
"license": "MIT"
},
"node_modules/wrap-ansi-cjs/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@ -16714,6 +16731,7 @@
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
@ -16728,6 +16746,7 @@
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
@ -16740,6 +16759,7 @@
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
"integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"

View File

@ -78,12 +78,11 @@
},
"scripts": {
"changelog": "standard-changelog",
"compile": "rimraf ./build && tsc",
"compile": "gulp clean && tsc",
"docs:dev": "cd docs && npm run start",
"format": "prettier --cache --write \"./**/*.ts\"",
"format:ci": "prettier --check \"./**/*.ts\"",
"lint": "eslint .",
"pack": "gulp pack",
"package": "gulp package",
"pre-commit": "lint-staged",
"prepare": "is-ci || husky",
@ -103,10 +102,10 @@
"debug": "^4.4.3",
"dedent": "^1.7.0",
"dotenv": "^17.2.3",
"glob": "^10.4.5",
"reflect-metadata": "^0.2.2",
"sha.js": "^2.4.12",
"sql-highlight": "^6.1.0",
"tinyglobby": "^0.2.15",
"tslib": "^2.8.1",
"uuid": "^11.1.0",
"yargs": "^18.0.0"
@ -158,7 +157,6 @@
"prettier": "^2.8.8",
"redis": "^5.8.2",
"remap-istanbul": "^0.13.0",
"rimraf": "^5.0.10",
"sinon": "^21.0.0",
"sinon-chai": "^4.0.1",
"sort-package-json": "^3.4.0",

View File

@ -13,10 +13,3 @@ import {Logger} from "../logger/Logger";
export function importClassesFromDirectories(logger: Logger, directories: string[], formats = [".js", ".cjs", ".ts"]): Function[] {
return [];
}
/**
* Loads all json files from the given directory.
*/
export function importJsonsFromDirectories(directories: string[], format = ".json"): any[] {
return [];
}

View File

@ -1,9 +1,9 @@
import * as glob from "glob"
import { PlatformTools } from "../platform/PlatformTools"
import { globSync } from "tinyglobby"
import { Logger } from "../logger/Logger"
import { PlatformTools } from "../platform/PlatformTools"
import { importOrRequireFile } from "./ImportUtils"
import { ObjectUtils } from "./ObjectUtils"
import { InstanceChecker } from "./InstanceChecker"
import { ObjectUtils } from "./ObjectUtils"
/**
* Loads all exported classes from the given directory.
@ -34,7 +34,7 @@ export async function importClassesFromDirectories(
}
const allFiles = directories.reduce((allDirs, dir) => {
return allDirs.concat(glob.sync(PlatformTools.pathNormalize(dir)))
return allDirs.concat(globSync(PlatformTools.pathNormalize(dir)))
}, [] as string[])
if (directories.length > 0 && allFiles.length === 0) {
@ -64,19 +64,3 @@ export async function importClassesFromDirectories(
return loadFileClasses(dirs, [])
}
/**
* Loads all json files from the given directory.
*/
export function importJsonsFromDirectories(
directories: string[],
format = ".json",
): any[] {
const allFiles = directories.reduce((allDirs, dir) => {
return allDirs.concat(glob.sync(PlatformTools.pathNormalize(dir)))
}, [] as string[])
return allFiles
.filter((file) => PlatformTools.pathExtname(file) === format)
.map((file) => require(PlatformTools.pathResolve(file)))
}

View File

@ -2,7 +2,7 @@ import appRoot from "app-root-path"
import { expect } from "chai"
import fs from "fs/promises"
import path from "path"
import { rimraf } from "rimraf"
import { glob } from "tinyglobby"
import { DataSource } from "../../../../src/data-source/DataSource"
import { filepathToName } from "../../../../src/util/PathUtils"
@ -93,7 +93,8 @@ describe("multi-database > basic-functionality", () => {
beforeEach(() => reloadTestingDatabases(connections))
after(async () => {
await closeTestingConnections(connections)
await rimraf(`${tempPath}/**/*.attach.db`, { glob: true })
const files = await glob(`${tempPath}/**/*.attach.db`)
await Promise.all(files.map((file) => fs.rm(file, { force: true })))
})
it("should correctly attach and create database files", () =>

View File

@ -1,6 +1,6 @@
import { expect } from "chai"
import { rm } from "fs/promises"
import { dirname } from "path"
import { rimraf } from "rimraf"
import { DataSource } from "../../../src/data-source/DataSource"
import { getTypeOrmConfig } from "../../utils/test-utils"
@ -10,8 +10,8 @@ describe("github issues > #799 sqlite: 'database' path should be created", () =>
const path = `${__dirname}/tmp/sqlitedb.db`
before(() => rimraf(dirname(path)))
after(() => rimraf(dirname(path)))
before(() => rm(dirname(path), { recursive: true, force: true }))
after(() => rm(dirname(path), { recursive: true, force: true }))
afterEach(async () => {
if (dataSource?.isInitialized) {

View File

@ -1,6 +1,6 @@
import { expect } from "chai"
import { exec } from "child_process"
import { readFile, writeFile, chmod, unlink, rmdir } from "fs/promises"
import { chmod, readFile, rm, unlink, writeFile } from "fs/promises"
import { dirname } from "path"
describe("cli init command", () => {
@ -42,7 +42,7 @@ describe("cli init command", () => {
})
afterEach(async () => {
await rmdir(`./${testProjectPath}`, { recursive: true })
await rm(`./${testProjectPath}`, { recursive: true, force: true })
})
for (const databaseOption of databaseOptions) {