forked from koluku/sudden-death
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
3 changed files
with
54 additions
and
21 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
57 changes: 37 additions & 20 deletions
57
scripts/pr_copy_ci_sudden_death/pr_copy_ci/copy_package.ts
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,39 +1,56 @@ | ||
const fs = require("fs"); | ||
const hatoBotPackage = require( | ||
`${process.env.GITHUB_WORKSPACE}/hato-bot/package.json`, | ||
); | ||
const hatoBotPackageLock = require( | ||
`${process.env.GITHUB_WORKSPACE}/hato-bot/package-lock.json`, | ||
); | ||
const suddenDeathPackage = require( | ||
`${process.env.GITHUB_WORKSPACE}/sudden-death/package.json`, | ||
); | ||
const suddenDeathPackageLock = require( | ||
`${process.env.GITHUB_WORKSPACE}/sudden-death/package-lock.json`, | ||
); | ||
|
||
module.exports = () => { | ||
import {readFileSync,writeFileSync} from "fs"; | ||
|
||
export function script() { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const hatoBotPackage: { [key: string]: any } = JSON.parse( | ||
readFileSync( | ||
`${process.env.GITHUB_WORKSPACE}/hato-bot/package.json`, | ||
).toString(), | ||
); | ||
|
||
const suddenDeathPackagePath = `${process.env.GITHUB_WORKSPACE}/sudden-death/package.json`; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const suddenDeathPackage: { [key: string]: any } = JSON.parse( | ||
readFileSync(suddenDeathPackagePath).toString(), | ||
); | ||
|
||
delete hatoBotPackage.scripts; | ||
|
||
for (const packageKey of Object.keys(hatoBotPackage)) { | ||
suddenDeathPackage[packageKey] = hatoBotPackage[packageKey]; | ||
} | ||
|
||
fs.writeFileSync( | ||
`${process.env.GITHUB_WORKSPACE}/sudden-death/package.json`, | ||
writeFileSync( | ||
suddenDeathPackagePath, | ||
JSON.stringify(suddenDeathPackage, null, " ") + "\n", | ||
"utf8", | ||
); | ||
|
||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const hatoBotPackageLock: { [key: string]: any } = JSON.parse( | ||
readFileSync( | ||
`${process.env.GITHUB_WORKSPACE}/hato-bot/package-lock.json`, | ||
).toString(), | ||
); | ||
|
||
const suddenDeathPackageLockPath = `${process.env.GITHUB_WORKSPACE}/sudden-death/package-lock.json`; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const suddenDeathPackageLock: { [key: string]: any } = JSON.parse( | ||
readFileSync(suddenDeathPackageLockPath).toString(), | ||
); | ||
|
||
delete hatoBotPackageLock.name; | ||
|
||
for (const packageLockKey of Object.keys(hatoBotPackageLock)) { | ||
suddenDeathPackageLock[packageLockKey] = hatoBotPackageLock[packageLockKey]; | ||
} | ||
|
||
fs.writeFileSync( | ||
`${process.env.GITHUB_WORKSPACE}/sudden-death/package-lock.json`, | ||
writeFileSync( | ||
suddenDeathPackageLockPath, | ||
JSON.stringify(suddenDeathPackageLock, null, " ") + "\n", | ||
"utf8", | ||
); | ||
}; | ||
} |
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,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
npm ci | ||
mv node_modules/ ../ |