-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fc07c9
commit b0ebda5
Showing
4 changed files
with
58 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 |
---|---|---|
@@ -1,24 +1,26 @@ | ||
import { readdirSync } from 'node:fs'; | ||
import { resolve } from 'node:path'; | ||
import { readjson, writejson } from './utils'; | ||
import { playgrounds, readjson, writejson } from './utils'; | ||
|
||
const TASKS_PATH = resolve('.codesandbox/tasks.json'); | ||
|
||
const taskJson = readjson(TASKS_PATH); | ||
const names = readdirSync(resolve('playgrounds')); | ||
main(); | ||
|
||
let port = 4000; | ||
names.flatMap((name) => { | ||
const task = `@playground/${name}`; | ||
taskJson.tasks[name] = { | ||
name: `Preview ${task}`, | ||
command: `pnpm --filter ${task} dev`, | ||
runAtStart: true, | ||
preview: { | ||
port: port++, | ||
prLink: 'direct', | ||
}, | ||
}; | ||
}); | ||
function main() { | ||
const taskJson = readjson(TASKS_PATH); | ||
|
||
writejson(TASKS_PATH, taskJson); | ||
let port = 4000; | ||
playgrounds.forEach((name) => { | ||
const task = `@playground/${name}`; | ||
taskJson.tasks[name] = { | ||
name: `Preview ${task}`, | ||
command: `pnpm --filter ${task} dev`, | ||
runAtStart: true, | ||
preview: { | ||
port: port++, | ||
prLink: 'direct', | ||
}, | ||
}; | ||
}); | ||
|
||
writejson(TASKS_PATH, taskJson); | ||
} |
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