-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dev-tools] ESM module build command improvements (#446)
- Loading branch information
1 parent
3a7fd33
commit eceb424
Showing
14 changed files
with
289 additions
and
86 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -7,6 +7,8 @@ let ocularConfig = { | |
check: true | ||
}, | ||
|
||
babel: false, | ||
|
||
lint: { | ||
paths: ['modules'] | ||
}, | ||
|
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
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,27 @@ | ||
import esbuild from 'esbuild'; | ||
import fs from 'fs/promises'; | ||
import {getCJSEntryPoints} from './helpers/get-cjs-entry-points.js'; | ||
import {getCJSExportConfig} from './configuration/get-esbuild-config.js'; | ||
|
||
async function main() { | ||
for (const fileName of getCJSEntryPoints()) { | ||
const inputPath = `./dist/${fileName}.js`; | ||
try { | ||
await fs.stat(inputPath); | ||
|
||
const esbuildConfig = await getCJSExportConfig({ | ||
input: inputPath, | ||
output: `dist/${fileName}.cjs` | ||
}); | ||
const result = await esbuild.build(esbuildConfig); | ||
if (result.errors.length > 0) { | ||
process.exit(1); | ||
} | ||
} catch { | ||
// File does not exist | ||
console.error(`\x1b[33mCannot find file ${inputPath}\x1b[0m`); | ||
} | ||
} | ||
} | ||
|
||
main(); |
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
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 @@ | ||
*.cjs |
Oops, something went wrong.