mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
Remove fs-extra
from lib/cli/scripts
This commit is contained in:
parent
f0593f9e9e
commit
ea609bfdad
@ -1,7 +1,6 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { readJSON } from 'fs-extra';
|
||||
|
||||
import { sortPackageJson } from '../../../../scripts/node_modules/sort-package-json';
|
||||
import { generateMapperContent, mapCoreExportToSelf, write } from './utils';
|
||||
|
||||
@ -22,8 +21,12 @@ import { generateMapperContent, mapCoreExportToSelf, write } from './utils';
|
||||
* remove those manually here.
|
||||
*/
|
||||
async function run() {
|
||||
const selfPackageJson = await readJSON(join(__dirname, '../package.json'));
|
||||
const corePackageJson = await readJSON(join(__dirname, '../../../core/package.json'));
|
||||
const selfPackageJson = JSON.parse(
|
||||
await readFile(join(__dirname, '../package.json'), { encoding: 'utf8' })
|
||||
);
|
||||
const corePackageJson = await JSON.parse(
|
||||
await readFile(join(__dirname, '../../../core/package.json'), { encoding: 'utf8' })
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
Object.entries<Record<string, string>>(corePackageJson.exports)
|
||||
|
@ -1,8 +1,14 @@
|
||||
import { ensureFile, writeFile } from 'fs-extra';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { mkdir, writeFile } from 'node:fs/promises';
|
||||
import { dirname } from 'node:path';
|
||||
|
||||
import { dedent } from 'ts-dedent';
|
||||
|
||||
export const write = async (location: string, data: string) => {
|
||||
await ensureFile(location);
|
||||
if (!existsSync(location)) {
|
||||
const directory = dirname(location);
|
||||
await mkdir(directory, { recursive: true });
|
||||
}
|
||||
return writeFile(location, data);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user