rct-template
Scaffold the code base a react reusable component or container.
Installation
- A recommended way to install @4geit/rct-template is through git repository using the following command:
git clone git@gitlab.com:4geit/react/rct-template.git
alternatively you can use the HTTPS URL:
git clone https://gitlab.com/4geit/react/rct-template.git
-
rct-template
requires you to set those environment variables:
-
REACT_NAMESPACE_ID
: the namespace id of the group/subgroup where you want the new project to be created (e.g. if you have the right two create a new project with the subgroup 4geit/react, you can set it's namespace ID1772784
) -
GITLAB_PRIVATE_TOKEN
: a gitlab token allowed to create an account in the namespace ID (4geit/react) -
GITLAB_AUTH_TOKEN
: a gitlab token allowed to release tags on the created project -
NPM_TOKEN
: a npm token allowed to publish a package in the@4geit
organization -
RUNNER_ID
: the runner id that will run the CI build. -
AWS_ACCESS_KEY
: the AWS access key allowed to deploy on a S3 bucket suffixed with a*.ws3.4ge.it
name. -
AWS_SECRET_KEY
: the AWS secret key paired with the access key.
If you are a BASH user, you can add those variables in your ~/.bashrc
file:
export REACT_NAMESPACE_ID=1772784
export GITLAB_PRIVATE_TOKEN=XXXX
export GITLAB_AUTH_TOKEN=XXXX
export NPM_TOKEN=XXXX
export RUNNER_ID=XXXX
export AWS_ACCESS_KEY=XXXX
export AWS_SECRET_KEY=XXXX
Create a new repository
- The easiest way to generate a new repository with
rct-template
is to use the following command line:
./rct-template/create-new-repo.sh
The command will ask a set of values such as:
-
<NAME>
: the name of the repository the one used inrct-<NAME>-<TYPE>
-
<TYPE>
: the type of the repository the one used inrct-<NAME>-<TYPE>
it can contain the valuecomponent
orcontainer
-
<AUTHOR_NAME>
: the name of the author stored in thepackage.json
-
<AUTHOR_EMAIL>
: the name of the author stored in thepackage.json
-
<DESCRIPTION>
: the description of the project stored in thepackage.json
andREADME.md
- But you can also use the command argument by doing so:
./rct-template/create-new-repo.sh <NAME> <TYPE> <AUTHOR_NAME> <AUTHOR_EMAIL>
You will still be asked to type the description though.
- You can also skip typing the author name and email each time by setting those environment variables:
export AUTHOR_NAME="Master Peace"
export AUTHOR_EMAIL="master.peace@provider.xyz"