forked from kysely-org/kysely
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
export all operation nodes, forever. (kysely-org#972)
- Loading branch information
1 parent
5791204
commit 63bb3b2
Showing
3 changed files
with
69 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* This script ensures all files in a path are exported in the index.ts file. | ||
* For now it only checks the operation-node folder, as we've had issues with | ||
* missing exports there. | ||
*/ | ||
|
||
const fs = require('node:fs') | ||
const path = require('node:path') | ||
const forEachFile = require('./util/for-each-file') | ||
|
||
let errorsFound = false | ||
|
||
function checkExports(dir) { | ||
const indexFileContents = fs.readFileSync( | ||
path.join(__dirname, '..', 'src/index.ts'), | ||
'utf-8', | ||
) | ||
|
||
forEachFile(dir, (filePath) => { | ||
if (filePath.endsWith('.ts')) { | ||
const expectedExportPath = filePath.replace( | ||
/^.+\/src\/(.+)\.ts$/, | ||
"'./$1.js'", | ||
) | ||
|
||
if (!indexFileContents.includes(expectedExportPath)) { | ||
console.log(`Missing export: ${expectedExportPath}`) | ||
errorsFound = true | ||
} | ||
} | ||
}) | ||
} | ||
|
||
checkExports(path.join(__dirname, '..', 'src/operation-node')) | ||
|
||
if (errorsFound) { | ||
console.log(' ') | ||
console.log('check-exports.js failed!') | ||
process.exit(1) | ||
} |
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