From 1a400fb4307ac0448674b832279619e34ebac3b7 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 11 Feb 2024 11:35:58 +0100 Subject: [PATCH] chore: update readme old references, remove kickstart tasks, simplify initialization --- .github/workflows/release.yml | 2 +- README.md | 20 +++++++++++--------- package.json | 14 ++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87014a1..def766c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,7 +55,7 @@ jobs: - name: Setup node.js environment uses: actions/setup-node@v4 with: - node-version: '18.19.0' + node-version: '20.9.0' - name: Setup MySQL server uses: mirromutth/mysql-action@v1.1 with: diff --git a/README.md b/README.md index 9dc4cd0..443e306 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![TypeScript](https://img.shields.io/badge/Typescript-5.3.3-informational?logo=typescript&color=2F74C0)](https://www.typescriptlang.org/) [![Express](https://img.shields.io/badge/Express-4.18.2-informational?logo=express&color=B1B1B1)](https://expressjs.com/) [![Typeorm](https://img.shields.io/badge/Typeorm-0.2.41-informational?logo=typeorm&color=FFAB00)](https://typeorm.io/#/) -[![Mocha](https://img.shields.io/badge/Mocha-9.1.3-informational?logo=mocha&color=8A6343)](https://mochajs.org) +[![Mocha](https://img.shields.io/badge/Mocha-10.3.0-informational?logo=mocha&color=8A6343)](https://mochajs.org) ![Github action workflow status](https://github.com/steve-lebleu/typeplate/actions/workflows/build.yml/badge.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/github/steve-lebleu/typeplate/badge.svg?branch=master)](https://coveralls.io/github/steve-lebleu/typeplate?branch=master) @@ -25,7 +25,7 @@ Thanks to Daniel F. Sousa for inspiration with her [Express ES2017 REST API boil - **Business validation** with self designed business members. - **Logs management** with [morgan](https://github.com/expressjs/morgan) and [winston](https://github.com/winstonjs/winston). - **Changelog completion** with [auto-changelog](https://www.npmjs.com/package/auto-changelog). - - **Testing** with included unit and e2e test sets builded with [mocha](https://mochajs.org/), [chai](https://www.chaijs.com/), [sinon](https://sinonjs.org/) and [supertest](https://github.com/visionmedia/supertest). + - **Testing** with included unit and integration test sets builded with [mocha](https://mochajs.org/), [chai](https://www.chaijs.com/), [sinon](https://sinonjs.org/) and [supertest](https://github.com/visionmedia/supertest). - **Documentation** with [api-doc](https://apidocjs.com/). - **Security** - **SSL secure connection** with native [HTTPS node module](https://nodejs.org/docs/latest-v14.x/api/https.html). @@ -82,7 +82,7 @@ $ cd path-to/your-project-name/ ### Step 3: build ```bash -$ npm run kickstart:dev +$ npm run init ``` ### Step 4: setup package.json @@ -91,7 +91,7 @@ Open the *./package.json* file and edit it with your own values. ### Step 5: setup environment -Open *./dist/env/development.env* and fill the required env variables (uncommented in the file). See [env variables list](https://github.com/konfer-be/typeplate/wiki/Environment-variables) for more informations. +Open *./dist/env/development.env* and fill the required env variables (uncommented in the file). See wiki [env variables list](https://github.com/steve-lebleu/typeplate/wiki/Environment-variables) for more informations. ```bash # Access token Secret passphrase @@ -130,7 +130,7 @@ TYPEORM_PORT = "3306" ### Step 6: setup cliamrc.json -Transactional emails are send with [cliam](https://github.com/konfer-be/cliam) behind the scene. Open the *.cliamrc.json* and fill the [required configuration](https://github.com/konfer-be/cliam/wiki/Configuration) according your sending mode. See Cliam official [documentation](https://github.com/konfer-be/cliam/wiki) for more information. +Transactional emails are send with [cliam](https://github.com/steve-lebleu/cliam). Open the *.cliamrc.json* and fill the [required configuration](https://github.com/steve-lebleu/cliam/wiki/Configuration) according your sending mode. See Cliam official [documentation](https://github.com/steve-lebleu/cliam/wiki) for more information. Sandbox is set to true by default and emails are not send. Pass this value to false when you're ready. @@ -142,9 +142,9 @@ $ nodemon ## > Entity generation -Some repetitive tasks such as creating resources can be done easily with [rsgen](https://github.com/konfer-be/rsgen). +Some repetitive tasks such as creating resources can be done quickly with [rsgen](https://github.com/steve-lebleu/rsgen). -See [entity generation](https://github.com/konfer-be/typeplate/wiki/Entity-generation) wiki section to learn more about generated elements and how to use. +See [entity generation](https://github.com/steve-lebleu/typeplate/wiki/Entity-generation) wiki section to learn more about generated elements and how to use. ## > Documentation @@ -159,16 +159,18 @@ See [apidoc](http://apidocjs.com/) for more informations about customization. ## > Tests ```bash -$ npm run test --env test +$ npm run test ``` +:warning: Because there are integration tests, you need a dedicated database to run the tests suites. It's already managed in CI/CD using Github actions, You need to mount it yourself in your local environment. + HTML coverage report is generated by [Istanbul](https://github.com/gotwarlost/istanbul) in *./reports/nyc-coverage*. Bonus with *./insomnia.workspace.json* if you wish run manual e2e tests without create the config. ## > Continuous integration -Basic Travis-CI configuration is provided in *./.travis.yml* file. +Basic Github actions configuration is provided in *./.github/workkflows.yml* files. ## > Deployment diff --git a/package.json b/package.json index cf30895..8805f4e 100644 --- a/package.json +++ b/package.json @@ -38,19 +38,17 @@ }, "scripts": { "init": "npm-run-all -s init:*", - "init:env": "cp ./src/env/template.env ./src/env/development.env && cp ./src/env/template.env ./src/env/test.env && cp ./src/env/template.env ./src/env/staging.env && cp ./src/env/template.env ./src/env/production.env && rm -rf ./src/env/template.env", - "init:repository": "rm -rf ./.git && git init && git add . --all && git commit -m \"First commit\"", + "init:install": "npm i typescript@5.3.3 -g && npm i typeorm@0.2.41 -g && npm i rsgen -g && npm i ", + "init:copy": "mkdir -p ./dist/env && cp ./src/env/template.env ./dist/env/development.env && cp ./src/env/template.env ./dist/env/test.env && cp ./src/env/template.env ./dist/env/staging.env && cp ./src/env/template.env ./dist/env/production.env", + "init:compile": "tsc", + "init:version": "rm -rf ./.git && git init && git add . --all && git commit -m \"First commit\"", "ci:test": "nyc --reporter=lcov --report-dir=./reports/coverage npm-run-all -s test:*", "doc": "apidoc -i src/ -o docs/apidoc/", - "kickstart": "npm i typescript@5.3.3 -g && npm i typeorm@0.2.32 -g && npm i rsgen -g && npm i && mkdir -p ./dist/env", - "kickstart:dev": "npm run kickstart && npm run init && cp ./src/env/development.env ./dist/env/development.env && cp ./src/env/test.env ./dist/env/test.env && tsc", - "kickstart:staging": "npm run kickstart && cp ./src/env/staging.env ./dist/env/staging.env && tsc", - "kickstart:production": "npm run kickstart && cp ./src/env/production.env ./dist/env/production.env && tsc", - "kickstart:test": "npm run kickstart && cp ./src/env/test.env ./dist/env/test.env && tsc", + "start": "nodemon", "test": "nyc --reporter=html --report-dir=./reports/nyc-coverage npm-run-all -s test:*", "test:unit": "./node_modules/.bin/mocha ./test/units/00-application.unit.test.js --exit --reporter spec --timeout 10000 --env test", "test:e2e": "typeorm schema:drop && typeorm schema:sync && ./node_modules/.bin/mocha ./test/e2e/00-api.e2e.test.js --exit --reporter spec --timeout 10000 --env test", - "version": "npm run todo && git add package.json && git add README.md && auto-changelog -p && git add CHANGELOG.md && git commit -m \"Update changelog\" --no-verify" + "version": "git add package.json && git add README.md && auto-changelog -p && git add CHANGELOG.md && git commit -m \"Update changelog\" --no-verify" }, "_moduleAliases": { "@core": "dist/api/core",