-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7211 from codyrancher/nuxt-removal
Nuxt removal
- Loading branch information
Showing
64 changed files
with
5,550 additions
and
940 deletions.
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.