generated from CourseDesign/node-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee70e1b
commit 6183967
Showing
42 changed files
with
1,017 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Test CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'develop' | ||
- 'release' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
- 'develop' | ||
- 'release' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x] | ||
|
||
steps: | ||
- name: Checkout source code | ||
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 install | ||
- name: Lint | ||
run: npm run lint | ||
- name: Build | ||
run: npm run build:production:all | ||
- name: Test | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
src | ||
script | ||
template | ||
.github | ||
* | ||
!dist/* | ||
!dist/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Design System | ||
# conev sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
script | ||
node_modules | ||
dist | ||
gulpfile.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": [ | ||
"../../.eslintrc.json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# Logs | ||
old/logs | ||
*.log | ||
*.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 tests 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 | ||
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 | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# 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 | ||
|
||
package-lock.json | ||
/storage/ | ||
mongodb-binaries/ | ||
/profiling/ | ||
/.vscode/ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* | ||
!dist/* | ||
!dist/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const gulp = require('gulp'); | ||
const ts = require('gulp-typescript'); | ||
|
||
function getTsconfig(env) { | ||
if (env != null) { | ||
return `tsconfig.${env.toLowerCase()}.json`; | ||
} | ||
|
||
return 'tsconfig.json'; | ||
} | ||
|
||
const tsProject = ts.createProject(getTsconfig(process.env.NODE_ENV)); | ||
|
||
const outDir = 'dist' | ||
|
||
gulp.task('default', () => tsProject.src() | ||
.pipe(tsProject()) | ||
.pipe(gulp.dest(outDir)) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "conev-sync-core", | ||
"version": "1.0.3", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"types" : "dist/index.d.ts", | ||
"scripts": { | ||
"test": "jest", | ||
"run": "node dist/index.js", | ||
"build": "gulp", | ||
"build:production": "cross-env NODE_ENV=production npm run build", | ||
"install": "npm run build:production" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.10", | ||
"@types/node": "^14.6.2", | ||
"cross-env": "^7.0.2", | ||
"gulp": "^4.0.2", | ||
"gulp-typescript": "^6.0.0-alpha.1", | ||
"jest": "^26.4.2", | ||
"ts-jest": "^26.3.0", | ||
"typescript": "^4.0.2" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.ts$": "ts-jest" | ||
}, | ||
"testRegex": "\\.spec\\.ts$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"js" | ||
], | ||
"modulePathIgnorePatterns": [ | ||
"dist" | ||
], | ||
"globals": { | ||
"ts-jest": { | ||
"diagnostics": true | ||
} | ||
} | ||
}, | ||
"dependencies": { | ||
"deepmerge": "^4.2.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import ConfigBuilder from './config-builder'; | ||
import SourceMock from '../source/source.mock'; | ||
|
||
describe('config-builder', () => { | ||
const source1 = new SourceMock( | ||
new Map<string, Record<string, unknown>>([ | ||
['default', { source: '1', port: 3000, db: { type: 'postgres' } }], | ||
['develop', { env: 'develop', port: 3001 }], | ||
]) | ||
); | ||
|
||
const source2 = new SourceMock( | ||
new Map<string, Record<string, unknown>>([ | ||
[ | ||
'default', | ||
{ | ||
source: '2', | ||
port: 3000, | ||
db: { port: 7070, username: 'test', type: 'mysql' }, | ||
}, | ||
], | ||
['production', { env: 'production', port: 3002 }], | ||
]) | ||
); | ||
|
||
test('build', () => { | ||
const config = new ConfigBuilder() | ||
.addSource(source1, source2) | ||
.addEnv('default', 'develop') | ||
.build(); | ||
|
||
expect(config.get()).toEqual({ | ||
source: '2', | ||
env: 'develop', | ||
port: 3001, | ||
db: { port: 7070, username: 'test', type: 'mysql' }, | ||
}); | ||
expect(config.get('source')).toEqual('2'); | ||
expect(config.get('db.port')).toEqual(7070); | ||
}); | ||
}); |
Oops, something went wrong.