Skip to content

Commit

Permalink
fix cli issue (#4)
Browse files Browse the repository at this point in the history
Co-authored-by: nzhang4 <nzhang4@stubhub.com>
  • Loading branch information
Edward-Roshan and nzhang4 authored Nov 18, 2020
1 parent 7cca799 commit d5946a5
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 30 deletions.
2 changes: 0 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ CODE_OF_CONDUCT.md
CONTRIBUTING.md
pull_request_template.md
build
bin/*
src/cli-wrapper.ts
action.ts
action.yml
2 changes: 1 addition & 1 deletion action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as core from '@actions/core';
import avj from './src/avj';
import chalk from 'chalk';

const fileExtension = core.getInput('file-extension') ?? [];
const fileExtension = core.getInput('file-extension') ?? ['.json'];
const ignoreFiles = core.getInput('ignore-files') ?? [];
const ignoreDirectories = core.getInput('ignore-directories') ?? [];
const readPath = core.getInput('read-path') ?? './';
Expand Down
6 changes: 3 additions & 3 deletions src/cli-wrapper.ts → bin/cli-wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

import args from 'args';
import Args from './types/args';
import avj from './avj';
import Args from '../src/types/args';
import avj from '../src/avj';
import chalk from 'chalk';

export function parseArgumentsIntoOptions(rawArgs: string[]): Args {
args
.option('file-extension', '[Required] file extension that you want to read. such as "config" or "xml". split with comma.')
.option('file-extension', '[Required] file extension that you want to read. such as ".config" or ".json". split with comma.')
.option('ignore-files', 'the files you want to ignore. split with comma.')
.option('ignore-directories', 'the directories you want to ignore. split with comma.')
.option('read-path', 'the path that you assign to read.');
Expand Down
4 changes: 4 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

require('ts-node').register();
require('./cli.ts');
3 changes: 3 additions & 0 deletions bin/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import cli from './cli-wrapper';

cli(process.argv);
3 changes: 0 additions & 3 deletions cli.ts

This file was deleted.

2 changes: 1 addition & 1 deletion dist/action/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/action/index.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/action/sourcemap-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -3847,23 +3847,23 @@ exports.SourceMapConsumer = __webpack_require__(327).SourceMapConsumer;
/***/ ((module) => {

"use strict";
module.exports = require("fs");
module.exports = require("fs");;

/***/ }),

/***/ 282:
/***/ ((module) => {

"use strict";
module.exports = require("module");
module.exports = require("module");;

/***/ }),

/***/ 622:
/***/ ((module) => {

"use strict";
module.exports = require("path");
module.exports = require("path");;

/***/ })

Expand Down
129 changes: 129 additions & 0 deletions dist/cli/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


buffer-from
MIT
MIT License

Copyright (c) 2016, 2018 Linus Unnebäck

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


camelcase
MIT
MIT License
Expand Down Expand Up @@ -161,6 +186,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


make-error
ISC
Copyright 2014 Julien Fontanet

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


mri
MIT
The MIT License (MIT)
Expand Down Expand Up @@ -237,6 +271,63 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


source-map
BSD-3-Clause

Copyright (c) 2009-2011, Mozilla Foundation and contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the names of the Mozilla Foundation nor the names of project
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


source-map-support
MIT
The MIT License (MIT)

Copyright (c) 2014 Evan Wallace

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


supports-color
MIT
MIT License
Expand All @@ -248,3 +339,41 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


ts-node
MIT
The MIT License (MIT)

Copyright (c) 2014 Blake Embrey (hello@blakeembrey.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


yn
MIT
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion dist/cli/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cli/index.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/cli/sourcemap-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -3847,23 +3847,23 @@ exports.SourceMapConsumer = __webpack_require__(327).SourceMapConsumer;
/***/ ((module) => {

"use strict";
module.exports = require("fs");
module.exports = require("fs");;

/***/ }),

/***/ 282:
/***/ ((module) => {

"use strict";
module.exports = require("module");
module.exports = require("module");;

/***/ }),

/***/ 622:
/***/ ((module) => {

"use strict";
module.exports = require("path");
module.exports = require("path");;

/***/ })

Expand Down
2 changes: 1 addition & 1 deletion dist/index/index.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/index/sourcemap-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -3847,23 +3847,23 @@ exports.SourceMapConsumer = __webpack_require__(327).SourceMapConsumer;
/***/ ((module) => {

"use strict";
module.exports = require("fs");
module.exports = require("fs");;

/***/ }),

/***/ 282:
/***/ ((module) => {

"use strict";
module.exports = require("module");
module.exports = require("module");;

/***/ }),

/***/ 622:
/***/ ((module) => {

"use strict";
module.exports = require("path");
module.exports = require("path");;

/***/ })

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anyone-developer/anyone-validate-json",
"version": "0.9.5",
"version": "0.9.6",
"description": "This action helps you to validate JSON syntax in a specified directory. And write back with formatted content. read file recursively with specified file extensions.",
"main": "index.ts",
"types": "index.d.ts",
Expand All @@ -9,7 +9,10 @@
"src/types/args.d.ts",
"src/types/avj-item.d.ts",
"index.ts",
"index.d.ts"
"index.d.ts",
"bin/cli-wrapper.ts",
"bin/cli.js",
"bin/cli.ts"
],
"scripts": {
"test": "ts-node test.ts",
Expand All @@ -18,18 +21,22 @@
"build": "npm run build-index && npm run build-action && npm run build-cli && npm run build-win && npm run build-macos && npm run build-linux",
"build-index": "ncc build index.ts -o dist/index -m -s --license LICENSE",
"build-action": "ncc build action.ts -o dist/action -m -s --license LICENSE",
"build-cli": "ncc build cli.ts -o dist/cli -m -s --license LICENSE",
"build-cli": "ncc build bin/cli.js -o dist/cli -m -s --license LICENSE",
"build-win": "pkg dist/cli/index.js -t node12-win-x64 -o build/release/anyone-validate-json-win",
"build-macos": "pkg dist/cli/index.js -t node12-macos-x64 -o build/release/anyone-validate-json-macos",
"build-linux": "pkg dist/cli/index.js -t node12-linux-x64 -o build/release/anyone-validate-json-linux"
},
"bin": {
"anyone-validate-json": "./bin/cli.js",
"avj": "./bin/cli.js"
},
"repository": "git://github.com/anyone-developer/anyone-validate-json.git",
"keywords": [
"cli",
"anyone-validate-json",
"anyone-developer",
"xml",
"xml-formatter",
"json",
"json-formatter",
"formatter",
"validate",
"validation"
Expand Down Expand Up @@ -68,7 +75,9 @@
"prefer-promise-reject-errors": 0,
"prefer-optional-chain": 0,
"@typescript-eslint/restrict-template-expressions": 0,
"unicorn/no-reduce": 0
"unicorn/no-reduce": 0,
"unicorn/import-index": 0,
"import/no-unassigned-import": 0
}
}
}

0 comments on commit d5946a5

Please sign in to comment.