Skip to content

Commit 444233c

Browse files
author
Cristopher Jiménez Meza
authored
Merge pull request #1 from cristopher1/development
v1.0.0
2 parents 83e3eb5 + 1fdf0f1 commit 444233c

File tree

5 files changed

+196
-12
lines changed

5 files changed

+196
-12
lines changed

.github/workflows/cd.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Workflow to use continuos delivery
2+
3+
name: CD
4+
5+
on:
6+
push:
7+
tags:
8+
- v*
9+
10+
jobs:
11+
test_and_build:
12+
name: Test and build the distributable generator-koa2-simple-api-generator
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 20.x
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: audit
24+
run: npm audit
25+
26+
- name: run quality check
27+
run: npm run quality-check
28+
29+
- name: build the dist folder
30+
run: npm run build
31+
32+
- name: save artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: distributable-generator-koa2-simple-api-generator
36+
path: |
37+
dist
38+
LICENSE
39+
README.md
40+
package.json
41+
retention-days: 1
42+
43+
release:
44+
name: Create new release
45+
runs-on: ubuntu-latest
46+
needs: test_and_build
47+
permissions:
48+
contents: write
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: actions/setup-node@v4
52+
with:
53+
node-version: 20.x
54+
55+
- name: create a new release
56+
uses: actions/create-release@v1.1.4
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
with:
60+
tag_name: ${{ github.ref_name }}
61+
release_name: ${{ github.ref_name }}
62+
body_path: RELEASE_NOTES.md
63+
64+
publish:
65+
name: publish generator-koa2-simple-api-generator package
66+
runs-on: ubuntu-latest
67+
needs: release
68+
environment: publish
69+
steps:
70+
- name: download generator-koa2-simple-api-generator distribuible
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: distributable-generator-koa2-simple-api-generator
74+
75+
- uses: actions/setup-node@v4
76+
with:
77+
node-version: 20.x
78+
79+
- name: publish generator-koa2-simple-api-generator en npm
80+
uses: JS-DevTools/npm-publish@v3
81+
with:
82+
token: ${{ secrets.NPM_TOKEN }}

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Workflow to use continuous integration
2+
3+
name: CI
4+
5+
on:
6+
push:
7+
branches:
8+
- development
9+
- main
10+
pull_request:
11+
branches:
12+
- development
13+
14+
jobs:
15+
test_and_build:
16+
name: Test the source code and build the generator-koa2-simple-api-generator generator
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20.x
23+
24+
- name: install dependencies using package-lock.json
25+
run: npm ci
26+
27+
- name: audit
28+
run: npm audit
29+
30+
- name: run linter, formatter and unit tests
31+
run: |
32+
npm run lint
33+
npm run format
34+
npm run test
35+
36+
- name: build the dist folder
37+
run: npm run build
38+
39+
- name: save artifact
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: dist-generator-koa2-simple-api-generator
43+
path: |
44+
dist
45+
LICENSE
46+
README.md
47+
package.json
48+
retention-days: 1
49+
50+
create_generator:
51+
name: Test a generator created by generator-koa2-simple-api-generator generator
52+
needs: test_and_build
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
node-version: ['>=18.17.0', '20.x']
57+
steps:
58+
- name: download dist generator-koa2-simple-api-generator generator
59+
uses: actions/download-artifact@v4
60+
with:
61+
name: dist-generator-koa2-simple-api-generator
62+
63+
- uses: actions/setup-node@v4
64+
with:
65+
node-version: ${{ matrix.node-version }}
66+
67+
- name: print node-version
68+
run: echo ${{ matrix.node-version }}
69+
70+
- name: install yeoman
71+
run: npm install -g yo
72+
73+
- name: install dependencies, it does not use the package-lock.json file
74+
run: npm install
75+
76+
- name: link the generator
77+
run: npm link
78+
79+
- name: create a new folder
80+
working-directory: ../
81+
run: mkdir -p generator_test
82+
83+
- name: create a new generator
84+
working-directory: ../generator_test
85+
run: yo koa2-simple-api-generator new_api postgresql --runGitInit --runPackageScripts --useDocker --nodeVersion=21 --projectFolderName=api --useDockerCompose --databaseName=postgresql
86+
87+
- name: audit
88+
run: npm audit
89+
90+
- name: run linter and formatter
91+
working-directory: ../generator_test/api
92+
run: |
93+
npm run lint
94+
npm run format

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<h1 align="center">Welcome to generator-koa2-simple-api-generator 👋</h1>
22
<p>
3-
<img alt="Version" src="https://img.shields.io/badge/version-0.1.0-blue.svg?cacheSeconds=2592000" />
3+
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
44
<a href="https://github.com/cristopher1/generator-koa2-simple-api-generator#readme" target="_blank">
55
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
66
</a>
@@ -82,14 +82,14 @@ yo koa2-simple-api-generator koa2_api_project
8282

8383
The generator-koa2-simple-api-generator include various options, these are:
8484

85-
| option | value | default | description | example |
86-
| :---------------- | :-----: | :-----: | :------------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------- |
87-
| runGitInit | Boolean | false | Run git init automatically, then installing the dependencies | `yo koa2-simple-api-generator project_name --runGitInit` |
88-
| runPackageScripts | Boolean | false | Run the scripts that configure the package, then installing the dependencies | `yo koa2-simple-api-generator project_name --runPackageScripts` |
89-
| useDocker | Boolean | false | Add docker support using DockerFile, .dockerignore and others | `yo koa2-simple-api-generator project_name --useDocker` |
90-
| nodeVersion | Number | 16 | Node version used in DockerFile. (FROM nodeVersion). Recommended to use node 16, 18, 20 or 21 | `yo koa2-simple-api-generator project_name --nodeVersion=21` |
91-
| projectFolderName | String | api | Project folder name used in DockerFile. (WORKDIR /usr/src/projectFolderName) | `yo koa2-simple-api-generator project_name --projectFolderName=project_folder_name` |
92-
| useDockerCompose | String | false | Add Docker Compose support. | `yo koa2-simple-api-generator project_name --useDockerCompose` |
85+
| option | value | default | description | example |
86+
| :---------------- | :-----: | :-----: | :--------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------- |
87+
| runGitInit | Boolean | false | Run git init automatically, then installing the dependencies | `yo koa2-simple-api-generator project_name --runGitInit` |
88+
| runPackageScripts | Boolean | false | Run the scripts that configure the package, then installing the dependencies | `yo koa2-simple-api-generator project_name --runPackageScripts` |
89+
| useDocker | Boolean | false | Add docker support using DockerFile, .dockerignore and others | `yo koa2-simple-api-generator project_name --useDocker` |
90+
| nodeVersion | Number | 16 | Node version used in DockerFile. (FROM nodeVersion). Recommended to use node 16, 18, 20 or 21 | `yo koa2-simple-api-generator project_name --nodeVersion=21` |
91+
| projectFolderName | String | api | Project folder name used in DockerFile. (WORKDIR /usr/src/projectFolderName) | `yo koa2-simple-api-generator project_name --projectFolderName=project_folder_name` |
92+
| useDockerCompose | String | false | Add Docker Compose support. | `yo koa2-simple-api-generator project_name --useDockerCompose` |
9393
| databaseName | String | null | Select the database to which the application will connect. Accepts the values: postgresql, mysql, mariadb and mongodb. | `yo koa2-simple-api-generator project_name --databaseName=postgresql` |
9494

9595
## <a id="structure"></a> Project structure

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generator-koa2-simple-api-generator",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"description": "Yeoman generator to create a simple base structure for api rest based in koa2 framework.",
55
"homepage": "https://github.com/cristopher1/generator-koa2-simple-api-generator",
66
"type": "module",
@@ -14,6 +14,14 @@
1414
"./app": {
1515
"types": "./dist/types/generators/app/index.d.ts",
1616
"import": "./dist/generators/app/index.js"
17+
},
18+
"./docker": {
19+
"types": "./dist/types/generators/docker/index.d.ts",
20+
"import": "./dist/generators/docker/index.js"
21+
},
22+
"./docker_compose": {
23+
"types": "./dist/types/generators/docker_compose/index.d.ts",
24+
"import": "./dist/generators/docker_compose/index.js"
1725
}
1826
},
1927
"keywords": [

0 commit comments

Comments
 (0)