judgekit
v0.0.7-hotfix5
Published
various of toolCLI for code judge, exam, test, etc.
Downloads
1
Readme
- 한국어 -
the CLI node module for JS code judge quick testing.
Judgekit is made for easy code generation and quick code testing. With this module, every time you test code a new node process is created for running the given script file. You don't need to change any configuration after editing the script file while testing - just press the enter key in the termial!
notice
this modules is based on my tester.js gist. most things in there are same in here too, but it's not a bad choice to see the gist.
Installation
because it is CLI modules, i strongly suggest to install in global.
yarn global add judgekit
npm install -g judgekit
Features
base comamnd is judgekit
. every arguments, options, subcommands are based on this command.
first of all, you can see all comamnd and CLI information via judgekit --help
command.
Test script
you can run special javascript file by running test
command as below examples.
judgekit test <script[.js]>
judgekit test 1000
judgekit test 1000.js
because only javascript is valid in this CLI, you don't have to type .js
extension yourself as you see above command.
also you don't have to restart CLI when changing script file. why? because script processor is re-created everytime you continue test.
everytime processor is created, it load latest script codes again and again. so you don't have to restart anything anymore.
+ because of this feature, you also don't have to restart CLI when changing testcase hjson file too.
Test script with Test Case
to load special script file and run testcase datas automatically, you can use -TC
options as you see below examples.
judgekit test <script[.js]> -TC
judgekit test <script[.js]> --testcase
judgekit test <script[.js]> --testcase customHJSON.hjson
as you see, if you have custom file you can also use it.
the default testcase file's name is testcase.hjson
.
notice that -tc
flag is not valid. ~~yeah i know this is weird...~~
Test Case
the testcase file is designed for automatically input. you can see example format in here
Test case can be three format - json, hjson, yaml.
testcase.hjson
is default file of TestCase. you can customize the name and use to --testcase
flag's value. at least, it be in CMD path (current terminal path).
Code Generation (WIP)
tired about typing same codes everytime start code exam or judge problems?
code generation command will copy-paste boilerplate codes from templates/
directory.
the comamnd format is same as below examples.
judgekit generate <script_name[.js]> [template_script_name[.js]] [-O outdir]
judgekit generate examples/1000
judgekit generate 1000 -O examples
notice
currently you can use only one template -readline_ex.js
, but i will add more template scripts and support custom template via command argument.
Config
Judge judgekit CLI accepts config file called kitconfig.json
.
the config file will be automatically generated in user's home directory - also if there is config file in project root, cli will load it. the config file is used for some CLI config or option cache. for example with judgekit test 1000 -TC specialTestCase.json
command, the Config will write this in config file. so after setting options, you don't need to call twice. like
judgekit test 1000 -TC testcase.yaml
judgekit test 1000 -TC
format
the config file is same as below default configs.
{
"currentLang": "en",
"testcasePath": "testcase.hjson",
"templatePath": "readline_ex.js",
"generatePath": "src"
}
Config Command
also for some config you can set it by judgekit config
.
currently you can use it only for currentLang
config.
judgekit config -L en
judgekit config --lang ko
TODO
- [x] Internationalize Project
- [x] support english CLI
- [x] support korean README
- [x] support json/yaml testcase format too
- [ ] support pre-run input mapper scripts
- [ ] improve code generation
- [x] add some code generation templates
- [ ] more built-in code templates and choose prompt
- [ ] support test code(jest?)