-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(build): add script to stop exporting demos in built files (#10063)
* chore(build): add script to stop exporting demos in built files * chore(build): update to remove demo exports from shipped TS files also * chore(ci): update deployment to clean exports of demos
- Loading branch information
1 parent
ef5fc38
commit 07a7ec3
Showing
4 changed files
with
18 additions
and
16 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
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,14 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const distIndexFiles = ['esm', 'js'].map((dir) => path.join(process.cwd(), 'dist', dir, 'index.js')); | ||
const distIndexDeclarationFiles = ['esm', 'js'].map((dir) => path.join(process.cwd(), 'dist', dir, 'index.d.ts')); | ||
|
||
[...distIndexFiles, ...distIndexDeclarationFiles].forEach((file) => { | ||
const fileContents = fs.readFileSync(file, 'utf8'); | ||
const newFileContents = fileContents | ||
.split('\n') | ||
.filter((line) => !line.includes('demos')) | ||
.join('\n'); | ||
fs.writeFileSync(file, newFileContents); | ||
}); |