Skip to content

Commit

Permalink
Update project bootstrap instructions (#40)
Browse files Browse the repository at this point in the history
Updates the instructions explaining how to bootstrap a project based on
its type (e.g. web or Python/Rust).

Signed-off-by: Rémy Greinhofer <[email protected]>
  • Loading branch information
rgreinho authored Apr 13, 2023
1 parent c5e7da0 commit 846b116
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 42 deletions.
18 changes: 3 additions & 15 deletions content/language-tooling-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,7 @@ poetry add -G dev \

Web project must be built with [React], [Next.js] and [Tailwind CSS].

### Initialization

To quickly start a project, run the following commands:

```bash
export WEB_PROJECT=my-project
npx create-next-app ${WEB_PROJECT}
cd ${WEB_PROJECT}
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
```

Go through the next sections to configure [Tailwind CSS] correctly.
### Tailwind CSS

#### tailwind.config.js

Expand Down Expand Up @@ -304,7 +292,7 @@ Add the new `font-faces` to `styles/globals.css`:
A new custom font family is now available using the [Tailwind CSS] class
`font-dharma`.
### Component Collections
#### Component Collections
Here are the components collection that have been selected by the team:
Expand All @@ -320,7 +308,7 @@ Here are the components collection that have been selected by the team:
- <https://www.tailwind-kit.com/>
- <https://www.tailwindtoolbox.com/>
### Helpers
#### Helpers
- <https://tailwindcomponents.com/cheatsheet/>
Expand Down
98 changes: 71 additions & 27 deletions content/project-standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ All the operations can also be performed via the [GitHub] website.
### Create a new GitHub repository

> **Remark: for React projects, refer to the
> [web guidelines](https://peopleforbikes.github.io/language-tooling-guidelines/#web>).**
Start by defining the `PFB` variables:

```bash
Expand All @@ -272,7 +269,65 @@ export PFB_REPO_DESCRIPTION="Describe my project in one line."
export PFB_REPO_LANG=<Node,Python,Rust> # Choose the appropriate language
```

Create the repository:
Then, depending of the type of project being created, the bootstrap process
varies.

#### Bootstrap a NextJS project

Create the NextJS app:

```bash
npx create-next-app@latest \
--ts \
--tailwind \
--eslint \
--experimental-app \
--src-dir \
--import-alias @/* \
--use pnpm \
"${PFB_REPO}"
```

Import the BNA mechanics files:

```bash
cd ${PFB_REPO}
TEMPLATE_GITHUB_TMP="$(mktemp -d)/template"
git clone --depth=1 [email protected]:PeopleForBikes/bna-mechanics-project-template "${TEMPLATE_GITHUB_TMP}"
rsync -vrlp --exclude '.git' "${TEMPLATE_GITHUB_TMP}/" .
echo -e "# ${PFB_REPO}\n\n${PFB_REPO_DESCRIPTION}" > README.md
```

Check the `.github/workflows` folder and remove the workflows that do not belong
to the project.

```bash
git add .
git commit -sam "Import BNA Mechanics files" \
-m "Imports the BNA Mechanics files from the project template."
```

Configure the GitHub CLI to use SSH:

```bash
gh config set git_protocol ssh -h github.com
```

Create the GitHub repository:

```bash
gh repo create \
"PeopleForBikes/${PFB_REPO}" \
--public \
--description "${PFB_REPO_DESCRIPTION}" \
--source=. \
--remote=upstream \
--push
```

#### Bootstrap a Rust/Python project

Create the GitHub repository:

```bash
gh repo create \
Expand All @@ -283,9 +338,13 @@ gh repo create \
git clone "[email protected]:PeopleForBikes/${PFB_REPO}"
```

The `README.md` and the `.gitignore` files cannot be generated automatically
when creating a repository from a template. Therefore they must be added after
the fact:
Initialize the project, depending on the programming language:

- Rust: `cargo init`
- Python:
`poetry init --name "${PFB_REPO}" --description "${PFB_REPO_DESCRIPTION}"`

Add a `README.md` and the appropriate `.gitignore` file:

```bash
cd "${PFB_REPO}"
Expand All @@ -297,15 +356,6 @@ curl https://raw.githubusercontent.com/github/gitignore/main/${PFB_REPO_LANG}.gi
> .gitignore
```

Now, initialize the project, depending on its programming language:

- Rust: `cargo init`
- Python:
`poetry init --name "${PFB_REPO}" --description "${PFB_REPO_DESCRIPTION}"`

Check the `.github/workflows` folder and remove the workflows that do not
pertain to the project.

Then submit the changes:

```bash
Expand All @@ -314,6 +364,11 @@ git commit -sam "Initial import" -m "Imports project scaffolding."
git push
```

#### All projects

Check the `.github/workflows` folder and remove the workflows that do not belong
to the project.

Apply the labels with [labelr](https://github.com/rgreinho/labelr-rs):

```bash
Expand Down Expand Up @@ -354,17 +409,6 @@ As the final touch, some repository settings can also be adjusted:
gh repo edit --enable-merge-commit=false --delete-branch-on-merge
```

#### (Optional) Manually import the files

Instead of using the template, the files can also be imported manually with the
following command:

```bash
TEMPLATE_GITHUB_TMP="$(mktemp -d)/template"
git clone --depth=1 [email protected]:PeopleForBikes/.bna-mechanics-project-template "${TEMPLATE_GITHUB_TMP}"
rsync -vrlp --exclude '.git' "${TEMPLATE_GITHUB_TMP}" .
```

### Archive a public repository

Archive repositories to indicate that they are unmaintained and make them
Expand Down

0 comments on commit 846b116

Please sign in to comment.