Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
environment:
matrix:
- nodejs_version: "12"
- nodejs_version: "14"
- nodejs_version: "16"
- nodejs_version: "18"
- nodejs_version: "20"
branches:
only:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
operating-system: [macos-latest, ubuntu-latest]
node-version: [12, 13, 14, 16, 18]
node-version: [16, 18, 20]
name: Node.js ${{ matrix.node-version }} Test on ${{ matrix.operating-system }}

steps:
Expand Down
105 changes: 0 additions & 105 deletions app.js

This file was deleted.

4 changes: 4 additions & 0 deletions assets/tmpl/.gitignore.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deploy/
node_modules/
.idea/
package-lock.json
15 changes: 15 additions & 0 deletions assets/tmpl/docker-compose.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3'
# Settings and configurations that are common for all containers
services:
mysql:
image: 'mysql:8.0'
container_name: "${name}-mysql"
command: mysqld --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: '3AQqZTfmww=Ftj'
MYSQL_DATABASE: '${name}'
restart: 'always'
volumes:
- "./runtime/deploy/data/mysql:/var/lib/mysql"
ports:
- "13306:3306"
30 changes: 30 additions & 0 deletions assets/tmpl/meta/example/example.product.json.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/product.schema.json",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "integer"
},
"productId": {
"description": "The unique identifier for a product",
"type": "integer"
},
"productName": {
"description": "Name of the product",
"type": "string"
},
"price": {
"description": "The price of the product",
"type": "number",
"exclusiveMinimum": 0
}
},
"required": [
"id",
"productId"
]
}
3 changes: 2 additions & 1 deletion assets/tmpl/package.json.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"scripts": {
"dev:services": "cd ./services/ && nodemon",
"build:services": "cd ./services/ && npm run build"
"build:services": "cd ./services/ && npm run build",
"gen:services": "koapp generate ./meta -d ./services/src/modules"
},
"dependencies": {
"${name}-services": "file:services"
Expand Down
113 changes: 113 additions & 0 deletions assets/tmpl/services/.gitignore.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# temp
runtimes/
runtime/
.DS_Store

# IDEA
.idea/

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
package-lock.json
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity
yarn.lock

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
3 changes: 2 additions & 1 deletion assets/tmpl/services/package.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test-cov": "nyc mocha -r @swc-node/register src/**/*.test.ts --parallel"
},
"dependencies": {
"@axiosleo/koapp": "^0.5.0",
"@axiosleo/koapp": "^0.6.2",
"@axiosleo/orm-mysql": "^0.8.6",
"cluster": "^0.7.7",
"dotenv": "^10.0.0"
Expand All @@ -34,6 +34,7 @@
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"eslint": "^8.55.0",
"json-schema-to-ts": "^3.0.0",
"nodemon": "^3.0.2",
"pkg": "^5.8.0",
"ts-node": "^10.9.1",
Expand Down
4 changes: 2 additions & 2 deletions assets/tmpl/services/src/app.ts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export default class App extends KoaApplication {
port: config.envs.app.api_port,
routers,
static: {
rootDir: path.join(root, staticRoot || '../web/dist'),
rootDir: path.join(root, staticRoot || '../web/'),
index: 'index.html',
notFoundFile: 'view/error/404.html'
// notFoundFile: 'view/error/404.html'
},
};
super(options);
Expand Down
2 changes: 1 addition & 1 deletion assets/tmpl/services/src/config.ts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
port: process.env.MYSQL_PORT ? parseInt(process.env.MYSQL_PORT) : 13306,
user: process.env.MYSQL_USER || 'root',
pass: process.env.MYSQL_PASS || '3AQqZTfmww=Ftj',
db: process.env.MYSQL_DB || 'cms',
db: process.env.MYSQL_DB || '${name}',
}
}
};
2 changes: 1 addition & 1 deletion assets/tmpl/services/src/modules/index.ts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const defaultHandler = {
}]
};

const root = new Router('/api/v1', defaultHandler);
const root = new Router('/api', defaultHandler);
root.new('/***', defaultHandler);

export default [root];
Loading