New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(generator): add ignoreEnv generate option during ensureBuild(cmd) #8955
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5746107
Added ignoreEnv build option to ignore env and process.env fields dur…
wlarch 29aac68
Added test suite for full-static-with-ignore-env
wlarch 0f228f8
Opted for generate option instead of build option, refactored condition
wlarch 55fb772
Added type & default for ignoreEnv generate option
wlarch 67b41b1
Added ignoreEnv to snap config
wlarch File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/fixtures/full-static-with-ignore-env/full-static-with-ignore-env.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { buildFixture } from '../../utils/build' | ||
|
||
buildFixture('full-static-with-ignore-env') |
40 changes: 40 additions & 0 deletions
40
test/fixtures/full-static-with-ignore-env/layouts/default.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<main> | ||
<nav> | ||
<NLink to="/"> | ||
Home | ||
</NLink> | ||
<NLink to="/store"> | ||
Store | ||
</NLink> | ||
<NLink to="/encoding/中文"> | ||
Encoding | ||
</NLink> | ||
<NLink to="/pagination/1"> | ||
Pagination | ||
</NLink> | ||
<NLink to="/dynamic/foo bar/#hash"> | ||
Dynamic route 1 | ||
</NLink> | ||
<NLink to="/dynamic/foo%20bar"> | ||
Dynamic route 2 | ||
</NLink> | ||
</nav> | ||
<br> | ||
<Nuxt /> | ||
</main> | ||
</template> | ||
|
||
<style scoped> | ||
main { | ||
margin: 1em 1em; | ||
} | ||
|
||
nav { | ||
margin-bottom: 1em; | ||
} | ||
|
||
a { | ||
margin-right: 1em; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export default { | ||
target: 'static', | ||
export: { | ||
payload: { | ||
config: true | ||
} | ||
}, | ||
router: { | ||
// base: '/test', | ||
}, | ||
generate: { | ||
ignoreEnv: true | ||
}, | ||
foo: { | ||
shell: process.env.SHELL | ||
}, | ||
env: { | ||
x: 123 | ||
}, | ||
hooks: { | ||
export: { | ||
before ({ setPayload }) { | ||
setPayload({ shared: true }) | ||
}, | ||
route ({ route, setPayload }) { | ||
setPayload({ myRoute: route }) | ||
} | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
test/fixtures/full-static-with-ignore-env/pages/dynamic/_name.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<div> | ||
Welcome {{ $route.params.name || 'nuxter' }}! | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
} | ||
</script> |
5 changes: 5 additions & 0 deletions
5
test/fixtures/full-static-with-ignore-env/pages/encoding/中文.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div> | ||
<h1>Encoded path</h1> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<div> | ||
<h1>Full Static Playground!</h1> | ||
</div> | ||
</template> |
21 changes: 21 additions & 0 deletions
21
test/fixtures/full-static-with-ignore-env/pages/pagination/_i.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<template> | ||
<div> | ||
<NLink v-if="i>0" :to="`./${i-1}`"> | ||
Previous | ||
</NLink> | ||
Page {{ i }} | ||
<NLink v-if="i<5" :to="`./${i+1}`"> | ||
Next | ||
</NLink> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
computed: { | ||
i () { | ||
return parseInt(this.$route.params.i) || 0 | ||
} | ||
} | ||
} | ||
</script> |
13 changes: 13 additions & 0 deletions
13
test/fixtures/full-static-with-ignore-env/pages/payload.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<template> | ||
<div v-text="JSON.stringify(payload)" /> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
asyncData ({ payload }) { | ||
return { | ||
payload | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
<div> | ||
<h3>Welcome {{ $store.state.auth.user.name }}!</h3> | ||
<br> | ||
You visited this page <strong>{{ $store.state.counter }}</strong> times. | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
async asyncData ({ store }) { | ||
await store.dispatch('auth/FETCH_USER') | ||
}, | ||
fetch () { | ||
this.$store.commit('COUNT') | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export const state = () => ({ | ||
user: null | ||
}) | ||
|
||
export const mutations = { | ||
SET_USER (state, user) { | ||
state.user = user | ||
} | ||
} | ||
|
||
export const actions = { | ||
FETCH_USER ({ commit }) { | ||
commit('SET_USER', { | ||
name: (process.client ? 'C' : 'S') + ' Æ A-' + (10 + Math.round(Math.random() * 10)) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const state = () => ({ | ||
counter: 0 | ||
}) | ||
|
||
export const mutations = { | ||
COUNT (state) { | ||
state.counter += 1 | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be missing something, but is this used to test the feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be fully honest I wasn't quite sure if this was the right way to test the feature using the suggested
ignoreEnv
option innuxt.config.js
.