forked from ohcnetwork/leaderboard
-
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.
Updated symlinks, added scripts, updated readme (ohcnetwork#404)
* Updated symlinks, added scripts, updated markdown * added build command * remove yarn lock * gitignore * maybe this works * pnpm lock * build command change * wrong script mb * minor change to package json
- Loading branch information
1 parent
5f58e97
commit 09ac838
Showing
20 changed files
with
141 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,8 @@ data-repo | |
|
||
#IDE | ||
.idea | ||
.vscode | ||
.vscode | ||
|
||
# Package Lock | ||
package-lock.json | ||
yarn.lock |
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,4 +1,2 @@ | ||
# Ignore data | ||
./data | ||
./contributors | ||
./data-repo |
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
const { execSync } = require('child_process'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const dotenv = require('dotenv'); | ||
dotenv.config(); | ||
|
||
const dataRepoDir = "data-repo"; | ||
|
||
const askYN = (question, def, ycallback, ncallback) => { | ||
console.log(`${question} (${def ? 'Y/n' : 'y/N'})`); | ||
const stdin = process.openStdin(); | ||
stdin.addListener('data', function (d) { | ||
const input = d.toString().trim().toLowerCase(); | ||
stdin.removeAllListeners('data'); | ||
if (input === 'y' || (!input && def)) { | ||
ycallback(); | ||
} else if (input === 'n' || (!input && !def)) { | ||
ncallback(); | ||
} else { | ||
askYN(question, def, ycallback, ncallback); | ||
} | ||
}); | ||
} | ||
if (!fs.existsSync(path.join(process.cwd(), dataRepoDir))) { | ||
console.log("Looks like you have not loaded any data.") | ||
askYN("Download data now?", true, () => { | ||
execSync(`node scripts/loadOrgData.js`, { stdio: 'inherit' }) | ||
process.exit(0); | ||
}, () => { | ||
console.log("Aborting..."); | ||
process.exit(1); | ||
}); | ||
} |
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,47 @@ | ||
const { execSync } = require('child_process'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const dotenv = require('dotenv'); | ||
dotenv.config(); | ||
|
||
const DATA_SOURCE = process.env.DATA_SOURCE || null; | ||
if (!DATA_SOURCE) { | ||
console.error('Please provide a DATA_SOURCE environment variable'); | ||
process.exit(1); | ||
} | ||
const cwd = process.cwd(); | ||
const dataRepoPath = path.join(cwd, 'data-repo'); | ||
|
||
function executeCommand(command, workingDir = cwd) { | ||
try { | ||
const result = execSync(command, { cwd: workingDir, stdio: 'inherit' }); | ||
return result; | ||
} catch (error) { | ||
console.error(`Error executing command: ${command}`, error); | ||
} | ||
} | ||
|
||
if (fs.existsSync(path.join(dataRepoPath, '.git'))) { | ||
console.log("Updating existing data repository..."); | ||
const remotes = executeCommand('git remote -v', dataRepoPath) | ||
if (remotes && remotes.includes('upstream')) { | ||
executeCommand('git clean -df', dataRepoPath); | ||
executeCommand('git fetch upstream', dataRepoPath); | ||
executeCommand('git checkout --force main', dataRepoPath); | ||
executeCommand('git reset --hard main', dataRepoPath); | ||
executeCommand('git pull upstream main', dataRepoPath); | ||
} | ||
} else { | ||
console.log("Cloning data repository for the first time..."); | ||
|
||
fs.rmSync(dataRepoPath, { recursive: true, force: true }); | ||
executeCommand(`git clone ${DATA_SOURCE} ${dataRepoPath}`); | ||
executeCommand('git remote add upstream ' + DATA_SOURCE, dataRepoPath); | ||
executeCommand('git remote remove origin', dataRepoPath); | ||
executeCommand('git pull upstream main', dataRepoPath); | ||
} | ||
|
||
if (fs.existsSync(path.join(dataRepoPath, 'config/assets'))) { | ||
console.log("Copying assets to public folder..."); | ||
fs.cpSync(path.join(dataRepoPath, 'config/assets'), path.join(cwd, 'public'), { recursive: true }); | ||
} |
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,4 @@ | ||
{ | ||
"framework": "nextjs" | ||
} | ||
"framework": "nextjs", | ||
"buildCommand": "node ./scripts/loadOrgData.js && next build" | ||
} |