remove dependencies
This commit is contained in:
parent
a7873cc203
commit
8f914cc2d9
@ -6,8 +6,6 @@
|
||||
## Compile lemon-js
|
||||
```bash
|
||||
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
||||
npm install
|
||||
# or
|
||||
./build.sh
|
||||
```
|
||||
|
||||
@ -89,4 +87,8 @@ See lemon.html for additional documentation.
|
||||
Used re2js lexer from: [http://git.macaw.me:3000/chichenkov/re2-js-generator](http://git.macaw.me:3000/chichenkov/re2-js-generator)
|
||||
|
||||
## Original project
|
||||
See https://github.com/sormy/lemon-js
|
||||
See https://github.com/sormy/lemon-js
|
||||
|
||||
## Links
|
||||
- Used js-beautify-node from: [https://github.com/rwaldron/js-beautify-node](https://github.com/rwaldron/js-beautify-node)
|
||||
- Used args-parser from: [https://www.npmjs.com/package/args-parser](https://www.npmjs.com/package/args-parser)
|
@ -2,8 +2,6 @@
|
||||
|
||||
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
||||
|
||||
npm install
|
||||
|
||||
cat config.example > config.js
|
||||
|
||||
node main.js
|
2
build.sh
2
build.sh
@ -2,6 +2,4 @@
|
||||
|
||||
gcc -o ./lemon-src/lemon-js -O2 ./lemon-src/lemon-js.c
|
||||
|
||||
npm install
|
||||
|
||||
cat config.template > config.js
|
File diff suppressed because it is too large
Load Diff
41
libs/args-parser.js
Normal file
41
libs/args-parser.js
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 1/30/19.
|
||||
*/
|
||||
|
||||
function Parse (argv) {
|
||||
// Removing node/bin and called script name
|
||||
argv = argv.slice(2);
|
||||
|
||||
// Returned object
|
||||
var args = {};
|
||||
|
||||
var argName, argValue;
|
||||
|
||||
// For each argument
|
||||
argv.forEach(function (arg, index) {
|
||||
// Seperate argument, for a key/value return
|
||||
arg = arg.split('=');
|
||||
|
||||
// Retrieve the argument name
|
||||
argName = arg[0];
|
||||
|
||||
// Remove "--" or "-"
|
||||
if (argName.indexOf('-') === 0) {
|
||||
argName = argName.slice(argName.slice(0, 2).lastIndexOf('-') + 1);
|
||||
}
|
||||
|
||||
// Associate defined value or initialize it to "true" state
|
||||
argValue = (arg.length === 2)
|
||||
? parseFloat(arg[1]).toString() === arg[1] // check if argument is valid number
|
||||
? +arg[1]
|
||||
: arg[1]
|
||||
: true;
|
||||
|
||||
// Finally add the argument to the args set
|
||||
args[argName] = argValue;
|
||||
});
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
module.exports = Parse;
|
1179
libs/js-beautifier.js
Normal file
1179
libs/js-beautifier.js
Normal file
File diff suppressed because it is too large
Load Diff
13
main.js
13
main.js
@ -2,8 +2,8 @@
|
||||
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 1/28/19.
|
||||
*/
|
||||
|
||||
var js_beautify = require("js-beautify");
|
||||
var args = require("args-parser")(process.argv);
|
||||
var js_beautify = require("./libs/js-beautifier");
|
||||
var args = require("./libs/args-parser")(process.argv);
|
||||
var fs = require("fs");
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
@ -55,7 +55,14 @@ var post_process_parser = function () {
|
||||
}
|
||||
}
|
||||
|
||||
out_js = js_beautify(out_js, {indent_size: 4, space_in_empty_paren: true});
|
||||
out_js = js_beautify(out_js, {
|
||||
indent_size: 4,
|
||||
indent_char: ' ',
|
||||
preserve_newlines: true,
|
||||
space_after_anon_function: true,
|
||||
keep_array_indentation: false,
|
||||
braces_on_own_line: false
|
||||
});
|
||||
|
||||
if(!fs.existsSync(output_path)){
|
||||
fs.mkdirSync(output_path);
|
||||
|
@ -7,8 +7,5 @@
|
||||
"name": "chichenkov",
|
||||
"email": "rolahd@yandex.ru"
|
||||
},
|
||||
"dependencies": {
|
||||
"args-parser": "^1.1.0",
|
||||
"js-beautify": "^1.8.9"
|
||||
}
|
||||
"dependencies": {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user