Development Workflow
Problem:
Needed changes are identified for an app, but the changes involve both the app and dependencies (RCLs) used by the app.
Solution:
-
Based on the issue description make up a feature name for the solution. This name will be used to create a “feature” branch in all the affected repos as well as a “solution” folder name locally. The convention for the branch name is the word “feature” followed by one’s initials or moniker, followed by the issue number, followed by a one or two word description, all of which are delimited by dashes. For example, suppose the issue is about tooltips and the issue is #22. Then the branch name might be
feature-cn-22-tooltips
. -
Create a local folder for the solution that matches the branch name. Let’s call this the solution folder.
-
Clone all the repositories needed into the solution folder.
-
Create the feature branch in the repos before you make changes:
$ git checkout -b feature-cn-22-tooltips
-
In the below, italicized steps are not done by developer.
-
For RCLs:
-
Make changes to code, Styleguidist, etc.
-
Update Cypress tests as needed
-
Commit and push changes
-
Create a PR, which creates a preview for QA
-
Once QA signs off, change pipeline to “in review”
-
Once reviews are completed and all comments resolved, merge code, publish RCL to NPM with new version
-
Delete the feature branch
-
-
For App:
-
Source dependent RCLs locally (I don’t know how to do this)
-
Make changes to code
-
Update Cypress tests as needed
-
Commit and push changes
-
Wait for dependencies to be republished
-
Update
package.json
with new dependency version and update (yarn install
) -
Create a PR, which creates a preview for QA
-
Once QA signs off, change pipeline to “in review”
-
Once reviews are completed and all comments resolved, publish app
-
Delete the feature branch
-
Using YALC
To install and see help:
$ yarn global add yalc
$ yalc help
yalc [command] [options] [package1 [package2...]]
Commands:
publish Publish package in yalc local repo
installations Work with installations file: show/clean
push Publish package in yalc local repo and push to all
installations
add Add package from yalc repo to the project
link Link package from yalc repo to the project
update Update packages from yalc repo
remove Remove packages from the project
retreat Remove packages from project, but leave in lock file (to be
restored later)
check Check package.json for yalc packages
dir Show yalc system directory
Options:
--help Show help [boolean]
In RCL:
$ yalc publish
NOTE: this command runs prepublishOnly
script.
To see where the “local repo” is:
$ yalc dir
C:\Users\mando\AppData\Local\Yalc
To use the locally sourced RCL, go to the app (or other RCL):
$ yalc link markdown-translatable
Package markdown-translatable@1.0.0-rc.1+05065799 linked ==> C:\Users\mando\Projects\bugfix-mandolyte-120-oq-highlight\tc-create-app\node_modules\markdown-translatable.
To confirm linkage:
$ cd node_modules/
$ ls -al | grep markdown-translatable
lrwxrwxrwx 1 mando 197611 100 Jun 26 07:44 markdown-translatable -> /c/Users/mando/Projects/bugfix-mandolyte-120-oq-highlight/tc-create-app/.yalc/markdown-translatable/
Or to see all linked modules: ls -al | grep ^l
Note that the “link” command copies from the “local repo” to a subdirectory “.yalc” in the app folder. Thus, add these two entries to “.gitignore”
/.yalc
yalc.lock
Then yarn start
as usual to launch the app. If start is already running, then it will detect the new link sources and recompile.
Workflow
- make changes to RCL
-
yalc publish
(this builds and puts the app into the local store) - in using APP or RCL,
yalc link yourRclName
(this copies from the local store to.yalc
and make it linkable in node_modules). Once copied, you can simply useyalc update
to update to any published changes. - if
yarn start
is running it will auto rebuild; otherwise runyarn start