Comparing version 9.0.0 to 9.0.1
# Changelog | ||
## 9.0.1 | ||
- **BREAKING**: Fixed major bug that required passing `--` inorder to pass flags to the command. | ||
Normally I release major breaking changes as major versions, but this was a bug and no documentation | ||
anywhere states using `--` as intended or official behavior. | ||
- **Change**: Fixed some documentation issues | ||
- **Change**: `npm run lint` command now includes calling `tsc` to check for typescript errors | ||
## 9.0.0 | ||
@@ -3,0 +10,0 @@ - ***BREAKING***: Converted project to Typescript |
@@ -0,1 +1,2 @@ | ||
import { Command } from 'commander'; | ||
import { EnvCmdOptions } from './types'; | ||
@@ -6,1 +7,2 @@ /** | ||
export declare function parseArgs(args: string[]): EnvCmdOptions; | ||
export declare function parseArgsUsingCommander(args: string[]): Command; |
@@ -9,16 +9,8 @@ "use strict"; | ||
function parseArgs(args) { | ||
const program = new commander_1.Command(); | ||
program | ||
.version('9.0.0', '-v, --version') | ||
.usage('[options] <command> [...args]') | ||
.option('-f, --file [path]', 'Custom env file file path (default path: ./.env)') | ||
.option('-r, --rc-file [path]', 'Custom rc file path (default path: ./.env-cmdrc(|.js|.json)') | ||
.option('-e, --environments [env1,env2,...]', 'The rc file environment(s) to use', utils_1.parseArgList) | ||
.option('--fallback', 'Fallback to default env file path, if custom env file path not found') | ||
.option('--no-override', 'Do not override existing environment variables') | ||
.option('--use-shell', 'Execute the command in a new shell with the given environment') | ||
.parse(['_', '_', ...args]); | ||
// get the command and command args | ||
// Get the command and command args | ||
let program = parseArgsUsingCommander(args); | ||
const command = program.args[0]; | ||
const commandArgs = program.args.slice(1); | ||
const commandArgs = args.splice(args.indexOf(command) + 1); | ||
// Reprocess the args with the command and command args removed | ||
program = parseArgsUsingCommander(args.slice(0, args.indexOf(command))); | ||
const noOverride = !program.override; | ||
@@ -50,1 +42,15 @@ const useShell = !!program.useShell; | ||
exports.parseArgs = parseArgs; | ||
function parseArgsUsingCommander(args) { | ||
const program = new commander_1.Command(); | ||
return program | ||
.version('9.0.1', '-v, --version') | ||
.usage('[options] <command> [...args]') | ||
.option('-f, --file [path]', 'Custom env file path (default path: ./.env)') | ||
.option('-r, --rc-file [path]', 'Custom rc file path (default path: ./.env-cmdrc(|.js|.json)') | ||
.option('-e, --environments [env1,env2,...]', 'The rc file environment(s) to use', utils_1.parseArgList) | ||
.option('--fallback', 'Fallback to default env file path, if custom env file path not found') | ||
.option('--no-override', 'Do not override existing environment variables') | ||
.option('--use-shell', 'Execute the command in a new shell with the given environment') | ||
.parse(['_', '_', ...args]); | ||
} | ||
exports.parseArgsUsingCommander = parseArgsUsingCommander; |
{ | ||
"name": "env-cmd", | ||
"version": "9.0.0", | ||
"description": "Executes a command using the envs in the provided env file", | ||
"version": "9.0.1", | ||
"description": "Executes a command using the environment variables in an env file", | ||
"main": "dist/index.js", | ||
@@ -18,3 +18,3 @@ "types": "dist/index.d.ts", | ||
"coveralls": "coveralls < coverage/lcov.info", | ||
"lint": "eslint --fix ./src/**/*.ts ./test/**/*.ts", | ||
"lint": "eslint --fix ./src/**/*.ts ./test/**/*.ts && tsc --noEmit", | ||
"build": "tsc" | ||
@@ -21,0 +21,0 @@ }, |
@@ -45,3 +45,3 @@ [![Travis](https://img.shields.io/travis/toddbluhm/env-cmd.svg)](https://travis-ci.org/toddbluhm/env-cmd) | ||
-v, --version output the version number | ||
-f, --file [path] Custom env file file path (default path: ./.env) | ||
-f, --file [path] Custom env file path (default path: ./.env) | ||
-r, --rc-file [path] Custom rc file path (default path: ./.env-cmdrc(|.js|.json) | ||
@@ -65,3 +65,3 @@ -e, --environments [env1,env2,...] The rc file environment(s) to use | ||
**.rc file `.env-cmdrc`** | ||
**.rc file `./.env-cmdrc`** | ||
@@ -109,3 +109,3 @@ ```json | ||
```sh | ||
./node_modules/.bin/env-cmd -f ./test/.env --use-shell "node run lint && node test" | ||
./node_modules/.bin/env-cmd -f ./test/.env --use-shell "npm run lint && npm test" | ||
``` | ||
@@ -211,2 +211,2 @@ | ||
- `npm test` make sure all tests pass | ||
- `npm run test-cover` make sure the coverage has not decreased from current master | ||
- `npm run test-cover` make sure the coverage has not decreased from current master |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
39652
25
616
208