-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
32f5fba
commit 2e6d29b
Showing
27 changed files
with
11,527 additions
and
13,445 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
target/ | ||
*.spv | ||
*.exrc | ||
.pnp.cjs | ||
.pnp.loader.mjs | ||
.yarn/ |
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 |
---|---|---|
|
@@ -2,3 +2,6 @@ node_modules/ | |
wasm/pkg/ | ||
public/build/ | ||
dist/ | ||
.install-timestamp | ||
.pnp.cjs | ||
.pnp.loader.mjs |
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 |
---|---|---|
@@ -1,41 +1,41 @@ | ||
// This script automatically installs the npm packages listed in package-lock.json and runs before `npm start`. | ||
// It skips the installation if this has already run and neither package.json nor package-lock.json has been modified since. | ||
// This script automatically installs the packages listed in yarn.lock and runs before `yarn start`. | ||
// It skips the installation if this has already run and neither package.json nor yarn.lock has been modified since. | ||
|
||
import { execSync } from "child_process"; | ||
import { existsSync, statSync, writeFileSync } from "fs"; | ||
|
||
const INSTALL_TIMESTAMP_FILE = "node_modules/.install-timestamp"; | ||
const INSTALL_TIMESTAMP_FILE = ".install-timestamp"; | ||
|
||
// Checks if the install is needed by comparing modification times | ||
const isInstallNeeded = () => { | ||
if (!existsSync(INSTALL_TIMESTAMP_FILE)) return true; | ||
|
||
const timestamp = statSync(INSTALL_TIMESTAMP_FILE).mtime; | ||
return ["package.json", "package-lock.json"].some((file) => { | ||
return ["package.json", "yarn.lock"].some((file) => { | ||
return existsSync(file) && statSync(file).mtime > timestamp; | ||
}); | ||
}; | ||
|
||
// Run `npm ci` if needed and update the install timestamp | ||
// Run `yarn install` if needed and update the install timestamp | ||
if (isInstallNeeded()) { | ||
try { | ||
// eslint-disable-next-line no-console | ||
console.log("Installing npm packages..."); | ||
console.log("Installing yarn packages..."); | ||
|
||
// Check if packages are up to date, doing so quickly by using `npm ci`, preferring local cached packages, and skipping the package audit and other checks | ||
execSync("npm ci --prefer-offline --no-audit --no-fund", { stdio: "inherit" }); | ||
// Check if packages are up to date, doing so quickly by using `--immutable` and `--immutable-cache`. | ||
execSync("yarn install --immutable --immutable-cache", { stdio: "inherit" }); | ||
|
||
// Touch the install timestamp file | ||
writeFileSync(INSTALL_TIMESTAMP_FILE, ""); | ||
|
||
// eslint-disable-next-line no-console | ||
console.log("Finished installing npm packages."); | ||
} catch (error) { | ||
console.log("Finished installing yarn packages."); | ||
} catch { | ||
// eslint-disable-next-line no-console | ||
console.error("Failed to install npm packages. Please run `npm install` from the `/frontend` directory."); | ||
console.error("Failed to install yarn packages. Please run `yarn install` from the `/frontend` directory."); | ||
process.exit(1); | ||
} | ||
} else { | ||
// eslint-disable-next-line no-console | ||
console.log("All npm packages are up-to-date."); | ||
console.log("All yarn packages are up-to-date."); | ||
} |
Oops, something went wrong.