-
Notifications
You must be signed in to change notification settings - Fork 266
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
Nuxt removal #7211
Merged
Merged
Nuxt removal #7211
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = { env: { test: { presets: [['@babel/env', { targets: { node: 'current' } }]] } } }; | ||
module.exports = require('./shell/babel.config.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
{ | ||
"extends": "../tsconfig.default.json", | ||
"extends": "../shell/tsconfig.default.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"types": ["cypress"] | ||
"types": [ | ||
"cypress" | ||
] | ||
}, | ||
"include": ["./**/*.ts", "../types/*.ts"] | ||
"include": [ | ||
"./**/*.ts", | ||
"../types/*.ts" | ||
] | ||
} |
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,33 @@ | ||
# Middleware | ||
|
||
## Location | ||
The definitions of middleware reside in `shell/middleware`. Middleware added to the object in `shell/nuxt/middleware.js` will be initialized at the start of the app rendering. | ||
|
||
|
||
## Notes | ||
This file was generated by nuxt and will soon be redefined by hand. It's safe to add new middleware to this file. | ||
|
||
## Pattern | ||
Define the middleware in a file that resides within `shell/middleware`. Then add the instantiation to the object that resides in `shell/nuxt/middleware.js`. | ||
|
||
shell/middleware/i18n.js | ||
```js | ||
export default async function({ | ||
isHMR, app, store, route, params, error, redirect | ||
}) { | ||
// If middleware is called from hot module replacement, ignore it | ||
if (isHMR) { | ||
return; | ||
} | ||
|
||
await store.dispatch('i18n/init'); | ||
} | ||
``` | ||
|
||
shell/nuxt/middleware.js | ||
```js | ||
... | ||
middleware['i18n'] = require('../middleware/i18n.js') | ||
middleware['i18n'] = middleware['i18n'].default || middleware['i18n'] | ||
... | ||
``` |
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,47 @@ | ||
# Nuxt Plugins | ||
|
||
## Location | ||
The definitions of plugins reside in `shell/plugins`. Plugins added to `shell/nuxt/index.js` will be initialized at the start of the app rendering. | ||
|
||
|
||
## Notes | ||
This file was generated by nuxt and will soon be redefined by hand. It's safe to add new plugins to this file. | ||
|
||
## Pattern | ||
Define the store in a file that resides within `shell/plugins`. Then add the plugins import and execution to `shell/nuxt/index.js`. | ||
|
||
shell/plugins/version.js | ||
```js | ||
/** | ||
* Fetch version metadata from backend /rancherversion API and store it | ||
* | ||
* This metadata does not change for an installation of Rancher | ||
*/ | ||
|
||
import { setVersionData } from '@shell/config/version'; | ||
|
||
export default async function({ store }) { | ||
try { | ||
const response = await store.dispatch('rancher/request', { | ||
url: '/rancherversion', | ||
method: 'get', | ||
redirectUnauthorized: false | ||
}); | ||
|
||
setVersionData(response); | ||
} catch (e) { | ||
console.warn('Failed to fetch Rancher version metadata', e); // eslint-disable-line no-console | ||
} | ||
} | ||
``` | ||
|
||
shell/nuxt/index.js | ||
```js | ||
... | ||
import version from '../plugins/version'; | ||
... | ||
if (process.client && typeof version === 'function') { | ||
await version(app.context, inject); | ||
} | ||
... | ||
``` |
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,22 @@ | ||
# Routes | ||
|
||
## Location | ||
|
||
The core dashboard routes are defined in `shell/nuxt/router.js`. | ||
|
||
|
||
## Notes | ||
This file was generated by nuxt and will soon be redefined by hand. It's safe to add new routes to this file. | ||
|
||
## Pattern | ||
First instantiate a page component at the top of the file. Then define a new route at the bottom of the file by giving the page component a unique path and name | ||
```js | ||
const about = () => interopDefault(import('../pages/about.vue')) | ||
... | ||
{ | ||
path: "/about", | ||
component: about, | ||
name: "about" | ||
} | ||
... | ||
``` |
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 @@ | ||
# Stores | ||
|
||
## Location | ||
The definitions of stores reside in `shell/store`. Stores added to `shell/nuxt/store.js` will be initialized at the start of the app rendering. | ||
|
||
|
||
## Notes | ||
This file was generated by nuxt and will soon be redefined by hand. It's safe to add new stores to this file. | ||
|
||
## Pattern | ||
Define the store in a file that resides within `shell/store`. Then add the store to `shell/nuxt/store.js`. | ||
|
||
shell/nuxt/store.js | ||
```js | ||
... | ||
resolveStoreModules(require('../store/i18n.js'), 'i18n.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
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@vue/cli-plugin-babel/preset', | ||
{ useBuiltIns: false } | ||
], | ||
[ | ||
'@babel/preset-env', | ||
{ targets: { node: 'current' } } | ||
] | ||
], | ||
env: { test: { presets: [['@babel/env', { targets: { node: 'current' } }]] } } | ||
}; |
Oops, something went wrong.
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.
There' a change @aalves08 is bringing in that makes use of these, i think via the
$config
service. it would be good to validate that feature (once it's merged) still works fineThere 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.
For reference this is the PR #7516
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.
This is the part that adds the version env variable
dashboard/scripts/build-embedded
Line 16 in 92a6911
I did have to make changes to the vue.config.js since it doesn't have a concept of publicRuntimeConfig. I defined that using definePlugin and updated the nuxt/client.js since definePlugin didn't seem to support replacing the NUXT prefix.