Skip to content

Commit

Permalink
feat(builder): followSymlinks option to allow for symlinks (#6368)
Browse files Browse the repository at this point in the history
  • Loading branch information
SnirShechter authored and pi0 committed Sep 29, 2019
1 parent d1df5c8 commit 92c7f4e
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/builder/src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ export default class Builder {
async resolveFiles (dir, cwd = this.options.srcDir) {
return this.ignore.filter(await glob(this.globPathWithExtensions(dir), {
cwd,
ignore: this.options.ignore
ignore: this.options.ignore,
follow: this.options.build.followSymlinks
}))
}

Expand Down
3 changes: 2 additions & 1 deletion packages/config/src/config/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@ export default () => ({
},
friendlyErrors: true,
additionalExtensions: [],
warningIgnoreFilters: []
warningIgnoreFilters: [],
followSymlinks: false
})
1 change: 1 addition & 0 deletions packages/config/test/__snapshots__/options.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Object {
"img": [Function],
"video": [Function],
},
"followSymlinks": false,
"friendlyErrors": true,
"hardSource": false,
"hotMiddleware": Object {},
Expand Down
2 changes: 2 additions & 0 deletions packages/config/test/config/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Object {
"img": [Function],
"video": [Function],
},
"followSymlinks": false,
"friendlyErrors": true,
"hardSource": false,
"hotMiddleware": Object {},
Expand Down Expand Up @@ -376,6 +377,7 @@ Object {
"img": [Function],
"video": [Function],
},
"followSymlinks": false,
"friendlyErrors": true,
"hardSource": false,
"hotMiddleware": Object {},
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/basic/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default {
build: {
scopeHoisting: true,
publicPath: '',
followSymlinks: true,
postcss: {
preset: {
features: {
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/basic/pages/symlink/deep/nested-symlinked.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<h1>Nested symlink page</h1>
</template>
3 changes: 3 additions & 0 deletions test/fixtures/basic/pages/symlink/symlinked.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<h1>Symlinked page</h1>
</template>
3 changes: 3 additions & 0 deletions test/fixtures/basic/pages2/deep/nested-symlinked.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<h1>Nested symlink page</h1>
</template>
3 changes: 3 additions & 0 deletions test/fixtures/basic/pages2/symlinked.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<h1>Symlinked page</h1>
</template>
10 changes: 10 additions & 0 deletions test/unit/basic.ssr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,16 @@ describe('basic ssr', () => {
expect(html).toMatch('<h1>JS Layout</h1>')
expect(html).toMatch('<h2>custom page</h2>')
})
/* Testing symlinks functionality */
test('/symlink/symlinked', async () => {
const { html } = await nuxt.server.renderRoute('/symlink/symlinked')
expect(html).toContain('<h1>Symlinked page</h1>')
})

test('/symlink/deep/nested-symlinked', async () => {
const { html } = await nuxt.server.renderRoute('/symlink/deep/nested-symlinked')
expect(html).toContain('<h1>Nested symlink page</h1>')
})

// Close server and ask nuxt to stop listening to file changes
afterAll(async () => {
Expand Down

0 comments on commit 92c7f4e

Please sign in to comment.