Skip to content

Commit

Permalink
0.9.1
Browse files Browse the repository at this point in the history
- Fix wrong tsconfig being resolved when having typescript to false with Svelte (fixes #62)
- Upgrade Gradle and dependencies
  • Loading branch information
WarningImHack3r committed Sep 14, 2024
1 parent c81c6c4 commit 2ba3888
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,27 @@ open class SvelteSource(project: Project) : Source<SvelteConfig>(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 <code>npx svelte-kit sync</code> 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"]
Expand Down

0 comments on commit 2ba3888

Please sign in to comment.