diff --git a/tools/dispatch-release.mjs b/tools/dispatch-release.mjs index 3bdc53a23f53b7ecba8fcf112741b1f5c5a47431..0d0f5545feb7cb9cba98ed3865a36df6f3912870 100644 --- a/tools/dispatch-release.mjs +++ b/tools/dispatch-release.mjs @@ -1,6 +1,6 @@ import got from 'got'; import shell from 'shelljs'; -import { options } from './utils.mjs'; +import { options } from './utils/options.mjs'; const version = options.release; const tag = options.tag || 'latest'; diff --git a/tools/docs/config.ts b/tools/docs/config.ts index fe295b233322d81cf2afa019de2e57f758b47b61..ff93ea7ae76c73eec75d717e12fdb6d8237cc3bc 100644 --- a/tools/docs/config.ts +++ b/tools/docs/config.ts @@ -2,7 +2,7 @@ import table from 'markdown-table'; import { getOptions } from '../../lib/config/options'; import { getCliName } from '../../lib/workers/global/config/parse/cli'; import { getEnvName } from '../../lib/workers/global/config/parse/env'; -import { readFile, updateFile } from '../utils/index'; +import { readFile, updateFile } from '../utils'; const options = getOptions(); diff --git a/tools/release.mjs b/tools/release.mjs index eb1d20f3ea4294a5eb37f0c3439060cc30fc4226..748028a26ba2d00a6acd8bfd42d73e43a7846eeb 100644 --- a/tools/release.mjs +++ b/tools/release.mjs @@ -1,29 +1,9 @@ import shell from 'shelljs'; -import { options } from './utils.mjs'; +import { options } from './utils/options.mjs'; const version = options.release; -// const sha = program.sha; - -// let err = false; shell.echo(`Publishing version: ${version}`); -// shell.echo('Publishing npm package ...'); -// if ( -// !exec(`npm --no-git-tag-version version ${version}`) || -// !exec(`npm publish`) -// ) { -// err = true; -// } - -// shell.echo('Publishing docker images ...'); -// if (!exec(`./.github/workflows/release-docker.sh ${version} ${sha}`)) { -// err = true; -// } - // eslint-disable-next-line promise/valid-params,@typescript-eslint/no-floating-promises import('./dispatch-release.mjs').catch(); - -// if (err) { -// shell.exit(2); -// } diff --git a/tools/utils.mjs b/tools/utils.mjs deleted file mode 100644 index 6b06b719de492c8cea98e1cc5b0888b07d708255..0000000000000000000000000000000000000000 --- a/tools/utils.mjs +++ /dev/null @@ -1,35 +0,0 @@ -import { Command } from 'commander'; -import shell from 'shelljs'; - -const program = new Command(); -program - .version('0.0.1') - .requiredOption('-r, --release <type>', 'Version to use') - .option('-s, --sha <type>', 'Git sha to use') - .option('-t, --tag <type>', 'Npm dist-tag to publish to') - .option('-d, --dry-run'); - -program.parse(process.argv); - -export const options = program.opts(); - -export { program }; - -/** - * Executes a shell command - * @param cmd {string} The command to execute - * @returns {boolean} Returns true on zero exit code otherwise false - */ -export function exec(cmd) { - try { - if (!options.dryRun) { - const res = shell.exec(cmd); - return res.code === 0; - } - shell.echo(`DRY-RUN: ${cmd}`); - } catch (e) { - shell.echo(e.toString()); - return false; - } - return true; -} diff --git a/tools/utils/options.mjs b/tools/utils/options.mjs new file mode 100644 index 0000000000000000000000000000000000000000..afbadf386b0ce40ea133b69ba7da224aa636f965 --- /dev/null +++ b/tools/utils/options.mjs @@ -0,0 +1,15 @@ +import { Command } from 'commander'; + +const program = new Command(); +program + .version('0.0.1') + .requiredOption('-r, --release <type>', 'Version to use') + .option('-s, --sha <type>', 'Git sha to use') + .option('-t, --tag <type>', 'Npm dist-tag to publish to') + .option('-d, --dry-run'); + +program.parse(process.argv); + +export const options = program.opts(); + +export { program };