Skip to content

Commit

Permalink
feat: add vscode debug config (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Nov 25, 2023
1 parent ed11a3b commit 6a77a32
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 94 deletions.
50 changes: 10 additions & 40 deletions .github/workflows/nodejs.yml
@@ -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
@@ -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
@@ -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
@@ -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
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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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"
}
}

0 comments on commit 6a77a32

Please sign in to comment.