Skip to content

Commit

Permalink
refactor: remove del, update rimraf
Browse files Browse the repository at this point in the history
  • Loading branch information
alumni committed Dec 23, 2024
1 parent c33e22a commit b7cc21b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 158 deletions.
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 { Gulpclass, Task, SequenceTask, MergedTask } from "gulpclass";

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 @@ export class Gulpfile {
*/
@Task()
async clean() {
return del(["./build/**"]);
return rimraf(["./build/**"]);
}

/**
Expand Down Expand Up @@ -86,7 +86,7 @@ export class Gulpfile {

@Task()
async browserClearPackageDirectory() {
return del([
return rimraf([
"./build/browser/**"
]);
}
Expand Down Expand Up @@ -193,7 +193,7 @@ export class Gulpfile {
*/
@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

0 comments on commit b7cc21b

Please sign in to comment.