Skip to content

Commit

Permalink
docs: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
chihab committed Jun 4, 2023
1 parent a90a64c commit 9dcfc35
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 60 deletions.
73 changes: 19 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
- [Linux, macOS (Bash)](#linux-macos-bash)
- [In `.env`](#in-env)
- [Cascading Environment Variables](#cascading-environment-variables)
- [Usage in Monorepos](#usage-in-monorepos)
- [Nx](#nx)
- [Usage in Nx Monorepos](#usage-in-nx-monorepos)
- [Good Practices](#good-practices)
- [Usage with Docker](#usage-with-docker)
- [Known Issues](#known-issues)
Expand Down Expand Up @@ -136,55 +135,10 @@ If you want to have a shorter prefix like `NG_` or if you want to access some do
}
```

```ts
"architect": {
"build": {
"builder": "@ngx-env/builder:browser",
"options": {
...
"scripts": []
"ngxEnv": {
"prefix": "ORG_"
}
}
}
}
```

```ts
"architect": {
"build": {
"builder": "@ngx-env/builder:browser",
"options": {
...
"scripts": []
"ngxEnv": {
"prefix": "ORG_"
}
}
}
}
```

```ts
"architect": {
"build": {
"builder": "@ngx-env/builder:browser",
"options": {
...
"scripts": []
"ngxEnv": {
"prefix": "ORG_"
}
}
}
}
```

or using `ng config`

```sh
ng config projects.YOUR_APP_NAME.architect.build.options.ngxEnv.prefix 'ORG_'
ng config projects.YOUR_APP_NAME.architect.build.options.ngxEnv.prefix '(ORG|GITHUB|)_'
```

Any other variables not starting with `NG_APP_` or your custom prefix will be ignored to avoid accidentally exposing a private key on the machine that could have the same name.
Expand Down Expand Up @@ -394,24 +348,35 @@ These root configurations are equivalent:
* ` "root": "/home/user/monorepo"`
* ` "root": "/home/user/monorepo/.env"`

# Usage in Monorepos

## Nx
# Usage in Nx Monorepos

**@ngx-env/builder** supports [Nx](https://nx.dev) projects with multiple applications.

Currently the schematics only supports Angular CLI projects, so you need to install the package and uppdate `project.json`.
Currently the schematics only supports Angular CLI projects, so you need to install the package and uppdate `project.json` manually.

1. **Install the package**
```
npm add -D @ngx-env/builder
```

2. **Replace Angular builders in project.json**

Replace every occurence of `@angular-devkit/build-angular` with `@ngx-env/builder` in `project.json` file.

When you have multiple applications in your Nx workspace, you can define a common `.env.*` files in the root of your workspace and override it in each application or any other subdirectory below the root. See [Cascading Environment Variables](#cascading-environment-variables) for more details.
3. **Create .env.d.ts inside src/**

```ts
declare var process: {
env: {
NG_APP_ENV: string;
[key: string]: any;
};
};
```

Explore @ngx-env/builder usage in a [sample Nx workspace here](https://github.com/chihab/ngx-env/tree/main/apps/nx-demo).
When you have multiple applications in your Nx workspace, you can define common `.env.*` files in the root of your workspace and override them in each application or any other subdirectory below the root. See [Cascading Environment Variables](#cascading-environment-variables) for more details.

You can also checkout the sample Nx workspace [ here](https://github.com/chihab/ngx-env/tree/main/apps/nx-demo).

# Good Practices

Expand Down
2 changes: 1 addition & 1 deletion apps/ngx-env-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngx-env/demo",
"version": "16.1.0",
"version": "16.1.1",
"private": true,
"scripts": {
"ng": "ng",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "16.1.0",
"version": "16.1.1",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
4 changes: 2 additions & 2 deletions packages/builder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngx-env/builder",
"version": "16.1.0",
"version": "16.1.1",
"description": "Easily inject environment variables into your Angular applications",
"author": "chihab <chihab@gmail.com>",
"homepage": "https://github.com/chihab/ngx-env",
Expand Down Expand Up @@ -44,4 +44,4 @@
"peerDpendencies": {
"@angular-devkit/schematics-cli": ">=12.0.0"
}
}
}
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ngx-env/core",
"version": "16.1.0",
"version": "16.1.1",
"description": "Easily inject environment variables into your Angular applications",
"author": "chihab <chihab@gmail.com>",
"homepage": "https://github.com/chihab/ngx-env",
Expand Down Expand Up @@ -28,4 +28,4 @@
"dependencies": {
"tslib": "^2.3.0"
}
}
}

0 comments on commit 9dcfc35

Please sign in to comment.