Skip to content

Commit ac81756

Browse files
authored
Merge pull request #19 from kyubisation/hotfix/v1.2.1
Documentation update
2 parents dfc956e + 579c0ea commit ac81756

12 files changed

+115
-154
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ environment variables into index.html file(s) by replacing `<!--CONFIG-->`
1515
(Missing environment variables will be represented by null). This should be done
1616
on the host serving the bundled angular files.
1717

18-
### AOT
19-
This will not work in Module.forRoot or Module.forChild scripts or parameters.
20-
These are build time only due to AOT restrictions.
18+
### AoT
19+
By default, this will not work in Module.forRoot or Module.forChild scripts or parameters.
20+
These are build time only due to AoT restrictions.
21+
22+
With `ngssc wrap-aot ng build ...` it is however possible to retain the configuration, by replacing
23+
the environment variables with tokens during the AoT build and reverting afterwards. (See [CLI wrap-aot](#wrap-aot))
2124

2225
## Getting Started
2326
```

documentation/README.md

Lines changed: 28 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ How it works & Limitations
1616

1717
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.
1818

19-
### AOT
19+
### AoT
2020

21-
This will not work in Module.forRoot or Module.forChild scripts or parameters. These are build time only due to AOT restrictions.
21+
By default, this will not work in Module.forRoot or Module.forChild scripts or parameters. These are build time only due to AoT restrictions.
22+
23+
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))
2224

2325
Getting Started
2426
---------------
@@ -80,86 +82,42 @@ ngssc --help
8082
```
8183

8284
### Insert
83-
84-
Usage: insert \[options\] \[directory\]
85+
Usage: insert [options] [directory]
8586

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

88-
Options
89-
90-
Description
91-
92-
`-s, --search`
93-
94-
Search environment variables in available .js files (Defaults to false)
95-
96-
`-e, --env <value>`
97-
98-
Add an environment variable to be resolved (default: \[\])
99-
100-
`-p, --placeholder <value>`
101-
102-
Set the placeholder to replace with the environment variables (Defaults to `<!--CONFIG-->`)
103-
104-
`-h, --head`
105-
106-
Insert environment variables into the head tag (after title tag, if available, otherwise before closing head tag)
107-
108-
`--dry`
109-
110-
Perform the insert without actually inserting the variables
111-
112-
`-h, --help`
113-
114-
output usage information
89+
| Options | Description |
90+
| --- | --- |
91+
| `-s, --search` | Search environment variables in available .js files (Defaults to false) |
92+
| `-e, --env <value>` | Add an environment variable to be resolved (default: []) |
93+
| `-p, --placeholder <value>` | Set the placeholder to replace with the environment variables (Defaults to `<!--CONFIG-->`) |
94+
| `-h, --head` | Insert environment variables into the head tag (after title tag, if available, otherwise before closing head tag) |
95+
| `--dry` | Perform the insert without actually inserting the variables |
96+
| `-h, --help` | output usage information |
11597

11698
### Init
117-
118-
Usage: init \[options\] \[directory\]
99+
Usage: init [options] [directory]
119100

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

122-
Options
123-
124-
Description
125-
126-
`-ef, --environment-file`
127-
128-
The environment file to initialize (environmentFile defaults to src/environments/environment.prod.ts)
129-
130-
`--npm`
131-
132-
Install angular-service-side-configuration via npm (Default)
133-
134-
`--yarn`
135-
136-
Install angular-service-side-configuration via yarn
137-
138-
`-h, --help`
139-
140-
output usage information
103+
| Options | Description |
104+
| --- | --- |
105+
| `-ef, --environment-file` | The environment file to initialize (environmentFile defaults to src/environments/environment.prod.ts) |
106+
| `--npm` | Install angular-service-side-configuration via npm (Default) |
107+
| `--yarn` | Install angular-service-side-configuration via yarn |
108+
| `-h, --help` | output usage information |
141109

142110
### Wrap-Aot
111+
Usage: wrap-aot [options] [ng...]
143112

144-
Usage: wrap-aot \[options\] \[ng...\]
145-
146-
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.
147-
148-
Options
149-
150-
Description
151-
152-
`-ef, --environment-file`
153-
154-
The environment file to prepare for aot-compilation (Defaults to src/environments/environment.prod.ts)
155-
156-
`--dist`
157-
158-
The output path of the ng build (Defaults to dist/\*\*)
159-
160-
`-h, --help`
113+
Wrap an angular command with aot compilation to retain configuration (Use "ngssc wrap-aot ng build ..."). This will temporarily replace the
114+
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.
161115

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

164122
Native CLI
165123
----------

documentation/classes/_cli_command_base_.commandbase.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

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

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

4444
**Parameters:**
4545

@@ -59,7 +59,7 @@ ___
5959

6060
**_name**: *`string`*
6161

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

6464
___
6565

@@ -71,7 +71,7 @@ ___
7171

7272
**_execute**(): `Promise`<`void`>
7373

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

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

@@ -82,7 +82,7 @@ ___
8282

8383
**_log**(message: *`string`*): `void`
8484

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

8787
**Parameters:**
8888

@@ -99,7 +99,7 @@ ___
9999

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

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

104104
**Parameters:**
105105

@@ -117,7 +117,7 @@ ___
117117

118118
**execute**(): `Promise`<`void`>
119119

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

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

documentation/classes/_cli_init_command_.initcommand.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

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

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

4848
**Parameters:**
4949

@@ -68,7 +68,7 @@ ___
6868

6969
**_directory**: *`string`*
7070

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

7373
___
7474
<a id="_environmentfile"></a>
@@ -77,7 +77,7 @@ ___
7777

7878
**_environmentFile**: *`string`*
7979

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

8282
___
8383
<a id="_options"></a>
@@ -86,7 +86,7 @@ ___
8686

8787
**_options**: *`object`*
8888

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

9191
#### Type declaration
9292

@@ -105,7 +105,7 @@ ___
105105

106106
**_packagePath**: *`string`*
107107

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

110110
___
111111

@@ -119,7 +119,7 @@ ___
119119

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

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

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

@@ -130,7 +130,7 @@ ___
130130

131131
**_initEnvironmentFile**(): `void`
132132

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

135135
**Returns:** `void`
136136

@@ -141,7 +141,7 @@ ___
141141

142142
**_installPackage**(): `void`
143143

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

146146
**Returns:** `void`
147147

@@ -154,7 +154,7 @@ ___
154154

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

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

159159
**Parameters:**
160160

@@ -173,7 +173,7 @@ ___
173173

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

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

178178
**Parameters:**
179179

@@ -191,7 +191,7 @@ ___
191191

192192
**_validateOptions**(): `void`
193193

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

196196
**Returns:** `void`
197197

@@ -204,7 +204,7 @@ ___
204204

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

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

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

0 commit comments

Comments
 (0)