Skip to content

Commit

Permalink
fix(wb): make optimizeForDockerBuild support any GitHub-hosted packages
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Oct 3, 2023
1 parent 3a6808e commit 540dfa3
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions packages/wb/src/commands/optimizeForDockerBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,15 @@ export const optimizeForDockerBuildCommand: CommandModule<unknown, InferredOptio

for (const packageJsonPath of packageJsonPaths) {
const packageJson: PackageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const deps = packageJson.dependencies || {};
if (deps['@discord-bot/llm'] && deps['@discord-bot/llm'] !== 'workspace:*') {
deps['@discord-bot/llm'] = './@discord-bot/llm';
}
const depNames = ['@moti-components/go-e-mon', '@online-judge/shared', 'program-executor', 'judge'];
for (const depName of depNames) {
if (deps[depName]) {
deps[depName] = `./${depName}`;
const keys = ['dependencies', 'devDependencies'] as const;
for (const key of keys) {
const deps = packageJson[key] || {};
for (const [name, value] of Object.entries(deps)) {
if (value?.startsWith('[email protected]:')) {
deps[name] = `./${name}`;
}
}
}
// TODO: remove after migrating from online-judge-shared to @online-judge/shared
if (deps['online-judge-shared']) {
deps['online-judge-shared'] = './online-judge-shared';
}

optimizeDevDependencies(argv, packageJson);

Expand Down

0 comments on commit 540dfa3

Please sign in to comment.