scripts: Instead of removing history from hs-client#master, append to it.

This commit is contained in:
Nodari Chkuaselidze 2023-08-08 13:01:32 +04:00
parent 54499395f4
commit 23468477af
No known key found for this signature in database
GPG key ID: B018A7BB437D1F05

View file

@ -62,7 +62,9 @@ const COPY_FILES = [
'bin/hsw-rpc', 'bin/hsw-rpc',
'lib/client/index.js', 'lib/client/index.js',
'lib/client/wallet.js', 'lib/client/wallet.js',
'lib/client/node.js' 'lib/client/node.js',
'LICENSE',
'SECURITY.md'
]; ];
const README = ` const README = `
@ -139,22 +141,36 @@ async function setupPackageContent(dir) {
return hsClientPkg; return hsClientPkg;
} }
async function setupGit(dir, version, log) { async function setupGit(dir, log) {
const commands = [ const commands = [
'git init -b master', 'git init -b master',
`git remote add origin ${REMOTE}`, `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 add .',
`git commit --gpg-sign -m "v${version}"`, `git commit --gpg-sign -m "v${version}"`,
`git tag --sign v${version} -m "v${version}"` `git tag --sign v${version} -m "v${version}"`
]; ];
const manualCommands = [ const manualCommands = [
'git push -f origin master', 'git push origin master',
`git push -f origin v${version}` `git push origin v${version}`
]; ];
log('Setting up git: ', dir);
for (const cmd of [...commands]) { for (const cmd of [...commands]) {
log(` > ${cmd} in ${dir}.`); log(` > ${cmd} in ${dir}.`);
@ -199,16 +215,20 @@ async function setupGit(dir, version, log) {
const pkgDir = await ensureDir(dir); const pkgDir = await ensureDir(dir);
if (!noSteps && !noGit)
await setupGit(pkgDir, log);
log(`Copying files to ${pkgDir}...`); log(`Copying files to ${pkgDir}...`);
const pkg = await setupPackageContent(pkgDir); const pkg = await setupPackageContent(pkgDir);
let gitNext = null;
if (!noGit)
gitNext = await setupGit(pkgDir, pkg.version, log);
if (noSteps) if (noSteps)
return; return;
let gitNext;
if (!noGit)
gitNext = await finalGit(pkgDir, pkg.version, log);
console.log(`Generated ${pkgDir}.`); console.log(`Generated ${pkgDir}.`);
console.log('Next steps:'); console.log('Next steps:');
console.log(` $ cd ${pkgDir}`); console.log(` $ cd ${pkgDir}`);