Commit f95a4c97 authored by 周汉成's avatar 周汉成 Committed by Renée Kooi
Browse files

use utils.find() (#482)

parent 840a05b0
var debug = require('debug')('bankai.graph-service-worker')
var findup = require('@choojs/findup')
var assert = require('assert')
var path = require('path')
......@@ -41,7 +40,7 @@ function node (state, createEdge) {
parse()
function parse () {
find(basedir, filenames, function (err, filename) {
utils.find(basedir, filenames, function (err, filename) {
if (err) {
state.metadata.serviceWorker = 'service-worker.js'
return createEdge('bundle', Buffer.from(''), {
......@@ -108,16 +107,6 @@ function browserifyOpts (entries) {
}
}
function find (rootname, arr, done) {
if (!arr.length) return done(new Error('Could not find files'))
var filename = arr[0]
var newArr = arr.slice(1)
findup(rootname, filename, function (err, dirname) {
if (err) return find(rootname, newArr, done)
done(null, path.join(dirname, filename))
})
}
function fileEnv (state) {
var script = [
`${state.scripts.bundle.hash.toString('hex').slice(0, 16)}/bundle.js`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment