From cc6099f6b5d2dd8efa0da386387660f15485b1cb Mon Sep 17 00:00:00 2001 From: Adham Farrag Date: Sat, 21 Sep 2024 22:28:56 +0700 Subject: [PATCH] chore: standardize file name capitalization (#167) --- eslint.config.mjs | 22 +++- knip.ts | 4 +- snippets/{Nuxt => nuxt}/boilerplates.json | 0 snippets/{Nuxt => nuxt}/components.json | 0 snippets/{Nuxt => nuxt}/composables.json | 0 snippets/{Nuxt => nuxt}/utils.json | 0 src/codelens/index.ts | 8 +- src/codelens/layers.ts | 12 +- src/codelens/modules.ts | 22 ++-- src/codelens/plugins.ts | 14 +-- src/commands/CSS.ts | 8 +- src/commands/Component.ts | 4 +- src/commands/Composable.ts | 4 +- src/commands/Devtools.ts | 112 +++++++++--------- src/commands/FileTemplates.ts | 17 ++- src/commands/InstallDependencies.ts | 17 ++- src/commands/Layout.ts | 2 - src/commands/Linters.ts | 26 ++-- src/commands/Middleware.ts | 2 +- src/commands/Nitro.ts | 16 +-- src/commands/Nuxi/commonCommands.ts | 2 +- src/commands/Nuxi/index.ts | 45 ++++--- src/commands/Nuxi/multiStepCommands.ts | 10 +- src/commands/Page.ts | 5 +- src/commands/Plugin.ts | 2 +- src/commands/Project.ts | 20 ++-- src/commands/Store.ts | 2 +- src/commands/Structure.ts | 12 +- src/commands/Templates.ts | 6 +- src/commands/Util.ts | 2 +- src/commands/index.ts | 40 +++---- src/extension.ts | 2 +- src/index.ts | 4 +- .../completionProviders/nuxtIgnore.ts | 14 +-- .../completionProviders/nuxtRC.ts | 26 ++-- .../completionProviders/vueFiles.ts | 12 +- src/intellisense/index.ts | 2 +- src/nuxi/index.ts | 2 +- src/sideBar/index.ts | 36 +++--- src/sideBar/prettier.config.ts | 4 +- src/sideBar/src/composables/modules.ts | 6 +- src/sideBar/src/main.ts | 14 +-- src/sideBar/src/plugins/globals.cjs | 10 +- src/sideBar/src/router/index.ts | 8 +- src/sideBar/src/utilities/vscode.ts | 16 +-- src/sideBar/tailwind.config.cjs | 84 ++++++------- src/sideBar/vite.config.ts | 12 +- src/snippets/index.ts | 10 +- src/statusBar/index.ts | 12 +- src/templates/linters.ts | 2 +- src/templates/vueFiles.ts | 4 +- src/types.ts | 24 ++-- src/utils/commands.ts | 4 +- src/utils/dependency.ts | 32 ++--- src/utils/file.ts | 10 +- src/utils/files.ts | 14 +-- src/utils/global.ts | 10 +- src/utils/index.ts | 52 ++++---- src/utils/navigation.ts | 2 +- src/utils/nuxt.ts | 8 +- src/utils/outputChannel.ts | 8 +- src/utils/pkgJSON.ts | 2 +- src/utils/vscode.ts | 12 +- src/utils/watchers.ts | 4 +- src/watchers/config.ts | 10 +- src/watchers/files.ts | 6 +- src/watchers/index.ts | 9 +- tsup.config.ts | 24 ++-- 68 files changed, 470 insertions(+), 477 deletions(-) rename snippets/{Nuxt => nuxt}/boilerplates.json (100%) rename snippets/{Nuxt => nuxt}/components.json (100%) rename snippets/{Nuxt => nuxt}/composables.json (100%) rename snippets/{Nuxt => nuxt}/utils.json (100%) diff --git a/eslint.config.mjs b/eslint.config.mjs index 238f016..0206aae 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,7 +3,7 @@ import unjs from 'eslint-config-unjs'; export default unjs({ rules: { '@typescript-eslint/naming-convention': 'off', - "@typescript-eslint/no-duplicate-enum-values": 'off', + '@typescript-eslint/no-duplicate-enum-values': 'off', '@typescript-eslint/semi': 'off', 'curly': ['error', 'all'], 'eqeqeq': 'warn', @@ -23,6 +23,26 @@ export default unjs({ 'prefer-const': ['error', { destructuring: 'any', ignoreReadBeforeAssign: false }], 'require-await': 'error', 'sort-imports': ['error', { ignoreDeclarationSort: true }], + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'off', + 'no-template-curly-in-string': 'off', + 'array-callback-return': 'off', + 'camelcase': 'off', + 'no-console': 'off', + 'quotes': ['error', 'single'], + 'comma-spacing': ['error', { before: false, after: true }], + 'keyword-spacing': ['error', { before: true, after: true }], + 'space-before-function-paren': ['error', 'always'], + 'object-curly-spacing': ['error', 'always'], + 'arrow-spacing': ['error', { before: true, after: true }], + 'key-spacing': ['error', { beforeColon: false, afterColon: true, mode: 'strict' }], + 'space-before-blocks': ['error', 'always'], + 'space-infix-ops': ['error', { int32Hint: false }], + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-extraneous-class': 'off', + 'comma-dangle': 'off', }, ignores: [ 'out', diff --git a/knip.ts b/knip.ts index 2a084de..8f3875a 100644 --- a/knip.ts +++ b/knip.ts @@ -13,8 +13,8 @@ const config: KnipConfig = { ignoreDependencies: ['ofetch', '@types/vscode-webview', 'prettier', 'prettier-plugin-tailwindcss'], ignore: ['build/**', 'prettier.config.ts'], vite: { - "config": [ - "vite.config.ts" + 'config': [ + 'vite.config.ts' ] } } diff --git a/snippets/Nuxt/boilerplates.json b/snippets/nuxt/boilerplates.json similarity index 100% rename from snippets/Nuxt/boilerplates.json rename to snippets/nuxt/boilerplates.json diff --git a/snippets/Nuxt/components.json b/snippets/nuxt/components.json similarity index 100% rename from snippets/Nuxt/components.json rename to snippets/nuxt/components.json diff --git a/snippets/Nuxt/composables.json b/snippets/nuxt/composables.json similarity index 100% rename from snippets/Nuxt/composables.json rename to snippets/nuxt/composables.json diff --git a/snippets/Nuxt/utils.json b/snippets/nuxt/utils.json similarity index 100% rename from snippets/Nuxt/utils.json rename to snippets/nuxt/utils.json diff --git a/src/codelens/index.ts b/src/codelens/index.ts index 1437e1d..68fed53 100644 --- a/src/codelens/index.ts +++ b/src/codelens/index.ts @@ -1,9 +1,9 @@ import { languages } from 'vscode'; -import { ModulesCodelensProvider } from './modules' -import { PluginsCodelensProvider } from './plugins' -import { LayersCodeLensProvider } from './layers' +import { LayersCodeLensProvider } from './layers'; +import { ModulesCodelensProvider } from './modules'; +import { PluginsCodelensProvider } from './plugins'; -function activateCodelenses() { +function activateCodelenses () { const modulesLens = new ModulesCodelensProvider() const pluginsLens = new PluginsCodelensProvider() const layersLens = new LayersCodeLensProvider() diff --git a/src/codelens/layers.ts b/src/codelens/layers.ts index 8d19e63..d95cf25 100644 --- a/src/codelens/layers.ts +++ b/src/codelens/layers.ts @@ -7,13 +7,13 @@ export class LayersCodeLensProvider implements CodeLensProvider { private _onDidChangeCodeLenses: EventEmitter = new EventEmitter() public readonly onDidChangeCodeLenses: Event = this._onDidChangeCodeLenses.event - constructor() { + constructor () { this.regex = /extends:/g, workspace.onDidChangeConfiguration((_) => { this._onDidChangeCodeLenses.fire() }) } - public provideCodeLenses(document: TextDocument): CodeLens[] | Thenable { + public provideCodeLenses (document: TextDocument): CodeLens[] | Thenable { this.codeLenses = [] const regex = new RegExp(this.regex) @@ -31,13 +31,13 @@ export class LayersCodeLensProvider implements CodeLensProvider { return this.codeLenses } - public resolveCodeLens(codeLens: CodeLens) { - if (workspace.getConfiguration("codelens-sample").get("enableCodeLens", true)) { + public resolveCodeLens (codeLens: CodeLens) { + if (workspace.getConfiguration('codelens-sample').get('enableCodeLens', true)) { codeLens.command = { title: 'Add new layer', - tooltip: "Nuxtr: Add new layer", + tooltip: 'Nuxtr: Add new layer', command: 'nuxtr.createLayer', - arguments: ["Argument 1", false] + arguments: ['Argument 1', false] } return codeLens } diff --git a/src/codelens/modules.ts b/src/codelens/modules.ts index 782705d..1d0c4c3 100644 --- a/src/codelens/modules.ts +++ b/src/codelens/modules.ts @@ -1,12 +1,4 @@ -import { - CodeLens, - CodeLensProvider, - Event, - EventEmitter, - Position, - TextDocument, - workspace, -} from 'vscode'; +import { CodeLens, CodeLensProvider, Event, EventEmitter, Position, TextDocument, workspace } from 'vscode'; export class ModulesCodelensProvider implements CodeLensProvider { @@ -15,7 +7,7 @@ export class ModulesCodelensProvider implements CodeLensProvider { private _onDidChangeCodeLenses: EventEmitter = new EventEmitter() public readonly onDidChangeCodeLenses: Event = this._onDidChangeCodeLenses.event - constructor() { + constructor () { this.regex = /modules:/g workspace.onDidChangeConfiguration((_) => { @@ -23,7 +15,7 @@ export class ModulesCodelensProvider implements CodeLensProvider { }) } - public provideCodeLenses(document: TextDocument): CodeLens[] | Thenable { + public provideCodeLenses (document: TextDocument): CodeLens[] | Thenable { this.codeLenses = [] const regex = new RegExp(this.regex) @@ -41,13 +33,13 @@ export class ModulesCodelensProvider implements CodeLensProvider { return this.codeLenses } - public resolveCodeLens(codeLens: CodeLens) { - if (workspace.getConfiguration("codelens-sample").get("enableCodeLens", true)) { + public resolveCodeLens (codeLens: CodeLens) { + if (workspace.getConfiguration('codelens-sample').get('enableCodeLens', true)) { codeLens.command = { title: 'Add new module', - tooltip: "Tooltip provided by sample extension", + tooltip: 'Tooltip provided by sample extension', command: 'nuxtr.createModuleAction', - arguments: ["Argument 1", false] + arguments: ['Argument 1', false] } return codeLens } diff --git a/src/codelens/plugins.ts b/src/codelens/plugins.ts index 6b65103..0d0ea86 100644 --- a/src/codelens/plugins.ts +++ b/src/codelens/plugins.ts @@ -7,7 +7,7 @@ export class PluginsCodelensProvider implements CodeLensProvider { private _onDidChangeCodeLenses: EventEmitter = new EventEmitter() public readonly onDidChangeCodeLenses: Event = this._onDidChangeCodeLenses.event - constructor() { + constructor () { this.regex = /plugins:/g workspace.onDidChangeConfiguration((_) => { @@ -15,9 +15,9 @@ export class PluginsCodelensProvider implements CodeLensProvider { }) } - public provideCodeLenses(document: TextDocument): CodeLens[] | Thenable { + public provideCodeLenses (document: TextDocument): CodeLens[] | Thenable { - if (workspace.getConfiguration("codelens-sample").get("enableCodeLens", true)) { + if (workspace.getConfiguration('codelens-sample').get('enableCodeLens', true)) { this.codeLenses = [] const regex = new RegExp(this.regex) const text = document.getText() @@ -36,13 +36,13 @@ export class PluginsCodelensProvider implements CodeLensProvider { return [] } - public resolveCodeLens(codeLens: CodeLens) { - if (workspace.getConfiguration("codelens-sample").get("enableCodeLens", true)) { + public resolveCodeLens (codeLens: CodeLens) { + if (workspace.getConfiguration('codelens-sample').get('enableCodeLens', true)) { codeLens.command = { title: 'Add new plugin', command: 'nuxtr.createPlugin', - tooltip: "Tooltip provided by sample extension", - arguments: ["Argument 1", false] + tooltip: 'Tooltip provided by sample extension', + arguments: ['Argument 1', false] } return codeLens } diff --git a/src/commands/CSS.ts b/src/commands/CSS.ts index deba9aa..3233436 100644 --- a/src/commands/CSS.ts +++ b/src/commands/CSS.ts @@ -20,7 +20,7 @@ enum VuetifyOptions { createConfigFile = 'Create Vuetify config file', } -function configureCSS() { +function configureCSS () { window .showQuickPick(frameworks, { canPickMany: false, @@ -85,7 +85,7 @@ const configureTailwind = () => { const filePath = `${await projectSrcDirectory()}/assets/css/tailwind.css` await createFile({ - fileName: `tailwind.css`, + fileName: 'tailwind.css', content: tailwindCSSFile, fullPath: filePath, }) @@ -144,7 +144,7 @@ const configureUno = async () => { if (selections.includes(UnoCSSOptions.createConfigFile)) { await createFile({ - fileName: `uno.config.ts`, + fileName: 'uno.config.ts', content: unoCSSConfig, fullPath: filePath, }) @@ -192,7 +192,7 @@ const configureVuetify = async () => { if (selections.includes(VuetifyOptions.createConfigFile)) { await createFile({ - fileName: `vuetify.config.ts`, + fileName: 'vuetify.config.ts', content: vuetifyConfigFile, fullPath: filePath, }) diff --git a/src/commands/Component.ts b/src/commands/Component.ts index 0ff2783..44fb809 100644 --- a/src/commands/Component.ts +++ b/src/commands/Component.ts @@ -1,4 +1,4 @@ -import { window } from 'vscode' +import { window } from 'vscode'; import { createDir, createFile, createSubFolders, generateVueFileBasicTemplate, projectSrcDirectory, showSubFolderQuickPick, } from '../utils'; const createComponent = () => { @@ -44,4 +44,4 @@ const directCreateComponent = (path: string) => { }) } -export { createComponent, directCreateComponent } +export { createComponent, directCreateComponent }; diff --git a/src/commands/Composable.ts b/src/commands/Composable.ts index 54f5a5a..9094296 100644 --- a/src/commands/Composable.ts +++ b/src/commands/Composable.ts @@ -1,6 +1,6 @@ import { window } from 'vscode' -import { createDir, createFile, createSubFolders, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick } from '../utils' import { composableTemplate } from '../templates' +import { createDir, createFile, createSubFolders, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick } from '../utils' const createComposable = () => { window @@ -8,7 +8,7 @@ const createComposable = () => { prompt: 'What is your composable name?', placeHolder: 'composable name', }) - .then(async(name) => { + .then(async (name) => { if (!name) { return } diff --git a/src/commands/Devtools.ts b/src/commands/Devtools.ts index 934eb40..b020f8c 100644 --- a/src/commands/Devtools.ts +++ b/src/commands/Devtools.ts @@ -1,9 +1,10 @@ -import { ThemeColor, window } from "vscode"; -import { readFileSync, writeFileSync } from "node:fs"; -import { trimEnd } from "string-ts"; -import { join } from "pathe"; -import { parseModule } from "magicast"; -import semver from 'semver' +import { parseModule } from 'magicast'; +import { readFileSync, writeFileSync } from 'node:fs'; +import { join } from 'pathe'; +import semver from 'semver'; +import { trimEnd } from 'string-ts'; +import { ThemeColor, window } from 'vscode'; +import { hideDevtoolsStatusBar, updateDevtoolsStatusBar } from '../statusBar'; import { findNuxtConfig, getInstallationCommand, @@ -11,37 +12,36 @@ import { isNuxtTwo, projectRootDirectory, runCommand, -} from "../utils"; -import { hideDevtoolsStatusBar, updateDevtoolsStatusBar } from "../statusBar"; +} from '../utils'; let mod: any; let nuxtConfigFile: string; -const moduleName = "@nuxt/devtools"; +const moduleName = '@nuxt/devtools'; const nuxtConfigPath = findNuxtConfig(); if (nuxtConfigPath) { - nuxtConfigFile = readFileSync(`${nuxtConfigPath}`, "utf8"); + nuxtConfigFile = readFileSync(`${nuxtConfigPath}`, 'utf8'); mod = parseModule(nuxtConfigFile, { sourceFileName: nuxtConfigPath }); } else { // window.showErrorMessage('Nuxt config file not found.') } const updateNuxtFile = () => { - nuxtConfigFile = readFileSync(`${nuxtConfigPath}`, "utf8"); + nuxtConfigFile = readFileSync(`${nuxtConfigPath}`, 'utf8'); mod = parseModule(nuxtConfigFile, { sourceFileName: nuxtConfigPath }); }; -async function readConfigFile() { +async function readConfigFile () { await updateNuxtFile(); const config = - mod.exports.default.$type === "function-call" + mod.exports.default.$type === 'function-call' ? mod.exports.default.$args[0] : mod.exports.default; return config; } -async function directToggleDevTools() { +async function directToggleDevTools () { try { const config = await readConfigFile(); let isEnabled: boolean; @@ -49,7 +49,7 @@ async function directToggleDevTools() { if (!config.devtools && !config.$development?.devtools) { config.devtools = { enabled: false }; window.showInformationMessage( - `Nuxt Devtools ${config.devtools.enabled ? "disabled" : "enabled"}.` + `Nuxt Devtools ${config.devtools.enabled ? 'disabled' : 'enabled'}.` ); } @@ -59,7 +59,7 @@ async function directToggleDevTools() { config.devtools.enabled = !isEnabled; window.showInformationMessage( - `Nuxt Devtools ${isEnabled ? "disabled" : "enabled"}.` + `Nuxt Devtools ${isEnabled ? 'disabled' : 'enabled'}.` ); } else if (config.$development?.devtools) { isEnabled = config.$development.devtools.enabled; @@ -67,59 +67,59 @@ async function directToggleDevTools() { config.$development.devtools.enabled = !isEnabled; window.showInformationMessage( - `Nuxt Devtools ${isEnabled ? "disabled" : "enabled"}.` + `Nuxt Devtools ${isEnabled ? 'disabled' : 'enabled'}.` ); } const generated = mod.generate().code; - writeFileSync(`${nuxtConfigPath}`, `${trimEnd(generated)}\n`, "utf8"); + writeFileSync(`${nuxtConfigPath}`, `${trimEnd(generated)}\n`, 'utf8'); return; } catch (error) { window.showErrorMessage(`Error toggling Nuxt Devtools: ${error}`); } } -function isDevtoolsInstalled(): Promise { +function isDevtoolsInstalled (): Promise { const packageJsonPath = join(`${projectRootDirectory()}/package.json`); const packageJson = require(packageJsonPath); return ( (packageJson.dependencies && - packageJson.dependencies["@nuxt/devtools"] !== undefined) || + packageJson.dependencies['@nuxt/devtools'] !== undefined) || (packageJson.devDependencies && - packageJson.devDependencies["@nuxt/devtools"] !== undefined) + packageJson.devDependencies['@nuxt/devtools'] !== undefined) ); } -async function installDevtools() { +async function installDevtools () { const response = await window.showErrorMessage( - "Nuxt Devtools is not installed. Install it?", - "Install", - "Close" + 'Nuxt Devtools is not installed. Install it?', + 'Install', + 'Close' ); - if (response === "Install") { + if (response === 'Install') { const command = await getInstallationCommand(moduleName, true); await runCommand({ command, - message: "Installing Nuxt Devtools", - successMessage: "Nuxt Devtools installed successfully", - errorMessage: "Nuxt Devtools installation failed", + message: 'Installing Nuxt Devtools', + successMessage: 'Nuxt Devtools installed successfully', + errorMessage: 'Nuxt Devtools installation failed', }).then(() => { const generated = mod.generate().code; - writeFileSync(`${nuxtConfigPath}`, `${trimEnd(generated)}\n`, "utf8"); + writeFileSync(`${nuxtConfigPath}`, `${trimEnd(generated)}\n`, 'utf8'); }); } } -async function nuxtConfigWatcher() { +async function nuxtConfigWatcher () { const config = await readConfigFile(); let devtoolsEnabled = false; if (config.$development) { if ( config.$development.devtools && - typeof config.$development.devtools === "object" + typeof config.$development.devtools === 'object' ) { devtoolsEnabled = config.$development.devtools.enabled; } @@ -129,23 +129,23 @@ async function nuxtConfigWatcher() { devtoolsEnabled = false; } - const statusText = devtoolsEnabled ? "$(nuxt-logo)" : "$(nuxt-disabled)"; + const statusText = devtoolsEnabled ? '$(nuxt-logo)' : '$(nuxt-disabled)'; const tooltip = devtoolsEnabled - ? "Nuxt Devtools: Installed & Enabled" - : "Nuxt Devtools: Installed & Disabled"; + ? 'Nuxt Devtools: Installed & Enabled' + : 'Nuxt Devtools: Installed & Disabled'; const color = devtoolsEnabled - ? "#00DC82" - : new ThemeColor("activityBar.inactiveForeground"); + ? '#00DC82' + : new ThemeColor('activityBar.inactiveForeground'); updateDevtoolsStatusBar({ - command: "nuxtr.directToggleDevTools", + command: 'nuxtr.directToggleDevTools', tooltip, text: statusText, color, }); } -async function nuxtDevToolsHandler() { +async function nuxtDevToolsHandler () { const isInstalled = isDevtoolsInstalled(); const nuxtTwo = isNuxtTwo(); let isDevtoolsNative = false; @@ -158,22 +158,22 @@ async function nuxtDevToolsHandler() { if (nuxtTwo) { updateDevtoolsStatusBar({ command: '', - tooltip: "Nuxt Devtools: Not supported for Nuxt 2", - text: "$(nuxt-disabled)", - color: new ThemeColor("activityBar.inactiveForeground"), + tooltip: 'Nuxt Devtools: Not supported for Nuxt 2', + text: '$(nuxt-disabled)', + color: new ThemeColor('activityBar.inactiveForeground'), }); hideDevtoolsStatusBar() } else if (!isInstalled && !isDevtoolsNative) { await installDevtools(); updateDevtoolsStatusBar({ - command: "nuxtr.directUpgradeNuxt", - tooltip: "Nuxt Devtools: Not installed", - text: "$(nuxt-disabled)", - color: "#FE0601", + command: 'nuxtr.directUpgradeNuxt', + tooltip: 'Nuxt Devtools: Not installed', + text: '$(nuxt-disabled)', + color: '#FE0601', }); } else { const config = await readConfigFile(); - if (typeof config.devtools === "boolean") { + if (typeof config.devtools === 'boolean') { config.devtools = { enabled: config.devtools, }; @@ -181,18 +181,18 @@ async function nuxtDevToolsHandler() { if (!config.devtools || config.devtools.enabled === false) { updateDevtoolsStatusBar({ - command: "nuxtr.directToggleDevTools", - tooltip: "Nuxt Devtools: Installed & Disabled", - color: new ThemeColor("activityBar.inactiveForeground"), - text: "$(nuxt-disabled)", + command: 'nuxtr.directToggleDevTools', + tooltip: 'Nuxt Devtools: Installed & Disabled', + color: new ThemeColor('activityBar.inactiveForeground'), + text: '$(nuxt-disabled)', }); return; } else { updateDevtoolsStatusBar({ - command: "nuxtr.directToggleDevTools", - tooltip: "Nuxt Devtools: Installed & Enabled", - text: "$(nuxt-logo)", - color: "#00DC82", + command: 'nuxtr.directToggleDevTools', + tooltip: 'Nuxt Devtools: Installed & Enabled', + text: '$(nuxt-logo)', + color: '#00DC82', }); } } @@ -201,5 +201,5 @@ async function nuxtDevToolsHandler() { export { directToggleDevTools, nuxtConfigWatcher, - nuxtDevToolsHandler, + nuxtDevToolsHandler }; diff --git a/src/commands/FileTemplates.ts b/src/commands/FileTemplates.ts index 1f864c5..52758be 100644 --- a/src/commands/FileTemplates.ts +++ b/src/commands/FileTemplates.ts @@ -1,10 +1,9 @@ -import { window } from 'vscode' import { existsSync, mkdirSync } from 'node:fs' - +import { window } from 'vscode' import { createFile, createSubFolders, createVueTemplate, generateVueFileBasicTemplate, generateVueFileTemplate, projectRootDirectory, projectSrcDirectory, showSubFolderQuickPick } from '../utils' -function createPageTemplate() { +function createPageTemplate () { const editor = window.activeTextEditor if (editor) { const selection = editor.selection @@ -20,7 +19,7 @@ function createPageTemplate() { } } -function createLayoutTemplate() { +function createLayoutTemplate () { const editor = window.activeTextEditor if (editor) { const selection = editor.selection @@ -41,8 +40,8 @@ const createFileFromTemplate = (template?: string) => { window .showInputBox({ - prompt: `What is your page name?`, - placeHolder: `Page name`, + prompt: 'What is your page name?', + placeHolder: 'Page name', }) .then(async (name) => { if (!name) { return } @@ -61,7 +60,7 @@ const createFileFromTemplate = (template?: string) => { name, subFolders, commandType: 'pages', - content: generateVueFileTemplate(`page`, template), + content: generateVueFileTemplate('page', template), }) }) } else { @@ -83,7 +82,7 @@ const createFileFromTemplate = (template?: string) => { createFile({ fileName: `${name}.vue`, - content: generateVueFileTemplate(`layout`, template), + content: generateVueFileTemplate('layout', template), fullPath: filePath, }) }) @@ -131,4 +130,4 @@ const createEmptyFileTemplate = () => { } -export { createPageTemplate, createLayoutTemplate, createFileFromTemplate, createEmptyFileTemplate } \ No newline at end of file +export { createEmptyFileTemplate, createFileFromTemplate, createLayoutTemplate, createPageTemplate } diff --git a/src/commands/InstallDependencies.ts b/src/commands/InstallDependencies.ts index bc3f2dd..6321752 100644 --- a/src/commands/InstallDependencies.ts +++ b/src/commands/InstallDependencies.ts @@ -1,7 +1,6 @@ -import * as vscode from "vscode" -import { detectPackageManagerByName } from "../utils" -import pm from "../content/pm" -import { newTerminal } from "../utils"; +import * as vscode from 'vscode'; +import pm from '../content/pm'; +import { detectPackageManagerByName, newTerminal } from '../utils'; export const installDependencies = () => { @@ -16,14 +15,14 @@ export const installDependencies = () => { const options: vscode.QuickPickOptions = { canPickMany: false, ignoreFocusOut: true, - placeHolder: "No package manager detected. Chose one!", + placeHolder: 'No package manager detected. Chose one!', } if (packageManager) { - if (packageManager.installCommand.includes("yarn")) { - packageManager.installCommand = "yarn" + if (packageManager.installCommand.includes('yarn')) { + packageManager.installCommand = 'yarn' } - newTerminal("Install Dependencies", packageManager.installCommand) + newTerminal('Install Dependencies', packageManager.installCommand) } else { vscode.window.showQuickPick(items, options).then((name) => { if (name) { @@ -31,7 +30,7 @@ export const installDependencies = () => { (item) => item.name === name.label )?.installCommand if (command) { - newTerminal("Install Dependencies", command) + newTerminal('Install Dependencies', command) } } }) diff --git a/src/commands/Layout.ts b/src/commands/Layout.ts index f80ab32..fc326a1 100644 --- a/src/commands/Layout.ts +++ b/src/commands/Layout.ts @@ -1,7 +1,5 @@ import { window } from 'vscode' import { createDir, createFile, normalizeFileExtension, projectSrcDirectory } from '../utils' - - import { generateVueFileTemplate } from '../utils/files' diff --git a/src/commands/Linters.ts b/src/commands/Linters.ts index 61c896d..4e71bbe 100644 --- a/src/commands/Linters.ts +++ b/src/commands/Linters.ts @@ -1,7 +1,7 @@ -import { ConfigurationTarget, window, workspace } from 'vscode' import { writeFileSync } from 'node:fs' -import { createFile, getInstallationCommand, injectPkgJSONScript, openExternalLink, projectRootDirectory, runCommand, updateNuxtConfig} from '../utils' +import { ConfigurationTarget, window, workspace } from 'vscode' import { eslintConfig, stylelintConfig, stylelintIgnore } from '../templates' +import { createFile, getInstallationCommand, injectPkgJSONScript, openExternalLink, projectRootDirectory, runCommand, updateNuxtConfig } from '../utils' const frameworks = ['Eslint', 'Stylelint'] enum StylelintOptions { @@ -10,7 +10,7 @@ enum StylelintOptions { createStyleLintAndIgnoreFiles = 'Create .stylelintrc & .stylelintignore files', } -function configureLinters() { +function configureLinters () { window .showQuickPick(frameworks, { canPickMany: false, @@ -35,7 +35,7 @@ const configureEslint = async () => { await runCommand({ command: eslintCommand, - message: `Installing Eslint`, + message: 'Installing Eslint', successMessage: 'Eslint installed successfully', errorMessage: 'Eslint installation failed', }) @@ -56,7 +56,7 @@ const configureEslint = async () => { await injectPkgJSONScript(scriptName, script) await createFile({ - fileName: `eslint.config.mjs`, + fileName: 'eslint.config.mjs', content: eslintConfig, fullPath: `${projectRootDirectory()}/eslint.config.mjs` }) @@ -75,9 +75,9 @@ const configureEslint = async () => { if (devServerChecker === 'Yes') { await runCommand({ command: devServerCheckerCommand, - message: `Installing vite-plugin-eslint2 module`, - successMessage: `vite-plugin-eslint2 installed successfully`, - errorMessage: `vite-plugin-eslint2 installation failed`, + message: 'Installing vite-plugin-eslint2 module', + successMessage: 'vite-plugin-eslint2 installed successfully', + errorMessage: 'vite-plugin-eslint2 installation failed', }) await updateNuxtConfig('inject-eslint-devChcker') @@ -106,9 +106,9 @@ const configureStylelint = () => { await runCommand({ command, - message: `Installing stylelint, @nuxtjs/stylelint-module, stylelint-config-recommended-vue modules`, - successMessage: `stylelint, @nuxtjs/stylelint-module, stylelint-config-recommended-vue modules installed successfully`, - errorMessage: `stylelint, @nuxtjs/stylelint-module, stylelint-config-recommended-vue modules installation failed`, + message: 'Installing stylelint, @nuxtjs/stylelint-module, stylelint-config-recommended-vue modules', + successMessage: 'stylelint, @nuxtjs/stylelint-module, stylelint-config-recommended-vue modules installed successfully', + errorMessage: 'stylelint, @nuxtjs/stylelint-module, stylelint-config-recommended-vue modules installation failed', }) } @@ -127,13 +127,13 @@ const configureStylelint = () => { const stylelintIgnorePath = `${projectRootDirectory()}/.stylelintignore` await createFile({ - fileName: `.stylelintignore`, + fileName: '.stylelintignore', content: stylelintIgnore, fullPath: stylelintIgnorePath, }) await createFile({ - fileName: `.stylelintrc`, + fileName: '.stylelintrc', content: stylelintConfig, fullPath: stylelintPath, }) diff --git a/src/commands/Middleware.ts b/src/commands/Middleware.ts index 4720c89..75c8280 100644 --- a/src/commands/Middleware.ts +++ b/src/commands/Middleware.ts @@ -1,6 +1,6 @@ import { window } from 'vscode' -import { createDir, createFile, createSubFolders, hasServerDir, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick} from '../utils' import { nitroDefaultTemplate, nuxtMiddlewareTemplate } from '../templates' +import { createDir, createFile, createSubFolders, hasServerDir, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick } from '../utils' const createMiddleware = () => { window diff --git a/src/commands/Nitro.ts b/src/commands/Nitro.ts index f727f26..d1ab979 100644 --- a/src/commands/Nitro.ts +++ b/src/commands/Nitro.ts @@ -1,6 +1,6 @@ -import { window } from 'vscode' -import { createDir, createFile, createSubFolders, hasServerDir, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick } from '../utils' -import { nitroDefaultTemplate, nitroPluginTemplate, nitroUtilTemplate } from '../templates' +import { window } from 'vscode'; +import { nitroDefaultTemplate, nitroPluginTemplate, nitroUtilTemplate } from '../templates'; +import { createDir, createFile, createSubFolders, hasServerDir, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick } from '../utils'; const createNitroAPI = () => { window @@ -177,11 +177,5 @@ const directCreateNitroRoute = (path: string) => { } export { - createNitroAPI, - directCreateNitroAPI, - createNitroRoute, - directCreateNitroRoute, - createNitroPlugin, - createNitroMiddleware, - createNitroUtil -} + createNitroAPI, createNitroMiddleware, createNitroPlugin, createNitroRoute, createNitroUtil, directCreateNitroAPI, directCreateNitroRoute +}; diff --git a/src/commands/Nuxi/commonCommands.ts b/src/commands/Nuxi/commonCommands.ts index 3928889..752992c 100644 --- a/src/commands/Nuxi/commonCommands.ts +++ b/src/commands/Nuxi/commonCommands.ts @@ -12,4 +12,4 @@ const nuxtAnalyze = () => newTerminal('Nuxi: Analyze', `${runCommand} nuxi analy const nuxtInfo = () => newTerminal('Nuxi: Info', `${runCommand} nuxi info`, `${projectRootDirectory()}`) const nuxtModule = async () => await handleModuleCommand() -export { nuxtDev, nuxtBuild, nuxtGenerate, nuxtCleanUp, nuxtAnalyze, nuxtInfo, nuxtModule } \ No newline at end of file +export { nuxtAnalyze, nuxtBuild, nuxtCleanUp, nuxtDev, nuxtGenerate, nuxtInfo, nuxtModule }; diff --git a/src/commands/Nuxi/index.ts b/src/commands/Nuxi/index.ts index ac3cb3a..26d5e29 100644 --- a/src/commands/Nuxi/index.ts +++ b/src/commands/Nuxi/index.ts @@ -1,32 +1,31 @@ -import { QuickPickItem, ThemeIcon, window } from 'vscode'; import { capitalize } from 'string-ts'; +import { QuickPickItem, ThemeIcon, window } from 'vscode'; import { detectPackageManagerByName, newTerminal, projectRootDirectory } from '../../utils'; - -import { handleAddCommand, handleDevtoolsCommand, handleModuleCommand } from './multiStepCommands'; import { tryImportNuxi } from '../../nuxi'; +import { handleAddCommand, handleDevtoolsCommand, handleModuleCommand } from './multiStepCommands'; const pm = detectPackageManagerByName(); const runCommand = pm ? pm.runCommand : 'npx'; enum CLICommandDescription { - add = "Create a new template file", - analyze = "Build nuxt and analyze production bundle (experimental)", - "build-module" = "Helper command for using @nuxt/module-builder", - build = "Build nuxt for production deployment", - cleanup = "Cleanup generated nuxt files and caches", - _dev = "Run nuxt development server (internal command to start child process)", - dev = "Run nuxt development server", - devtools = "Enable or disable devtools in a Nuxt project", - generate = "Build Nuxt and prerender all routes", - info = "Get information about nuxt project", - init = "Initialize a fresh project", - module = "Manage Nuxt Modules", - prepare = "Prepare nuxt for development/build", - preview = "Launches nitro server for local testing after nuxi build", - start = "Launches nitro server for local testing after nuxi build", - test = "Run tests", - typecheck = "Runs vue-tsc to check types throughout your app", - upgrade = "Upgrade nuxt" + add = 'Create a new template file', + analyze = 'Build nuxt and analyze production bundle (experimental)', + 'build-module' = 'Helper command for using @nuxt/module-builder', + build = 'Build nuxt for production deployment', + cleanup = 'Cleanup generated nuxt files and caches', + _dev = 'Run nuxt development server (internal command to start child process)', + dev = 'Run nuxt development server', + devtools = 'Enable or disable devtools in a Nuxt project', + generate = 'Build Nuxt and prerender all routes', + info = 'Get information about nuxt project', + init = 'Initialize a fresh project', + module = 'Manage Nuxt Modules', + prepare = 'Prepare nuxt for development/build', + preview = 'Launches nitro server for local testing after nuxi build', + start = 'Launches nitro server for local testing after nuxi build', + test = 'Run tests', + typecheck = 'Runs vue-tsc to check types throughout your app', + upgrade = 'Upgrade nuxt' } const directlyExecutableCommands = new Set([ 'dev', 'build', 'generate', 'cleanup', 'analyze', 'build-module', 'info', 'typecheck', 'preview', 'prepare', 'upgrade', 'start', 'test' ]); @@ -100,6 +99,6 @@ const showCLICommands = async () => { }; -export { showCLICommands } +export { showCLICommands }; -export {nuxtDev, nuxtBuild, nuxtGenerate, nuxtCleanUp, nuxtAnalyze, nuxtInfo, nuxtModule} from './commonCommands'; \ No newline at end of file +export { nuxtAnalyze, nuxtBuild, nuxtCleanUp, nuxtDev, nuxtGenerate, nuxtInfo, nuxtModule } from './commonCommands'; diff --git a/src/commands/Nuxi/multiStepCommands.ts b/src/commands/Nuxi/multiStepCommands.ts index 112478a..2c3d883 100644 --- a/src/commands/Nuxi/multiStepCommands.ts +++ b/src/commands/Nuxi/multiStepCommands.ts @@ -1,7 +1,7 @@ +import { ofetch } from 'ofetch'; import { QuickPickItem, QuickPickOptions, window } from 'vscode'; -import { ofetch } from 'ofetch' -import { detectPackageManagerByName, isNuxtTwo, newTerminal, projectRootDirectory } from '../../utils'; import type { nuxtModule } from '../../types'; +import { detectPackageManagerByName, isNuxtTwo, newTerminal, projectRootDirectory } from '../../utils'; const pm = detectPackageManagerByName(); @@ -47,7 +47,7 @@ export const handleAddCommand = (): void => { return; } - const terminalName = `Nuxi: Add`; + const terminalName = 'Nuxi: Add'; const command = `nuxi add ${template} ${templateName}`; newTerminal(terminalName, command, `${projectRootDirectory()}`); }); @@ -89,7 +89,7 @@ export const handleModuleCommand = async () => { return; } - const terminalName = `Nuxi: Module`; + const terminalName = 'Nuxi: Module'; const command = `${runCommand} nuxi module add ${userSelection}`; newTerminal(terminalName, command, `${projectRootDirectory()}`); }); @@ -120,7 +120,7 @@ export const handleDevtoolsCommand = () => { } const state = selection.label; - const terminalName = `Nuxi: Devtools`; + const terminalName = 'Nuxi: Devtools'; const command = `nuxi devtools ${state}`; newTerminal(terminalName, command, `${projectRootDirectory()}`); }) diff --git a/src/commands/Page.ts b/src/commands/Page.ts index 2113f77..3b15669 100644 --- a/src/commands/Page.ts +++ b/src/commands/Page.ts @@ -1,6 +1,5 @@ import { window } from 'vscode' import { createDir, createFile, createSubFolders, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick } from '../utils' - import { generateVueFileTemplate } from '../utils/files' const createPage = () => { @@ -9,7 +8,7 @@ const createPage = () => { prompt: 'What is your page name?', placeHolder: 'page name', }) - .then(async(name) => { + .then(async (name) => { if (!name) {return} const pagesDir = `${await projectSrcDirectory()}/pages` @@ -27,7 +26,7 @@ const createPage = () => { }) } -function directCreatePage(path: string) { +function directCreatePage (path: string) { window .showInputBox({ prompt: 'What is your page name?', diff --git a/src/commands/Plugin.ts b/src/commands/Plugin.ts index 7508de9..722241a 100644 --- a/src/commands/Plugin.ts +++ b/src/commands/Plugin.ts @@ -1,6 +1,6 @@ import { window } from 'vscode' -import { createDir, createFile, createSubFolders, hasServerDir, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick } from '../utils' import { nitroPluginTemplate, nuxtPluginTemplate } from '../templates' +import { createDir, createFile, createSubFolders, hasServerDir, normalizeFileExtension, projectSrcDirectory, showSubFolderQuickPick } from '../utils' const createPlugin = () => { window diff --git a/src/commands/Project.ts b/src/commands/Project.ts index ecf7234..e18b958 100644 --- a/src/commands/Project.ts +++ b/src/commands/Project.ts @@ -1,6 +1,6 @@ -import { OpenDialogOptions, QuickInputButton, QuickPick, QuickPickItem, ThemeIcon, Uri, window } from 'vscode'; import { downloadTemplate } from 'giget'; import { ofetch } from 'ofetch'; +import { OpenDialogOptions, QuickInputButton, QuickPick, QuickPickItem, ThemeIcon, Uri, window } from 'vscode'; import { NuxtOfficialTemplate, UserProjectTemplate } from '../types'; import { nuxtrConfiguration, openExternalLink, openFolder, quickOpenButtons } from '../utils'; @@ -23,7 +23,7 @@ const fetchOfficialTemplates = async (): Promise => { const res = await ofetch('https://nuxt.new/data/starters.json'); return res as NuxtOfficialTemplate[]; } catch { - window.showErrorMessage(`Failed to fetch Nuxt templates`); + window.showErrorMessage('Failed to fetch Nuxt templates'); return []; } }; @@ -37,7 +37,7 @@ const fetchUserTemplates = (): UserProjectTemplate[] => { branch: item.branch, } as UserProjectTemplate)); } catch { - window.showErrorMessage(`Failed to fetch user templates`); + window.showErrorMessage('Failed to fetch user templates'); return []; } }; @@ -45,7 +45,7 @@ const fetchTemplate = async (repo: NuxtOfficialTemplate, path: string, projectNa try { await downloadTemplate(`${repo.branch}`, { cwd: path, - registry: "https://raw.githubusercontent.com/nuxt/starter/templates/templates", + registry: 'https://raw.githubusercontent.com/nuxt/starter/templates/templates', dir: projectName, }); } catch { @@ -84,14 +84,14 @@ const createProjectPrompt = (officialTemplates: NuxtOfficialTemplate[], userTemp picker.canSelectMany = false; picker.ignoreFocusOut = true; picker.matchOnDescription = true; - picker.placeholder = "Select a Nuxt starter"; + picker.placeholder = 'Select a Nuxt starter'; const officialItems: QuickPickItem[] = officialTemplates.map((item) => ({ label: item.name, description: item.description, buttons: [quickOpenButtons.github, quickOpenButtons.docs], package: item, - iconPath: new ThemeIcon("nuxt-logo"), + iconPath: new ThemeIcon('nuxt-logo'), } as QuickPickItem)); const userItems: QuickPickItem[] = userTemplates.map((item) => ({ @@ -100,7 +100,7 @@ const createProjectPrompt = (officialTemplates: NuxtOfficialTemplate[], userTemp // Hide buttons for user templates buttons: [], package: item, - iconPath: new ThemeIcon("account"), + iconPath: new ThemeIcon('account'), } as QuickPickItem)); picker.items = [...officialItems, ...userItems]; @@ -149,7 +149,7 @@ const handleFileUri = async (fileUri: Uri[] | undefined, template: (NuxtOfficial await fetchUserTemplate(userTemplate, fileUri[0].fsPath, proName); } - const result = await window.showInformationMessage(`Project created`, 'Open in current window', 'Open in new window'); + const result = await window.showInformationMessage('Project created', 'Open in current window', 'Open in new window'); const projectPath = `${fileUri[0].fsPath}/${proName}`; const projectURI = Uri.file(projectPath); @@ -184,7 +184,7 @@ const handleItemButton = (e: { item: QuickPickItem & { package: NuxtOfficialTemp } }; -export async function createProject() { +export async function createProject () { try { const nuxtTemplates = await fetchOfficialTemplates() as NuxtOfficialTemplate[]; const userTemplates = await fetchUserTemplates() as UserProjectTemplate[]; @@ -195,6 +195,6 @@ export async function createProject() { return; } } catch { - window.showErrorMessage(`Failed to fetch Nuxt starters`); + window.showErrorMessage('Failed to fetch Nuxt starters'); } } diff --git a/src/commands/Store.ts b/src/commands/Store.ts index 3084489..f249741 100644 --- a/src/commands/Store.ts +++ b/src/commands/Store.ts @@ -14,7 +14,7 @@ import { import { vuexContent } from '../templates' -async function detectPiniaModule() { +async function detectPiniaModule () { const moduleName = '@pinia/nuxt' const isConfigured = isModuleConfigured(moduleName) const installationCommand = await getInstallationCommand(moduleName, true) diff --git a/src/commands/Structure.ts b/src/commands/Structure.ts index ebe7fb2..d29ba0d 100644 --- a/src/commands/Structure.ts +++ b/src/commands/Structure.ts @@ -1,9 +1,9 @@ -import { window } from 'vscode' import { existsSync, mkdirSync } from 'node:fs' -import { createFile, generateVueFileTemplate, isNuxtTwo, projectRootDirectory, projectSrcDirectory } from '../utils' +import { window } from 'vscode' import { appConfigContent } from '../templates' +import { createFile, generateVueFileTemplate, isNuxtTwo, projectRootDirectory, projectSrcDirectory } from '../utils' -function promptDirectorySelection() { +function promptDirectorySelection () { let directories = ['components', 'pages', 'assets', 'plugins', 'layouts', 'middleware', 'modules',] const nuxtTwoDirectories = ['static', 'store',] @@ -29,7 +29,7 @@ function promptDirectorySelection() { if (dir === 'pages') { await createFile({ - fileName: `index.vue`, + fileName: 'index.vue', content: generateVueFileTemplate('page'), fullPath: `${dirPath}/index.vue`, }) @@ -37,7 +37,7 @@ function promptDirectorySelection() { if (dir === 'layouts') { await createFile({ - fileName: `default.vue`, + fileName: 'default.vue', content: generateVueFileTemplate('layout'), fullPath: `${dirPath}/default.vue`, }) @@ -85,4 +85,4 @@ const errorLayout = async () => { }) } -export { projectStructure, appConfig, nuxtIgnore, nuxtRC, errorLayout } +export { appConfig, errorLayout, nuxtIgnore, nuxtRC, projectStructure } diff --git a/src/commands/Templates.ts b/src/commands/Templates.ts index 9a79bc6..0116752 100644 --- a/src/commands/Templates.ts +++ b/src/commands/Templates.ts @@ -1,8 +1,8 @@ -import { window } from 'vscode' import { existsSync } from 'node:fs' -import { getInstallationCommand, projectRootDirectory, runCommand } from '../utils' -import type { TSConfigNuxt } from '../types' import { readTSConfig, writeTSConfig } from 'pkg-types' +import { window } from 'vscode' +import type { TSConfigNuxt } from '../types' +import { getInstallationCommand, projectRootDirectory, runCommand } from '../utils' export enum PugConfigurationSteps { installPug = 'Install Pug', diff --git a/src/commands/Util.ts b/src/commands/Util.ts index 9c31b21..d98b16d 100644 --- a/src/commands/Util.ts +++ b/src/commands/Util.ts @@ -1,6 +1,6 @@ import { window } from 'vscode' -import { createDir, createFile, createSubFolders, hasServerDir, projectSrcDirectory, showSubFolderQuickPick } from '../utils' import { nitroUtilTemplate, nuxtUtilTemplate } from '../templates' +import { createDir, createFile, createSubFolders, hasServerDir, projectSrcDirectory, showSubFolderQuickPick } from '../utils' const createUtil = () => { window diff --git a/src/commands/index.ts b/src/commands/index.ts index f64df04..9d35c9a 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -1,24 +1,24 @@ -import { createComponent, directCreateComponent } from './Component' -import { createPage, directCreatePage } from './Page' -import { createComposable, directCreateComposable } from './Composable' -import { createLayout, directCreateLayout } from './Layout' -import { createPlugin, directCreatePlugin } from './Plugin' -import { createMiddleware, directCreateMiddleware } from './Middleware' -import { createNitroAPI, createNitroMiddleware, createNitroPlugin, createNitroRoute, createNitroUtil, directCreateNitroAPI, directCreateNitroRoute } from './Nitro' -import { appConfig, errorLayout, nuxtIgnore, nuxtRC, projectStructure } from './Structure' -import { openDocumentation, openModules } from './externalLinks' -import { nuxtAnalyze, nuxtBuild, nuxtCleanUp, nuxtDev, nuxtGenerate, nuxtInfo, nuxtModule, showCLICommands } from './Nuxi' -import { createStore, directCreateStore } from './Store' -import { installDependencies } from './InstallDependencies' -import { openSettings } from '../utils/navigation' import { managePackageVersion, upgradePackage } from '../utils/dependency' -import { configureCSS } from './CSS' -import { configureLinters } from './Linters' -import { configurePug } from './Templates' -import { createEmptyFileTemplate, createFileFromTemplate, createLayoutTemplate, createPageTemplate } from './FileTemplates' -import { directToggleDevTools, nuxtConfigWatcher } from './Devtools' -import { createUtil, directCreateUtil } from './Util' -import { createProject } from './Project' +import { openSettings } from '../utils/navigation' +import { createComponent, directCreateComponent } from './component' +import { createComposable, directCreateComposable } from './composable' +import { configureCSS } from './css' +import { directToggleDevTools, nuxtConfigWatcher } from './devtools' +import { openDocumentation, openModules } from './externalLinks' +import { createEmptyFileTemplate, createFileFromTemplate, createLayoutTemplate, createPageTemplate } from './fileTemplates' +import { installDependencies } from './installDependencies' +import { createLayout, directCreateLayout } from './layout' +import { configureLinters } from './linters' +import { createMiddleware, directCreateMiddleware } from './middleware' +import { createNitroAPI, createNitroMiddleware, createNitroPlugin, createNitroRoute, createNitroUtil, directCreateNitroAPI, directCreateNitroRoute } from './nitro' +import { nuxtAnalyze, nuxtBuild, nuxtCleanUp, nuxtDev, nuxtGenerate, nuxtInfo, nuxtModule, showCLICommands } from './nuxi' +import { createPage, directCreatePage } from './page' +import { createPlugin, directCreatePlugin } from './plugin' +import { createProject } from './project' +import { createStore, directCreateStore } from './store' +import { appConfig, errorLayout, nuxtIgnore, nuxtRC, projectStructure } from './structure' +import { configurePug } from './templates' +import { createUtil, directCreateUtil } from './util' const commands = { diff --git a/src/extension.ts b/src/extension.ts index 87b3042..7acb337 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -66,7 +66,7 @@ export const publicCommands = [ // categorize commands and functions -export function activateExtension(context: ExtensionContext) { +export function activateExtension (context: ExtensionContext) { // initial output channel logger logger.log('Nuxtr is active') diff --git a/src/index.ts b/src/index.ts index 26f303d..c9b7e9c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,8 @@ import { ExtensionContext, commands } from 'vscode'; import { activateExtension, publicCommands } from './extension' -import { isNuxtProject , isNuxtTwo } from './utils'; +import { isNuxtProject, isNuxtTwo } from './utils'; -export async function activate(context: ExtensionContext) { +export async function activate (context: ExtensionContext) { const isNuxt = await isNuxtProject(); diff --git a/src/intellisense/completionProviders/nuxtIgnore.ts b/src/intellisense/completionProviders/nuxtIgnore.ts index b467f59..d9b3168 100644 --- a/src/intellisense/completionProviders/nuxtIgnore.ts +++ b/src/intellisense/completionProviders/nuxtIgnore.ts @@ -1,13 +1,13 @@ -import * as vscode from 'vscode'; import { existsSync, readdirSync } from 'node:fs'; import { dirname, extname, join, sep } from 'pathe'; +import * as vscode from 'vscode'; const EXTENSIONS = new Set(['.vue', '.js', '.ts']); const DIR_SEPARATOR = sep; const SCOPED_DIRECTORIES = new Set(['components', 'layouts', 'pages', 'composables', 'middleware']); export class NuxtIgnoreCompletionProvider implements vscode.CompletionItemProvider { - provideCompletionItems( + provideCompletionItems ( document: vscode.TextDocument, position: vscode.Position, ): vscode.ProviderResult { @@ -45,7 +45,7 @@ export class NuxtIgnoreCompletionProvider implements vscode.CompletionItemProvid return []; } - private createCompletionItems(directories: string[]): vscode.CompletionItem[] { + private createCompletionItems (directories: string[]): vscode.CompletionItem[] { return directories.map(subDir => { const type = this.getCompletionItemType(subDir); const item = new vscode.CompletionItem(subDir, type); @@ -58,12 +58,12 @@ export class NuxtIgnoreCompletionProvider implements vscode.CompletionItemProvid }); } - private getCompletionItemType(name: string): vscode.CompletionItemKind { + private getCompletionItemType (name: string): vscode.CompletionItemKind { const extension = extname(name); return EXTENSIONS.has(extension) ? vscode.CompletionItemKind.File : vscode.CompletionItemKind.Folder; } - private getSubDirectories(directory: string): string[] { + private getSubDirectories (directory: string): string[] { directory = directory.replace(/!/g, ''); try { @@ -79,11 +79,11 @@ export class NuxtIgnoreCompletionProvider implements vscode.CompletionItemProvid return []; } - private getTopLevelSubDirectories(directory: string): string[] { + private getTopLevelSubDirectories (directory: string): string[] { return this.getSubDirectories(directory).filter(subDir => SCOPED_DIRECTORIES.has(subDir)); } - private logError(error: any): void { + private logError (error: any): void { console.error(error); } } diff --git a/src/intellisense/completionProviders/nuxtRC.ts b/src/intellisense/completionProviders/nuxtRC.ts index e024d73..bf3b377 100644 --- a/src/intellisense/completionProviders/nuxtRC.ts +++ b/src/intellisense/completionProviders/nuxtRC.ts @@ -1,31 +1,31 @@ +import * as nuxtRcSchemaJson from '@nuxt/schema/schema/config.schema.json'; import * as vscode from 'vscode'; -import * as nuxtRcSchemaJson from "@nuxt/schema/schema/config.schema.json"; import type { ConfigurationProperty } from '../../types'; const nuxtRcSchema = nuxtRcSchemaJson as { properties: { [key: string]: ConfigurationProperty } }; const autoImportProperty: ConfigurationProperty = { - type: "boolean", - id: "#imports/autoImport", + type: 'boolean', + id: '#imports/autoImport', default: true, - title: "Enable implicit auto import from Vue, Nuxt, and module contributed utilities. Generate global TypeScript definitions.", - markdownType: "SrcTypesImportsImportsOptions" + title: 'Enable implicit auto import from Vue, Nuxt, and module contributed utilities. Generate global TypeScript definitions.', + markdownType: 'SrcTypesImportsImportsOptions' }; const transformProperty: ConfigurationProperty = { - type: "object", - id: "#imports/transform", + type: 'object', + id: '#imports/transform', properties: { exclude: { - type: "array", + type: 'array', }, include: { - type: "array", + type: 'array', } } }; -function createCompletionItem(propertyName: string, property: ConfigurationProperty) { +function createCompletionItem (propertyName: string, property: ConfigurationProperty) { const snippet = new vscode.CompletionItem(propertyName); snippet.detail = property.title || ''; snippet.label = propertyName; @@ -52,7 +52,7 @@ function createCompletionItem(propertyName: string, property: ConfigurationPrope export class CustomCompletionProvider implements vscode.CompletionItemProvider { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + provideCompletionItems (document: vscode.TextDocument, position: vscode.Position) { const linePrefix = document.lineAt(position).text.slice(0, position.character); const completionItems = Object.keys(nuxtRcSchema.properties) @@ -76,8 +76,8 @@ export class CustomCompletionProvider implements vscode.CompletionItemProvider { }); if (propertyPath === 'imports') { - nestedCompletionItems.push(createCompletionItem("autoImport", autoImportProperty)); - nestedCompletionItems.push(createCompletionItem("transform", transformProperty)); + nestedCompletionItems.push(createCompletionItem('autoImport', autoImportProperty)); + nestedCompletionItems.push(createCompletionItem('transform', transformProperty)); } return nestedCompletionItems; diff --git a/src/intellisense/completionProviders/vueFiles.ts b/src/intellisense/completionProviders/vueFiles.ts index 5ff922a..b8737f4 100644 --- a/src/intellisense/completionProviders/vueFiles.ts +++ b/src/intellisense/completionProviders/vueFiles.ts @@ -1,6 +1,6 @@ -import { CompletionItem, CompletionItemKind, CompletionItemProvider, Position, ProviderResult, TextDocument } from 'vscode'; import { readdirSync, statSync } from 'node:fs'; import { join, sep } from 'pathe'; +import { CompletionItem, CompletionItemKind, CompletionItemProvider, Position, ProviderResult, TextDocument } from 'vscode'; import { isDirectory, isNuxtTwo, projectSrcDirectory } from '../../utils'; @@ -9,7 +9,7 @@ let pagesDir = 'pages'; const DIR_SEPARATOR = sep; -async function provider(dirPath: string): Promise { +async function provider (dirPath: string): Promise { const items: CompletionItem[] = []; const fullPath = join(`${await projectSrcDirectory()}`, dirPath); const isDir = await isDirectory(fullPath); @@ -36,7 +36,7 @@ async function provider(dirPath: string): Promise { } export class PublicDirCompletionProvider implements CompletionItemProvider { - provideCompletionItems(document: TextDocument, position: Position): + provideCompletionItems (document: TextDocument, position: Position): ProviderResult { const currentLine = document.lineAt(position.line).text; const cursorPosition = position.character; @@ -57,7 +57,7 @@ export class PublicDirCompletionProvider implements CompletionItemProvider { const fullPathTest = join(`${projectSrcDirectory()}`, subDirMatch[1]); try { - // eslint-disable-next-line @typescript-eslint/no-unused-vars + isDir = isDirectory(fullPathTest); } catch (error) { console.error('Error checking directory:', fullPathTest, error); @@ -108,7 +108,7 @@ export class PublicDirCompletionProvider implements CompletionItemProvider { } export class NuxtPagesCompletionProvider implements CompletionItemProvider { - provideCompletionItems(document: TextDocument, position: Position): + provideCompletionItems (document: TextDocument, position: Position): ProviderResult { const currentLine = document.lineAt(position.line).text; const cursorPosition = position.character; @@ -129,7 +129,7 @@ export class NuxtPagesCompletionProvider implements CompletionItemProvider { const fullPathTest = join(`${projectSrcDirectory()}`, subDirMatch[1]); try { - // eslint-disable-next-line @typescript-eslint/no-unused-vars + isDir = isDirectory(fullPathTest); } catch (error) { console.error('Error checking directory:', fullPathTest, error); diff --git a/src/intellisense/index.ts b/src/intellisense/index.ts index ecf7adc..0d88ad6 100644 --- a/src/intellisense/index.ts +++ b/src/intellisense/index.ts @@ -7,7 +7,7 @@ import { languageSelector, nuxtrConfiguration, patternSelector } from '../utils' const intelliSenseConfig = nuxtrConfiguration().intellisense; -export function activateIntellisense(context: ExtensionContext) { +export function activateIntellisense (context: ExtensionContext) { if (intelliSenseConfig.nuxtignore) { const nuxtIgnoreProvider = languages.registerCompletionItemProvider( patternSelector('**/.nuxtignore'), diff --git a/src/nuxi/index.ts b/src/nuxi/index.ts index a2db662..c7cb539 100644 --- a/src/nuxi/index.ts +++ b/src/nuxi/index.ts @@ -1,5 +1,5 @@ import { tryImport } from '../utils'; -export async function tryImportNuxi() { +export async function tryImportNuxi () { return ((await tryImport('nuxi')) || (await tryImport('nuxi-nightly'))) as undefined | typeof import('nuxi-nightly'); } diff --git a/src/sideBar/index.ts b/src/sideBar/index.ts index 3c9fe37..9ee221d 100644 --- a/src/sideBar/index.ts +++ b/src/sideBar/index.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode' import { capitalize } from 'string-ts' import { existsSync, readFileSync, readdirSync, unlinkSync } from 'node:fs' import { exec } from 'node:child_process' -import { destr } from "destr" +import { destr } from 'destr' import { detectPackageManagerByName, @@ -27,9 +27,9 @@ const nonce = getNonce() export class ModulesView implements vscode.WebviewViewProvider { _view?: vscode.WebviewView - constructor(private readonly _extensionUri: vscode.Uri) {} + constructor (private readonly _extensionUri: vscode.Uri) {} - public resolveWebviewView(webviewView: vscode.WebviewView) { + public resolveWebviewView (webviewView: vscode.WebviewView) { this._view = webviewView webviewView.webview.options = { @@ -52,12 +52,12 @@ export class ModulesView implements vscode.WebviewViewProvider { }) } - public goToProjectView() { + public goToProjectView () { this.postMessage({ command: 'projectView' }) this.getDependencies() } - public async getDependencies() { + public async getDependencies () { const dependencies = await getProjectDependencies() const scripts = getProjectScripts() @@ -120,7 +120,7 @@ export class ModulesView implements vscode.WebviewViewProvider { } } - public runAction(script: string) { + public runAction (script: string) { const packageManager = detectPackageManagerByName() switch (packageManager?.name) { @@ -190,7 +190,7 @@ export class ModulesView implements vscode.WebviewViewProvider { } } - public async updateModules() { + public async updateModules () { const installedModules = await getProjectDependencies() this.postMessage({ command: 'installedModules', @@ -198,13 +198,13 @@ export class ModulesView implements vscode.WebviewViewProvider { }) } - public postMessage(message: any) { + public postMessage (message: any) { if (this._view) { this._view.webview.postMessage(message) } } - private _getHtmlForWebview(webview: vscode.Webview) { + private _getHtmlForWebview (webview: vscode.Webview) { const stylesUri = getUri(webview, this._extensionUri, ['src', 'sidebar', 'build', 'assets', 'index.css']) // The JS file from the Vue build output const scriptUri = getUri(webview, this._extensionUri, ['src', 'sidebar', 'build', 'assets', 'index.js']) @@ -227,7 +227,7 @@ export class ModulesView implements vscode.WebviewViewProvider { ` } - private async installModule(module: any) { + private async installModule (module: any) { const command = await getInstallationCommand( module.npm, module['dependency-type'] === 'dev' ? true : false @@ -273,7 +273,7 @@ export class ModulesView implements vscode.WebviewViewProvider { ) } - private async addNuxtModule(module: any) { + private async addNuxtModule (module: any) { await updateNuxtConfig('add-module', module) this.postMessage({ command: 'moduleInstalled', @@ -292,11 +292,11 @@ export class ModulesView implements vscode.WebviewViewProvider { }) } - public async upgradeModule(module: any) { + public async upgradeModule (module: any) { await managePackageVersion(module) } - public async removeModule(module: any) { + public async removeModule (module: any) { // show confirmation message const confirmation = await vscode.window.showInformationMessage( `Are you sure you want to remove ${module}?`, @@ -308,7 +308,7 @@ export class ModulesView implements vscode.WebviewViewProvider { await removePackage(module) } } - public editSnippet(snippet: string) { + public editSnippet (snippet: string) { const snippetPath = `${projectRootDirectory()}/.vscode/${snippet}` if (existsSync(snippetPath)) { vscode.window.showTextDocument(vscode.Uri.file(snippetPath)) @@ -317,7 +317,7 @@ export class ModulesView implements vscode.WebviewViewProvider { } } - public editTemplate(snippet: string) { + public editTemplate (snippet: string) { const snippetPath = `${projectRootDirectory()}/.vscode/${snippet}` if (existsSync(snippetPath)) { vscode.window.showTextDocument(vscode.Uri.file(snippetPath)) @@ -326,7 +326,7 @@ export class ModulesView implements vscode.WebviewViewProvider { } } - public async deleteTemplate(template: string) { + public async deleteTemplate (template: string) { // create a confirmation message to delete the template const confirmation = await vscode.window.showInformationMessage( `Are you sure you want to delete ${template}?`, @@ -344,7 +344,7 @@ export class ModulesView implements vscode.WebviewViewProvider { } - public async deleteSnippet(snippet: string) { + public async deleteSnippet (snippet: string) { // create a confirmation message to delete the template const confirmation = await vscode.window.showInformationMessage( `Are you sure you want to delete ${snippet}?`, @@ -362,7 +362,7 @@ export class ModulesView implements vscode.WebviewViewProvider { } - private _setWebviewMessageListener(webview: vscode.Webview) { + private _setWebviewMessageListener (webview: vscode.Webview) { webview.onDidReceiveMessage((message: any) => { const { command, module, script } = message switch (command) { diff --git a/src/sideBar/prettier.config.ts b/src/sideBar/prettier.config.ts index 901047e..e877a04 100644 --- a/src/sideBar/prettier.config.ts +++ b/src/sideBar/prettier.config.ts @@ -1,5 +1,5 @@ module.exports = { - plugins: [require("prettier-plugin-tailwindcss")], - tailwindConfig: "./tailwind.config.js", + plugins: [require('prettier-plugin-tailwindcss')], + tailwindConfig: './tailwind.config.js', pluginSearchDirs: false, }; diff --git a/src/sideBar/src/composables/modules.ts b/src/sideBar/src/composables/modules.ts index 9623007..e2d39fd 100644 --- a/src/sideBar/src/composables/modules.ts +++ b/src/sideBar/src/composables/modules.ts @@ -1,5 +1,5 @@ -import content from "./modules.json"; -const layers = new Set(["seo-kit", "umami"]); +import content from './modules.json'; +const layers = new Set(['seo-kit', 'umami']); export interface Module { name: string; @@ -47,7 +47,7 @@ export interface Contributor { } -export function useModules() { +export function useModules () { const modules = content.modules as unknown as Module[]; modules.forEach((module: Module) => { module.isLayer = layers.has(module.name) ? true : false; diff --git a/src/sideBar/src/main.ts b/src/sideBar/src/main.ts index 0526125..b2fee9c 100644 --- a/src/sideBar/src/main.ts +++ b/src/sideBar/src/main.ts @@ -1,9 +1,9 @@ -import { createApp } from "vue"; -import "./assets/main.css"; -import App from "./App.vue"; -import { provideVSCodeDesignSystem } from "@vscode/webview-ui-toolkit"; -import { createRouter, createWebHistory } from "vue-router"; -import routes from "./router"; +import { createApp } from 'vue'; +import './assets/main.css'; +import App from './App.vue'; +import { provideVSCodeDesignSystem } from '@vscode/webview-ui-toolkit'; +import { createRouter, createWebHistory } from 'vue-router'; +import routes from './router'; const router = createRouter({ history: createWebHistory(), @@ -11,4 +11,4 @@ const router = createRouter({ }); provideVSCodeDesignSystem().register(); -createApp(App).use(router).mount("#app"); +createApp(App).use(router).mount('#app'); diff --git a/src/sideBar/src/plugins/globals.cjs b/src/sideBar/src/plugins/globals.cjs index 1373b5a..a99b13b 100644 --- a/src/sideBar/src/plugins/globals.cjs +++ b/src/sideBar/src/plugins/globals.cjs @@ -1,16 +1,16 @@ -import _ from "lodash"; +import _ from 'lodash'; export default { - install(app) { - const componentFiles = import.meta.globEager("./components/Icon/*.vue"); + install (app) { + const componentFiles = import.meta.globEager('./components/Icon/*.vue'); for (const [path, m] of Object.entries(componentFiles)) { const componentName = _.upperFirst( _.camelCase( path - .split("/") + .split('/') .pop() - .replace(/\.\w+$/, ""), + .replace(/\.\w+$/, ''), ), ); diff --git a/src/sideBar/src/router/index.ts b/src/sideBar/src/router/index.ts index 566003e..a729e13 100644 --- a/src/sideBar/src/router/index.ts +++ b/src/sideBar/src/router/index.ts @@ -1,9 +1,9 @@ -import Home from "../pages/Home.vue"; -import Project from "../pages/Project.vue"; +import Home from '../pages/Home.vue'; +import Project from '../pages/Project.vue'; const routes = [ - { path: "/", component: Home }, - { path: "/project", component: Project }, + { path: '/', component: Home }, + { path: '/project', component: Project }, ]; export default routes; diff --git a/src/sideBar/src/utilities/vscode.ts b/src/sideBar/src/utilities/vscode.ts index d8d9f96..10f99f1 100644 --- a/src/sideBar/src/utilities/vscode.ts +++ b/src/sideBar/src/utilities/vscode.ts @@ -1,4 +1,4 @@ -import type { WebviewApi } from "vscode-webview"; +import type { WebviewApi } from 'vscode-webview'; /** * A utility wrapper around the acquireVsCodeApi() function, which enables @@ -12,10 +12,10 @@ import type { WebviewApi } from "vscode-webview"; class VSCodeAPIWrapper { private readonly vsCodeApi: WebviewApi | undefined; - constructor() { + constructor () { // Check if the acquireVsCodeApi function exists in the current development // context (i.e. VS Code development window or web browser) - if (typeof acquireVsCodeApi === "function") { + if (typeof acquireVsCodeApi === 'function') { this.vsCodeApi = acquireVsCodeApi(); } } @@ -28,7 +28,7 @@ class VSCodeAPIWrapper { * * @param message Abitrary data (must be JSON serializable) to send to the extension context. */ - public postMessage(message: unknown) { + public postMessage (message: unknown) { if (this.vsCodeApi) { this.vsCodeApi.postMessage(message); } else { @@ -44,11 +44,11 @@ class VSCodeAPIWrapper { * * @return The current state or `undefined` if no state has been set. */ - public getState(): unknown | undefined { + public getState (): unknown | undefined { if (this.vsCodeApi) { return this.vsCodeApi.getState(); } else { - const state = localStorage.getItem("vscodeState"); + const state = localStorage.getItem('vscodeState'); return state ? JSON.parse(state) : undefined; } } @@ -64,11 +64,11 @@ class VSCodeAPIWrapper { * * @return The new state. */ - public setState(newState: T): T { + public setState (newState: T): T { if (this.vsCodeApi) { return this.vsCodeApi.setState(newState); } else { - localStorage.setItem("vscodeState", JSON.stringify(newState)); + localStorage.setItem('vscodeState', JSON.stringify(newState)); return newState; } } diff --git a/src/sideBar/tailwind.config.cjs b/src/sideBar/tailwind.config.cjs index cfd73e2..dfa5a89 100644 --- a/src/sideBar/tailwind.config.cjs +++ b/src/sideBar/tailwind.config.cjs @@ -1,58 +1,58 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: ["./index.html", "./src/**/*.{js,jsx,ts,tsx,vue}"], + content: ['./index.html', './src/**/*.{js,jsx,ts,tsx,vue}'], theme: { extend: { colors: { green: { - 50: "#D6FFEE", - 100: "#ACFFDD", - 200: "#83FFCC", - 300: "#30FFAA", - 500: "#00BD6F", - 400: "#00dc82", - 600: "#009D5D", - 700: "#007E4A", - 800: "#005E38", - 900: "#003F25", + 50: '#D6FFEE', + 100: '#ACFFDD', + 200: '#83FFCC', + 300: '#30FFAA', + 500: '#00BD6F', + 400: '#00dc82', + 600: '#009D5D', + 700: '#007E4A', + 800: '#005E38', + 900: '#003F25', }, gray: { - 50: "#FAFAFA", - 100: "#F4F4F5", - 200: "#E4E4E7", - 300: "#D4D4D8", - 400: "#A1A1AA", - 500: "#71717A", - 600: "#52525B", - 700: "#3F3F46", - 800: "#27272A", + 50: '#FAFAFA', + 100: '#F4F4F5', + 200: '#E4E4E7', + 300: '#D4D4D8', + 400: '#A1A1AA', + 500: '#71717A', + 600: '#52525B', + 700: '#3F3F46', + 800: '#27272A', }, base: { - 1: "#ffffff", - 2: "#F0F0F0", - 3: "#E7E7E7", - 4: "#E5E5E5", - 5: "#D4D4D4", - 6: "#CCCCCC", - 7: "#C6C6C6", - 8: "#BBBBBB", - 9: "#A0A0A0", - 10: "#808080", - 11: "#7F7F7F", - 12: "#606060", - 13: "#454545", - 14: "#3C3C3C", - 15: "#3A3D41", - 16: "#333333", - 17: "#303031", - 18: "#292929", - 19: "#252526", - 20: "#1E1E1E", - 21: "#000000", + 1: '#ffffff', + 2: '#F0F0F0', + 3: '#E7E7E7', + 4: '#E5E5E5', + 5: '#D4D4D4', + 6: '#CCCCCC', + 7: '#C6C6C6', + 8: '#BBBBBB', + 9: '#A0A0A0', + 10: '#808080', + 11: '#7F7F7F', + 12: '#606060', + 13: '#454545', + 14: '#3C3C3C', + 15: '#3A3D41', + 16: '#333333', + 17: '#303031', + 18: '#292929', + 19: '#252526', + 20: '#1E1E1E', + 21: '#000000', }, }, fontFamily: { - inter: ["Inter", "sans-serif"], + inter: ['Inter', 'sans-serif'], }, }, }, diff --git a/src/sideBar/vite.config.ts b/src/sideBar/vite.config.ts index 5099748..bd8c8d7 100644 --- a/src/sideBar/vite.config.ts +++ b/src/sideBar/vite.config.ts @@ -1,17 +1,17 @@ -import { defineConfig } from "vite"; -import vue from "@vitejs/plugin-vue"; +import { defineConfig } from 'vite'; +import vue from '@vitejs/plugin-vue'; export default defineConfig({ plugins: [vue()], build: { - outDir: "build", + outDir: 'build', cssMinify: 'esbuild', minify: 'terser', rollupOptions: { output: { - entryFileNames: `assets/[name].js`, - chunkFileNames: `assets/[name].js`, - assetFileNames: `assets/[name].[ext]`, + entryFileNames: 'assets/[name].js', + chunkFileNames: 'assets/[name].js', + assetFileNames: 'assets/[name].[ext]', }, }, } diff --git a/src/snippets/index.ts b/src/snippets/index.ts index a9a01a9..ee203fc 100644 --- a/src/snippets/index.ts +++ b/src/snippets/index.ts @@ -10,7 +10,7 @@ interface Snippet { } -export async function toggleSnippets(source: 'Nuxt' | 'Nitro', moveToDisabled: boolean) { +export async function toggleSnippets (source: 'Nuxt' | 'Nitro', moveToDisabled: boolean) { const homeDir = homedir(); const extensionName = 'nuxtr.nuxtr-vscode'; const nuxtrVersion = await extensions.getExtension(extensionName)?.packageJSON.version; @@ -49,14 +49,14 @@ export async function toggleSnippets(source: 'Nuxt' | 'Nitro', moveToDisabled: b languages.registerCompletionItemProvider( { language: 'vue' }, { - provideCompletionItems() { + provideCompletionItems () { const completionItem = new CompletionItem('nuxtBaseLayout', CompletionItemKind.Snippet); completionItem.detail = 'Generate a Nuxt Layout template'; const template = generateVueFileTemplate('layout'); const documentation = new MarkdownString(); - documentation.appendMarkdown(`Generate a Nuxt layout template according to your Nuxtr configuration.\n\n`); + documentation.appendMarkdown('Generate a Nuxt layout template according to your Nuxtr configuration.\n\n'); documentation.appendCodeblock(template, 'vue'); completionItem.documentation = documentation; @@ -72,14 +72,14 @@ languages.registerCompletionItemProvider( languages.registerCompletionItemProvider( { language: 'vue' }, { - provideCompletionItems() { + provideCompletionItems () { const completionItem = new CompletionItem('vueBase', CompletionItemKind.Snippet); completionItem.detail = 'Generate a Vue file template'; const template = generateVueFileTemplate('page'); const documentation = new MarkdownString(); - documentation.appendMarkdown(`Generate a Vue file template according to your Nuxtr configuration.\n\n`); + documentation.appendMarkdown('Generate a Vue file template according to your Nuxtr configuration.\n\n'); documentation.appendCodeblock(template, 'vue'); completionItem.documentation = documentation; diff --git a/src/statusBar/index.ts b/src/statusBar/index.ts index 04bd79a..82ce13a 100644 --- a/src/statusBar/index.ts +++ b/src/statusBar/index.ts @@ -1,6 +1,6 @@ -import { ExtensionContext, StatusBarAlignment, StatusBarItem, ThemeColor, commands, window } from 'vscode' -import { directToggleDevTools, nuxtDevToolsHandler } from '../commands/Devtools' -import { dependenciesUpdatesHandler } from '../utils' +import { ExtensionContext, StatusBarAlignment, StatusBarItem, ThemeColor, commands, window } from 'vscode'; +import { directToggleDevTools, nuxtDevToolsHandler } from '../commands/devtools'; +import { dependenciesUpdatesHandler } from '../utils'; export const statusBars: NuxtrStatusBars = { devToolsStatusBar: window.createStatusBarItem(StatusBarAlignment.Right, 100), @@ -18,7 +18,7 @@ interface DevtoolsStatusBar { color?: ThemeColor; } -export function activateStatusBarIcons(context: ExtensionContext): NuxtrStatusBars { +export function activateStatusBarIcons (context: ExtensionContext): NuxtrStatusBars { statusBars.devToolsStatusBar.name = 'Nuxtr'; statusBars.devToolsStatusBar.text = '$(loading~spin)'; statusBars.devToolsStatusBar.show(); @@ -39,13 +39,13 @@ export function activateStatusBarIcons(context: ExtensionContext): NuxtrStatusBa return statusBars; } -export function updateDevtoolsStatusBar(statusBar: DevtoolsStatusBar) { +export function updateDevtoolsStatusBar (statusBar: DevtoolsStatusBar) { statusBars.devToolsStatusBar.command = statusBar.command; statusBars.devToolsStatusBar.tooltip = statusBar.tooltip; statusBars.devToolsStatusBar.text = statusBar.text; statusBars.devToolsStatusBar.color = statusBar.color; } -export function hideDevtoolsStatusBar() { +export function hideDevtoolsStatusBar () { statusBars.devToolsStatusBar.hide() } \ No newline at end of file diff --git a/src/templates/linters.ts b/src/templates/linters.ts index e130f46..be21092 100644 --- a/src/templates/linters.ts +++ b/src/templates/linters.ts @@ -11,7 +11,7 @@ const stylelintConfig = `{ } ` -const stylelintIgnore = `node_modules` +const stylelintIgnore = 'node_modules' export { eslintConfig, stylelintConfig, stylelintIgnore } \ No newline at end of file diff --git a/src/templates/vueFiles.ts b/src/templates/vueFiles.ts index d7bdd47..cecb571 100644 --- a/src/templates/vueFiles.ts +++ b/src/templates/vueFiles.ts @@ -9,13 +9,13 @@ const templateTag = (type: string, language: string) => { `; } -function generateStyleTag(lang: string, scoped: boolean) { +function generateStyleTag (lang: string, scoped: boolean) { return ` ` } -function generateScriptTag(scriptType: string, lang: string) { +function generateScriptTag (scriptType: string, lang: string) { return ` ` diff --git a/src/types.ts b/src/types.ts index d71c392..a54bfa6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -14,29 +14,29 @@ export interface ConfigurationProperty { export interface NuxtrConfiguration { openItemsAfterCreation: boolean; - defaultPackageManager: "null" | "Yarn" | "NPM" | "pnpm" | "Bun"; + defaultPackageManager: 'null' | 'Yarn' | 'NPM' | 'pnpm' | 'Bun'; monorepoMode: { DirectoryName: string | null; }; vueFiles: { template: { - defaultLanguage: "html" | "pug"; + defaultLanguage: 'html' | 'pug'; } - firstTag: "template" | "script"; + firstTag: 'template' | 'script'; script: { - type: "setup" | "options"; - defaultLanguage: "js" | "ts"; + type: 'setup' | 'options'; + defaultLanguage: 'js' | 'ts'; }; style: { addStyleTag: boolean; alwaysScoped: boolean; defaultLanguage: - | "css" - | "scss" - | "sass" - | "less" - | "stylus" - | "postcss"; + | 'css' + | 'scss' + | 'sass' + | 'less' + | 'stylus' + | 'postcss'; }; pages: { defaultTemplate: string; @@ -56,7 +56,7 @@ export interface NuxtrConfiguration { } piniaFiles: { - defaultTemplate: "options" | "setup"; + defaultTemplate: 'options' | 'setup'; } projectTemplates: UserProjectTemplate[]; diff --git a/src/utils/commands.ts b/src/utils/commands.ts index bb67bbe..83be57f 100644 --- a/src/utils/commands.ts +++ b/src/utils/commands.ts @@ -1,4 +1,4 @@ -import { hasServerDir } from "../utils"; +import { hasServerDir } from '../utils'; export const getCommandType = async (commandType: string) => { let type = { @@ -98,7 +98,7 @@ export const getCommandType = async (commandType: string) => { case 'nuxtUtil': { type = { name: 'Utilities', - path: `utils`, + path: 'utils', extension: '.ts', }; break; diff --git a/src/utils/dependency.ts b/src/utils/dependency.ts index 95dec9e..c291b29 100644 --- a/src/utils/dependency.ts +++ b/src/utils/dependency.ts @@ -1,12 +1,12 @@ +import { destr } from 'destr'; +import { exec } from 'node:child_process'; +import { existsSync, readFileSync, readdirSync } from 'node:fs'; +import { readPackageJSON } from 'pkg-types'; import { ProgressLocation, QuickPickItem, QuickPickOptions, StatusBarItem, commands, window } from 'vscode'; -import { existsSync, readFileSync, readdirSync } from 'node:fs' -import { exec } from 'node:child_process' -import { destr } from "destr" -import { readPackageJSON } from 'pkg-types' -import { nuxtrConfiguration, projectRootDirectory, runCommand } from './global' -import { installDependencies } from '../commands/InstallDependencies' -import pm from '../content/pm' -import { newTerminal } from '.' +import { newTerminal } from '.'; +import { installDependencies } from '../commands/installDependencies'; +import pm from '../content/pm'; +import { nuxtrConfiguration, projectRootDirectory, runCommand } from './global'; const items: QuickPickItem[] = pm.map((item) => { @@ -226,10 +226,10 @@ export const updateDependencies = async () => { const outdatedDependenciesList: any = await commands.executeCommand('nuxtr.globalState', { name: 'outdatedDependencies' }) const updateCommand: any = { - NPM: `npm install`, - Yarn: `yarn add`, - pnpm: `pnpm add`, - Bun: `bun add`, + NPM: 'npm install', + Yarn: 'yarn add', + pnpm: 'pnpm add', + Bun: 'bun add', } const command = packageManager ? updateCommand[packageManager.name] : (updateCommand[defaultPackageManager] === null ? updateCommand.NPM : updateCommand[defaultPackageManager]) @@ -278,7 +278,7 @@ export const updateDependencies = async () => { return } -export function upgradePackage(packageName: string) { +export function upgradePackage (packageName: string) { const packageManager = detectPackageManagerByName() const defaultPackageManager = nuxtrConfiguration().defaultPackageManager const options: QuickPickOptions = { @@ -307,7 +307,7 @@ export function upgradePackage(packageName: string) { } } -export async function managePackageVersion(packageName: string) { +export async function managePackageVersion (packageName: string) { const packageManager = detectPackageManagerByName() const defaultPackageManager = nuxtrConfiguration().defaultPackageManager @@ -421,7 +421,7 @@ export async function managePackageVersion(packageName: string) { } } -export async function removePackage(packageName: string): Promise { +export async function removePackage (packageName: string): Promise { const packageManager = detectPackageManagerByName() // uninstall package @@ -470,7 +470,7 @@ export async function removePackage(packageName: string): Promise { ) } -export async function isDependencyInstalled(packageName: string): Promise { +export async function isDependencyInstalled (packageName: string): Promise { const dependencies = await getProjectDependencies() return dependencies.some((dependency) => dependency.name === packageName) } \ No newline at end of file diff --git a/src/utils/file.ts b/src/utils/file.ts index 72514f8..14b7700 100644 --- a/src/utils/file.ts +++ b/src/utils/file.ts @@ -1,8 +1,8 @@ -import { Uri, window, workspace } from 'vscode'; -import { capitalize, endsWith, replace, split, trim } from 'string-ts'; import { existsSync, mkdirSync, readdirSync } from 'node:fs'; -import { join } from 'pathe'; import { TextEncoder } from 'node:util'; +import { join } from 'pathe'; +import { capitalize, endsWith, replace, split, trim } from 'string-ts'; +import { Uri, window, workspace } from 'vscode'; import { getCommandType } from './commands'; @@ -89,7 +89,7 @@ export const showSubFolderQuickPick = async (args: { window .showQuickPick(args.subFolders, { placeHolder: 'Select a subfolder' }) - .then(async(selection) => { + .then(async (selection) => { if (selection === undefined) { return; } @@ -164,6 +164,6 @@ export const createVueTemplate = (content: string, type: string) => { }; -export const normalizeName = (name: string) => split(trim(split(name, '.')[0]), "-").map((value) => capitalize(value)).join(''); +export const normalizeName = (name: string) => split(trim(split(name, '.')[0]), '-').map((value) => capitalize(value)).join(''); export const normalizeFileExtension = (name: string, extension: string) => endsWith(name, extension) ? replace(name, extension, '') : name diff --git a/src/utils/files.ts b/src/utils/files.ts index be7e53e..6d23ea3 100644 --- a/src/utils/files.ts +++ b/src/utils/files.ts @@ -1,10 +1,10 @@ -import { readFileSync } from 'node:fs' +import { readFileSync } from 'node:fs'; import { nuxtrConfiguration, projectRootDirectory, vscodeConfiguration } from '.'; -import { generateScriptTag, generateStyleTag, piniaOptionsContent, piniaSetupContent, templateTag } from '../templates' +import { generateScriptTag, generateStyleTag, piniaOptionsContent, piniaSetupContent, templateTag } from '../templates'; const eolConfiguration = vscodeConfiguration().files.eol -export function generateVueFileTemplate(type: 'page' | 'layout', template?: string) { +export function generateVueFileTemplate (type: 'page' | 'layout', template?: string) { const userDefaultTemplate = template || (type === 'page' ? nuxtrConfiguration().vueFiles.pages.defaultTemplate : nuxtrConfiguration().vueFiles.layouts.defaultTemplate); @@ -17,8 +17,8 @@ export function generateVueFileTemplate(type: 'page' | 'layout', template?: stri } } -export function generateVueFileBasicTemplate(type: string) { - let fileTemplate = `` +export function generateVueFileBasicTemplate (type: string) { + let fileTemplate = '' const templateLang = nuxtrConfiguration().vueFiles.template.defaultLanguage const firstTag = nuxtrConfiguration().vueFiles.firstTag const scriptType = nuxtrConfiguration().vueFiles.script.type @@ -29,7 +29,7 @@ export function generateVueFileBasicTemplate(type: string) { const scriptTag = generateScriptTag(scriptType, lang) - const eol = eolConfiguration === '\n' ? `\n\n` : `\n\n`; + const eol = eolConfiguration === '\n' ? '\n\n' : '\n\n'; if (firstTag === 'template') { fileTemplate = templateTag(type, templateLang); @@ -50,6 +50,6 @@ export function generateVueFileBasicTemplate(type: string) { return fileTemplate } -export function generatePiniaTemplates(name: string) { +export function generatePiniaTemplates (name: string) { return nuxtrConfiguration().piniaFiles.defaultTemplate === 'options' ? piniaOptionsContent(name) : piniaSetupContent(name) } \ No newline at end of file diff --git a/src/utils/global.ts b/src/utils/global.ts index 87de07c..1171172 100644 --- a/src/utils/global.ts +++ b/src/utils/global.ts @@ -1,10 +1,10 @@ -import { ProgressLocation, ThemeIcon, Uri, Webview, env, window, workspace } from 'vscode'; -import type { WorkspaceConfiguration } from 'vscode'; import { exec } from 'node:child_process'; +import type { WorkspaceConfiguration } from 'vscode'; +import { ProgressLocation, ThemeIcon, Uri, Webview, env, window, workspace } from 'vscode'; +import { installDependencies } from '../commands/installDependencies'; +import type { NuxtrConfiguration } from '../types'; import { hasSrcDir } from './nuxt'; -import { installDependencies } from '../commands/InstallDependencies' import { logger } from './outputChannel'; -import type { NuxtrConfiguration } from '../types'; export const getNonce = () => { let text = ''; @@ -127,7 +127,7 @@ export const runCommand = async (args: { }; -const _jiti = require("jiti")(projectRootDirectory(), { esmResolve: true, interopDefault: true }); +const _jiti = require('jiti')(projectRootDirectory(), { esmResolve: true, interopDefault: true }); export async function tryImport (path: string): Promise { try { diff --git a/src/utils/index.ts b/src/utils/index.ts index 8fbe775..4554106 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,64 +1,54 @@ export { getNonce, getUri, - projectRootDirectory, - openExternalLink, - nuxtrConfiguration, - vscodeConfiguration, newTerminal, - runCommand, + nuxtrConfiguration, + openExternalLink, + projectRootDirectory, projectSrcDirectory, - tryImport + runCommand, + tryImport, + vscodeConfiguration } from './global' export { - removeNuxtModule, + findNuxtConfig, getNuxtVersion, - isNuxtTwo, hasServerDir, - findNuxtConfig, - isNuxtProject, isModuleConfigured, + isNuxtProject, + isNuxtTwo, + removeNuxtModule, updateNuxtConfig } from './nuxt' export { - getProjectDependencies, - getProjectScripts, + dependenciesUpdatesHandler, detectPackageManagerByName, getInstallationCommand, getOutdatedPackages, - dependenciesUpdatesHandler, - updateDependencies, + getProjectDependencies, + getProjectScripts, isDependencyInstalled, + managePackageVersion, removePackage, - managePackageVersion + updateDependencies } from './dependency' export { + createDir, createFile, createSubFolders, - showSubFolderQuickPick, - createDir, createVueTemplate, + normalizeFileExtension, normalizeName, - normalizeFileExtension + showSubFolderQuickPick } from './file' export { logger } from './outputChannel' -export { createConfigWatcher } from './watchers' export { injectPkgJSONScript } from './pkgJSON' +export { createConfigWatcher } from './watchers' -export { - languageSelector, - patternSelector, - isDirectory, - openFolder, - quickOpenButtons -} from './vscode'; +export { isDirectory, languageSelector, openFolder, patternSelector, quickOpenButtons } from './vscode' -export { - generateVueFileBasicTemplate, - generateVueFileTemplate, - generatePiniaTemplates -} from './files' +export { generatePiniaTemplates, generateVueFileBasicTemplate, generateVueFileTemplate } from './files' diff --git a/src/utils/navigation.ts b/src/utils/navigation.ts index 10d6294..c3f48a0 100644 --- a/src/utils/navigation.ts +++ b/src/utils/navigation.ts @@ -1,5 +1,5 @@ import { commands } from 'vscode' -export function openSettings() { +export function openSettings () { commands.executeCommand('workbench.action.openSettings', 'nuxtr') } \ No newline at end of file diff --git a/src/utils/nuxt.ts b/src/utils/nuxt.ts index 15f5457..5270827 100644 --- a/src/utils/nuxt.ts +++ b/src/utils/nuxt.ts @@ -1,9 +1,9 @@ -import { window } from 'vscode'; -import { existsSync, readFileSync, writeFileSync } from 'node:fs'; +import { pathExistsSync } from 'fs-extra'; import { parseModule } from 'magicast'; +import { existsSync, readFileSync, writeFileSync } from 'node:fs'; import { trimEnd } from 'string-ts'; +import { window } from 'vscode'; import { projectRootDirectory } from '.'; -import { pathExistsSync } from 'fs-extra'; export const findNuxtConfig = (): string | undefined => { const names = ['nuxt.config.ts', 'nuxt.config.js']; @@ -200,7 +200,7 @@ export const updateNuxtConfig = (action: 'inject-eslint-devChcker' | 'add-module } catch { window.showErrorMessage( - `Failed to update nuxt config.` + 'Failed to update nuxt config.' ); } }; diff --git a/src/utils/outputChannel.ts b/src/utils/outputChannel.ts index e469c23..d90175f 100644 --- a/src/utils/outputChannel.ts +++ b/src/utils/outputChannel.ts @@ -3,22 +3,22 @@ class Logger { private static _instance: Logger private _outputChannel: OutputChannel - private constructor() { + private constructor () { this._outputChannel = window.createOutputChannel('Nuxtr', { log: true }) } - public static getInstance(): Logger { + public static getInstance (): Logger { if (!Logger._instance) { Logger._instance = new Logger() } return Logger._instance } - public log(message: string): void { + public log (message: string): void { this._outputChannel.appendLine(message) } - public show(): void { + public show (): void { this._outputChannel.show() } } diff --git a/src/utils/pkgJSON.ts b/src/utils/pkgJSON.ts index 8674be8..0138116 100644 --- a/src/utils/pkgJSON.ts +++ b/src/utils/pkgJSON.ts @@ -1,6 +1,6 @@ -import { projectRootDirectory } from './' import { readPackageJSON, writePackageJSON } from 'pkg-types' +import { projectRootDirectory } from './' export const injectPkgJSONScript = async (scriptName: string, script: string) => { const packageJsonPath = `${projectRootDirectory()}/package.json` diff --git a/src/utils/vscode.ts b/src/utils/vscode.ts index b52d487..ec9296e 100644 --- a/src/utils/vscode.ts +++ b/src/utils/vscode.ts @@ -5,7 +5,7 @@ export const languageSelector = (language: string): DocumentSelector => ({ schem export const patternSelector = (pattern: string): DocumentSelector => ({ scheme: 'file', pattern, } as const); -export async function isDirectory(filePath: string): Promise { +export async function isDirectory (filePath: string): Promise { try { const stat = await workspace.fs.stat(Uri.file(filePath)); return stat.type === FileType.Directory; @@ -15,7 +15,7 @@ export async function isDirectory(filePath: string): Promise { } -export async function openFolder(path: Uri, folderName: string, newWindow: boolean) { +export async function openFolder (path: Uri, folderName: string, newWindow: boolean) { try { await commands.executeCommand('vscode.openFolder', path, { forceNewWindow: newWindow, @@ -27,13 +27,13 @@ export async function openFolder(path: Uri, folderName: string, newWindow: boole const github: QuickInputButton = { - iconPath: new ThemeIcon("github"), - tooltip: "Template Github Repo", + iconPath: new ThemeIcon('github'), + tooltip: 'Template Github Repo', }; const docs: QuickInputButton = { - iconPath: new ThemeIcon("book"), - tooltip: "Template Docs/Reference", + iconPath: new ThemeIcon('book'), + tooltip: 'Template Docs/Reference', }; diff --git a/src/utils/watchers.ts b/src/utils/watchers.ts index f1a4398..e06b503 100644 --- a/src/utils/watchers.ts +++ b/src/utils/watchers.ts @@ -1,6 +1,6 @@ import { ConfigurationChangeEvent, Disposable, commands, window, workspace } from 'vscode'; -export function createConfigWatcher(configKey: string, callback?: () => Promise, defaultBehavior?: boolean): Disposable { +export function createConfigWatcher (configKey: string, callback?: () => Promise, defaultBehavior?: boolean): Disposable { const watcher = workspace.onDidChangeConfiguration(async (event: ConfigurationChangeEvent) => { if (event.affectsConfiguration(configKey)) { if (callback && typeof callback === 'function') { @@ -9,7 +9,7 @@ export function createConfigWatcher(configKey: string, callback?: () => Promise< if (defaultBehavior) { const question = window.showInformationMessage( - `Nuxtr configuration updated.`, + 'Nuxtr configuration updated.', 'Reload Window' ); diff --git a/src/watchers/config.ts b/src/watchers/config.ts index b986efe..1fe6cc6 100644 --- a/src/watchers/config.ts +++ b/src/watchers/config.ts @@ -1,11 +1,11 @@ -import { Disposable, commands, window } from 'vscode'; -import { createConfigWatcher, getProjectDependencies, nuxtrConfiguration, projectRootDirectory } from '../utils'; import { existsSync } from 'node:fs'; +import { readTSConfig } from 'pkg-types'; +import { Disposable, commands, window } from 'vscode'; +import nuxtrCommands from '../commands'; +import { PugConfigurationSteps } from '../commands/templates'; import { toggleSnippets } from '../snippets'; import { TSConfigNuxt } from '../types'; -import { readTSConfig } from 'pkg-types' -import nuxtrCommands from '../commands' -import { PugConfigurationSteps } from '../commands/Templates' +import { createConfigWatcher, getProjectDependencies, nuxtrConfiguration, projectRootDirectory } from '../utils'; const reloatWindowProps = () => { window.showInformationMessage('Configuration has been modified.', 'Reload Window').then((answer) => { diff --git a/src/watchers/files.ts b/src/watchers/files.ts index b98d02f..49879b9 100644 --- a/src/watchers/files.ts +++ b/src/watchers/files.ts @@ -1,12 +1,12 @@ -import { ExtensionContext, StatusBarItem, commands, workspace } from 'vscode' +import { ExtensionContext, StatusBarItem, commands, workspace } from 'vscode'; +import { nuxtConfigWatcher } from '../commands/devtools'; import { findNuxtConfig, projectRootDirectory } from '../utils'; -import { nuxtConfigWatcher } from '../commands/Devtools'; class FileWatchers { public sidebarProvider: any public statusBar: StatusBarItem - constructor(sidebarProvider: any, context: ExtensionContext, statusBar: StatusBarItem) { + constructor (sidebarProvider: any, context: ExtensionContext, statusBar: StatusBarItem) { this.sidebarProvider = sidebarProvider this.statusBar = statusBar } diff --git a/src/watchers/index.ts b/src/watchers/index.ts index 3b9014a..811ece6 100644 --- a/src/watchers/index.ts +++ b/src/watchers/index.ts @@ -1,4 +1,7 @@ - - +export { + intellisenseConfigWatcher, + nitroSnippetsConfigWatcher, + nuxtSnippetsConfigWatcher, + templatesConfigWatcher +} from './config' export { default as filesWatcher } from './files' -export { nuxtSnippetsConfigWatcher, nitroSnippetsConfigWatcher, templatesConfigWatcher, intellisenseConfigWatcher } from './config' \ No newline at end of file diff --git a/tsup.config.ts b/tsup.config.ts index 3582942..25d4ba9 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'tsup' export default defineConfig({ entry: [ 'src/index.ts', ], - outDir: "out", + outDir: 'out', format: ['cjs'], shims: false, dts: false, @@ -18,16 +18,16 @@ export default defineConfig({ target: 'es2022', external: ['vscode'], noExternal: [ - "@nuxt/schema", - "destr", - "fs-extra", - "jiti", - "magicast", - "ofetch", - "pathe", - "pkg-types", - "string-ts", - "giget", - "semver" + '@nuxt/schema', + 'destr', + 'fs-extra', + 'jiti', + 'magicast', + 'ofetch', + 'pathe', + 'pkg-types', + 'string-ts', + 'giget', + 'semver' ] })