diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5937b2..6bd2c09 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -202,9 +202,9 @@ jobs: # Run Verify Plugin task and IntelliJ Plugin Verifier tool - name: Run Plugin Verification tasks - # run: exit 0 + run: exit 0 # Disabled until it works again for a lot of IDEs (https://github.com/JetBrains/intellij-platform-plugin-template/issues/462) - run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} + # run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} # Collect Plugin Verifier Result - name: Collect Plugin Verifier Result diff --git a/CHANGELOG.md b/CHANGELOG.md index 011ee13..0abb156 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ ## [Unreleased] +### Fixed + +- Fix a crash when not using TypeScript in a Svelte project (#62) + ## [0.9.0] - 2024-08-01 ### Added diff --git a/gradle.properties b/gradle.properties index c2f7a72..db8ecdf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ pluginGroup = com.github.warningimhack3r.intellijshadcnplugin pluginName = intellij-shadcn-plugin pluginRepositoryUrl = https://github.com/WarningImHack3r/intellij-shadcn-plugin # SemVer format -> https://semver.org -pluginVersion = 0.9.0 +pluginVersion = 0.9.1 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 223 @@ -21,7 +21,7 @@ platformPlugins = dev.blachut.svelte.lang:223.7571.203, org.jetbrains.plugins.vu platformBundledPlugins = JavaScript, intellij.webpack # Gradle Releases -> https://github.com/gradle/gradle/releases -gradleVersion = 8.9 +gradleVersion = 8.10 # Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib kotlin.stdlib.default.dependency = false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8ef9414..41f65fe 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,10 +5,10 @@ junit = "4.13.2" # plugins changelog = "2.2.1" intellijPlatform = "2.0.1" -kotlin = "2.0.10" +kotlin = "2.0.20" kover = "0.8.3" qodana = "2024.1.9" -serialization = "1.7.1" +serialization = "1.7.2" [libraries] junit = { group = "junit", name = "junit", version.ref = "junit" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 2c35211..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/backend/sources/impl/SvelteSource.kt b/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/backend/sources/impl/SvelteSource.kt index 68171b8..bc9da38 100644 --- a/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/backend/sources/impl/SvelteSource.kt +++ b/src/main/kotlin/com/github/warningimhack3r/intellijshadcnplugin/backend/sources/impl/SvelteSource.kt @@ -36,25 +36,27 @@ open class SvelteSource(project: Project) : Source(project, Svelte log.warn("Alias $alias does not start with $, @ or ~, returning it as-is") return alias } - val usesKit = DependencyManager.getInstance(project).isDependencyInstalled("@sveltejs/kit") - val tsConfigName = if (getLocalConfig().typescript) "tsconfig.json" else "jsconfig.json" - val configFile = if (usesKit) ".svelte-kit/$tsConfigName" else tsConfigName val fileManager = FileManager.getInstance(project) - var tsConfig = fileManager.getFileContentsAtPath(configFile) + val usesKit = DependencyManager.getInstance(project).isDependencyInstalled("@sveltejs/kit") + val configFileName = if (usesKit) { + ".svelte-kit/tsconfig.json" + } else if (getLocalConfig().typescript) "tsconfig.json" else "jsconfig.json" + var tsConfig = fileManager.getFileContentsAtPath(configFileName) if (tsConfig == null) { - if (!usesKit) throw NoSuchFileException("Cannot get $configFile") + if (!usesKit) throw NoSuchFileException("Cannot get $configFileName") val res = ShellRunner.getInstance(project).execute(arrayOf("npx", "svelte-kit", "sync")) if (res == null) { NotificationManager(project).sendNotification( - "Failed to generate $configFile", + "Failed to generate $configFileName", "Please run npx svelte-kit sync in your project directory to generate the file and try again.", NotificationType.ERROR ) - throw NoSuchFileException("Cannot get or generate $configFile") + throw NoSuchFileException("Cannot get or generate $configFileName") } - Thread.sleep(250) // wait for the sync to create the files + Thread.sleep(500) // wait for the sync to create the files tsConfig = - fileManager.getFileContentsAtPath(configFile) ?: throw NoSuchFileException("Cannot get $configFile") + fileManager.getFileContentsAtPath(configFileName) + ?: throw NoSuchFileException("Cannot get $configFileName after sync") } val aliasPath = parseTsConfig(tsConfig) .jsonObject["compilerOptions"]