Skip to content

Commit

Permalink
moves docs publishing to separate workflow and updates readme for con…
Browse files Browse the repository at this point in the history
…fig env var replacement changes
  • Loading branch information
Jason Holt Smith committed May 23, 2024
1 parent b6d3b02 commit 1b8bd0d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/build-test-deploy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,4 @@ jobs:
run: npx lerna publish from-package --yes
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_USER: ${{ secrets.NPM_USER }}
- name: Build HTML docs
id: builddocs
run: npm run docs
- uses: actions/deploy-pages@v4
NPM_USER: ${{ secrets.NPM_USER }}
20 changes: 20 additions & 0 deletions .github/workflows/deploy-pages-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: deploy-pages-main
on:
push:
branches:
- main
jobs:
deploy-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install Dependencies
id: installdeps
run: npm ci
- name: Build HTML docs
id: builddocs
run: npm run docs
- uses: actions/deploy-pages@v4
20 changes: 12 additions & 8 deletions packages/aft-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@ Ex: with an `aftconfig.json` containing:
```json
{
"SomeCustomClassConfig": {
"configField1": "%your_env_var%",
"configField1": %your_env_var%,
"configField2": "some-value",
"configField3": ["foo", true, 10]
"configField3": ["foo", true, 10],
"configField4": "%another_env_var%"
}
}
```
and with the following environment variables set:
> export your_env_var="an important value"
```
> export your_env_var="42"
> export another_env_var="the meaning of everything"
```

and a config class of:
```typescript
export class SomeCustomClassConfig {
configField1: string = 'default_value_here';
configField1: number = 0;
configField2: string = 'another_default_value';
configField3: Array<string | boolean | number> = ['default_val'];
configField4: string = 'last_default_value';
Expand All @@ -37,20 +41,20 @@ export class SomeCustomClassConfig {
can be accessed using an `AftConfig` instance as follows:
```typescript
const config = aftConfig.getSection(SomeCustomClassConfig); // or new AftConfig().getSection(SomeCustomClassConfig);
config.configField1; // returns "an important value"
config.configField1; // returns 42
config.configField2; // returns "some-value"
config.configField3; // returns ["foo", true, 10] as an array
config.configField4; // returns "last_default_value"
config.configField4; // returns "the meaning of everything"
```

and if you wish to entirely disregard the configuration specified in your `aftconfig.json` file you can use the following (still based on the above example):
```typescript
const config = new AftConfig({
SomeCustomClassConfig: {
configField1: 'custom_value_here'
configField1: 42
}
});
config.configField1; // returns "custom_value_here"
config.configField1; // returns 42
config.configField2; // returns "another_default_value"
config.configField3; // returns ["default_val"] as an array
config.configField4; // returns "last_default_value"
Expand Down

0 comments on commit 1b8bd0d

Please sign in to comment.