-
Notifications
You must be signed in to change notification settings - Fork 433
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
Showing
3 changed files
with
31 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Mainly a quick script to migrate the generated files into the | ||
// lib folder of a TypeScript clone. | ||
// | ||
// node ./lib/migrate-to-tsc.js [optional/file/path/to/tsc] | ||
|
||
import { existsSync, readdirSync, readFileSync, writeFileSync } from "fs" | ||
import { join } from "path" | ||
|
||
const maybeTSWorkingDir = [process.argv[2], "../TypeScript", "TypeScript"] | ||
const tscWD = maybeTSWorkingDir.find(wd => existsSync(wd)) | ||
|
||
if (!tscWD) throw new Error("Could not find a TypeScript clone to put the generated files in.") | ||
|
||
const generatedFiles = readdirSync("generated") | ||
generatedFiles.forEach(file => { | ||
const contents = readFileSync(join("generated", file) , "utf8") | ||
const newFilePath = join(tscWD, "lib", file.replace(".generated", "")) | ||
writeFileSync(newFilePath, contents) | ||
}) | ||
|
||
console.log(`Moved ${generatedFiles.map(f => f.replace(".generated", "")).join(", ")} to '${tscWD}'.`) |