1.0.3 • Published 12 months ago

nv-cli-json2code v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

nv-cli-json2code

  • nv-cli-json2code
  • cli-tool, convert json to a js function
  • for macro tool using, coz nested-big-json-config is hard to modify.
  • its slow , should NOT use in normal code, only for cli-tool

install

  • npm install nv-cli-json2code -g

usage

    Usage: nv_cli_j2code [options]
    Options:
        -i, --input         input string ,default stdin
        -o, --output        output string,default stdout
        -n, --name          final var name,default ___dumped
        -h, --help          usage

example

      #nv_cli_j2code 
         
        {
           "a b": {
               1:null,
                   k: {k:{"k k":true}}
           },
           ary: [
              1,2,3
           ],
           dict: {
              k1:"ssss"
           }
        }

        // press ctrl+D

        module.exports = ()=>{
            let j={};
            j["a b"]            = {}
            j["a b"][1]         = null
            j["a b"].k          = {}
            j["a b"].k.k        = {}
            j["a b"].k.k["k k"] = true
            j.ary               = []
            j.ary[0]            = 1
            j.ary[1]            = 2
            j.ary[2]            = 3
            j.dict              = {}
            j.dict.k1           = "ssss"
            return(j);
        }


     #

    nv-cli-json2code# nv_cli_j2code -i package.json -n pkg_cfg

    module.exports =()=>{
        let j={};
        j.dependencies                     = {}
        j.dependencies["nv-char-jsid"]     = "^1.0.2"
        j.dependencies["nv-cli-basic"]     = "^1.0.5"
        j.dependencies["nv-facutil-basic"] = "^1.3.15"
        j.dependencies["nv-string-basic"]  = "^1.0.50"
        j.dependencies.nvjson              = "^1.3.1"
        j.name                             = "nv-cli-json2code"
        j.description                      = ""
        j.version                          = "1.0.1"
        j.main                             = "index.js"
        j.scripts                          = {}
        j.scripts.test                     = "echo \"Error: no test specified\" && exit 1"
        j.bin                              = {}
        j.bin.nv_cli_j2code                = "cli.js"
        j.author                           = ""
        j.license                          = "ISC"
        return(j);
    }


     # nv_cli_j2code -i  node_modules/y18n/package.json

    module.exports =()=>{
        let j={};
        j.name                                           = "y18n"
        j.version                                        = "5.0.8"
        j.description                                    = "the bare-bones internationalization library used by yargs"
        j.exports                                        = {}
        j.exports["."]                                   = []
        j.exports["."][0]                                = {}
        j.exports["."][0].import                         = "./index.mjs"
        j.exports["."][0].require                        = "./build/index.cjs"
        j.exports["."][1]                                = "./build/index.cjs"
        j.type                                           = "module"
        j.module                                         = "./build/lib/index.js"
        j.keywords                                       = []
        j.keywords[0]                                    = "i18n"
        j.keywords[1]                                    = "internationalization"
        j.keywords[2]                                    = "yargs"
        j.homepage                                       = "https://github.com/yargs/y18n"
        j.bugs                                           = {}
        j.bugs.url                                       = "https://github.com/yargs/y18n/issues"
        j.repository                                     = "yargs/y18n"
        j.license                                        = "ISC"
        j.author                                         = "Ben Coe <bencoe@gmail.com>"
        j.main                                           = "./build/index.cjs"
        j.scripts                                        = {}
        j.scripts.check                                  = "standardx **/*.ts **/*.cjs **/*.mjs"
        j.scripts.fix                                    = "standardx --fix **/*.ts **/*.cjs **/*.mjs"
        j.scripts.pretest                                = "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs"
        j.scripts.test                                   = "c8 --reporter=text --reporter=html mocha test/*.cjs"
        j.scripts["test:esm"]                            = "c8 --reporter=text --reporter=html mocha test/esm/*.mjs"
        j.scripts.posttest                               = "npm run check"
        j.scripts.coverage                               = "c8 report --check-coverage"
        j.scripts.precompile                             = "rimraf build"
        j.scripts.compile                                = "tsc"
        j.scripts.postcompile                            = "npm run build:cjs"
        j.scripts["build:cjs"]                           = "rollup -c"
        j.scripts.prepare                                = "npm run compile"
        j.devDependencies                                = {}
        j.devDependencies["@types/node"]                 = "^14.6.4"
        j.devDependencies["@wessberg/rollup-plugin-ts"]  = "^1.3.1"
        j.devDependencies.c8                             = "^7.3.0"
        j.devDependencies.chai                           = "^4.0.1"
        j.devDependencies["cross-env"]                   = "^7.0.2"
        j.devDependencies.gts                            = "^3.0.0"
        j.devDependencies.mocha                          = "^8.0.0"
        j.devDependencies.rimraf                         = "^3.0.2"
        j.devDependencies.rollup                         = "^2.26.10"
        j.devDependencies.standardx                      = "^7.0.0"
        j.devDependencies["ts-transform-default-export"] = "^1.0.2"
        j.devDependencies.typescript                     = "^4.0.0"
        j.files                                          = []
        j.files[0]                                       = "build"
        j.files[1]                                       = "index.mjs"
        j.files[2]                                       = "!*.d.ts"
        j.engines                                        = {}
        j.engines.node                                   = ">=10"
        j.standardx                                      = {}
        j.standardx.ignore                               = []
        j.standardx.ignore[0]                            = "build"
        return(j);
    }

LICENSE

  • ISC