Skip to content

Commit

Permalink
feat: added addons documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelPanic92 committed Aug 29, 2024
1 parent 472931b commit 8de1580
Show file tree
Hide file tree
Showing 13 changed files with 431 additions and 35 deletions.
1 change: 1 addition & 0 deletions doc/pages/commands/_meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"scaffold": "new",
"docs": "docs",
"generate": "generate"
}
11 changes: 11 additions & 0 deletions doc/pages/commands/docs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Docs

It allows you to open this documentation website.

## Get Started

To open the documentation site you need to launch the command:

```bash copy
devmy docs
```
17 changes: 17 additions & 0 deletions doc/pages/commands/generate/addon/angular_tailwind.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: angular/tailwind
---
# Angular/Tailwind

The Devmy CLI provides a set of predefined configurations that will allow you to start developing right away.

The addon will take care of installing the necessary dependencies and initializing the library of
[TailwindCSS](https://tailwindcss.com/) so that it is ready to use immediately.

## Get Started

To add a new tailwind configuration, use the following Devmy CLI command:

```bash copy
devmy generate addon angular/tailwind
```
25 changes: 25 additions & 0 deletions doc/pages/commands/generate/addon/firebase_hosting.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: firebase/hosting
---

# Firebase/Hosting

The Devmy CLI provides a set of predefined configurations that will allow you to start developing right away.

The firebase/hosting addon allows you to automatically select and configure applications within the monorepo
to be used as [hosting for Firebase](https://firebase.google.com/docs/hosting). When you run the command, the CLI
will prompt you to choose the application where the changes will be applied, and you'll need to select the project
containing the Firebase configurations.
After that, a list of monorepo applications compatible with this feature will be displayed.

The plugin will check for any already configured applications to prevent accidental overwrites.

By selecting the desired applications, the plugin will automatically integrate them into the Firebase configuration.

## Get Started

To add a new firebase hosting configuration, use the following Devmy CLI command:

```bash copy
devmy generate addon firebase/hosting
```
158 changes: 158 additions & 0 deletions doc/pages/commands/generate/addon/gitlab.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Gitlab

The Devmy CLI provides a set of predefined configurations that will allow you to start developing right away.

Gitlab Addon automates the process of setting up the gitlab configuration for
the current workspace, making it ready for CI/CD environment. It will create the
following files automatically:

1. .gitlab-ci.yml
automatically creates the `.gitlab-ci.yml` file including all the common steps of all the projects defined in the
[Devmy devops project](https://gitlab.com/pillar-1/devops)

2. Merge request template
automatically creates and configure the `.gitlab/merge_request_templates/merge_request_template.md` file including all
the common sections of all projects


**IMPORTANT:**
- Add environment variables:
once the command is finished, it will invite you to configure some environment variables on gitlab.
Do it now or it will be your business and you will have to manually recover them later.

## Get Started

To add a new vercel configuration, use the following Devmy CLI command:

```bash copy
devmy generate addon gitlab
```

## Manual configuration

in case you want to manually configure the gitlab configuration you will have to do following steps.

### .gitlab-ci.yml

You will have to insert the `.gitlab-ci.yml` file into
your application.
this is a sample `.gitlab-ci.yml` which is usually applied by this addon:

```yml filename=".gitlab-ci.yml" copy
include:
- file: /gitlab-ci/common.yml
project: pillar-1/devops
ref: v1.1.6
```
### Merge request
You will have to create and configure the `.gitlab/merge_request_templates/merge_request_template.md`.
this is a sample `merge_request_template.md` which is usually applied by this addon:

```markdown filename="merge_request_template.md" copy
## First you have to merge
<!-- Please delete options that are not relevant. -->
- [ ] https://gitlab.com/{group}/{project}/-/merge_requests/{id}
- [ ] https://gitlab.com/{group}/{project}/-/merge_requests/{id}
- [ ] https://gitlab.com/{group}/{project}/-/merge_requests/{id}
## Description
<!--
Include a summary of the change and indicate which issue was resolved by indicating the task number.
Please also include relevant rationale and context.
-->
...
**Issue:** [DE-00000](https://app.clickup.com/t/2428116/DE-00000)
## Screenshots
<!-- Please include all images necessary to understand your merge request. -->
## Type of change
- [ ] Bug fix (non-disruptive change that solves a problem)
- [ ] New feature (non-disruptive change that adds new functionality)
- [ ] Breaking change (fix or feature that would prevent existing features from working as intended)
- [ ] Docs (correction or addition of documentation)
## How was it tested?
<!--
Describe the tests you ran to verify the changes.
Please provide instructions so we can reproduce. Please also list all details relevant to your test setup.
-->
- [ ] Test A
- [ ] Test B
## Checklist:
- [ ] I have included the task ID in the title of this merge request
- [ ] I aligned my branch with the changes in the `main` branch
- [ ] I did a self-review of my code
- [ ] I commented out my code, especially in hard-to-understand areas
- [ ] I made corresponding changes to the documentation
- [ ] I formatted and sorted the code correctly
- [ ] I've added tests that prove my fix is effective or that my functionality is correct
- [ ] New and existing unit tests pass locally with my changes
```
### Semantic Release
You will have to update the `.releaserc.js` file to work with gitlab.

install the gitlab plugin for semantic release:

```bash copy
pnpm i -D @semantic-release/gitlab -w
```
this is a sample `.releaserc.js` which is usually applied by this addon:

```js filename=".releaserc.js" copy
const { env } = require('@dotenv-run/core');
env({
files: ['.env.vault'],
});
/**
* @type {import('semantic-release').GlobalConfig}
*/
const releaseConfig = {
branches: ["main"],
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
["@semantic-release/gitlab", { assets: ["CHANGELOG.md"] }],
[
"@semantic-release/exec",
{
prepareCmd: "pnpm version ${nextRelease.version} --allow-same-version --no-commit-hooks --no-git-tag-version -ws --no-workspaces-update",
},
],
[
"@semantic-release/git",
{
assets: [
"CHANGELOG.md",
"package.json",
"package-lock.json",
"applications/**/package.json",
"libraries/**/pnpm-lock.yaml"
],
message:
"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
},
],
],
};
module.exports = releaseConfig;
```
120 changes: 120 additions & 0 deletions doc/pages/commands/generate/addon/vercel.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Vercel

The Devmy CLI provides a set of predefined configurations that will allow you to start developing right away.

Vercel Addon automates the process of setting up the Vercel configuration for
the current application, making it ready for deployment. It performs the
following tasks automatically:

1. Requests Vercel Tokens:
For both the staging and production environments, you will be asked to
provide their respective Vercel tokens. You can obtain these tokens by
visiting:
https://vercel.com/account/tokens

2. Updates the CDCI file:
The command will modify your (GitLab CI) configuration to include deployment
steps for both staging and production environments.

3. Populates .env.vault variables:
The script will automatically insert environment variables into the
.env.vault file for both staging and production.


**IMPORTANT:**
- Separate Vercel accounts:
This command assumes that staging and production are hosted on two separate
Vercel accounts. Using the same token for both environments will result in
deployment issues. Make sure to provide distinct tokens for each environment.

- Account access:
If you do not have access to the Vercel accounts for staging or production,
please contact your project lead or admin to request access before running
this setup.

## Get Started

To add a new vercel configuration, use the following Devmy CLI command:

```bash copy
devmy generate addon vercel
```

## Manual configuration

in case you want to manually configure the vercel configuration you will have to insert the vercel.json file into
your application.
see the [official documentation](https://vercel.com/docs/projects/project-configuration).
this is a sample `vercel.json` which is usually applied by this addon:

```json copy
{
"version": 2,
"regions": ["cdg1"],
"framework": "angular",
"installCommand": "echo \"Install (SKIPPED): pnpm deploy bundles local libraries into node_modules. Running pnpm install again would overwrite them.\"",
"buildCommand": "pnpm build",
"outputDirectory": "dist"
}
```

### Environment

Once you have defined the `vercel.json` file you will need to include the following variables in .env.vault production
and staging areas:

```dotenv
[APPLICATION_PREFIX]_VERCEL_PROJECT_ID=[application project id]
[APPLICATION_PREFIX]_VERCEL_ORG_ID=[application organization id]
[APPLICATION_PREFIX]_VERCEL_TOKEN=[application vercel token]
```
To get `VERCEL_PROJECT_ID` and `VERCEL_ORG_ID` you will have to manually link the project to vercel using the vercel
CLI command [vercel link](https://vercel.com/docs/cli/link) command and retrieving them from the `./.vercel/project.json`
file. The operation must be repeated for the staging environment and for the production environment.

To get the vercel token, you will have to manually generate it at https://vercel.com/account/tokens
(make sure you are logged in to the right account).

### Pipelines

#### Gitlab

Once you have defined the `vercel.json` file you will need to include the `vercel.yml` file in your `.gitlab-ci.yml`

```yaml copy

include:
- file: /gitlab-ci/common.yml
project: pillar-1/devops
ref: v1.1.6
- file: /gitlab-ci/vercel.yml
project: pillar-1/devops
ref: v1.1.6
```
and configure staging and production jobs. to do this, simply create jobs that inherit from `.deploy-vercel` and
`.deploy-staging` if you are configuring the staging environment or `.deploy-production` if you are configuring
production.

here is an example:

```yaml copy
"[STAGING] My App":
extends:
- .deploy-staging
- .deploy-vercel
variables:
APPLICATION_PREFIX: MY_APP
APPLICATION_NAME: my-app
"[PRODUCTION] My App":
extends:
- .deploy-production
- .deploy-vercel
variables:
APPLICATION_PREFIX: MY_APP
APPLICATION_NAME: my-app
```

**Pay attention**: `APPLICATION_PREFIX` refers to the prefix used by dotenv-vault for its variables,
while `APPLICATION_NAME` corresponds to the application name specified in its package.json
8 changes: 7 additions & 1 deletion doc/pages/commands/generate/application/angular.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ document.startViewTransition.

### TailwindCSS

Both during the creation phase of the Angular application and afterwards, it will be possible to add [TailwindCSS](https://tailwindcss.com/).
Both during the creation phase of the Angular application and afterwards, it will be possible to add [TailwindCSS](/commands/generate/addon/angular_tailwind).

The addon will take care of installing the necessary dependencies and initializing the library so that it is ready to use immediately.

### Vercel

Both during the creation phase of the Angular application and afterwards, it will be possible to add [Vercel](/commands/generate/addon/vercel) deploy configuration.

The addon will take care of installing the necessary dependencies and initializing the CDCI so that it is ready to use immediately.
Loading

0 comments on commit 8de1580

Please sign in to comment.