Skip to content

Commit 1ed6527

Browse files
committed
Add option to build command
1 parent 68b7a6d commit 1ed6527

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/build.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ const rimrafAsync = promisify(rimraf);
2424
* @param {Object} opts
2525
*/
2626
export const buildLocale = async (opts = {}) => {
27-
if (!fs.existsSync(rootResolve('src/locale'))) return;
27+
const { localePath } = opts;
28+
if (!fs.existsSync(rootResolve(localePath))) return;
2829
printRow('Start building locale files...', { lineDown: 0 });
2930

3031
await rimrafAsync('locale');
3132

3233
const localDst = rootResolve('locale');
33-
copyRecursiveSync(rootResolve('src/locale'), localDst);
34+
copyRecursiveSync(rootResolve(localePath), localDst);
3435

3536
// Create locale/index.js file
3637
let result = '';

src/cli.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ export const createCommands = (yargs) => {
8484
describe: 'Increase automatically the patch version',
8585
type: 'boolean',
8686
default: true,
87+
})
88+
.positional('localePath', {
89+
describe: 'Path to the directory containing locale files',
90+
type: 'string',
91+
default: 'src/locale',
8792
});
8893
webpackOptions(yargs);
8994
}, (argv) => build(argv))

0 commit comments

Comments
 (0)