Skip to content

Commit 701518e

Browse files
committed
feat: error.vue creation command
1 parent cf156f2 commit 701518e

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,12 @@
868868
"category": "Nuxtr",
869869
"when": "nuxtr.isNuxtProject"
870870
},
871+
{
872+
"command": "nuxtr.errorLayout",
873+
"title": "Create error.vue Layout",
874+
"category": "Nuxtr",
875+
"when": "nuxtr.isNuxtProject"
876+
},
871877
{
872878
"command": "nuxtr.installDependencies",
873879
"title": "Install Dependencies",
@@ -1093,4 +1099,4 @@
10931099
"uglify-js@<2.4.24": ">=2.4.24"
10941100
}
10951101
}
1096-
}
1102+
}

src/commands/Structure.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,12 @@ const nuxtRC = () => {
7777
})
7878
}
7979

80-
export { projectStructure, appConfig, nuxtIgnore, nuxtRC }
80+
const errorLayout = () => {
81+
createFile({
82+
fileName: 'error.vue',
83+
content: generateVueFileTemplate('page'),
84+
fullPath: `${projectSrcDirectory()}/error.vue`,
85+
})
86+
}
87+
88+
export { projectStructure, appConfig, nuxtIgnore, nuxtRC, errorLayout }

src/commands/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createLayout, directCreateLayout } from './Layout'
55
import { createPlugin, directCreatePlugin } from './Plugin'
66
import { createMiddleware, directCreateMiddleware } from './Middleware'
77
import { createNitroAPI, directCreateNitroAPI, createNitroRoute, directCreateNitroRoute, createNitroPlugin, createNitroMiddleware, createNitroUtil } from './Nitro'
8-
import { projectStructure, appConfig, nuxtIgnore, nuxtRC } from './Structure'
8+
import { projectStructure, appConfig, nuxtIgnore, nuxtRC, errorLayout } from './Structure'
99
import { openDocumentation, openModules } from './externalLinks'
1010
import { nuxtDev, nuxtBuild, nuxtGenerate, nuxtCleanUp, nuxtAnalyze, nuxtInfo, nuxtModule, showCLICommands } from './Nuxi'
1111
import { createStore, directCreateStore } from './Store'
@@ -58,6 +58,7 @@ const commands = {
5858
appConfig,
5959
nuxtIgnore,
6060
nuxtRC,
61+
errorLayout,
6162
installDependencies,
6263
upgradePackage,
6364
managePackageVersion,

src/extension.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const commandList = [
3535
{ command: 'nuxtr.appConfig', function: nuxtrCommands.appConfig },
3636
{ command: 'nuxtr.nuxtIgnore', function: nuxtrCommands.nuxtIgnore },
3737
{ command: 'nuxtr.nuxtRC', function: nuxtrCommands.nuxtRC },
38+
{ command: 'nuxtr.errorLayout', function: nuxtrCommands.errorLayout },
3839
{ command: 'nuxtr.installDependencies', function: nuxtrCommands.installDependencies },
3940
{ command: 'nuxtr.openSettings', function: nuxtrCommands.openSettings },
4041
{ command: 'nuxtr.configureCSS', function: nuxtrCommands.configureCSS },

0 commit comments

Comments
 (0)