Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use node:fs/promises #11206

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor: remove del, update rimraf
  • Loading branch information
alumni committed Dec 23, 2024
commit b7cc21b142244277d326bb2814b8256619f8de8e
8 changes: 4 additions & 4 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import fs from "fs/promises";
import gulp from "gulp";
import del from "del";
import shell from "gulp-shell";
import replace from "gulp-replace";
import rename from "gulp-rename";
import sourcemaps from "gulp-sourcemaps";
import ts from "gulp-typescript";
import { rimraf } from "rimraf";

@Gulpclass()
export class Gulpfile {
Expand All @@ -21,7 +21,7 @@
*/
@Task()
async clean() {
return del(["./build/**"]);
return rimraf(["./build/**"]);
}

/**
Expand Down Expand Up @@ -86,7 +86,7 @@

@Task()
async browserClearPackageDirectory() {
return del([
return rimraf([
"./build/browser/**"
]);
}
Expand Down Expand Up @@ -165,7 +165,7 @@
@Task()
async packageCreateEsmIndex() {
const buildDir = "./build/package";
const cjsIndex = require(`${buildDir}/index.js`);

Check warning on line 168 in gulpfile.ts

View workflow job for this annotation

GitHub Actions / formatting

Require statement not part of import statement
const cjsKeys = Object.keys(cjsIndex).filter(key => key !== "default" && !key.startsWith("__"));

const indexMjsContent =
Expand Down Expand Up @@ -193,7 +193,7 @@
*/
@Task()
async packageClearPackageDirectory() {
return del([
return rimraf([
"build/package/src/**"
]);
}
Expand Down
150 changes: 10 additions & 140 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
"class-transformer": "^0.5.1",
"conventional-changelog-angular": "^5.0.13",
"conventional-changelog-cli": "^2.2.2",
"del": "6.1.1",
"eslint": "^8.44.0",
"gulp": "^4.0.2",
"gulp-istanbul": "^1.1.3",
Expand All @@ -135,7 +134,7 @@
"prettier": "^2.8.3",
"redis": "^4.6.4",
"remap-istanbul": "^0.13.0",
"rimraf": "^4.1.2",
"rimraf": "^5.0.10",
"sinon": "^15.0.1",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Category } from "./entity/Category"
import { Post } from "./entity/Post"
import { User } from "./entity/User"
import { filepathToName } from "../../../../src/util/PathUtils"
import rimraf from "rimraf"
import { rimraf } from "rimraf"
import path from "path"
import fs from "fs/promises"
import appRoot from "app-root-path"
Expand Down
13 changes: 6 additions & 7 deletions test/github-issues/799/issue-799.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import "reflect-metadata"
import * as assert from "assert"
import rimraf from "rimraf"
import { expect } from "chai"
import { dirname } from "path"
import { DataSource } from "../../../src/data-source/DataSource"
import { getTypeOrmConfig } from "../../utils/test-utils"
import { rimraf } from "rimraf"

describe("github issues > #799 sqlite: 'database' path should be created", () => {
let dataSource: DataSource
Expand All @@ -26,14 +25,14 @@ describe("github issues > #799 sqlite: 'database' path should be created", () =>
)
if (isEnabled === false) return

const dataSource = new DataSource({
dataSource = new DataSource({
name: "sqlite",
type: "sqlite",
database: path,
})
await dataSource.initialize()

assert.strictEqual(dataSource.isInitialized, true)
expect(dataSource.isInitialized).to.equal(true)
})

it("should create the whole path to database file for better-sqlite3", async function () {
Expand All @@ -43,13 +42,13 @@ describe("github issues > #799 sqlite: 'database' path should be created", () =>
)
if (isEnabled === false) return

const dataSource = new DataSource({
dataSource = new DataSource({
name: "better-sqlite3",
type: "better-sqlite3",
database: path,
})
await dataSource.initialize()

assert.strictEqual(dataSource.isInitialized, true)
expect(dataSource.isInitialized).to.equal(true)
})
})
7 changes: 3 additions & 4 deletions test/github-issues/8975/issue-8975.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { expect } from "chai"
import { exec } from "child_process"
import { readFile, writeFile, chmod } from "fs/promises"
import { readFile, writeFile, chmod, unlink, rmdir } from "fs/promises"
import { dirname } from "path"
import rimraf from "rimraf"

describe("cli init command", () => {
const cliPath = `${dirname(dirname(dirname(__dirname)))}/src/cli.js`
Expand Down Expand Up @@ -43,11 +42,11 @@ describe("cli init command", () => {
})

after(async () => {
await rimraf(`./${builtSrcDirectory}/package.json`)
await unlink(`./${builtSrcDirectory}/package.json`)
})

afterEach(async () => {
await rimraf(`./${testProjectName}`)
await rmdir(`./${testProjectName}`, { recursive: true })
})

for (const databaseOption of databaseOptions) {
Expand Down
Loading