-
Notifications
You must be signed in to change notification settings - Fork 7
Design the Boilerplate
Yu Chung-Jen edited this page Jun 28, 2018
·
3 revisions
-
Environment Template
- Features:
- It's the general base of all projects, but the derivative content may differentiate by projects.
- The actions we need are:
- Init new project base on the template
- Update the old project with new template
- Contains:
- HTML template
- Package dependencies (package.json)
- Bundle tools (webpack, babel)
- Development tools (eslint)
- Tests ([TODO] check if the elements that all projects should have exist when build)
- Features:
-
Deployment Tool
- Features:
- Only need to config the setting once when init (to tell the tool your project id and bucket name).
- Deploy all projects with the latest deployment tool (There's no need to use the older versions),
- Take a config file or send arguments through cli.
- The actions we need are:
- Deploy. Options are:
- to production or staging
- select which files to be uploaded
- automatically detect which files have changed and just upload them / upload and overwrite all files
- the cache time of the files to be upload
- Set cache time of uploaded files.
- Deploy. Options are:
- Features:
There are three possible solutions:
- Build the functions as an independent npm package.
- Separate the projects as subfolder, handle the functions at the root of the folder.
- Separate the projects into different branches.
Check if each soluton meets our target features and actions needed:
Environment Template
independent package | handle at the top of projects | separate projects into branches | |
---|---|---|---|
Properties | |||
the derivative content may differentiate by projects | O | O | O |
The actions we need | |||
Init new project base on the template | O | O | O |
Update the old project with new template | X | X | O |
Deployment Tool
independent package | handle at the top of projects | separate projects into branches (save the tools in template branch) | |
---|---|---|---|
Properties | |||
Only need to config the setting once when init | O (if it is globally installed) | O | X, need to update the project manually after template updated |
Deploy all projects with the latest deployment tool | O (if it is globally installed) | O | X, as above |
Take a config file or send arguments through cli | O | O | O |
The actions we need | |||
Deploy with options | O | O | O |
Set cache time of uploaded files | O | O | O |
Conclusion:
- For environment template, only
separate projects into branches
can help us "update the old project with new template" with simplegit merge
. - But if we save deployment tools in the template branch, we need to update the project manually after template updated. So we have to abstract deployment tools out of the project.
- We can use "globally installed package" or make a new repo that handle the deployment of its subfolder. But former is much more flexible (no need to place the folder to be uploaded under the handler).