BEFORE RUNNING ANY SCRIPT I MADE, COMMIT YOUR CHANGES!!
Builder V10 and V11 are broken, update to V12
My Scripts
This is accurate since builder Version 10. (View version on running it.)
place the scripts folder on the same level as the angular project, for example:
C:/henk/scripts+C:/henk/angularProjectFolder/scr/..., where they are both directly inC:/henk/and not
C:/henk/scripts+C:/henk/folder/angularProjectFolder/scr/...nor
C:/henk/folder/scripts+C:/henk/angularProjectFolder/scr/...nor
C:/henk/folder/scripts+C:/henk/otherFolder/angularProjectFolder/scr/...
open the scripts/builderData.json, this is the default data.
If scripts/builderData.json does not exist, run builder.py, this will give you errors, but i will generate the scripts/builderData.json for you.
IMPORTANT!
This json will be created/read from wherever your builder.py is ran from. So if you run it in vscode whilst it is in a folder, it probably will create a new one in the top level.
{
"BuildNumber": 0,
"JSONVersion": 3,
"AngularProjectFolder": "PlayTimeClient",
"BuildDataPath": "/src/app/Models/buildData.ts",
"AngularDistName": "play-time",
"HostToUrl": "https://oldmartijntje.nl",
"BuilderMakeBranch": true,
"MainBranch": "main"
}set the BuildNumber to 0 to restart the counting of buildnumbers. This increases automatically every time you run builder.py.
don’t touch JSONVersion, this is for me to debug builder script issues.
how to configure builderData json
-
AngularProjectFolderif this is your configuration:
C:/henk/scripts&C:/henk/myAngularApp/scr/...then you should set
AngularProjectFolderto"myAngularApp" -
BuildDataPaththis is where your buildData wil get saved into the reposetory. So that you can display builddata in the running angular application
Set this to wherever you want this to be located inside your angular project. You can change the name too. Purely preference.
Make sure the parent folder exists beforehand, file itself doesn’t need to exist.
Adding extra data in here will be overwritten.
-
AngularDistName- go into
angular.json - press CTRL+F
- search for
"outputPath": "dist/ - copy the thing that comes after, for example:
If it is
"outputPath": "dist/play-time",Then you copy the
play-time - replace the value of
AngularDistNamewith the thing you copied.
- go into
-
HostToUrlthis is the url you want to host to. For example I am hosting to
https://oldmartijntje.nlBut you can also use
https://yourGithubUsername.github.io/YourGithubRepoif you are using default github pages. -
BuilderMakeBranchthe builder.py defaultly makes a new branch when you build. You can disable that here.
-
MainBranchafter making a new branch for each build, it switches back to this branch. If
BuilderMakeBranchis set tofalse, this still needs to be set accurately. -
GitRepoThe path to your git repo, so that the last commit url will work
testbuilder vs builder
builder.py updates the buildId and data. It also makes a new branch (if enabled), testbuilder.py doesn’t. testbuilder.py just builds the page in it’s current state to github pages.
remove local branches script
If you run this, it removes the local branches from your pc, make sure you commit beforehand.
problems i solved with my builder
- manually having to run
npm install, and the 2 build commands - angular routing problem. Where going to a route will cause errors unless the page sends you there.
- manually having to set a build number.
- teamwork issues:
- not knowing if it is up to date on the active build.
- Who builded the new version? It wasn’t ready yet
- did you build from dev? or from a feature branch?
hosting with a different url
hosting with a different url
there are a few steps:
get a domain
set the DNS
A-recordto the following IP:185.199.108.153set the CNAME, this is important for https, if using http, might be optional:
This is a screenshot from strato
add a
CNAMEinto the root folder of the project. thisCNAMEfile must contain your webAdress, for example:oldmartijntje.nlSubdomain
Basically the same as the above.
Link to original
gitignore
i reccomend to put the following in a .gitignore file:
BuilderData.json
environment.prod.ts
This is a screenshot from strato