gui-environment
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { IModuleArgs } from './types.js'; | ||
import { IModuleArgs } from '../shared/index.js'; | ||
/** | ||
@@ -6,8 +6,7 @@ * Executes an action based on the passed arguments. | ||
* @throws | ||
* - INVALID_CLI_ACTION: if an invalid action or no action at all is provided. | ||
* - INVALID_PATH: if the provided srcPath has an invalid format | ||
* - NOT_A_DIRECTORY: if the srcPath is not a valid directory | ||
* - INVALID_PATH: if the provided src has an invalid format | ||
* - NOT_A_DIRECTORY: if the src is not a valid directory | ||
* - INVALID_ENVIRONMENT_NAME: if the provided environment name is not supported by the package | ||
*/ | ||
declare const executeAction: ({ srcPath, init, environment }: IModuleArgs) => void; | ||
declare const executeAction: ({ src, init, development, staging, production, }: IModuleArgs) => void; | ||
export { executeAction, }; |
@@ -1,1 +0,1 @@ | ||
import{encodeError}from"error-message-utils";import{copyFile,isDirectory,writeTextFile}from"fs-utils-sync";import{ERRORS}from"./environment.errors.js";import{ENVIRONMENT_NAMES,buildEnvironmentPath,buildFilePath}from"./environment.utils.js";import{buildIndex,buildTypes,buildEnvironment}from"./environment.templates.js";import{validateSourcePath,canEnvironmentBeInitialized,validateEnvironmentName}from"./environment.validations.js";const __installEnvironment=(i,e)=>copyFile(buildFilePath(i,e),buildFilePath(i,"environment")),__init=e=>{canEnvironmentBeInitialized(buildEnvironmentPath(e)),writeTextFile(buildFilePath(e,"index"),buildIndex()),writeTextFile(buildFilePath(e,"types"),buildTypes()),ENVIRONMENT_NAMES.forEach(i=>writeTextFile(buildFilePath(e,i),buildEnvironment("production"===i))),__installEnvironment(e,"development")},__install=(i,e)=>{validateEnvironmentName(e),isDirectory(buildEnvironmentPath(i))||__init(i),__installEnvironment(i,e)},executeAction=({srcPath:i,init:e,environment:n})=>{if(validateSourcePath(i),e)__init(i);else{if(!n)throw new Error(encodeError('The CLI must be invoked with a valid action such as: gui-environment --init or gui-environment --environment="development"',ERRORS.INVALID_CLI_ACTION));__install(i,n)}};export{executeAction}; | ||
import{copyFile,isDirectory,isFile,readTextFile,writeTextFile}from"fs-utils-sync";import{ENVIRONMENT_NAMES,GIT_IGNORE_PATH}from"../shared/index.js";import{buildEnvironmentPath,buildFilePath,getEnvironmentName,buildGITIgnoreContent}from"../utils/index.js";import{buildIndex,buildTypes,buildEnvironment}from"../templates/index.js";import{validateSourcePath,canEnvironmentBeInitialized}from"../validations/index.js";const __installEnvironment=(i,e)=>copyFile(buildFilePath(i,e),buildFilePath(i,"environment")),__addEnvironmentToGITIgnore=e=>{if(isFile(GIT_IGNORE_PATH)){let i=readTextFile(GIT_IGNORE_PATH);var n=buildGITIgnoreContent(e,!0);i.includes(n)||(i+=n,writeTextFile(GIT_IGNORE_PATH,i))}else writeTextFile(GIT_IGNORE_PATH,buildGITIgnoreContent(e))},__init=e=>{canEnvironmentBeInitialized(buildEnvironmentPath(e)),writeTextFile(buildFilePath(e,"index"),buildIndex()),writeTextFile(buildFilePath(e,"types"),buildTypes()),ENVIRONMENT_NAMES.forEach(i=>writeTextFile(buildFilePath(e,i),buildEnvironment("production"===i))),__installEnvironment(e,"development"),__addEnvironmentToGITIgnore(e)},__install=(i,e)=>{isDirectory(buildEnvironmentPath(i))||__init(i),__installEnvironment(i,e)},executeAction=({src:i="src",init:e,development:n,staging:t,production:l})=>{validateSourcePath(i),e?__init(i):__install(i,getEnvironmentName(n,t,l))};export{executeAction}; |
@@ -1,2 +0,1 @@ | ||
export * from './types.js'; | ||
export * from './environment.js'; |
@@ -1,1 +0,1 @@ | ||
export*from"./types.js";export*from"./environment.js"; | ||
export*from"./environment.js"; |
{ | ||
"name": "gui-environment", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "The gui-environment package is a command-line tool that simplifies managing environment variables for your application. Easily set up different configurations based on your build mode (development or production) for a smooth development workflow.", | ||
@@ -12,3 +12,5 @@ "main": "dist/index.js", | ||
"test:integration": "vitest run --config vitest.test-integration.config.ts", | ||
"test:unit": "vitest run --config vitest.test-unit.config.ts" | ||
"test:unit": "vitest run --config vitest.test-unit.config.ts", | ||
"watch-test:integration": "vitest --config vitest.test-integration.config.ts", | ||
"watch-test:unit": "vitest --config vitest.test-unit.config.ts" | ||
}, | ||
@@ -15,0 +17,0 @@ "bin": { |
@@ -11,3 +11,3 @@ # GUI Environment | ||
```bash | ||
$ npm install -S gui-environment | ||
$ npm install -D gui-environment | ||
``` | ||
@@ -17,3 +17,6 @@ | ||
```bash | ||
$ npx gui-environment --srcPath="src" --init | ||
$ npx gui-environment --init | ||
# Using a custom source path | ||
$ npx gui-environment --src="custom-src" --init | ||
``` | ||
@@ -25,5 +28,8 @@ | ||
"scripts": { | ||
"build-dev": "gui-environment --srcPath='src' --environment='development' && tsc && ...", | ||
"build-staging": "gui-environment --srcPath='src' --environment='staging' && tsc && ...",, | ||
"build-production": "gui-environment --srcPath='src' --environment='production' && tsc && ...", | ||
"build-dev": "gui-environment --development && tsc && ...", | ||
"build-staging": "gui-environment --staging && tsc && ...", | ||
"build-production": "gui-environment --production && tsc && ...", | ||
// Using a custom source path | ||
"build-dev": "gui-environment --src='custom-src' --development && tsc && ...", | ||
} | ||
@@ -80,5 +86,11 @@ ... | ||
``` | ||
Keep in mind that whatever data you include in these files will be public when your app is deployed. Avoid including sensitive information such as API keys, secrets, etc... | ||
<br/> | ||
**Important:** keep in mind that whatever data you include in these files will be public when your app is deployed. Avoid sharing sensitive information such as API keys, secrets, etc... | ||
<br/> | ||
@@ -85,0 +97,0 @@ |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
15958
9.46%29
52.63%131
16.96%152
8.57%1
Infinity%