dept v0.1.12
dept
Dependencies templates management CLI to install your fixed NPM or Yarn dependencies and cofing files to your project.
Usage
$ dept -h
Usage: dept <command> [options]
Commands:
dept list Show all templates [aliases: ls]
dept show [templateName] Show a template in details [aliases: s]
dept default [templateName] Use a template by default [aliases: df]
dept install [templateName] Install dependencies and config files from a
template [aliases: i]
dept add [templateName] Add a template with '--data' or '--file'
options [aliases: a]
dept remove [templateName] Remove a template [aliases: r]
dept rename [templateName] Rename a template name
[newTemplateName] [aliases: mv]
dept view [templateName] View a filed in a template
[viewStatement] [aliases: v]
dept update [templateName] Update a field in a template
[updateStatement] [aliases: u]
dept export [templateName] Export a JSON template file [aliases: e]
dept listenv Show all package managers [aliases: env]
dept useenv [environment] Use a package manager [aliases: use]
dept json2yaml Convert a JSON format to a YAML
format with '--data' or '--file'
options [aliases: jy]
dept yaml2json Convert a YAML format to a JSON
format with '--data' or '--file'
options [aliases: yj]
Options:
--version, -v Show version [boolean]
--data, -d Specify a JSON or YAML data string with 'add',
'json2yaml' or 'yaml2json' [string]
--file, -f Specify a JSON or YAML file with 'add', 'json2yaml'
or 'yaml2json' [string]
--filename, -n Specify a filename of a JSON or YAML file with 'export',
'json2yaml' or 'yaml2json' [string]
--out-dir, -o Specify an output directory path to export a JSON or YAML
file with 'export', 'json2yaml' or 'yaml2json' [string]
--help, -h Show help [boolean]Template JSON/YAML format
You can define the following properties.
dependencies: NPM packagedependenciesdevDependencies: NPM packagedevDependenciesfiles: Config files like.eslintrc,.travis.ymland so on. If file extension is 'yaml' or 'yml', it is exported as a YAML file.
JSON example:
{
"dependencies": {
"module-name-A": "1.0.0"
},
"devDependencies": {
"module-name-B": "*",
"module-name-C": "^2.1.1"
},
"files": {
"file-name-A.json": {
"any-prop-1": [
"any-element-1",
"any-element-2",
"any-element-3"
],
"any-prop-2": {
"any-value-1": 123,
"any-value-2": true,
"any-value-3": "something"
},
"any-prop-3": "anything"
},
"file-name-B.txt": "Hello World",
"file-name-C.yml": {
"any-value": "any-value",
"any-list": [
"any-element-1",
"any-element-2"
]
}
}
}YAML example:
dependencies:
module-name-A: 1.0.0
devDependencies:
module-name-B: '*'
module-name-C: ^2.1.1
files:
file-name-A.json:
any-prop-1:
- any-element-1
- any-element-2
- any-element-3
any-prop-2:
any-value-1: 123
any-value-2: true
any-value-3: something
any-prop-3: anything
file-name-B.txt: Hello World
file-name-C.yml:
any-value: any-value
any-list:
- any-element-1
- any-element-2Real world's templates' examples are HERE.
Use cases
Install your fixed template to your existing project
You can add your fixed template with dept add then install the template to your existing project with dept install.
And you can set a default template with dept default.
$ dept add react-eslint-prettier -f ./template.json
$ dept default react-eslint-prettier
$ dept list
* react-eslint-prettier
express-typescript
vue-nuxt
$ cd your-app # Already NPM installed
$ dept installInstall your fixed template in your new project
It initializes your new project automatically if package.json doesn't exist.
$ dept list
* react-eslint-prettier
express-typescript
vue-nuxt
$ mkdir your-new-app
$ cd your-new-app # NOT NPM installed
$ dept installInstall your fixed template in your new project with Yarn
You can also use yarn instead of npm after you change a package manager with env and use.
$ dept env
* npm
yarn
$ dept use yarn
$ dept env
npm
* yarn
$ dept list
* react-eslint-prettier
express-typescript
vue-nuxt
$ mkdir your-new-app
$ cd your-new-app # NOT Yarn installed
$ dept installSpecify a template from your fixed templates
Of course, you can specify a template you'd like to use in your project after dept install.
$ dept list
* react-eslint-prettier
express-typescript
vue-nuxt
$ cd your-app
$ dept install express-typescriptView a field in a template
You can view a field in a template with dept view.
$ dept list
* react-eslint-prettier
express-typescript
vue-nuxt
$ dept view express-typescript "dependencies"
{
"express": "^4.16.0",
"mongoose": "*"
}
$ dept view express-typescript "dependencies.express"
"^4.16.0"Update a field in a template
You can update a field in a template with dept update.
Either dependencies, devDependencies or files is updatable.
$ dept list
* react-eslint-prettier
express-typescript
vue-nuxt
$ dept update express-typescript "dependencies={\"express\":\"^4.16.4\", \"mongoose\":\">=5.3.10\"}"Export a template file as JSON format
You can export a JSON template file with dept export to share it.
$ dept list
* react-eslint-prettier
express-typescript
vue-nuxt
$ dept export react-eslint-prettier --filename fixed-react-eslint-prettier.json --out-dir ./fixed-templates-dirHelper commands
Convert a JSON file to a YAML file
You can convet a JSON file to a YAML file with dept json2yaml.
$ dept json2yaml --file ./data.json --filename your-data.yml --out-dir ./converted-dir
$ ls ./converted-dir/
your-data.yml
$ dept jy -f ./data.json # Short expression
$ ls ./
data.ymlConvert a YAML file to a JSON file
You can convet a YAML file to a JSON file with dept yaml2json.
$ dept yaml2json --file ./data.yml --filename your-data.json --out-dir ./converted-dir
$ ls ./converted-dir/
your-data.json
$ dept yj -f ./data.yml # Short expression
$ ls ./
data.json4 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago