forked from PrismarineJS/prismarine-web-client
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
outdated commit hints in ci!! (#101)
- Loading branch information
Showing
7 changed files
with
77 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import path from 'path' | ||
import fs from 'fs' | ||
|
||
const publicPath = path.resolve(__dirname, '../../public') | ||
const texturesPath = path.join(publicPath, 'textures') | ||
|
||
if (fs.existsSync(texturesPath) && !process.argv.includes('-f')) { | ||
console.log('textures folder already exists, skipping...') | ||
process.exit(0) | ||
} else { | ||
import('./generateTextures') | ||
} |
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,52 @@ | ||
// pnpm bug workaround | ||
import fs from 'fs' | ||
import { parse } from 'yaml' | ||
import _ from 'lodash' | ||
|
||
const lockfile = parse(fs.readFileSync('./pnpm-lock.yaml', 'utf8')) | ||
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')) | ||
const depsKeys = ['dependencies', 'devDependencies'] | ||
|
||
const githubToken = process.env.GITHUB_TOKEN | ||
const ignoreDeps = packageJson.pnpm?.updateConfig?.ignoreDependencies ?? [] | ||
|
||
const outdatedDeps = [] | ||
|
||
const allDepsObj = {} | ||
|
||
for (const [key, val] of Object.entries(lockfile.importers)) { | ||
// Object.assign(allDepsObj, val) | ||
_.merge(allDepsObj, val) | ||
} | ||
|
||
for (const [depsKey, deps] of Object.entries(allDepsObj)) { | ||
for (const [depName, { specifier, version }] of Object.entries(deps)) { | ||
if (ignoreDeps.includes(depName)) continue | ||
if (!specifier.startsWith('github:')) continue | ||
// console.log('checking github:', depName, version, specifier) | ||
|
||
let possiblyBranch = specifier.match(/#(.*)$/)?.[1] ?? '' | ||
if (possiblyBranch) possiblyBranch = `/${possiblyBranch}` | ||
const sha = version.split('/').slice(3).join('/').replace(/\(.+/, '') | ||
const repo = version.split('/').slice(1, 3).join('/') | ||
|
||
const lastCommitJson = await fetch(`https://api.github.com/repos/${repo}/commits${possiblyBranch}?per_page=1`, { | ||
headers: { | ||
Authorization: githubToken ? `token ${githubToken}` : undefined, | ||
}, | ||
}).then(res => res.json()) | ||
|
||
const lastCommitActual = lastCommitJson ?? lastCommitJson[0] | ||
const lastCommitActualSha = Array.isArray(lastCommitActual) ? lastCommitActual[0]?.sha : lastCommitActual?.sha | ||
if (lastCommitActualSha === undefined) debugger | ||
if (sha !== lastCommitActualSha) { | ||
// console.log(`Outdated ${depName} github.com/${repo} : ${sha} -> ${lastCommitActualSha} (${lastCommitActual.commit.message})`) | ||
outdatedDeps.push({ depName, repo, sha, lastCommitActualSha }) | ||
} | ||
} | ||
|
||
} | ||
|
||
if (outdatedDeps.length) { | ||
throw new Error(`Outdated dependencies found: \n${outdatedDeps.map(({ depName, repo, sha, lastCommitActualSha }) => `${depName} github.com/${repo} : ${sha} -> ${lastCommitActualSha}`).join('\n')}`) | ||
} |
This file was deleted.
Oops, something went wrong.