Skip to content
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
9 changes: 5 additions & 4 deletions __tests__/validate-package-json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import {describe, expect, it} from 'vitest';
import fs from 'fs-extra';
import {glob} from '@docusaurus/glob';
import {readJSON} from '@docusaurus/fs';

type PackageJsonFile = {
file: string;
Expand All @@ -30,9 +30,10 @@ async function getPackagesJsonFiles(): Promise<PackageJsonFile[]> {
const files = await glob('packages/*/package.json');
return Promise.all(
files.map((file) =>
fs
.readJSON(file)
.then((content: PackageJsonFile['content']) => ({file, content})),
readJSON(file).then((content) => ({
file,
content: content as PackageJsonFile['content'],
})),
),
);
}
Expand Down
9 changes: 5 additions & 4 deletions __tests__/validate-tsconfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

import {describe, it} from 'vitest';
import fs from 'fs-extra';
import {glob} from '@docusaurus/glob';
import {Joi} from '@docusaurus/utils-validation';
import {readJSON} from '@docusaurus/fs';

type TsconfigFile = {
file: string;
Expand All @@ -24,9 +24,10 @@ async function getTsconfigFiles(): Promise<TsconfigFile[]> {
const files = await glob('packages/*/tsconfig.*');
return Promise.all(
files.map((file) =>
fs
.readJSON(file)
.then((content: TsconfigFile['content']) => ({file, content})),
readJSON(file).then((content) => ({
file,
content: content as TsconfigFile['content'],
})),
),
);
}
Expand Down
5 changes: 3 additions & 2 deletions admin/scripts/generateExamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

// @ts-check

import fs from 'fs-extra';
import fs from 'node:fs/promises';
import {execa} from 'execa';
import {readJSON} from '@docusaurus/fs';

/**
* Generate one example per init template
Expand Down Expand Up @@ -49,7 +50,7 @@ async function generateTemplateExample(template) {

const templatePackageJson =
await /** @type {Promise<import("../../packages/create-docusaurus/templates/classic/package.json") & { scripts: { [name: string]: string }; description: string }>} */ (
fs.readJSON(`examples/${template}/package.json`)
readJSON(`examples/${template}/package.json`)
);

// Attach the dev script which would be used in code sandbox by default
Expand Down
2 changes: 1 addition & 1 deletion admin/scripts/resizeImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import fs from 'fs-extra';
import fs from 'node:fs/promises';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import {program} from 'commander';
Expand Down
3 changes: 1 addition & 2 deletions eslint.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
// @ 'ExportDefaultDeclaration > Identifier, ExportNamedDeclaration[source=null] > ExportSpecifier',
// message: 'Export in one statement'
// },
...['node:path', 'fs-extra', 'webpack', 'lodash'].map((m) => ({
...['node:path', 'webpack', 'lodash'].map((m) => ({
selector: `ImportDeclaration[importKind=value]:has(Literal[value="${m}"]) > ImportSpecifier[importKind=value]`,
message:
'Default-import this, both for readability and interoperability with ESM',
Expand Down Expand Up @@ -199,7 +199,7 @@

'import/enforce-node-protocol-usage': [ERROR, 'always'],
'import/extensions': OFF,
// This rule doesn't yet support resolving .js imports when the actual file

Check warning on line 202 in eslint.rules.ts

View workflow job for this annotation

GitHub Actions / Lint AutoFix

This line has a comment length of 81. Maximum allowed is 80
// is .ts. Plus it's not all that useful when our code is fully TS-covered.
'import/no-unresolved': [
OFF,
Expand Down Expand Up @@ -237,7 +237,6 @@
{pattern: 'react', group: 'builtin', position: 'before'},
{pattern: 'react-dom', group: 'builtin', position: 'before'},
{pattern: 'react-dom/**', group: 'builtin', position: 'before'},
{pattern: 'fs-extra', group: 'builtin'},
{pattern: 'lodash', group: 'external', position: 'before'},
{pattern: 'clsx', group: 'external', position: 'before'},
// 'Bit weird to not use the `import/internal-regex` option, but this
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@
"@docusaurus/plugin-content-blog": "workspace:*",
"@docusaurus/plugin-content-docs": "workspace:*",
"@docusaurus/plugin-content-pages": "workspace:*",
"@docusaurus/fs": "workspace:*",
"@eslint/js": "^10.0.1",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@types/fs-extra": "^11.0.4",
"@types/lodash": "^4.17.25",
"@types/node": "^26.6.1",
"@types/prompts": "^2.4.9",
Expand All @@ -108,7 +108,6 @@
"eslint-plugin-react-you-might-not-need-an-effect": "^1.0.2",
"eslint-plugin-regexp": "^3.3.0",
"execa": "^10.0.1",
"fs-extra": "^11.4.0",
"globals": "^17.12.0",
"husky": "^9.1.7",
"image-size": "^2.0.4",
Expand Down
30 changes: 6 additions & 24 deletions pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions website/_dogfooding/testSwizzleThemeClassic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import path from 'node:path';
import fs from 'fs-extra';
import fs from 'node:fs/promises';
import {fileURLToPath} from 'node:url';
import {logger} from '@docusaurus/logger';

Expand Down Expand Up @@ -51,7 +51,7 @@ console.log('Args', {
});
console.log('\n');

await fs.remove(toPath);
await fs.rm(toPath, {recursive: true, force: true});

function filterComponentNames(componentNames) {
// TODO temp workaround: non-comps should be forbidden to wrap
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@crowdin/crowdin-api-client": "^1.57.0",
"@docsearch/react": "^4.7.0",
"@docusaurus/core": "workspace:*",
"@docusaurus/fs": "workspace:*",
"@docusaurus/glob": "workspace:*",
"@docusaurus/logger": "workspace:*",
"@docusaurus/plugin-client-redirects": "workspace:*",
Expand All @@ -62,7 +63,6 @@
"@docusaurus/utils-validation": "workspace:*",
"clsx": "^2.1.1",
"color": "^4.2.3",
"fs-extra": "^11.4.0",
"netlify-plugin-cache": "^1.0.3",
"prism-react-renderer": "^2.4.1",
"raw-loader": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion website/src/data/__tests__/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import {describe, expect, it} from 'vitest';
import fs from 'fs-extra';
import fs from 'node:fs';
import path from 'node:path';
import _ from 'lodash';
import {imageSizeFromFile} from 'image-size/fromFile';
Expand Down
2 changes: 1 addition & 1 deletion website/src/plugins/changelog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import path from 'node:path';
import fs from 'fs-extra';
import fs from 'node:fs/promises';
import pluginContentBlog from '@docusaurus/plugin-content-blog';
import {aliasedSitePath, docuHash, normalizeUrl} from '@docusaurus/utils';
import {safeGlob} from '@docusaurus/glob';
Expand Down
6 changes: 3 additions & 3 deletions website/src/plugins/changelog/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import fs from 'fs-extra';
import path from 'node:path';
import {outputFile} from '@docusaurus/fs';

/**
* Multiple versions may be published on the same day, causing the order to be
Expand Down Expand Up @@ -118,14 +118,14 @@ export async function createBlogFiles(
): Promise<void> {
await Promise.all(
changelogEntries.map((changelogEntry) =>
fs.outputFile(
outputFile(
path.join(generateDir, `${changelogEntry.title}.md`),
changelogEntry.content,
),
),
);

await fs.outputFile(
await outputFile(
path.join(generateDir, 'authors.json'),
JSON.stringify(createAuthorsMap(changelogEntries), null, 2),
);
Expand Down
2 changes: 1 addition & 1 deletion website/testCSSOrder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import path from 'node:path';
import {fileURLToPath} from 'node:url';
import fs from 'fs-extra';
import fs from 'node:fs/promises';

/*
This verifies CSS ordering on the Docusaurus site itself,
Expand Down
Loading