Skip to content

Commit 1cc222a

Browse files
authored
fix: handle static file glob on Windows (#778)
Release-As: 4.0.0-beta.6
1 parent faeb703 commit 1cc222a

File tree

4 files changed

+15
-43
lines changed

4 files changed

+15
-43
lines changed

package-lock.json

+11-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"@vercel/node": "^1.11.2-canary.4",
5858
"chalk": "^4.1.2",
5959
"fs-extra": "^10.0.0",
60+
"globby": "^11.0.4",
6061
"moize": "^6.1.0",
6162
"node-fetch": "^2.6.6",
6263
"node-stream-zip": "^1.15.0",

src/helpers/files.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
const { cpus } = require('os')
33

44
const { existsSync, readJson, move, cpSync, copy, writeJson } = require('fs-extra')
5+
const globby = require('globby')
56
const pLimit = require('p-limit')
67
const { join } = require('pathe')
78
const slash = require('slash')
8-
const glob = require('tiny-glob')
99

1010
const TEST_ROUTE = /(|\/)\[[^/]+?](\/|\.html|$)/
1111

@@ -24,7 +24,7 @@ exports.moveStaticPages = async ({ netlifyConfig, target, i18n, failBuild }) =>
2424
await move(source, dest)
2525
}
2626
// Move all static files, except error documents and nft manifests
27-
const pages = await glob('**/!(500|404|*.js.nft).{html,json}', {
27+
const pages = await globby(['**/*.{html,json}', '!**/(500|404|*.js.nft).{html,json}'], {
2828
cwd: root,
2929
dot: true,
3030
})

test/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ describe('onBuild()', () => {
208208
process.env.EXPERIMENTAL_MOVE_STATIC_PAGES = 'true'
209209
await plugin.onBuild(defaultArgs)
210210
expect(existsSync(path.resolve('.next/static-manifest.json'))).toBeTruthy()
211-
const data = JSON.parse(readFileSync(path.resolve('.next/static-manifest.json'), 'utf8'))
211+
const data = JSON.parse(readFileSync(path.resolve('.next/static-manifest.json'), 'utf8')).sort()
212212
expect(data).toMatchSnapshot()
213213
delete process.env.EXPERIMENTAL_MOVE_STATIC_PAGES
214214
})

0 commit comments

Comments
 (0)