Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add vscode debug config #52

Merged
merged 2 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 10 additions & 40 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,16 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: CI

on:
push:
branches:
- main
- master
branches: [ master ]

pull_request:
branches:
- main
- master
schedule:
- cron: '0 2 * * *'
branches: [ master ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node-version: [16]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout Git Source
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm i

- name: Continuous Integration
run: npm run ci

- name: Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
Job:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest'
version: '16, 18, 20'
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release

on:
push:
branches: [ master ]

jobs:
release:
name: Node.js
uses: eggjs/github-actions/.github/workflows/node-release.yml@master
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
# egg-boilerplate-simple

Boilerplate for egg quickstart.
Boilerplate for egg quickstart.

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Node.js CI](https://github.com/eggjs/egg-boilerplate-simple/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-boilerplate-simple/actions/workflows/nodejs.yml)
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/egg-boilerplate-simple.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-boilerplate-simple
[travis-image]: https://img.shields.io/travis/eggjs/egg-boilerplate-simple.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-boilerplate-simple
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-boilerplate-simple.svg?style=flat-square
[codecov-url]: https://codecov.io/gh/eggjs/egg-boilerplate-simple
[david-image]: https://img.shields.io/david/eggjs/egg-boilerplate-simple.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-boilerplate-simple
[snyk-image]: https://snyk.io/test/npm/egg-boilerplate-simple/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-boilerplate-simple
[download-image]: https://img.shields.io/npm/dm/egg-boilerplate-simple.svg?style=flat-square
Expand All @@ -27,12 +22,12 @@ Boilerplate for egg quickstart.
**Don't `npm i` this directly**

```bash
$ npm i -g egg-init
$ egg-init --type simple showcase
$ cd showcase
$ npm i
$ npm run dev
$ open http://localhost:7001
npm i -g egg-init
egg-init --type simple showcase
cd showcase
npm i
npm run dev
open http://localhost:7001
```

See [egg-init](https://github.com/eggjs/egg-init) for more detail.
36 changes: 36 additions & 0 deletions boilerplate/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Egg Debug",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"dev",
"--",
"--inspect-brk"
],
"console": "integratedTerminal",
"restart": true,
"autoAttachChildProcesses": true
},
{
"type": "node",
"request": "launch",
"name": "Egg Test",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"test:local",
"--",
"--inspect-brk"
],
"autoAttachChildProcesses": true
}
]
}
14 changes: 6 additions & 8 deletions boilerplate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,21 @@ see [egg docs][egg] for more detail.
### Development

```bash
$ npm i
$ npm run dev
$ open http://localhost:7001/
npm i
npm run dev
open http://localhost:7001/
```

### Deploy

```bash
$ npm start
$ npm stop
npm start
npm stop
```

### npm scripts

- Use `npm run lint` to check code style.
- Use `npm test` to run unit test.
- Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail.


[egg]: https://eggjs.org
[egg]: https://eggjs.org
24 changes: 9 additions & 15 deletions boilerplate/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,28 @@
"declarations": true
},
"dependencies": {
"egg": "^3",
"egg-scripts": "^2"
"egg": "^3.17.5",
"egg-scripts": "2"
},
"devDependencies": {
"egg-bin": "^5",
"egg-ci": "^2",
"egg-mock": "^5",
"eslint": "^8",
"eslint-config-egg": "^12"
"egg-bin": "6",
"egg-mock": "5",
"eslint": "8",
"eslint-config-egg": "13"
},
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-{{name}}",
"stop": "egg-scripts stop --title=egg-server-{{name}}",
"dev": "egg-bin dev",
"debug": "egg-bin debug",
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test",
"test": "npm run lint -- --fix && npm run test:local",
"test:local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
},
"ci": {
"version": "16, 18",
"type": "github"
},
"repository": {
"type": "git",
"url": ""
Expand Down
2 changes: 0 additions & 2 deletions boilerplate/app/controller/home.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const { Controller } = require('egg');

class HomeController extends Controller {
Expand Down
2 changes: 0 additions & 2 deletions boilerplate/app/router.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

/**
* @param {Egg.Application} app - egg application
*/
Expand Down
2 changes: 0 additions & 2 deletions boilerplate/config/config.default.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint valid-jsdoc: "off" */

'use strict';

/**
* @param {Egg.EggAppInfo} appInfo app info
*/
Expand Down
2 changes: 0 additions & 2 deletions boilerplate/config/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

/** @type Egg.EggPlugin */
module.exports = {
// had enabled by egg
Expand Down
2 changes: 0 additions & 2 deletions boilerplate/test/app/controller/home.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const { app, assert } = require('egg-mock/bootstrap');

describe('test/app/controller/home.test.js', () => {
Expand Down
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@
},
"author": "TZ <atian25@qq.com>",
"devDependencies": {
"egg-ci": "^2.1.0",
"egg-init": "^2.3.1",
"eslint": "^8.24.0",
"eslint-config-egg": "^12.1.0",
"npminstall": "^6.5.1"
},
"ci": {
"version": "16",
"type": "github"
"eslint": "8",
"eslint-config-egg": "13"
}
}