./scripts/bootstrap.shThen you are ready to start each template, by running yarn start at the template folder.
⚠️ Important: remember to synchronize the changes applied to yourtemplate/package.jsonwithtemplate.jsonand remove thetemplate/package.jsonfile before testing or executeyarn cleanto clean it automatically.
You can test the template locally by calling create-react-app specifying the folder of this project:
npx create-react-app test-template --template file:./carto-react-template/template-sample-app-2You can also test an specific version (eg. an alpha already published) with something like:
npx create-react-app my-sample-app-alpha --template @carto/cra-template-sample-app-2@1.1.0-alpha.0Follow these steps:
- Open a new branch for the release from master, eg.
git checkout -b release-v1.0.0-rc.3 - Run
./scripts/bootstrap.shto start with all templates ready (and have a bit of patience) - For each template:
- move to the internal folder of the template, with
cd template3.1. carto-react lib- (manually) upgrade if required all @carto/react-* package versions
- [if required] remove the link to @carto/react-* packages with
yarn unlink-carto-react - ensure latest references with
yarn. Delete previously node_modules if you feel a bit unsure :) 3.2. app works fine - launch the app, with
yarn start - manual review from browser (see errors & warnings)
- stop the app 3.3. test locally the cra template
- move to template root folder with
cd ..(eg. template-base-3) - run
yarn clean - [if you want to test templates] copy the hygen
_templatesor_templates-ts, from root directory to yourtemplate-x/template/_templatesdirectory, so you can use them inside the client project - use create-react-app to build a project (see instructions above)
- test cra project result as a user, including hygen generators
- move to the internal folder of the template, with
- Bump manually package version in package.json (root level --> package.json & inside template --> package.dev.json), checking @carto/react-* package versions are also correct.
- Update changelog: rename 'Unreleased' to new version, eg 1.0.0-rc.3 (2021-03-23)
- Push branch to remote to run CI (all test green) with
git push - Execute the release command, for each template, from its base folder (eg. template-sample-app-2):
yarn publish:prereleaseoryarn publish:release. Before the npm publication, a prepare-release script will clean all unnecesary development files and folders and copy the latest hygen templates. - The release process removes certain files and folders, to have a clean publication (as package.dev.json), but those are required, so don't commit that change.
- After a succesful release, merge the PR and create a tag in github
- Ensure all template packages have the correct tags at npm for each version, with
npm dist-tag ls. A prerelease shouldn't be set as latest, just an official release - If prerelease didn't work properly, you can set a specific (stable) version to be set again as latest, eg:
npm dist-tag add @carto/cra-template-base-3@2.1.0 latestand/or stablish some specific version to prerelease explicitly with eg:npm dist-tag add @carto/cra-template-base-3@2.2.0-beta.0 prerelease - Deploy the sample app template to firebase (if required)
The sample app corresponding to https://sample-app-react.carto.com/ is hosted in Firebase, so before deploying it you'll need to log into Firebase using:
cd template-sample-app-3/template
yarn firebase loginThen, just build the sample-app template and deploy it by executing:
yarn build
yarn firebase deployThis project supports browserslist and it has an unsupported browser page. For the first part, it is enough to keep browserslist key in template.json files, as it is, so no action. For the second (just a visual helper for generated projects) ideally on any release, or in the case of updating browserslist configuration, update the detection script by running:
yarn updateSupportedBrowsersIf script doesn't finish correctly, verify you have globally available the package it uses, or add it with:
yarn add browserslist-useragent-regexp --globalIn order to work side by side with a local version of the CARTO for React library packages (available at https://github.com/CartoDB/carto-react), both can be linked. Basic steps are:
git clone https://github.com/CartoDB/carto-react.git
cd carto-react
yarn
yarn build:watch
yarn link-allOnce all lib packages are compiled, link them into the proper carto-react-template with:
cd carto-react-template
cd <template>/template
yarn link-carto-react
yarn startFrom this moment, the template will be using your local version of the library packages, allowing a faster development.