diff --git a/README.md b/README.md index 3dcf969..7d03332 100644 --- a/README.md +++ b/README.md @@ -21,21 +21,21 @@ i18nTagSchema('./src', '\\.jsx?', './translation.schema.json', false, (output, t }) ``` -### Commandline +### Via npm +#### package.json +```json +{ + "scripts": { + "schema": "i18n-tag-schema ./src" + } +} ``` -Usage: i18n-tag-schema [options] - -Options: - - -h, --help output usage information - -V, --version output the version number - -s, --schema set schema path. defaults to ./translation.schema.json - -f, --filter a regular expression to filter source files. defaults to \\.jsx? - -g, --groups group translations by module filenames +```sh +$ npm run schema ``` -### Gulp Task +### Via Gulp ```js var gulp = require('gulp') var i18nTagSchema = require('i18n-tag-schema').default @@ -47,6 +47,26 @@ gulp.task('generate-translation-schema', function (cb) { }) ``` +### Via Command-line + +Install i18n-tag-schema as global package to use it as command-line tool + +```sh +$ npm install i18n-tag-schema -g +``` + +``` +Usage: i18n-tag-schema [options] + +Options: + + -h, --help output usage information + -V, --version output the version number + -s, --schema set schema path. defaults to ./translation.schema.json + -f, --filter a regular expression to filter source files. defaults to \.jsx? + -g, --groups group translations by module filenames +``` + ### Reference schema in translation.json file ```json { diff --git a/cli/index.js b/cli/index.js index 4afccd5..88ec601 100644 --- a/cli/index.js +++ b/cli/index.js @@ -7,7 +7,7 @@ program .version('0.0.1') .usage(' [options]') .option('-s, --schema ', 'set schema path. defaults to ./translation.schema.json') - .option('-f, --filter ', 'a regular expression to filter source files. defaults to \\\\.jsx?') + .option('-f, --filter ', 'a regular expression to filter source files. defaults to \\.jsx?') .option('-g, --groups', 'group translations by module filenames') .action(function (path) { i18nTagSchema(path, program.filter || '\\.jsx?', program.schema || './translation.schema.json', program.groups, (output, type) => {