Skip to content

Commit

Permalink
Remove: @rollup/plugin-commonjs and fs-extra
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianKoerner committed May 11, 2024
1 parent 52e9c89 commit a4f9dc1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 96 deletions.
87 changes: 2 additions & 85 deletions package-lock.json

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

7 changes: 2 additions & 5 deletions packages/@dicebear/collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,12 @@
},
"devDependencies": {
"@dicebear/core": "^9.0.0-alpha.1",
"@rollup/plugin-commonjs": "^25.0.3",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/fs-extra": "^11.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"change-case": "^5.4.3",
"del-cli": "^5.0.0",
"fs-extra": "^11.2.0",
"glob": "^10.3.12",
"rollup": "^4.14.0",
"rollup": "^4.17.2",
"tmp": "^0.2.1",
"tsx": "^4.7.1",
"webpack": "^5.76.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/@dicebear/collection/scripts/build-js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { glob } from 'glob';
import { dirname, join, basename } from 'node:path';
import { writeFile } from 'node:fs/promises';
import { pascalCase } from 'change-case';
import { ensureDir } from 'fs-extra';
import { fileURLToPath } from 'node:url';
import { Filesystem } from './helper/Filesystem.js';

const __dirname = fileURLToPath(new URL('.', import.meta.url));
const targetPath = join(__dirname, '..', 'lib');
Expand Down Expand Up @@ -42,7 +42,7 @@ export class ${className} extends Style {
}
`;

await ensureDir(dirname(styleClassTarget));
await Filesystem.ensureDir(dirname(styleClassTarget));
await writeFile(styleClassTarget, styleClassContent);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/@dicebear/collection/scripts/build-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { glob } from 'glob';
import { dirname, join, basename } from 'node:path';
import { readFile, writeFile } from 'node:fs/promises';
import { pascalCase } from 'change-case';
import { ensureDir } from 'fs-extra';
import { fileURLToPath } from 'node:url';
import { Definition } from '@dicebear/core';
import { Filesystem } from './helper/Filesystem.js';

const __dirname = fileURLToPath(new URL('.', import.meta.url));
const targetPath = join(__dirname, '..', 'lib');
Expand Down Expand Up @@ -82,7 +82,7 @@ export declare class ${className} extends Style<${className}Options> {
}
`;

await ensureDir(dirname(styleClassTarget));
await Filesystem.ensureDir(dirname(styleClassTarget));
await writeFile(styleClassTarget, styleClassContent);
}

Expand Down
10 changes: 10 additions & 0 deletions packages/@dicebear/collection/scripts/helper/Filesystem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { existsSync } from 'node:fs';
import { mkdir } from 'node:fs/promises';

export class Filesystem {
static async ensureDir(path: string) {
if (!existsSync(path)) {
await mkdir(path, { recursive: true });
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { describe, it } from 'node:test';
import { fileURLToPath } from 'url';
import { rollup } from 'rollup';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';

const __dirname = fileURLToPath(new URL('.', import.meta.url));
Expand All @@ -13,7 +12,7 @@ describe('rollup', () => {
it('Tree shaking', async () => {
const bundle = await rollup({
input: `${__dirname}/fixtures/tree-shaking/index.js`,
plugins: [nodeResolve(), commonjs(), json()],
plugins: [nodeResolve(), json()],
});

const { output } = await bundle.generate({
Expand Down

0 comments on commit a4f9dc1

Please sign in to comment.