mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
[Beta] Switch from Fly to Taskr (#2307)
* switch from fly to taskr * update taskfile
This commit is contained in:
parent
3c71e818bf
commit
8d0fdc09f7
79
flyfile.js
79
flyfile.js
|
@ -1,79 +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: parseInt('0755', 8)})
|
||||
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'
|
||||
// eslint-disable-next-line
|
||||
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
|
||||
})
|
||||
}
|
18
package.json
18
package.json
|
@ -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",
|
||||
|
@ -100,6 +100,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.2",
|
||||
"babel-plugin-istanbul": "4.1.3",
|
||||
|
@ -111,11 +115,7 @@
|
|||
"coveralls": "2.13.1",
|
||||
"cross-env": "5.0.1",
|
||||
"express": "4.15.2",
|
||||
"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.4",
|
||||
"lint-staged": "^3.4.0",
|
||||
|
|
79
taskfile.js
Normal file
79
taskfile.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
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: parseInt('0755', 8)})
|
||||
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'
|
||||
// eslint-disable-next-line
|
||||
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
|
||||
})
|
||||
}
|
112
yarn.lock
112
yarn.lock
|
@ -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"
|
||||
|
@ -280,7 +307,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:
|
||||
|
@ -304,7 +331,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:
|
||||
|
@ -1026,7 +1053,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"
|
||||
|
||||
|
@ -1251,7 +1278,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:
|
||||
|
@ -1327,9 +1354,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"
|
||||
|
@ -2307,45 +2334,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"
|
||||
|
@ -2517,6 +2505,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"
|
||||
|
@ -3731,7 +3730,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:
|
||||
|
@ -3766,6 +3765,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.2:
|
||||
version "0.7.2"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765"
|
||||
|
@ -5139,6 +5142,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, test-exclude@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26"
|
||||
|
@ -5181,6 +5195,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"
|
||||
|
|
Loading…
Reference in a new issue