-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: iswilljr <iswilljr@gmail.com>
- Loading branch information
Showing
11 changed files
with
137 additions
and
1,629 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
{ | ||
"printWidth": 120, | ||
"useTabs": false, | ||
"useTabs": true, | ||
"tabWidth": 2, | ||
"semi": true | ||
"semi": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { statSync } from "fs" | ||
|
||
const paths = ["lib/index.js", "lib/bin.js", "lib/index.d.ts", "package.json", "README.md"] | ||
let size = 0; | ||
for (const path of paths) { | ||
const stats = statSync(path) | ||
console.log(`${path}: ${stats.size < 1000 ? stats.size : stats.size / 1000}${stats.size<1000?"B":"KB"}`) | ||
size += stats.size | ||
} | ||
console.log() | ||
console.log(`Total: ${size} -> ${size < 1000 ? size : size / 1000}${size<1000?"B":"KB"}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,37 @@ | ||
{ | ||
"name": "config-env-file", | ||
"version": "3.1.0", | ||
"description": "A command line to generate a .env file based on a Config", | ||
"main": "lib/index.js", | ||
"bin": { | ||
"cef": "lib/bin.js" | ||
}, | ||
"scripts": { | ||
"build": "yarn typecheck && rimraf lib && tsc", | ||
"typecheck": "tsc --noEmit", | ||
"prepare": "yarn build" | ||
}, | ||
"keywords": [ | ||
"cli", | ||
"commander", | ||
"dotenv", | ||
"env", | ||
"config", | ||
"env-file" | ||
], | ||
"author": "iswilljr", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@types/node": "^17.0.29", | ||
"@typescript-eslint/eslint-plugin": "^5.21.0", | ||
"@typescript-eslint/parser": "^5.21.0", | ||
"eslint": "^8.14.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-config-standard": "^17.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-n": "^15.2.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"prettier": "^2.6.2", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.7.4" | ||
}, | ||
"dependencies": { | ||
"camel-case": "^4.1.2", | ||
"commander": "^9.2.0", | ||
"constant-case": "^3.0.4", | ||
"dotenv": "^16.0.1" | ||
}, | ||
"files": [ | ||
"lib", | ||
"README.md" | ||
], | ||
"types": "./lib/index.d.ts", | ||
"directories": { | ||
"lib": "lib" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/iswilljr/config-env-file.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/iswilljr/config-env-file/issues" | ||
}, | ||
"homepage": "https://github.com/iswilljr/config-env-file#readme" | ||
"name": "config-env-file", | ||
"version": "0.0.2-experimental", | ||
"description": "A command line to generate a .env file based on a Config", | ||
"license": "ISC", | ||
"main": "lib/index.js", | ||
"author": "iswilljr", | ||
"type": "module", | ||
"types": "./lib/index.d.ts", | ||
"files": [ | ||
"lib", | ||
"README.md" | ||
], | ||
"bin": { | ||
"cef": "lib/bin.js" | ||
}, | ||
"scripts": { | ||
"build": "tsc && rimraf lib/bin.d.ts && prettier lib --write", | ||
"prepublishOnly": "yarn build" | ||
}, | ||
"keywords": [ | ||
"config", | ||
"env" | ||
], | ||
"dependencies": { | ||
"no-case": "^3.0.4", | ||
"sade": "^1.8.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "17.0.29", | ||
"prettier": "2.6.2", | ||
"rimraf": "3.0.2", | ||
"typescript": "4.7.4" | ||
}, | ||
"repository": "git+https://github.com/iswilljr/config-env-file.git", | ||
"bugs": "https://github.com/iswilljr/config-env-file/issues" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
#!/usr/bin/env node | ||
import { Option, program } from "commander"; | ||
import configEnvFile from "."; | ||
|
||
program.version("3.0.1").description("A command line to generate a .env.local based on a Config"); | ||
|
||
program.argument("<file>", "The config file to use"); | ||
program.option("-d, --destination <destination>", "Destination path to env file"); | ||
program.option("-e, --extension <extension>", "extension to env file name (example: env.prod, env.local)"); | ||
program.option("-t, --template <template>", "Template to vars' name (example: REACT_APP_KEY, VITE_APP_API)"); | ||
program.addOption( | ||
new Option("-E, --env <type>", "Env (example: process.env, import.meta.env)").choices(["process", "import"]) | ||
); | ||
program.option("-m, --merge <file>", "merge a given env file with the new config"); | ||
|
||
program.action(configEnvFile); | ||
|
||
program.parse(process.argv); | ||
import {createRequire} from 'module' | ||
import sade from 'sade' | ||
import {configEnvFile} from './index.js' | ||
const pkg = createRequire(import.meta.url)('../package.json') | ||
sade('cef <config-file>') | ||
.version(pkg.version) | ||
.describe(pkg.description) | ||
.option('-d, --destination <d>', 'destination path to env file') | ||
.option('-e, --extension <e>', 'extension to env file name') | ||
.option('-p, --prefix <p>', 'prefix to variables name') | ||
.option('-E, --env <e>', 'how to access variables') | ||
.action(configEnvFile) | ||
.parse(process.argv) |
Oops, something went wrong.