Skip to content

Commit

Permalink
Merge PR #838 from 'nodech/update-hsclient'
Browse files Browse the repository at this point in the history
  • Loading branch information
nodech committed Aug 8, 2023
2 parents 5449939 + 2346847 commit 500d638
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions scripts/gen-hsclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ const COPY_FILES = [
'bin/hsw-rpc',
'lib/client/index.js',
'lib/client/wallet.js',
'lib/client/node.js'
'lib/client/node.js',
'LICENSE',
'SECURITY.md'
];

const README = `
Expand Down Expand Up @@ -139,22 +141,36 @@ async function setupPackageContent(dir) {
return hsClientPkg;
}

async function setupGit(dir, version, log) {
async function setupGit(dir, log) {
const commands = [
'git init -b master',
`git remote add origin ${REMOTE}`,
'git fetch -q origin master',
'git pull -q origin master',
'git rm -r .'
];

log('Setting up git: ', dir);

for (const cmd of [...commands]) {
log(` > ${cmd} in ${dir}.`);
log(await execCmd(cmd, dir, 20000));
commands.shift();
}
}

async function finalGit(dir, version, log) {
const commands = [
'git add .',
`git commit --gpg-sign -m "v${version}"`,
`git tag --sign v${version} -m "v${version}"`
];

const manualCommands = [
'git push -f origin master',
`git push -f origin v${version}`
'git push origin master',
`git push origin v${version}`
];

log('Setting up git: ', dir);

for (const cmd of [...commands]) {
log(` > ${cmd} in ${dir}.`);

Expand Down Expand Up @@ -199,16 +215,20 @@ async function setupGit(dir, version, log) {

const pkgDir = await ensureDir(dir);

if (!noSteps && !noGit)
await setupGit(pkgDir, log);

log(`Copying files to ${pkgDir}...`);
const pkg = await setupPackageContent(pkgDir);
let gitNext = null;

if (!noGit)
gitNext = await setupGit(pkgDir, pkg.version, log);

if (noSteps)
return;

let gitNext;

if (!noGit)
gitNext = await finalGit(pkgDir, pkg.version, log);

console.log(`Generated ${pkgDir}.`);
console.log('Next steps:');
console.log(` $ cd ${pkgDir}`);
Expand Down

0 comments on commit 500d638

Please sign in to comment.