/
index.js
33 lines (26 loc) · 939 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import klawSync from 'klaw-sync'
import { got } from 'got'
// eslint-disable-next-line
import getPort from 'get-port'
export { getNuxtConfig } from '../../packages/config'
export { getPort }
export * from './nuxt'
export * from './resource-size'
export function listPaths (dir, pathsBefore = [], options = {}) {
if (Array.isArray(pathsBefore) && pathsBefore.length) {
// Only return files that didn't exist before building
// and files that have been changed
options.filter = (item) => {
const foundItem = pathsBefore.find((itemBefore) => {
return item.path === itemBefore.path
})
return typeof foundItem === 'undefined' ||
item.stats.mtimeMs !== foundItem.stats.mtimeMs
}
}
return klawSync(dir, options)
}
export function equalOrStartsWith (string1, string2) {
return string1 === string2 || string2.startsWith(string1)
}
export const rp = got.extend({ decompress: false })