Skip to content

Commit 85f34f4

Browse files
authored
Merge pull request #110 from topcoder-platform/dev
Uni Nav in Online Review Release - 2023-01-10 -> master
2 parents a4bf9aa + 0bca51f commit 85f34f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1667
-980
lines changed

.circleci/config.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ running_npm_build: &running_npm_build
4444
name: Running npm Build
4545
command: |
4646
npm install
47-
npm run build
47+
APP_ENV=${LOGICAL_ENV} npm run build
4848
4949
workspace_persist: &workspace_persist
5050
root: .
@@ -58,29 +58,49 @@ running_version_patch: &running_version_patch
5858
name: Patching Version
5959
command: |
6060
npm install
61-
git config user.name brooketopcoder
62-
git config user.email brooke.souza@topcoder.com
61+
git config user.name $CIRCLE_USERNAME
62+
git config user.email security@topcoder.com
6363
npm version patch -m "Increment Version [ci skip]"
64-
git push --set-upstream origin master
64+
git push --set-upstream origin $CIRCLE_BRANCH
6565
6666
update_types: &update_types
6767
name: Updating Types
6868
command: |
6969
npm ci
7070
npm run types
7171
diffstatus=$(git status --porcelain)
72-
git config user.name brooketopcoder
73-
git config user.email brooke.souza@topcoder.com
72+
git config user.name $CIRCLE_USERNAME
73+
git config user.email security@topcoder.com
7474
git add types
7575
git diff-index --cached --quiet HEAD || git commit -m "Add Types [ci skip]"
76-
git push --set-upstream origin master
76+
git push --set-upstream origin $CIRCLE_BRANCH
77+
78+
check_types: &check_types
79+
name: Checking Types
80+
command: |
81+
npm ci
82+
npm run types
83+
diffstatus=$(git status --porcelain)
84+
git config user.name $CIRCLE_USERNAME
85+
git config user.email [email protected]
86+
git add types
87+
git diff-index --cached --quiet HEAD || echo 'WARNING: Types need updating'
88+
git diff-index --cached --quiet HEAD || exit 1
7789
7890
finger_print_add: &finger_print_add
7991
fingerprints:
8092
- "a5:ad:51:96:10:a9:09:fb:7b:b4:fc:b7:08:df:ab:fa"
8193

8294
# DEFINE STEPS FOR JOBS
8395

96+
check_types_steps: &check_types_steps
97+
- add_ssh_keys: *finger_print_add
98+
- checkout
99+
- setup_remote_docker
100+
- run: *install_build_dependency
101+
- run: *install_deploysuite
102+
- run: *check_types
103+
84104
build_steps_prod: &build_steps_prod
85105
# Initialization.
86106
- add_ssh_keys: *finger_print_add
@@ -118,6 +138,14 @@ deploy_steps: &deploy_steps
118138
119139
jobs:
120140

141+
check-types:
142+
<<: *defaults
143+
environment:
144+
DEPLOY_ENV: "DEV"
145+
LOGICAL_ENV: "dev"
146+
APPNAME: "universal-navigation"
147+
steps: *check_types_steps
148+
121149
build-dev:
122150
<<: *defaults
123151
environment:
@@ -158,6 +186,13 @@ workflows:
158186
build:
159187
jobs:
160188

189+
- check-types:
190+
context : org-global
191+
filters:
192+
branches:
193+
ignore:
194+
- master
195+
161196
- build-dev:
162197
context : org-global
163198
filters:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ See the [IAC README](../iac/README.md) for instructions for deploying the stack.
7575
The dev version of the UniNav script allows the following origins.
7676

7777
Customer & Member Mktg
78+
- https://topcoder.com
79+
- https://www.topcoder.com
7880
- https://topcoder-dev.com
7981
- https://www.topcoder-dev.com
8082

iac/uni-nav.deploy.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,32 @@ Resources:
8080
Items:
8181

8282
# Customer & Member Marketing Prod & Dev
83-
- !Sub https://${Domain}
84-
- !Sub https://www.${Domain}
83+
- https://www.topcoder.com
84+
- https://topcoder.com
85+
86+
# Customer Marketing Dev
87+
- !If
88+
- IsProd
89+
- !Ref AWS::NoValue
90+
- !Sub https://${Domain}
91+
- !If
92+
- IsProd
93+
- !Ref AWS::NoValue
94+
- !Sub https://www.${Domain}
95+
- !If
96+
- IsProd
97+
- !Ref AWS::NoValue
98+
- https://uninav.topcoder.com
8599

86100
# Customer Marketing Local
87101
- !If
88102
- IsProd
89103
- !Ref AWS::NoValue
90-
- http://localhost
104+
- http://localhost:8080
105+
- !If
106+
- IsProd
107+
- !Ref AWS::NoValue
108+
- http://topcoder.topcoder-dev.com
91109

92110
# Forum Prod & Dev
93111
- !Sub https://discussions.${Domain}

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
tcUniNav('init', 'footer-el', {
5454
type: 'footer',
55+
fullFooter: true,
5556
})
5657

5758
tcUniNav('update', 'tool-nav', {

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
"types": "./types/src/main.d.ts",
88
"repository": "https://github.com/topcoder-platform/universal-navigation.git",
99
"scripts": {
10-
"build:footer": "APP_BUILD_TARGET=footer vite build",
11-
"build:marketing": "APP_BUILD_TARGET=marketing vite build",
12-
"build:tool": "APP_BUILD_TARGET=tool vite build",
10+
"build:footer": "APP_BUILD_TARGET=footer vite build --mode=$NODE_ENV",
11+
"build:marketing": "APP_BUILD_TARGET=marketing vite build --mode=$NODE_ENV",
12+
"build:tool": "APP_BUILD_TARGET=tool vite build --mode=$NODE_ENV",
1313
"build:navs": "npm run build:marketing & npm run build:footer && npm run build:tool",
14-
"build": "npm run build:navs && vite build && npx rimraf ./types && npm run types",
14+
"build:base": "npm run build:navs && vite build --mode=$NODE_ENV && npx rimraf ./types && npm run types",
15+
"build": "NODE_ENV=production npm run build:base",
1516
"check": "svelte-check --tsconfig ./tsconfig.json",
16-
"demo:dist": "npx http-server --cors --host localhost --port 8080 ./dist",
17+
"demo:dist": "npx http-server --cors --host localhost --port 8083 ./dist",
1718
"demo:marketing": "npx http-server --host localhost --port 8081 ./demo/marketing -P http://localhost:8081? -o /",
1819
"demo:tool": "npx http-server --host localhost --port 8082 ./demo/tool -P http://localhost:8081? -o /",
1920
"demo": "npx npm-run-all -p demo:*",

public/assets/icon-arrow.svg

Lines changed: 3 additions & 0 deletions
Loading

public/assets/icon-tmenu.svg

Lines changed: 5 additions & 0 deletions
Loading

public/assets/tools/sprite.svg

Lines changed: 1 addition & 1 deletion
Loading

src/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ There are 2 sample integrations in the [/demo](./demo/) folder:
4949

5050
2. Serve the demo app
5151
- `% npm run demo`
52-
- http://localhost:8080
52+
- http://localhost:8083
5353

5454
3. Navigate to the specific nav:
5555
- Marketing Nav: http://localhost:8081
@@ -67,12 +67,14 @@ The build reads the app version in `package.json` and automatically outputs the
6767

6868
## Typescript Type Declaration Generation
6969

70-
Typescript type declarations (i.e. `*.d.ts`) are automatically generated for each branch as part of the Github build worklow.
70+
Typescript type declarations (i.e. `*.d.ts`) are automatically generated upon build. When developing the nav, it is preferred that each branch regenerates its types before PR merge.
7171

72-
After pushing changes to Github, Github builds the app and automatically runs the command to generate types.
72+
However, this is obviously error prone, so every time a push is made to master, the CI process will regenerate the types and commit them to the master branch if there are differences.
7373

74-
If there are any differences, Github automatically commits those into the branch.
74+
In addition, all pushes to the master branch will automatically increment the patch version number, which will allow the consumers of the types to get the updates with `npm update` or `yarn upgrade`.
7575

76-
If a PR exists for a branch that has out of date types, the PR will display an error until the types are generated and committed, but it will not pervent the merging of the PR.
76+
Both the types commit and the version patch commit will be authored by the user who merged the PR.
7777

78-
>**NOTE** In order to disseminate updates to the types via npm, you must increment the version number in the [../package.json](../package.json).
78+
For non-master branches, there is a build job in the CI that will check to see if there are any updates to the types required and exit with an error code 1 with message `WARNING: Types need updating`.
79+
80+
The error will not prevent merging a PR or deploying to an environment but will just be a flag for the PR owner and reviewers.

src/declarations.d.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)