Skip to content

Instantly share code, notes, and snippets.

Created March 17, 2018 20:00
Show Gist options
  • Save anonymous/0259ddbdf95dea4fa5505be15a914773 to your computer and use it in GitHub Desktop.
Save anonymous/0259ddbdf95dea4fa5505be15a914773 to your computer and use it in GitHub Desktop.
Inicializando um projeto NodeJS GraphQL
clone:
depth: full
pipelines:
default:
- step:
image: node:8.6.0
caches:
- node
script:
- npm install
- npm run pipelines
# Deploy to Digital Ocean
- mkdir -p ~/.ssh
- cat my_known_hosts >> ~/.ssh/known_hosts
- (umask 077; echo $SSH_PRIVATE_KEY | base64 --decode -i > ~/.ssh/id_rsa)
- git remote add server $DOCEAN_GIT_REPO
- git push server master
services:
- mysql
definitions:
services:
mysql:
image: mysql
environment:
MYSQL_DATABASE: '#### MYSQL-DATABASE-NAME-HERE ####'
MYSQL_ROOT_PASSWORD: '#### MYSQL-PASSWORD-HERE ####'
const gulp = require('gulp');
const clean = require('gulp-clean');
const ts = require('gulp-typescript');
const tsProject = ts.createProject('tsconfig.json');
gulp.task('scripts', ['static'], () => {
const tsResult = tsProject.src()
.pipe(tsProject());
return tsResult.js
.pipe(gulp.dest('dist'));
});
gulp.task('static', ['clean'], () => {
return gulp
.src(['src/**/*.json'])
.pipe(gulp.dest('dist'));
});
gulp.task('clean', () => {
return gulp
.src('dist')
.pipe(clean());
});
gulp.task('build', ['scripts']);
gulp.task('watch', ['build'], () => {
return gulp.watch(['src/**/*.ts', 'src/**/*.json'], ['build']);
});
gulp.task('default', ['watch']);
{
"name": "YOUR-PROJECT-NAME-HERE",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"clusters": "NODE_ENV=production port=8080 node dist/clusters",
"build": "npm run gulp build",
"start": "npm run build && npm run clusters",
"dev": "NODE_ENV=development JWT_SECRET=iron_man node_modules/.bin/nodemon --delay 5 dist/index",
"gulp": "node_modules/.bin/gulp",
"test": "NODE_ENV=test JWT_SECRET=jwt_test mocha",
"pipelines": "NODE_ENV=pipelines JWT_SECRET=jwt_pipelines mocha",
"coverage": "nyc --extension .ts --include 'src/**/*.ts' --reporter html npm test"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/bcryptjs": "2.4.1",
"@types/chai": "4.0.4",
"@types/chai-http": "3.0.3",
"@types/compression": "0.0.34",
"@types/cors": "2.8.3",
"@types/express": "4.0.37",
"@types/express-graphql": "0.0.34",
"@types/graphql": "0.11.5",
"@types/helmet": "0.0.36",
"@types/jsonwebtoken": "7.2.3",
"@types/lodash": "4.14.78",
"@types/mocha": "2.2.44",
"@types/node": "8.0.34",
"@types/sequelize": "4.0.76",
"chai": "4.1.2",
"chai-http": "3.0.0",
"gulp": "3.9.1",
"gulp-clean": "0.3.2",
"gulp-typescript": "3.2.2",
"mocha": "4.0.1",
"nodemon": "1.12.0",
"nyc": "11.3.0",
"ts-node": "3.3.0",
"typescript": "2.5.3"
},
"dependencies": {
"bcryptjs": "2.4.3",
"compression": "1.7.1",
"cors": "2.8.4",
"dataloader": "1.3.0",
"express": "4.16.2",
"express-graphql": "0.6.11",
"graphql": "0.11.7",
"graphql-fields": "1.0.2",
"graphql-tools": "2.3.0",
"helmet": "3.9.0",
"jsonwebtoken": "8.1.0",
"lodash": "4.17.4",
"mysql2": "1.4.2",
"sequelize": "4.13.10"
}
}
{
"compilerOptions": {
"lib": [
"esnext"
],
"target": "es6",
"module": "commonjs"
},
"compileOnSave": false,
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment