Add build process for prod
This commit is contained in:
parent
1c27390b87
commit
e7b8c0d64d
5 changed files with 70 additions and 16 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -69,6 +69,9 @@ desktop.ini
|
||||||
# PHPStorm
|
# PHPStorm
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
# Compiled files
|
||||||
|
/dist
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
/convert.js
|
/convert.js
|
||||||
/startscript.js
|
/startscript.js
|
||||||
|
|
16
ormconfig.js
16
ormconfig.js
|
@ -1,8 +1,18 @@
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
const moment = require('moment-timezone');
|
const moment = require('moment-timezone');
|
||||||
moment.tz.setDefault('UTC');
|
moment.tz.setDefault('UTC');
|
||||||
|
|
||||||
|
const entities = process.env.NODE_ENV === 'production'
|
||||||
|
? path.resolve(__dirname, 'dist/data/entities/*.js')
|
||||||
|
: path.resolve(__dirname, 'src/data/entities/*.ts');
|
||||||
|
|
||||||
|
const migrations = process.env.NODE_ENV === 'production'
|
||||||
|
? path.resolve(__dirname, 'dist/migrations/*.js')
|
||||||
|
: path.resolve(__dirname, 'src/migrations/*.ts');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
type: "mysql",
|
type: "mysql",
|
||||||
host: process.env.DB_HOST,
|
host: process.env.DB_HOST,
|
||||||
|
@ -16,7 +26,7 @@ module.exports = {
|
||||||
synchronize: false,
|
synchronize: false,
|
||||||
|
|
||||||
// Entities
|
// Entities
|
||||||
entities: [`${__dirname}/src/data/entities/*.ts`],
|
entities: [entities],
|
||||||
|
|
||||||
// Pool options
|
// Pool options
|
||||||
extra: {
|
extra: {
|
||||||
|
@ -31,8 +41,8 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Migrations
|
// Migrations
|
||||||
migrations: ["src/migrations/*.ts"],
|
migrations: [migrations],
|
||||||
cli: {
|
cli: {
|
||||||
migrationsDir: "src/migrations"
|
migrationsDir: path.dirname(migrations)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
45
package-lock.json
generated
45
package-lock.json
generated
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "newmodbot",
|
"name": "zeppelin",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
@ -676,6 +676,29 @@
|
||||||
"capture-stack-trace": "^1.0.0"
|
"capture-stack-trace": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"cross-env": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-jtdNFfFW1hB7sMhr/H6rW1Z45LFqyI431m3qU6bFXcQ3Eh7LtBuG3h74o7ohHZ3crrRkkqHlo4jYHFPcjroANg==",
|
||||||
|
"requires": {
|
||||||
|
"cross-spawn": "^6.0.5",
|
||||||
|
"is-windows": "^1.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"cross-spawn": {
|
||||||
|
"version": "6.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
||||||
|
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
|
||||||
|
"requires": {
|
||||||
|
"nice-try": "^1.0.4",
|
||||||
|
"path-key": "^2.0.1",
|
||||||
|
"semver": "^5.5.0",
|
||||||
|
"shebang-command": "^1.2.0",
|
||||||
|
"which": "^1.2.9"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"cross-spawn": {
|
"cross-spawn": {
|
||||||
"version": "5.1.0",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
|
||||||
|
@ -2068,8 +2091,7 @@
|
||||||
"is-windows": {
|
"is-windows": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz",
|
||||||
"integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
|
"integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"isarray": {
|
"isarray": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
@ -2685,6 +2707,11 @@
|
||||||
"to-regex": "^3.0.1"
|
"to-regex": "^3.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nice-try": {
|
||||||
|
"version": "1.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
||||||
|
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
|
||||||
|
},
|
||||||
"nodemon": {
|
"nodemon": {
|
||||||
"version": "1.17.5",
|
"version": "1.17.5",
|
||||||
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.17.5.tgz",
|
"resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.17.5.tgz",
|
||||||
|
@ -3236,6 +3263,15 @@
|
||||||
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
|
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"rimraf": {
|
||||||
|
"version": "2.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
|
||||||
|
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"glob": "^7.0.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"rxjs": {
|
"rxjs": {
|
||||||
"version": "6.2.1",
|
"version": "6.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz",
|
||||||
|
@ -3267,8 +3303,7 @@
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "5.5.0",
|
"version": "5.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
|
||||||
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
|
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"semver-compare": {
|
"semver-compare": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|
|
@ -5,12 +5,14 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"start": "ts-node src/index.ts",
|
"start-dev": "ts-node src/index.ts",
|
||||||
"start-watch": "nodemon",
|
"start-watch": "nodemon",
|
||||||
"precommit": "lint-staged",
|
"precommit": "lint-staged",
|
||||||
"postcommit": "git update-index --again",
|
"postcommit": "git update-index --again",
|
||||||
"format": "prettier --write \"./**/*.ts\"",
|
"format": "prettier --write \"./**/*.ts\"",
|
||||||
"typeorm": "ts-node ./node_modules/typeorm/cli.js"
|
"typeorm": "ts-node ./node_modules/typeorm/cli.js",
|
||||||
|
"build": "rimraf dist && tsc",
|
||||||
|
"start-prod": "cross-env NODE_ENV=production node dist/index.js"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.ts": [
|
"*.ts": [
|
||||||
|
@ -24,6 +26,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/lodash.at": "^4.6.3",
|
"@types/lodash.at": "^4.6.3",
|
||||||
"@types/moment-timezone": "^0.5.6",
|
"@types/moment-timezone": "^0.5.6",
|
||||||
|
"cross-env": "^5.2.0",
|
||||||
"dotenv": "^4.0.0",
|
"dotenv": "^4.0.0",
|
||||||
"emoji-regex": "^7.0.0",
|
"emoji-regex": "^7.0.0",
|
||||||
"eris": "^0.8.6",
|
"eris": "^0.8.6",
|
||||||
|
@ -51,6 +54,7 @@
|
||||||
"lint-staged": "^7.2.0",
|
"lint-staged": "^7.2.0",
|
||||||
"nodemon": "^1.17.5",
|
"nodemon": "^1.17.5",
|
||||||
"prettier": "^1.8.2",
|
"prettier": "^1.8.2",
|
||||||
|
"rimraf": "^2.6.2",
|
||||||
"tslint": "^5.8.0",
|
"tslint": "^5.8.0",
|
||||||
"tslint-config-prettier": "^1.6.0"
|
"tslint-config-prettier": "^1.6.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,16 @@
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"target": "ES6",
|
"target": "es2017",
|
||||||
"lib": [
|
"lib": [
|
||||||
"es6",
|
"es2017"
|
||||||
"es7",
|
|
||||||
"ES2017"
|
|
||||||
],
|
],
|
||||||
"baseUrl": "./",
|
"baseUrl": "./",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true,
|
||||||
}
|
"outDir": "./dist"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue