1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

[Stable] Move from Fly to Taskr (#2306)

* switch from fly to taskr

* update taskfile
This commit is contained in:
Luke Edwards 2017-06-22 06:51:49 -07:00 committed by Tim Neutkens
parent a33a01fba5
commit ba5b05a276
4 changed files with 173 additions and 134 deletions

View file

@ -1,78 +0,0 @@
const notifier = require('node-notifier')
const childProcess = require('child_process')
const isWindows = /^win/.test(process.platform)
export async function compile(fly) {
await fly.parallel(['bin', 'server', 'lib', 'client'])
}
export async function bin(fly, opts) {
await fly.source(opts.src || 'bin/*').babel().target('dist/bin', {mode: 0755})
notify('Compiled binaries')
}
export async function lib(fly, opts) {
await fly.source(opts.src || 'lib/**/*.js').babel().target('dist/lib')
notify('Compiled lib files')
}
export async function server(fly, opts) {
await fly.source(opts.src || 'server/**/*.js').babel().target('dist/server')
notify('Compiled server files')
}
export async function client(fly, opts) {
await fly.source(opts.src || 'client/**/*.js').babel().target('dist/client')
notify('Compiled client files')
}
export async function copy(fly) {
await fly.source('pages/**/*.js').target('dist/pages')
}
export async function build(fly) {
await fly.serial(['copy', 'compile'])
}
export default async function (fly) {
await fly.start('build')
await fly.watch('bin/*', 'bin')
await fly.watch('pages/**/*.js', 'copy')
await fly.watch('server/**/*.js', 'server')
await fly.watch('client/**/*.js', ['client'])
await fly.watch('lib/**/*.js', ['lib'])
}
export async function release(fly) {
await fly.clear('dist').start('build')
}
// We run following task inside a NPM script chain and it runs chromedriver
// inside a child process tree.
// Even though we kill this task's process, chromedriver exists throughout
// the lifetime of the original npm script.
export async function pretest(fly) {
const processName = isWindows ? 'chromedriver.cmd' : 'chromedriver'
const chromedriver = childProcess.spawn(processName, { stdio: 'inherit' })
// We need to do this, otherwise this task's process will keep waiting.
setTimeout(() => process.exit(0), 2000)
}
export async function posttest(fly) {
try {
const cmd = isWindows ? 'taskkill /im chromedriver* /t /f' : 'pkill chromedriver'
childProcess.execSync(cmd, { stdio: 'ignore' })
} catch(err) {
// Do nothing
}
}
// notification helper
function notify(msg) {
return notifier.notify({
title: '▲ Next',
message: msg,
icon: false
})
}

View file

@ -20,11 +20,11 @@
"next": "./dist/bin/next"
},
"scripts": {
"build": "fly",
"release": "fly release",
"pretestonly": "fly pretest",
"build": "taskr",
"release": "taskr release",
"pretestonly": "taskr pretest",
"testonly": "cross-env NODE_PATH=test/lib jest \\.test.js",
"posttestonly": "fly posttest",
"posttestonly": "taskr posttest",
"pretest": "npm run lint",
"test": "npm run testonly -- --coverage --forceExit --runInBand --verbose --bail",
"coveralls": "nyc --instrument=false --source-map=false report --temp-directory=./coverage --reporter=text-lcov | coveralls",
@ -96,6 +96,10 @@
"xss-filters": "1.2.7"
},
"devDependencies": {
"@taskr/babel": "1.0.0",
"@taskr/clear": "1.0.0",
"@taskr/esnext": "1.0.0",
"@taskr/watch": "1.0.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.1",
"babel-plugin-istanbul": "4.1.3",
@ -106,11 +110,7 @@
"chromedriver": "2.29.0",
"coveralls": "2.13.1",
"cross-env": "5.0.0",
"fly": "2.0.6",
"fly-babel": "2.1.1",
"fly-clear": "1.0.1",
"fly-esnext": "2.0.1",
"fly-watch": "1.1.1",
"taskr": "1.0.5",
"husky": "0.13.3",
"jest-cli": "20.0.1",
"lint-staged": "^3.4.0",

78
taskfile.js Normal file
View file

@ -0,0 +1,78 @@
const notifier = require('node-notifier')
const childProcess = require('child_process')
const isWindows = /^win/.test(process.platform)
export async function compile(task) {
await task.parallel(['bin', 'server', 'lib', 'client'])
}
export async function bin(task, opts) {
await task.source(opts.src || 'bin/*').babel().target('dist/bin', {mode: 0755})
notify('Compiled binaries')
}
export async function lib(task, opts) {
await task.source(opts.src || 'lib/**/*.js').babel().target('dist/lib')
notify('Compiled lib files')
}
export async function server(task, opts) {
await task.source(opts.src || 'server/**/*.js').babel().target('dist/server')
notify('Compiled server files')
}
export async function client(task, opts) {
await task.source(opts.src || 'client/**/*.js').babel().target('dist/client')
notify('Compiled client files')
}
export async function copy(task) {
await task.source('pages/**/*.js').target('dist/pages')
}
export async function build(task) {
await task.serial(['copy', 'compile'])
}
export default async function (task) {
await task.start('build')
await task.watch('bin/*', 'bin')
await task.watch('pages/**/*.js', 'copy')
await task.watch('server/**/*.js', 'server')
await task.watch('client/**/*.js', 'client')
await task.watch('lib/**/*.js', 'lib')
}
export async function release(task) {
await task.clear('dist').start('build')
}
// We run following task inside a NPM script chain and it runs chromedriver
// inside a child process tree.
// Even though we kill this task's process, chromedriver exists throughout
// the lifetime of the original npm script.
export async function pretest(task) {
const processName = isWindows ? 'chromedriver.cmd' : 'chromedriver'
const chromedriver = childProcess.spawn(processName, { stdio: 'inherit' })
// We need to do this, otherwise this task's process will keep waiting.
setTimeout(() => process.exit(0), 2000)
}
export async function posttest(task) {
try {
const cmd = isWindows ? 'taskkill /im chromedriver* /t /f' : 'pkill chromedriver'
childProcess.execSync(cmd, { stdio: 'ignore' })
} catch(err) {
// Do nothing
}
}
// notification helper
function notify(msg) {
return notifier.notify({
title: '▲ Next',
message: msg,
icon: false
})
}

133
yarn.lock
View file

@ -2,6 +2,33 @@
# yarn lockfile v1
"@taskr/babel@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@taskr/babel/-/babel-1.0.0.tgz#935c062def3d66828e4a5a96782d1c63b2b8b5da"
dependencies:
babel-core "^6.3.0"
flatten "^1.0.2"
read-pkg-up "^2.0.0"
"@taskr/clear@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@taskr/clear/-/clear-1.0.0.tgz#3d27344bbf9826332444bbcc820f70dc01959bcd"
dependencies:
bluebird "^3.5.0"
rimraf "^2.5.4"
"@taskr/esnext@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@taskr/esnext/-/esnext-1.0.0.tgz#04fdb594da231891b9ee4e589cabdb9e259e769c"
dependencies:
require-like "^0.1.2"
"@taskr/watch@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@taskr/watch/-/watch-1.0.0.tgz#30c78f488ec6b845d7afa01493f4e13f1195f68f"
dependencies:
chokidar "^1.7.0"
abab@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d"
@ -265,7 +292,7 @@ babel-code-frame@^6.16.0, babel-code-frame@^6.20.0, babel-code-frame@^6.22.0:
esutils "^2.0.2"
js-tokens "^3.0.0"
babel-core@6.24.0, babel-core@^6.0.0, babel-core@^6.3.0:
babel-core@6.24.0, babel-core@^6.0.0:
version "6.24.0"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02"
dependencies:
@ -289,7 +316,7 @@ babel-core@6.24.0, babel-core@^6.0.0, babel-core@^6.3.0:
slash "^1.0.0"
source-map "^0.5.0"
babel-core@^6.24.1:
babel-core@^6.24.1, babel-core@^6.3.0:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.1.tgz#8c428564dce1e1f41fb337ec34f4c3b022b5ad83"
dependencies:
@ -1006,7 +1033,7 @@ block-stream@*:
dependencies:
inherits "~2.0.0"
bluebird@^3.4.7, bluebird@^3.5.0:
bluebird@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.0.tgz#791420d7f551eea2897453a8a77653f96606d67c"
@ -1231,7 +1258,7 @@ cheerio@0.22.0:
lodash.reject "^4.4.0"
lodash.some "^4.4.0"
chokidar@^1.4.3, chokidar@^1.6.1:
chokidar@^1.4.3, chokidar@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468"
dependencies:
@ -1306,9 +1333,9 @@ cliui@^3.2.0:
strip-ansi "^3.0.1"
wrap-ansi "^2.0.0"
clor@^5.0.1:
version "5.1.0"
resolved "https://registry.yarnpkg.com/clor/-/clor-5.1.0.tgz#8d320650d7193add04ebf891d79dee4cabc80c2c"
clor@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/clor/-/clor-5.2.0.tgz#9ddc74e7e86728cfcd05a80546ba58d317b81035"
co@^4.6.0:
version "4.6.0"
@ -2188,45 +2215,6 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
fly-babel@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/fly-babel/-/fly-babel-2.1.1.tgz#bec3cb893b09fe2ceaff895ba87b2c96f05a5b69"
dependencies:
babel-core "^6.3.0"
flatten "^1.0.2"
read-pkg-up "^1.0.1"
fly-clear@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/fly-clear/-/fly-clear-1.0.1.tgz#6e14200478c741d72b217abd916b18c75211852c"
dependencies:
arrify "^1.0.1"
bluebird "^3.4.7"
rimraf "^2.5.4"
fly-esnext@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fly-esnext/-/fly-esnext-2.0.1.tgz#0468d6b235dc519eb8fcda4ffb8cc9f19ccbb66d"
dependencies:
require-like "^0.1.2"
fly-watch@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/fly-watch/-/fly-watch-1.1.1.tgz#2870081e80826faa5239379b4df97ae10aebae8d"
dependencies:
arrify "^1.0.1"
chokidar "^1.6.1"
fly@2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/fly/-/fly-2.0.6.tgz#77aa3c94e8e30ed235e06e91973f135dd55e03bd"
dependencies:
bluebird "^3.5.0"
clor "^5.0.1"
glob "^7.1.1"
minimist "^1.2.0"
mkdirp "^0.5.1"
for-in@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
@ -2383,6 +2371,17 @@ glob@^6.0.1:
once "^1.3.0"
path-is-absolute "^1.0.0"
glob@^7.1.2:
version "7.1.2"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"
global@^4.3.0:
version "4.3.2"
resolved "https://registry.yarnpkg.com/global/-/global-4.3.2.tgz#e76989268a6c74c38908b1305b10fc0e394e9d0f"
@ -3552,7 +3551,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3:
"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
dependencies:
@ -3587,6 +3586,10 @@ moment@^2.11.2:
version "2.18.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f"
mri@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.0.tgz#5c0a3f29c8ccffbbb1ec941dcec09d71fa32f36a"
ms@0.7.3:
version "0.7.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.3.tgz#708155a5e44e33f5fd0fc53e81d0d40a91be1fff"
@ -3989,6 +3992,12 @@ path-type@^1.0.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"
path-type@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73"
dependencies:
pify "^2.0.0"
pbkdf2@^3.0.3:
version "3.0.12"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.12.tgz#be36785c5067ea48d806ff923288c5f750b6b8a2"
@ -4216,6 +4225,13 @@ read-pkg-up@^1.0.1:
find-up "^1.0.0"
read-pkg "^1.0.0"
read-pkg-up@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be"
dependencies:
find-up "^2.0.0"
read-pkg "^2.0.0"
read-pkg@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28"
@ -4224,6 +4240,14 @@ read-pkg@^1.0.0:
normalize-package-data "^2.3.2"
path-type "^1.0.0"
read-pkg@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8"
dependencies:
load-json-file "^2.0.0"
normalize-package-data "^2.3.2"
path-type "^2.0.0"
readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.2.2, readable-stream@^2.2.6:
version "2.2.9"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.9.tgz#cf78ec6f4a6d1eb43d26488cac97f042e74b7fc8"
@ -4868,6 +4892,17 @@ tar@^2.2.1:
fstream "^1.0.2"
inherits "2"
taskr@1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/taskr/-/taskr-1.0.5.tgz#5dd18692b68716616fd767978af10a9eed4a58a4"
dependencies:
bluebird "^3.5.0"
clor "^5.1.0"
glob "^7.1.2"
mkdirp "^0.5.1"
mri "^1.1.0"
tinydate "^1.0.0"
test-exclude@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26"
@ -4908,6 +4943,10 @@ timers-browserify@^2.0.2:
dependencies:
setimmediate "^1.0.4"
tinydate@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/tinydate/-/tinydate-1.0.0.tgz#20f31756a13959ef8c57ec133ba29b5ade042cac"
tmpl@1.0.x:
version "1.0.4"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"