Skip to content

Commit

Permalink
Add option to build command
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Mar 24, 2021
1 parent 68b7a6d commit 1ed6527
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ const rimrafAsync = promisify(rimraf);
* @param {Object} opts
*/
export const buildLocale = async (opts = {}) => {
if (!fs.existsSync(rootResolve('src/locale'))) return;
const { localePath } = opts;
if (!fs.existsSync(rootResolve(localePath))) return;
printRow('Start building locale files...', { lineDown: 0 });

await rimrafAsync('locale');

const localDst = rootResolve('locale');
copyRecursiveSync(rootResolve('src/locale'), localDst);
copyRecursiveSync(rootResolve(localePath), localDst);

// Create locale/index.js file
let result = '';
Expand Down
5 changes: 5 additions & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ export const createCommands = (yargs) => {
describe: 'Increase automatically the patch version',
type: 'boolean',
default: true,
})
.positional('localePath', {
describe: 'Path to the directory containing locale files',
type: 'string',
default: 'src/locale',
});
webpackOptions(yargs);
}, (argv) => build(argv))
Expand Down

0 comments on commit 1ed6527

Please sign in to comment.