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

chore: remove fs-extra #106

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
45 changes: 0 additions & 45 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"dependencies": {
"chalk": "3.0.0",
"commander": "^6.1.0",
"fs-extra": "7.0.1",
"inquirer": "^7.3.3",
"json-schema-defaults": "0.4.0",
"json-schema-to-typescript": "11.0.3",
Expand All @@ -47,7 +46,6 @@
"devDependencies": {
"@eslint/js": "^9.17.0",
"@gamesdonequick/prettier-config": "^2.2.1",
"@types/fs-extra": "5.0.4",
"@types/hosted-git-info": "2.7.0",
"@types/inquirer": "^7.3.1",
"@types/node": "18",
Expand Down
3 changes: 1 addition & 2 deletions src/commands/schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { promisify } from "node:util";

import chalk from "chalk";
import { Command } from "commander";
import fse from "fs-extra";
import { compileFromFile } from "json-schema-to-typescript";

const writeFilePromise = promisify(fs.writeFile);
Expand Down Expand Up @@ -40,7 +39,7 @@ function action(inDir: string, cmd: { outDir: string; configSchema: boolean }) {

const outDir = path.resolve(processCwd, cmd.outDir);
if (!fs.existsSync(outDir)) {
fse.mkdirpSync(outDir);
fs.mkdirSync(outDir, { recursive: true });
}

const configSchemaPath = path.join(processCwd, "configschema.json");
Expand Down
10 changes: 6 additions & 4 deletions test/commands/defaultconfig.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from "node:fs";
import path from "node:path";

import { Command } from "commander";
import fse from "fs-extra";
import { beforeEach, describe, expect, it, vi } from "vitest";

import defaultConfigCommand from "../../src/commands/defaultconfig";
Expand All @@ -18,7 +17,7 @@ beforeEach(() => {
fs.writeFileSync("package.json", JSON.stringify({ name: "nodecg" }));

// Copy fixtures.
fse.copySync(path.resolve(__dirname, "../fixtures/"), "./");
fs.cpSync(path.resolve(__dirname, "../fixtures/"), "./", { recursive: true });

// Build program.
program = createMockProgram();
Expand All @@ -38,8 +37,9 @@ describe("when run with a bundle argument", () => {

it("should print an error when the target bundle does not have a configschema.json", async () => {
const spy = vi.spyOn(console, "error");
fse.mkdirpSync(
fs.mkdirSync(
path.resolve(process.cwd(), "./bundles/missing-schema-bundle"),
{ recursive: true },
);
await program.runWith("defaultconfig missing-schema-bundle");
expect(spy.mock.calls[0][0]).toMatchInlineSnapshot(
Expand Down Expand Up @@ -80,7 +80,9 @@ describe("when run with no arguments", () => {
});

it("should print an error when in a folder with no package.json", async () => {
fse.mkdirpSync(path.resolve(process.cwd(), "./bundles/not-a-bundle"));
fs.mkdirSync(path.resolve(process.cwd(), "./bundles/not-a-bundle"), {
recursive: true,
});
process.chdir("./bundles/not-a-bundle");

const spy = vi.spyOn(console, "error");
Expand Down
3 changes: 1 addition & 2 deletions test/commands/schema-types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { EventEmitter } from "node:events";
import fs from "node:fs";
import path from "node:path";

import fse from "fs-extra";
import { beforeEach, expect, it, vi } from "vitest";

import schemaTypesCommand from "../../src/commands/schema-types";
Expand All @@ -18,7 +17,7 @@ beforeEach(() => {
fs.writeFileSync("package.json", JSON.stringify({ name: "nodecg" }));

// Copy fixtures.
fse.copySync(path.resolve(__dirname, "../fixtures/"), "./");
fs.cpSync(path.resolve(__dirname, "../fixtures/"), "./", { recursive: true });

// Build program.
program = createMockProgram();
Expand Down
3 changes: 1 addition & 2 deletions test/commands/uninstall.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from "node:fs";
import path from "node:path";

import { Command } from "commander";
import fse from "fs-extra";
import inquirer from "inquirer";
import { beforeEach, expect, it, vi } from "vitest";

Expand All @@ -19,7 +18,7 @@ beforeEach(() => {
fs.writeFileSync("package.json", JSON.stringify({ name: "nodecg" }));

// Copy fixtures.
fse.copySync(path.resolve(__dirname, "../fixtures/"), "./");
fs.cpSync(path.resolve(__dirname, "../fixtures/"), "./", { recursive: true });

// Build program.
program = createMockProgram();
Expand Down
Loading