-
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.
setup publint and package.json fixes
fixes #130
- Loading branch information
1 parent
f13a3d9
commit f98c61c
Showing
10 changed files
with
199 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,8 @@ | |
"build-all": "pnpm -r build", | ||
"test-all": "pnpm -r test run", | ||
"changeset": "changeset", | ||
"release": "pnpm -r build && changeset publish" | ||
"release": "pnpm -r build && changeset publish", | ||
"publint": "node ./scripts/publint.js" | ||
}, | ||
"dependencies": { | ||
"@changesets/cli": "^2.26.2", | ||
|
@@ -18,6 +19,7 @@ | |
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-import": "2.29.0", | ||
"prettier": "3.1.0", | ||
"publint": "^0.2.5", | ||
"typescript": "5.3.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,52 @@ | ||
import { readdir } from 'node:fs/promises'; | ||
import { spawn } from 'node:child_process'; | ||
import { parseArgs } from 'node:util'; | ||
|
||
function publint(path) { | ||
return new Promise((resolve, reject) => { | ||
const child = spawn('publint', [path]); | ||
child.stdout.on('data', (data) => { | ||
console.log(data.toString()); | ||
}); | ||
|
||
child.stderr.on('data', (data) => { | ||
console.error(data.toString()); | ||
}); | ||
|
||
child.on('close', (code) => { | ||
if (code !== 0) { | ||
reject(code); | ||
} else { | ||
resolve(code); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
async function publintAll() { | ||
let hasError = false; | ||
await publint('./').catch(() => { | ||
hasError = true; | ||
}); | ||
for (const packagePath of await readdir('./packages')) { | ||
await publint(`./packages/${packagePath}`).catch(() => { | ||
hasError = true; | ||
}); | ||
} | ||
|
||
if (hasError) { | ||
throw new Error('publint failed'); | ||
} | ||
} | ||
|
||
const [path] = parseArgs({ allowPositionals: true }).positionals; | ||
|
||
if (path == null) { | ||
publintAll().catch(() => { | ||
process.exit(1); | ||
}); | ||
} else { | ||
publint(path).catch(() => { | ||
process.exit(1); | ||
}); | ||
} |