Skip to content

Commit c002913

Browse files
authored
chore: type errors and building optimization
chore: type errors and building optimization
2 parents 30c94ca + d9e67c8 commit c002913

File tree

10 files changed

+41
-37
lines changed

10 files changed

+41
-37
lines changed

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,8 @@
10331033
"typecheck": "tsc --noEmit"
10341034
},
10351035
"devDependencies": {
1036+
"@types/fs-extra": "^11.0.2",
1037+
"@types/util.promisify": "^1.0.5",
10361038
"@types/mocha": "^10.0.2",
10371039
"@types/node": "20.4.1",
10381040
"@types/vscode": "^1.82.0",
@@ -1046,8 +1048,6 @@
10461048
},
10471049
"dependencies": {
10481050
"@nuxt/schema": "^3.7.4",
1049-
"@types/fs-extra": "^11.0.2",
1050-
"@types/util.promisify": "^1.0.5",
10511051
"axios": "^1.5.1",
10521052
"destr": "^2.0.1",
10531053
"fs-extra": "^11.1.1",
@@ -1057,10 +1057,5 @@
10571057
"path": "^0.12.7",
10581058
"pkg-types": "^1.0.3",
10591059
"util": "^0.12.5"
1060-
},
1061-
"pnpm": {
1062-
"overrides": {
1063-
"magicast": "^0.3.0"
1064-
}
10651060
}
10661061
}

pnpm-lock.yaml

Lines changed: 13 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/Nuxi/multiStepCommands.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ export const handleModuleCommand = async () => {
8888
userSelection = selection.map((module) => module.label).join(' ')
8989
: userSelection = selection.label;
9090

91+
if (!userSelection || userSelection.length === 0) {
92+
return;
93+
}
94+
9195
const terminalName = `Nuxi: Module`;
9296
const command = `${runCommand} nuxi module add ${userSelection}`;
9397
newTerminal(terminalName, command, `${projectRootDirectory()}`);

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { workspace, ExtensionContext, commands, window } from 'vscode'
22
import { existsSync, promises as fs } from 'fs'
33
import { join } from 'path'
4-
import { isNuxtProject } from './utils'
4+
import { isNuxtProject, getConfiguration } from './utils'
55
import { activateExtension } from './extension'
66

77
export async function activate(context: ExtensionContext) {
88

99
let userRoot: string | undefined
1010

11-
const configuration = workspace.getConfiguration('nuxtr').monorepoMode.DirectoryName
11+
const configuration = getConfiguration().monorepoMode.DirectoryName
1212

1313
if (!configuration) {
1414
userRoot = workspace.workspaceFolders?.[0]?.uri.fsPath

src/intellisense/completionProviders/nuxtIgnore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class NuxtIgnoreCompletionProvider implements vscode.CompletionItemProvid
2929
} else if (textBeforeCursor.endsWith('!')) {
3030
const parts = textBeforeCursor.split('!');
3131
const userTypedPath = parts[0];
32+
// @ts-ignore
3233
const targetDirectory = path.join(currentDirectory, userTypedPath);
3334
const subDirectories = this.getSubDirectories(targetDirectory);
3435

src/intellisense/completionProviders/vueFiles.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ export class PublicDirCompletionProvider implements CompletionItemProvider {
6666

6767
if (subDirMatch) {
6868
const subdirectoryPath = subDirMatch[1];
69-
const subdirectories = subdirectoryPath.split('/');
7069

70+
if (!subdirectoryPath) {
71+
return [];
72+
}
73+
74+
const subdirectories = subdirectoryPath.split('/');
7175
let currentDir = isNuxtTwo() ? 'static' : 'public';
7276
const promises: Promise<CompletionItem[]>[] = [];
7377

@@ -135,6 +139,11 @@ export class NuxtPagesCompletionProvider implements CompletionItemProvider {
135139

136140
if (subDirMatch) {
137141
const subdirectoryPath = subDirMatch[1];
142+
143+
if (!subdirectoryPath) {
144+
return [];
145+
}
146+
138147
const subdirectories = subdirectoryPath.split('/');
139148

140149
let currentDir = 'pages';

src/templates/typeScriptFiles.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
function capitalizeFirstLettee(name: string) {
1+
function capitalizeFirstLetter(name: string) {
22
return name.charAt(0).toUpperCase() + name.slice(1)
3-
.replace(/\/([a-z])/g, (g) => g[1].toUpperCase())
43
}
54

65
const nitroDefaultTemplate = `export default defineEventHandler(async (event) => {
@@ -13,7 +12,7 @@ const nuxtMiddlewareTemplate = `export default defineNuxtRouteMiddleware((to, fr
1312
})
1413
`
1514

16-
const composableTemplate = (name: string) => `export const use${capitalizeFirstLettee(
15+
const composableTemplate = (name: string) => `export const use${capitalizeFirstLetter(
1716
name
1817
)} = () => {
1918
return ref()

src/utils/dependency.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ export const getProjectDependencies = async (): Promise<Dependency[]> => {
3030
const packageJSON = await readPackageJSON(packageJsonPath)
3131

3232
const addDependencies = (depObj: Record<string, string>) => {
33+
3334
dependencies.push(
3435
...Object.keys(depObj).map((key) => ({
3536
name: key,
37+
// @ts-ignore
3638
version: depObj[key].replace(/[\^~]/, ''),
3739
}))
3840
);
@@ -60,7 +62,6 @@ export const getOutdatedPackages = async () => {
6062
checkingVersionCommand = `${pm} outdated --json`
6163

6264

63-
logger.log(checkingVersionCommand)
6465
const child = exec(
6566
checkingVersionCommand,
6667
{ cwd: projectRootDirectory() },

tsconfig.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@
66
"target": "es2020",
77
"isolatedModules": true,
88
"moduleDetection": "force",
9+
"rootDir": "src",
910
"outDir": "out",
1011
"strict": true,
11-
"noUncheckedIndexedAccess": true,
12-
"noFallthroughCasesInSwitch": true,
13-
"forceConsistentCasingInFileNames": true,
14-
"noPropertyAccessFromIndexSignature": true,
1512
"skipLibCheck": true,
13+
"resolveJsonModule": true,
1614
"incremental": true,
17-
"tsBuildInfoFile": "node_modules/.cache/typescript/.tsbuildinfo",
15+
"sourceMap": true,
1816
},
1917
"exclude": [
2018
"node_modules",
2119
".vscode-test",
2220
"ui",
23-
"taze.config.ts"
21+
"taze.config.ts",
22+
"tsup.config.ts",
2423
],
2524
}

tsup.config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export default defineConfig({
1818
],
1919
noExternal: [
2020
"@nuxt/schema",
21-
"@types/fs-extra",
22-
"@types/util.promisify",
2321
"axios",
2422
"destr",
2523
"fs-extra",

0 commit comments

Comments
 (0)