Skip to content

Commit

Permalink
total build and e2e script. Will probably change later
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Feb 17, 2017
1 parent addb82f commit 7bc004c
Show file tree
Hide file tree
Showing 29 changed files with 361 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
scripts/install.js
scripts/verify.js
coverage
cypress/examples/**
cypress/examples/**
build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ build
*.log
npm-debug.log*
.mongo-db
.e2e
cypress/videos
dist
10 changes: 7 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"description": "conduit on node",
"main": "app.js",
"scripts": {
"start": "babel-node ./app.js",
"dev": "nodemon ./app.js",
"start": "node ./dist",
"dev": "nodemon ./src",
"prebuild": "rimraf dist",
"generateData": "babel-node scripts/generate",
"build": "babel --copy-files --out-dir dist --ignore *.test.js,__mocks__ src",
"test": "jest --coverage",
"test:watch": "jest --watch"
},
Expand Down Expand Up @@ -42,7 +45,8 @@
"chalk": "^1.1.3",
"faker": "^3.1.0",
"jest": "^18.1.0",
"lodash": "^4.17.4"
"lodash": "^4.17.4",
"rimraf": "^2.5.4"
},
"jest": {
"testEnvironment": "jest-environment-node",
Expand Down
Empty file removed api/public/.keep
Empty file.
2 changes: 1 addition & 1 deletion api/scripts/generate/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import faker from 'faker'
import _ from 'lodash'
import mongoose from 'mongoose'
import {commonProps} from './utils'
import '../../models/Article'
import '../../src/models/Article'

const Article = mongoose.model('Article')

Expand Down
2 changes: 1 addition & 1 deletion api/scripts/generate/comment.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import faker from 'faker'
import mongoose from 'mongoose'
import {commonProps} from './utils'
import '../../models/Comment'
import '../../src/models/Comment'

const Comment = mongoose.model('Comment')

Expand Down
2 changes: 1 addition & 1 deletion api/scripts/generate/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import crypto from 'crypto'
import faker from 'faker'
import mongoose from 'mongoose'
import {commonProps} from './utils'
import '../../models/User'
import '../../src/models/User'

const User = mongoose.model('User')

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions api/app.js → api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ if (!isProduction) {
app.use(errorhandler())
}

if (isProduction) {
if (process.env.MONGODB_URI) {
mongoose.connect(process.env.MONGODB_URI)
if ('MONGODB_DEBUG' in process.env) {
mongoose.set('debug', true)
}
} else {
mongoose.connect('mongodb://localhost/conduit')
mongoose.set('debug', true)
}

require('./models/User')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2995,7 +2995,7 @@ right-align@^0.1.1:
dependencies:
align-text "^0.1.1"

rimraf@2, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@~2.5.1, rimraf@~2.5.4:
rimraf@2, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.4, rimraf@~2.5.1, rimraf@~2.5.4:
version "2.5.4"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04"
dependencies:
Expand Down
4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"babel-preset-react-app": "^2.1.0",
"cross-env": "^3.1.4",
"jest": "^18.1.0",
"pushstate-server": "^2.2.1",
"react-scripts": "0.6.1",
"rimraf": "^2.5.4"
},
Expand All @@ -25,8 +26,9 @@
"superagent-promise": "^1.1.0"
},
"scripts": {
"start": "cross-env PORT=8080 react-scripts start",
"dev": "cross-env PORT=8080 react-scripts start",
"build": "react-scripts build",
"start": "pushstate-server build",
"test": "jest --coverage",
"test:watch": "jest --watch",
"postinstall": "echo \"removing client copy of eslint (will use root repo's version)\" && rimraf node_modules/eslint"
Expand Down
99 changes: 95 additions & 4 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abbrev@1, [email protected]:
version "1.0.9"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135"

accepts@~1.3.3:
accepts@^1.2.5, accepts@~1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.3.tgz#c3ca7434938648c3e0d9c1e328dd68b622c284ca"
dependencies:
Expand Down Expand Up @@ -1456,7 +1456,7 @@ compressible@~2.0.8:
dependencies:
mime-db ">= 1.24.0 < 2"

compression@^1.5.2:
compression@1.6.2, compression@^1.5.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/compression/-/compression-1.6.2.tgz#cceb121ecc9d09c52d7ad0c3350ea93ddd402bc3"
dependencies:
Expand All @@ -1483,6 +1483,23 @@ [email protected], connect-history-api-fallback@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.3.0.tgz#e51d17f8f0ef0db90a64fdb47de3051556e9f169"

[email protected]:
version "1.1.2"
resolved "https://registry.yarnpkg.com/connect-static-file/-/connect-static-file-1.1.2.tgz#d1254da775c8d694dba9b0c54994b7550cc1c7a5"
dependencies:
accepts "^1.2.5"
mime "^1.3.4"
send "^0.12.2"

[email protected]:
version "3.5.0"
resolved "https://registry.yarnpkg.com/connect/-/connect-3.5.0.tgz#b357525a0b4c1f50599cd983e1d9efeea9677198"
dependencies:
debug "~2.2.0"
finalhandler "0.5.0"
parseurl "~1.3.1"
utils-merge "1.0.0"

console-browserify@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10"
Expand Down Expand Up @@ -1548,6 +1565,10 @@ core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"

[email protected]:
version "3.2.1"
resolved "https://registry.yarnpkg.com/crc/-/crc-3.2.1.tgz#5d9c8fb77a245cd5eca291e5d2d005334bab0082"

cross-env@^3.1.4:
version "3.1.4"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-3.1.4.tgz#56e8bca96f17908a6eb1bc2012ca126f92842130"
Expand Down Expand Up @@ -1764,10 +1785,18 @@ delegates@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"

depd@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/depd/-/depd-1.0.1.tgz#80aec64c9d6d97e65cc2a9caa93c0aa6abf73aaa"

depd@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.0.tgz#e1bd82c6aab6ced965b97b88b17ed3e528ca18c3"

[email protected]:
version "1.0.3"
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.3.tgz#b433b4724e71fd8551d9885174851c5fc377e2c9"

destroy@~1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80"
Expand Down Expand Up @@ -1859,6 +1888,10 @@ ecc-jsbn@~0.1.1:
dependencies:
jsbn "~0.1.0"

[email protected]:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.0.tgz#6a0d7c6221e490feefd92ec3f441c9ce8cd097f4"

[email protected]:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
Expand Down Expand Up @@ -1957,6 +1990,10 @@ es6-weak-map@^2.0.1:
es6-iterator "2"
es6-symbol "3"

[email protected]:
version "1.0.1"
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.1.tgz#181a286ead397a39a92857cfb1d43052e356bff0"

escape-html@~1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
Expand Down Expand Up @@ -2125,6 +2162,12 @@ esutils@^2.0.0, esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"

etag@~1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/etag/-/etag-1.6.0.tgz#8bcb2c6af1254c481dfc8b997c906ef4e442c207"
dependencies:
crc "3.2.1"

etag@~1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/etag/-/etag-1.7.0.tgz#03d30b5f67dd6e632d2945d30d6652731a34d5d8"
Expand Down Expand Up @@ -2308,6 +2351,16 @@ fill-range@^2.1.0:
repeat-element "^1.1.2"
repeat-string "^1.5.2"

[email protected]:
version "0.5.0"
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-0.5.0.tgz#e9508abece9b6dba871a6942a1d7911b91911ac7"
dependencies:
debug "~2.2.0"
escape-html "~1.0.3"
on-finished "~2.3.0"
statuses "~1.3.0"
unpipe "~1.0.0"

[email protected]:
version "0.5.1"
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-0.5.1.tgz#2c400d8d4530935bc232549c5fa385ec07de6fcd"
Expand Down Expand Up @@ -2384,6 +2437,10 @@ forwarded@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.0.tgz#19ef9874c4ae1c297bcf078fde63a09b66a84363"

[email protected]:
version "0.2.4"
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.2.4.tgz#3582499206c9723714190edd74b4604feb4a614c"

[email protected]:
version "0.3.0"
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.3.0.tgz#651f838e22424e7566de161d8358caa199f83d4f"
Expand Down Expand Up @@ -4078,6 +4135,12 @@ object.omit@^2.0.0:
for-own "^0.1.4"
is-extendable "^0.1.1"

on-finished@~2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.2.1.tgz#5c85c1cc36299f78029653f667f27b6b99ebc029"
dependencies:
ee-first "1.1.0"

on-finished@~2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
Expand Down Expand Up @@ -4594,6 +4657,15 @@ punycode@^1.2.4, punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"

pushstate-server@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/pushstate-server/-/pushstate-server-2.2.1.tgz#1d36dd956a7fa9f1ddbb92328ebb961b73a9b663"
dependencies:
compression "1.6.2"
connect "3.5.0"
connect-static-file "1.1.2"
serve-static "1.11.2"

q@^1.1.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e"
Expand Down Expand Up @@ -4642,6 +4714,10 @@ range-parser@^1.0.3, range-parser@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e"

range-parser@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.0.3.tgz#6872823535c692e2c2a0103826afd82c2e0ff175"

rc@~1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.6.tgz#43651b76b6ae53b5c802f1151fa3fc3b059969c9"
Expand Down Expand Up @@ -5085,6 +5161,21 @@ [email protected]:
range-parser "~1.2.0"
statuses "~1.3.1"

send@^0.12.2:
version "0.12.3"
resolved "https://registry.yarnpkg.com/send/-/send-0.12.3.tgz#cd12dc58fde21e4f91902b39b2fda05a7a6d9bdc"
dependencies:
debug "~2.2.0"
depd "~1.0.1"
destroy "1.0.3"
escape-html "1.0.1"
etag "~1.6.0"
fresh "0.2.4"
mime "1.3.4"
ms "0.7.1"
on-finished "~2.2.1"
range-parser "~1.0.2"

sentence-case@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/sentence-case/-/sentence-case-2.1.0.tgz#d592fbed457fd1a59e3af0ee17e99f6fd70d7efd"
Expand All @@ -5104,7 +5195,7 @@ serve-index@^1.7.2:
mime-types "~2.1.11"
parseurl "~1.3.1"

serve-static@~1.11.2:
serve-static@1.11.2, serve-static@~1.11.2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.11.2.tgz#2cf9889bd4435a320cc36895c9aa57bd662e6ac7"
dependencies:
Expand Down Expand Up @@ -5252,7 +5343,7 @@ sshpk@^1.7.0:
jsbn "~0.1.0"
tweetnacl "~0.14.0"

"statuses@>= 1.3.1 < 2", statuses@~1.3.1:
"statuses@>= 1.3.1 < 2", statuses@~1.3.0, statuses@~1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e"

Expand Down
34 changes: 21 additions & 13 deletions package-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@ const concurrentTests = {
script: 'nps client.test',
color: 'black.bgYellow.bold.dim',
},
'e2e-tests': {
script: 'nps e2e',
color: 'bgGreen.bold.dim',
},
}

module.exports = {
scripts: {
default: {
script: series([
startInNewWindow('npm start mongo'),
startInNewWindow('npm start api'),
startInNewWindow('npm start client'),
startInNewWindow('npm start mongo --silent'),
startInNewWindow('npm start api --silent'),
startInNewWindow('npm start client --silent'),
]),
},
mongo: {
Expand All @@ -34,24 +30,35 @@ module.exports = {
stop: 'mongo admin --eval "db.shutdownServer()"',
},
api: {
script: series(['cd api', 'npm start']),
script: series(['cd api', 'npm start --silent']),
description: 'start the api server',
test: {
script: series(['cd api', 'npm test']),
script: series(['cd api', 'npm test --silent']),
description: 'run the api tests',
},
},
client: {
script: series(['cd client', 'cross-env PORT=8080 npm start']),
script: series(['cd client', 'npm start --silent -- 8080']),
description: 'start the client dev server',
test: {
script: series(['cd client', 'npm test']),
script: series(['cd client', 'npm test --silent']),
description: 'run the client tests',
},
},
dev: {
script: series([
startInNewWindow('npm start dev.mongo --silent'),
startInNewWindow('npm start dev.client --silent'),
startInNewWindow('npm start dev.api --silent'),
]),
description: 'starts everything in dev mode',
// dev is the same as live for mongo for now...
mongo: 'npm start mongo --silent',
client: series(['cd client', 'npm run dev --silent']),
api: series(['cd api', 'npm run dev --silent']),
},
e2e: {
script: 'cross-env MOCHA_COLORS=true cypress run',
description: 'run the E2E tests',
script: 'node scripts/e2e.js',
},
test: {
description: 'run the tests in parallel',
Expand Down Expand Up @@ -133,6 +140,7 @@ function startInNewWindow(command) {
`-e 'end tell'`,
].join(' ')
}

// this is not transpiled
/*
eslint
Expand Down
Loading

0 comments on commit 7bc004c

Please sign in to comment.