forked from rollup/rollup-docs-cn
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v3.0] Convert build scripts to ESM, update dependencies (#4558)
* Convert scripts to ESM, update dependencies * Fix lint issue 3.0.0-1
- Loading branch information
1 parent
220e21f
commit 5a955d4
Showing
11 changed files
with
257 additions
and
380 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { promises as fs } from 'fs'; | ||
import { resolve } from 'path'; | ||
|
||
export async function findConfigFileName(targetDir) { | ||
const filesInWorkingDir = new Set(await fs.readdir(targetDir)); | ||
for (const extension of ['mjs', 'cjs', 'ts', 'js']) { | ||
const fileName = `rollup.config.${extension}`; | ||
if (filesInWorkingDir.has(fileName)) return resolve(targetDir, fileName); | ||
} | ||
throw new Error('The repository needs to have a file "rollup.config.js" at the top level.'); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
const pkg = require('../package.json'); | ||
import { readFile } from 'fs/promises'; | ||
|
||
function checkChokidar() { | ||
const chokidarPkg = require('../node_modules/chokidar/package.json'); | ||
const chokidarFsevents = | ||
chokidarPkg.dependencies.fsevents || chokidarPkg.optionalDependencies.fsevents; | ||
if (!chokidarFsevents) return; | ||
const pkgFsevents = pkg.optionalDependencies.fsevents; | ||
if (chokidarFsevents !== pkgFsevents) { | ||
throw new Error( | ||
`The dependency "fsevents" should exist with the same version range "${chokidarFsevents}" as it has for chokidar but it has "${pkgFsevents}".` | ||
); | ||
} | ||
const pkg = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')); | ||
const chokidarPkg = JSON.parse( | ||
await readFile(new URL('../node_modules/chokidar/package.json', import.meta.url), 'utf8') | ||
); | ||
const chokidarFsevents = | ||
chokidarPkg.dependencies.fsevents || chokidarPkg.optionalDependencies.fsevents; | ||
const pkgFsevents = pkg.optionalDependencies.fsevents; | ||
if (chokidarFsevents !== pkgFsevents) { | ||
throw new Error( | ||
`The dependency "fsevents" should exist with the same version range "${chokidarFsevents}" as it has for chokidar but it has "${pkgFsevents}".` | ||
); | ||
} | ||
|
||
checkChokidar(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters