forked from processing/p5.js-website
-
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.
add script to pull in latest p5 version
and use across website pages
- Loading branch information
1 parent
e0371de
commit 9a54560
Showing
9 changed files
with
87 additions
and
44 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const p5Version = "1.9.4" as const; |
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,31 @@ | ||
import path from "path"; | ||
import { cloneLibraryRepo, repoRootPath, writeFile } from "./utils"; | ||
import { readFile } from "fs/promises"; | ||
|
||
/* Where to clone the repo to */ | ||
const clonedRepoPath = path.join(repoRootPath, "in", "p5.js"); | ||
|
||
const outputFile = path.join(repoRootPath, "src", "globals", "p5-version.ts"); | ||
|
||
const outputString = (version: string) => | ||
`export const p5Version = "${version}" as const;\n`; | ||
|
||
const run = async () => { | ||
console.log("Reading latest p5 version to update config..."); | ||
|
||
await cloneLibraryRepo(clonedRepoPath); | ||
|
||
// read version from package.json | ||
const packageConfigContents = await readFile( | ||
path.join(clonedRepoPath, "package.json"), | ||
"utf8", | ||
); | ||
const newP5Version = JSON.parse(packageConfigContents)["version"] as string; | ||
|
||
// write to ts file | ||
await writeFile(outputFile, outputString(newP5Version)); | ||
|
||
console.log("Done!"); | ||
}; | ||
|
||
run(); |