Skip to content

Commit

Permalink
fix: setup-project fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dereekb committed May 17, 2022
1 parent a4ee5cd commit 5e174fd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
- run:
# CircleCI does not have a great way to pass variables between run steps, so we grab the tag name before swapping to main, and then move tag to the main branch after making the merge commit into main.
name: copy tag id, merge release into main and use the release commit message, move tag from release to main
command: DEV_TAG_ID=$(git describe --abbrev=0 HEAD^) && TAG_ID=$(git describe --abbrev=0) && echo "merging new release ($TAG_ID) into main. Adding all commits since last dev tag ($DEV_TAG_ID)" && git checkout main && git merge release --squash -Xtheirs && git commit -m "$(git log $PREV_TAG_ID..release --pretty=%B | cat)" && git tag -f $TAG_ID
command: DEV_TAG_ID=$(git describe --abbrev=0 HEAD^) && TAG_ID=$(git describe --abbrev=0) && echo "merging new release ($TAG_ID) into main. Adding all commits since last dev tag ($DEV_TAG_ID)" && git checkout main && git merge release --squash -Xtheirs && git commit -m "$(git log $DEV_TAG_ID..release --pretty=%B | cat)" && git tag -f $TAG_ID
- run:
name: push main to origin, push new tag to origin
command: git push origin main && git push origin $(git describe --abbrev=0 --tags)
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/src/app/modules/demo/container/layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export class DemoLayoutComponent {
icon: 'home'
}];

readonly adminAnchors = [{
readonly adminAnchors: ClickableAnchorLinkSegueRef[] = [{
title: 'Admin Home',
ref: 'demo.home',
icon: 'home'
}];

readonly userAnchors = [{
readonly userAnchors: ClickableAnchorLinkSegueRef[] = [{
title: 'App Home',
ref: 'demo.app.home',
icon: 'home'
Expand Down
30 changes: 17 additions & 13 deletions setup/setup-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ INPUT_CODE_PREFIX=${2:-app} # example: gethapi
FIREBASE_BASE_EMULATORS_PORT=${3:-9100} # example: 9100
PARENT_DIRECTORY=${4:-'../../'} # parent directory to create this project within. Defaults to relative to this script's space within dbx-components.

# - Other Configuration
SOURCE_BRANCH=main # develop or main

# - Project Details
NAME=$FIREBASE_PROJECT_ID
PROJECT_NAME=$FIREBASE_PROJECT_ID
Expand Down Expand Up @@ -167,6 +170,7 @@ git commit -m "added firebase configuration"

# Install npm dependencies
npm i @dereekb/dbx-analytics @dereekb/dbx-web @dereekb/dbx-form @dereekb/firebase @dereekb/firebase-server @dereekb/dbx-firebase --force # TODO: Remove force once possible.
npm i -D @ngrx/store-devtools @firebase/rules-unit-testing firebase-functions-test # TODO: Figure out how to have the @dereekb dependencies also include these.

git add --all
git commit -m "added @dereekb dependencies"
Expand Down Expand Up @@ -227,7 +231,7 @@ git add --all
git commit -m "added Docker files and other utility files"

# add semver for semantic versioning and linting for commits
npm install -D @jscutlery/semver
npm install -D @jscutlery/semver husky
curl https://raw.githubusercontent.com/dereekb/dbx-components/main/.commitlintrc.json -o .commitlintrc.json

mkdir .husky
Expand All @@ -250,7 +254,7 @@ curl https://raw.githubusercontent.com/dereekb/dbx-components/main/jest.setup.ts

# add env files to ensure that jest CI tests export properly.
mkdir tmp # TODO: Change from /develop to /main later.
curl https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/apps/.env -o tmp/env.tmp
curl https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/apps/.env -o tmp/env.tmp
sed -e "s/APP_ID/$ANGULAR_APP_NAME/g" tmp/env.tmp > $ANGULAR_APP_FOLDER/.env
sed -e "s/APP_ID/$API_APP_NAME/g" tmp/env.tmp > $API_APP_FOLDER/.env
sed -e "s/APP_ID/$E2E_APP_NAME/g" tmp/env.tmp > $E2E_APP_FOLDER/.env
Expand All @@ -267,7 +271,7 @@ git commit -m "added jest configurations"
echo "Copying CircleCI Configurations."
echo "BEFORE CIRCLECI USE - Please update configuration on CircleCI and in \".circleci/config.yml\""
mkdir .circleci
curl https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/.circleci/config.yml -o .circleci/config.yml.tmp
curl https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/.circleci/config.yml -o .circleci/config.yml.tmp
sed -e "s/CI_GIT_USER_EMAIL/$CI_GIT_USER_EMAIL/g" -e "s/CI_GIT_USER_NAME/$CI_GIT_USER_NAME/g" -e "s/ANGULAR_APP_NAME/$ANGULAR_APP_NAME/g" -e "s/API_APP_NAME/$API_APP_NAME/g" -e "s/E2E_APP_NAME/$E2E_APP_NAME/g" .circleci/config.yml.tmp > .circleci/config.yml
rm .circleci/config.yml.tmp

Expand All @@ -276,30 +280,30 @@ git commit -m "added circleci configrations"

# Apply Project Configurations
echo "Applying Configuration to Projects"
curl https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/workspace.json -o ./workspace.json.tmp
curl https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/workspace.json -o ./workspace.json.tmp
sed -e "s:ANGULAR_APP_FOLDER:$ANGULAR_APP_FOLDER:g" -e "s:API_APP_FOLDER:$API_APP_FOLDER:g" -e "s:E2E_APP_FOLDER:$E2E_APP_FOLDER:g" -e "s:FIREBASE_COMPONENTS_FOLDER:$FIREBASE_COMPONENTS_FOLDER:g" -e "s:ANGULAR_COMPONENTS_FOLDER:$ANGULAR_COMPONENTS_FOLDER:g" -e "s:ANGULAR_APP_NAME:$ANGULAR_APP_NAME:g" -e "s:API_APP_NAME:$API_APP_NAME:g" -e "s:E2E_APP_NAME:$E2E_APP_NAME:g" -e "s:FIREBASE_COMPONENTS_NAME:$FIREBASE_COMPONENTS_NAME:g" -e "s:ANGULAR_COMPONENTS_NAME:$ANGULAR_COMPONENTS_NAME:g" ./workspace.json.tmp > ./workspace.json
rm ./workspace.json.tmp
rm ./angular.json

curl https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/project.json -o ./project.json
curl https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/project.json -o ./project.json

rm $ANGULAR_APP_FOLDER/project.json
curl https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/apps/app/project.json -o $ANGULAR_APP_FOLDER/project.json.tmp
curl https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/apps/app/project.json -o $ANGULAR_APP_FOLDER/project.json.tmp
sed -e "s:ANGULAR_APP_DIST_FOLDER:$ANGULAR_APP_DIST_FOLDER:g" -e "s:ANGULAR_APP_FOLDER:$ANGULAR_APP_FOLDER:g" -e "s:ANGULAR_APP_NAME:$ANGULAR_APP_NAME:g" -e "s:ANGULAR_APP_PORT:$ANGULAR_APP_PORT:g" $ANGULAR_APP_FOLDER/project.json.tmp > $ANGULAR_APP_FOLDER/project.json
rm $ANGULAR_APP_FOLDER/project.json.tmp

rm $API_APP_FOLDER/project.json
curl https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/apps/api/project.json -o $API_APP_FOLDER/project.json.tmp
curl https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/apps/api/project.json -o $API_APP_FOLDER/project.json.tmp
sed -e "s:API_APP_DIST_FOLDER:$API_APP_DIST_FOLDER:g" -e "s:API_APP_FOLDER:$API_APP_FOLDER:g" -e "s:API_APP_NAME:$API_APP_NAME:g" $API_APP_FOLDER/project.json.tmp > $API_APP_FOLDER/project.json
rm $API_APP_FOLDER/project.json.tmp

rm $ANGULAR_COMPONENTS_FOLDER/project.json
curl https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/components/app/project.json -o $ANGULAR_COMPONENTS_FOLDER/project.json.tmp
curl https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/components/app/project.json -o $ANGULAR_COMPONENTS_FOLDER/project.json.tmp
sed -e "s:ANGULAR_COMPONENTS_DIST_FOLDER:$ANGULAR_COMPONENTS_DIST_FOLDER:g" -e "s:ANGULAR_COMPONENTS_FOLDER:$ANGULAR_COMPONENTS_FOLDER:g" -e "s:ANGULAR_APP_PREFIX:$ANGULAR_APP_PREFIX:g" -e "s:ANGULAR_COMPONENTS_NAME:$ANGULAR_COMPONENTS_NAME:g" $ANGULAR_COMPONENTS_FOLDER/project.json.tmp > $ANGULAR_COMPONENTS_FOLDER/project.json
rm $ANGULAR_COMPONENTS_FOLDER/project.json.tmp

rm $FIREBASE_COMPONENTS_FOLDER/project.json
curl https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/components/firebase/project.json -o $FIREBASE_COMPONENTS_FOLDER/project.json.tmp
curl https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/components/firebase/project.json -o $FIREBASE_COMPONENTS_FOLDER/project.json.tmp
sed -e "s:FIREBASE_COMPONENTS_DIST_FOLDER:$FIREBASE_COMPONENTS_DIST_FOLDER:g" -e "s:FIREBASE_COMPONENTS_FOLDER:$FIREBASE_COMPONENTS_FOLDER:g" -e "s:FIREBASE_COMPONENTS_NAME:$FIREBASE_COMPONENTS_NAME:g" $FIREBASE_COMPONENTS_FOLDER/project.json.tmp > $FIREBASE_COMPONENTS_FOLDER/project.json
rm $FIREBASE_COMPONENTS_FOLDER/project.json.tmp

Expand Down Expand Up @@ -327,7 +331,7 @@ download_ts_file () {
download_app_ts_file () {
local FILE_PATH=$1
local TARGET_FOLDER=$ANGULAR_COMPONENTS_FOLDER
local DOWNLOAD_PATH=https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/components/app
local DOWNLOAD_PATH=https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/components/app
download_ts_file "$DOWNLOAD_PATH" "$TARGET_FOLDER" "$FILE_PATH"
}

Expand All @@ -353,7 +357,7 @@ git commit -m "setup app components"
download_firebase_ts_file () {
local FILE_PATH=$1
local TARGET_FOLDER=$FIREBASE_COMPONENTS_FOLDER
local DOWNLOAD_PATH=https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/components/firebase
local DOWNLOAD_PATH=https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/components/firebase
download_ts_file "$DOWNLOAD_PATH" "$TARGET_FOLDER" "$FILE_PATH"
}

Expand Down Expand Up @@ -383,7 +387,7 @@ git commit -m "setup api components"
download_angular_ts_file () {
local FILE_PATH=$1
local TARGET_FOLDER=$ANGULAR_APP_FOLDER
local DOWNLOAD_PATH=https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/apps/app
local DOWNLOAD_PATH=https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/apps/app
download_ts_file "$DOWNLOAD_PATH" "$TARGET_FOLDER" "$FILE_PATH"
}

Expand Down Expand Up @@ -444,7 +448,7 @@ git commit -m "setup app"
download_api_ts_file () {
local FILE_PATH=$1
local TARGET_FOLDER=$API_APP_FOLDER
local DOWNLOAD_PATH=https://raw.githubusercontent.com/dereekb/dbx-components/main/setup/templates/apps/api
local DOWNLOAD_PATH=https://raw.githubusercontent.com/dereekb/dbx-components/$SOURCE_BRANCH/setup/templates/apps/api
download_ts_file "$DOWNLOAD_PATH" "$TARGET_FOLDER" "$FILE_PATH"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export class AppLayoutComponent {
icon: 'home'
}];

readonly adminAnchors = [];
readonly adminAnchors: ClickableAnchorLinkSegueRef[] = [];

readonly userAnchors = [{
readonly userAnchors: ClickableAnchorLinkSegueRef[] = [{
title: 'App Home',
ref: 'app.app.home',
icon: 'home'
Expand Down

0 comments on commit 5e174fd

Please sign in to comment.