Created
September 9, 2020 14:10
-
-
Save simenandre/1e6719a4552fe2a97fe7cce4e7e87ef3 to your computer and use it in GitHub Desktop.
Create Github-issues automatically with Github CLI based on `.tsx` files in `src/modules`. (Very specific)
This file contains hidden or 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
| const fs = require('fs'); | |
| const path = require('path'); | |
| const exec = require('child_process').exec; | |
| const dir = `${__dirname}/src/modules/` | |
| async function* walk(dir) { | |
| for await (const d of await fs.promises.opendir(dir)) { | |
| const entry = path.join(dir, d.name); | |
| if (d.isDirectory()) yield* walk(entry); | |
| else if (d.isFile()) yield entry; | |
| } | |
| } | |
| (async () => { | |
| for await (const p of walk(dir)) { | |
| if (p.match(/.tsx/)) { | |
| const x = path.extname(p) | |
| const realName = path.basename(p, x); | |
| const pathName = p.replace(dir, ''); | |
| const body = ` | |
| _This issue is automatically created by @cobraz_ | |
| Right now, the ${realName} component is empty. We need to implement it. | |
| Path to the file is: ${pathName} | |
| `; | |
| exec( | |
| `gh issue create --title "Implement ${realName}" --body "${body}" --assignee cobraz --milestone "Implement all components"` | |
| ); | |
| console.log(`${realName} added!`) | |
| } | |
| }; | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment