Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import path from 'path';
import fs from 'fs-extra';
import { fileURLToPath } from 'url';
import arg from 'arg';
import { exec } from 'child_process';
import chalk from 'chalk';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const root = path.resolve(__dirname, '../');
const args = arg({
'--version': String,
'--package': String,
// Aliases
'-v': '--version',
'-p': '--package',
});
if (!args['--package']) {
console.error(`Please provide the package you want to deploy. ex: --package=sds-styling-hooks`);
}
if (args['--package']) {
const packageJson = fs.readJsonSync(path.resolve(root, `packages/${args['--package']}/package.json`));
if (!args['--version']) {
console.error(
`Please provide a version number. ex: --version=0.1.0\nThe current version for ${args['--package']} is ${packageJson.version}`,
);
} else {
exec(`cd packages/${args['--package']} && yarn build:dist --version=${args['--version']}`, (err) => {
if (err) return console.error(err);
console.log(
`${chalk.green('Successfully')} updated ${args['--package']} to version ${args['--version']}`,
);
exec(
`cd packages/${args['--package']} && npm version ${args['--version']} && yarn publish:internal`,
(err) => {
if (err) return console.error(err);
console.log(
`${chalk.green('Successfully')} published ${
args['--package']
} to internal Nexus. 🚀\nPackage located at https://nexus-dev.data.sfdc.net/nexus/#browse/browse:npmjs-internal:%40salesforce-ux%2F${
args['--package']
}%2F${args['--package']}-${args['--version']}.tgz`,
);
},
);
});
}
}
|