Skip to content

Documentation update #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ environment variables into index.html file(s) by replacing `<!--CONFIG-->`
(Missing environment variables will be represented by null). This should be done
on the host serving the bundled angular files.

### AOT
This will not work in Module.forRoot or Module.forChild scripts or parameters.
These are build time only due to AOT restrictions.
### AoT
By default, this will not work in Module.forRoot or Module.forChild scripts or parameters.
These are build time only due to AoT restrictions.

With `ngssc wrap-aot ng build ...` it is however possible to retain the configuration, by replacing
the environment variables with tokens during the AoT build and reverting afterwards. (See [CLI wrap-aot](#wrap-aot))

## Getting Started
```
Expand Down
98 changes: 28 additions & 70 deletions documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ How it works & Limitations

Environment variables are used for configuration. This package provides a script to search for usages in bundled angular files and a script for inserting populated environment variables into index.html file(s) by replacing `<!--CONFIG-->` (Missing environment variables will be represented by null). This should be done on the host serving the bundled angular files.

### AOT
### AoT

This will not work in Module.forRoot or Module.forChild scripts or parameters. These are build time only due to AOT restrictions.
By default, this will not work in Module.forRoot or Module.forChild scripts or parameters. These are build time only due to AoT restrictions.

With `ngssc wrap-aot ng build ...` it is however possible to retain the configuration, by replacing the environment variables with tokens during the AoT build and reverting afterwards. (See [CLI wrap-aot](#wrap-aot))

Getting Started
---------------
Expand Down Expand Up @@ -80,86 +82,42 @@ ngssc --help
```

### Insert

Usage: insert \[options\] \[directory\]
Usage: insert [options] [directory]

Search and replace the placeholder with environment variables (Directory defaults to current working directory)

Options

Description

`-s, --search`

Search environment variables in available .js files (Defaults to false)

`-e, --env <value>`

Add an environment variable to be resolved (default: \[\])

`-p, --placeholder <value>`

Set the placeholder to replace with the environment variables (Defaults to `<!--CONFIG-->`)

`-h, --head`

Insert environment variables into the head tag (after title tag, if available, otherwise before closing head tag)

`--dry`

Perform the insert without actually inserting the variables

`-h, --help`

output usage information
| Options | Description |
| --- | --- |
| `-s, --search` | Search environment variables in available .js files (Defaults to false) |
| `-e, --env <value>` | Add an environment variable to be resolved (default: []) |
| `-p, --placeholder <value>` | Set the placeholder to replace with the environment variables (Defaults to `<!--CONFIG-->`) |
| `-h, --head` | Insert environment variables into the head tag (after title tag, if available, otherwise before closing head tag) |
| `--dry` | Perform the insert without actually inserting the variables |
| `-h, --help` | output usage information |

### Init

Usage: init \[options\] \[directory\]
Usage: init [options] [directory]

Initialize an angular project with angular-server-side-configuration (Directory defaults to current working directory)

Options

Description

`-ef, --environment-file`

The environment file to initialize (environmentFile defaults to src/environments/environment.prod.ts)

`--npm`

Install angular-service-side-configuration via npm (Default)

`--yarn`

Install angular-service-side-configuration via yarn

`-h, --help`

output usage information
| Options | Description |
| --- | --- |
| `-ef, --environment-file` | The environment file to initialize (environmentFile defaults to src/environments/environment.prod.ts) |
| `--npm` | Install angular-service-side-configuration via npm (Default) |
| `--yarn` | Install angular-service-side-configuration via yarn |
| `-h, --help` | output usage information |

### Wrap-Aot
Usage: wrap-aot [options] [ng...]

Usage: wrap-aot \[options\] \[ng...\]

Wrap an angular command with aot compilation to retain configuration (Use "ngssc wrap-aot ng build ..."). This will temporarily replace the content of the environment file with tokens. After the inner command completes, this is reverted and the tokens in the dist files will be replaced by the actual values.

Options

Description

`-ef, --environment-file`

The environment file to prepare for aot-compilation (Defaults to src/environments/environment.prod.ts)

`--dist`

The output path of the ng build (Defaults to dist/\*\*)

`-h, --help`
Wrap an angular command with aot compilation to retain configuration (Use "ngssc wrap-aot ng build ..."). This will temporarily replace the
content of the environment file with tokens. After the inner command completes, this is reverted and the tokens in the dist files will be replaced by the actual values.

output usage information
| Options | Description |
| --- | --- |
| `-ef, --environment-file` | The environment file to prepare for aot-compilation (Defaults to src/environments/environment.prod.ts) |
| `--dist` | The output path of the ng build (Defaults to dist/**) |
| `-h, --help` | output usage information |

Native CLI
----------
Expand Down
12 changes: 6 additions & 6 deletions documentation/classes/_cli_command_base_.commandbase.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

⊕ **new CommandBase**(_name: *`string`*): [CommandBase](_cli_command_base_.commandbase.md)

*Defined in [cli/command-base.ts:1](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/command-base.ts#L1)*
*Defined in [cli/command-base.ts:1](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/command-base.ts#L1)*

**Parameters:**

Expand All @@ -59,7 +59,7 @@ ___

**● _name**: *`string`*

*Defined in [cli/command-base.ts:2](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/command-base.ts#L2)*
*Defined in [cli/command-base.ts:2](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/command-base.ts#L2)*

___

Expand All @@ -71,7 +71,7 @@ ___

▸ **_execute**(): `Promise`<`void`>

*Defined in [cli/command-base.ts:11](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/command-base.ts#L11)*
*Defined in [cli/command-base.ts:11](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/command-base.ts#L11)*

**Returns:** `Promise`<`void`>

Expand All @@ -82,7 +82,7 @@ ___

▸ **_log**(message: *`string`*): `void`

*Defined in [cli/command-base.ts:19](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/command-base.ts#L19)*
*Defined in [cli/command-base.ts:19](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/command-base.ts#L19)*

**Parameters:**

Expand All @@ -99,7 +99,7 @@ ___

▸ **_logValue**(message: *`string`*, value: *`any`*): `void`

*Defined in [cli/command-base.ts:13](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/command-base.ts#L13)*
*Defined in [cli/command-base.ts:13](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/command-base.ts#L13)*

**Parameters:**

Expand All @@ -117,7 +117,7 @@ ___

▸ **execute**(): `Promise`<`void`>

*Defined in [cli/command-base.ts:5](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/command-base.ts#L5)*
*Defined in [cli/command-base.ts:5](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/command-base.ts#L5)*

**Returns:** `Promise`<`void`>

Expand Down
24 changes: 12 additions & 12 deletions documentation/classes/_cli_init_command_.initcommand.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

*Overrides [CommandBase](_cli_command_base_.commandbase.md).[constructor](_cli_command_base_.commandbase.md#constructor)*

*Defined in [cli/init-command.ts:10](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/init-command.ts#L10)*
*Defined in [cli/init-command.ts:10](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/init-command.ts#L10)*

**Parameters:**

Expand All @@ -68,7 +68,7 @@ ___

**● _directory**: *`string`*

*Defined in [cli/init-command.ts:10](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/init-command.ts#L10)*
*Defined in [cli/init-command.ts:10](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/init-command.ts#L10)*

___
<a id="_environmentfile"></a>
Expand All @@ -77,7 +77,7 @@ ___

**● _environmentFile**: *`string`*

*Defined in [cli/init-command.ts:9](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/init-command.ts#L9)*
*Defined in [cli/init-command.ts:9](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/init-command.ts#L9)*

___
<a id="_options"></a>
Expand All @@ -86,7 +86,7 @@ ___

**● _options**: *`object`*

*Defined in [cli/init-command.ts:12](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/init-command.ts#L12)*
*Defined in [cli/init-command.ts:12](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/init-command.ts#L12)*

#### Type declaration

Expand All @@ -105,7 +105,7 @@ ___

**● _packagePath**: *`string`*

*Defined in [cli/init-command.ts:8](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/init-command.ts#L8)*
*Defined in [cli/init-command.ts:8](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/init-command.ts#L8)*

___

Expand All @@ -119,7 +119,7 @@ ___

*Overrides [CommandBase](_cli_command_base_.commandbase.md).[_execute](_cli_command_base_.commandbase.md#_execute)*

*Defined in [cli/init-command.ts:26](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/init-command.ts#L26)*
*Defined in [cli/init-command.ts:26](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/init-command.ts#L26)*

**Returns:** `Promise`<`void`>

Expand All @@ -130,7 +130,7 @@ ___

▸ **_initEnvironmentFile**(): `void`

*Defined in [cli/init-command.ts:42](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/init-command.ts#L42)*
*Defined in [cli/init-command.ts:42](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/init-command.ts#L42)*

**Returns:** `void`

Expand All @@ -141,7 +141,7 @@ ___

▸ **_installPackage**(): `void`

*Defined in [cli/init-command.ts:74](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/init-command.ts#L74)*
*Defined in [cli/init-command.ts:74](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/init-command.ts#L74)*

**Returns:** `void`

Expand All @@ -154,7 +154,7 @@ ___

*Inherited from [CommandBase](_cli_command_base_.commandbase.md).[_log](_cli_command_base_.commandbase.md#_log)*

*Defined in [cli/command-base.ts:19](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/command-base.ts#L19)*
*Defined in [cli/command-base.ts:19](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/command-base.ts#L19)*

**Parameters:**

Expand All @@ -173,7 +173,7 @@ ___

*Inherited from [CommandBase](_cli_command_base_.commandbase.md).[_logValue](_cli_command_base_.commandbase.md#_logvalue)*

*Defined in [cli/command-base.ts:13](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/command-base.ts#L13)*
*Defined in [cli/command-base.ts:13](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/command-base.ts#L13)*

**Parameters:**

Expand All @@ -191,7 +191,7 @@ ___

▸ **_validateOptions**(): `void`

*Defined in [cli/init-command.ts:32](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/init-command.ts#L32)*
*Defined in [cli/init-command.ts:32](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/init-command.ts#L32)*

**Returns:** `void`

Expand All @@ -204,7 +204,7 @@ ___

*Inherited from [CommandBase](_cli_command_base_.commandbase.md).[execute](_cli_command_base_.commandbase.md#execute)*

*Defined in [cli/command-base.ts:5](https://github.com/kyubisation/angular-server-side-configuration/blob/c276a03/src/cli/command-base.ts#L5)*
*Defined in [cli/command-base.ts:5](https://github.com/kyubisation/angular-server-side-configuration/blob/dfc956e/src/cli/command-base.ts#L5)*

**Returns:** `Promise`<`void`>

Expand Down
Loading