From 4b19b1f8b9a57eaf3876265363b32baf9ad49db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Wouts?= Date: Sun, 20 Feb 2022 11:01:13 +1100 Subject: [PATCH] fix(intellij): wrong version of @package/app was used --- .../intellij/plugin/services/PreviewJsService.kt | 13 +++++++------ scripts/release.ts | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/integrations/intellij/src/main/kotlin/com/previewjs/intellij/plugin/services/PreviewJsService.kt b/integrations/intellij/src/main/kotlin/com/previewjs/intellij/plugin/services/PreviewJsService.kt index 2b63c1bffb1..c6898115a0d 100644 --- a/integrations/intellij/src/main/kotlin/com/previewjs/intellij/plugin/services/PreviewJsService.kt +++ b/integrations/intellij/src/main/kotlin/com/previewjs/intellij/plugin/services/PreviewJsService.kt @@ -27,6 +27,8 @@ import java.util.* const val PLUGIN_ID = "com.previewjs.intellij.plugin" +const val PACKAGE_NAME = "@previewjs/app" +const val PACKAGE_VERSION = "1.1.0" @Service class PreviewJsSharedService : Disposable { @@ -117,8 +119,8 @@ ${e.stackTraceToString()}""", private fun isInstalled(): Boolean { val builder = processBuilder("node dist/is-installed.js") .directory(nodeDirPath.toFile()) - builder.environment()["PREVIEWJS_PACKAGE_NAME"] = "@previewjs/app" - builder.environment()["PREVIEWJS_PACKAGE_VERSION"] = "1.1.0" + builder.environment()["PREVIEWJS_PACKAGE_NAME"] = PACKAGE_NAME + builder.environment()["PREVIEWJS_PACKAGE_VERSION"] = PACKAGE_VERSION val process = builder.start() if (process.waitFor() != 0) { throw Error(readInputStream(process.errorStream)) @@ -153,8 +155,8 @@ ${e.stackTraceToString()}""", private fun install(project: Project) { val builder = processBuilder("node dist/install.js") .directory(nodeDirPath.toFile()) - builder.environment()["PREVIEWJS_PACKAGE_NAME"] = "@previewjs/app" - builder.environment()["PREVIEWJS_PACKAGE_VERSION"] = "1.0.3" + builder.environment()["PREVIEWJS_PACKAGE_NAME"] = PACKAGE_NAME + builder.environment()["PREVIEWJS_PACKAGE_VERSION"] = PACKAGE_VERSION val process = builder.start() val reader = BufferedReader(InputStreamReader(process.inputStream)) val consoleView = project.service().consoleView @@ -173,8 +175,7 @@ ${e.stackTraceToString()}""", .directory(nodeDirPath.toFile()) builder.environment()["PORT"] = "$PORT" builder.environment()["PREVIEWJS_INTELLIJ_VERSION"] = plugin.getVersion() - builder.environment()["PREVIEWJS_PACKAGE_NAME"] = "@previewjs/app" - builder.environment()["PREVIEWJS_PACKAGE_VERSION"] = "1.0.3" + builder.environment()["PREVIEWJS_PACKAGE_NAME"] = PACKAGE_NAME val process = builder.start() serverProcess = process serverOutputReader = BufferedReader(InputStreamReader(process.inputStream)) diff --git a/scripts/release.ts b/scripts/release.ts index c464cfed822..71843a84854 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -33,8 +33,8 @@ async function main() { const version = await updateNodePackage("app"); await replaceInFile( "integrations/intellij/src/main/kotlin/com/previewjs/intellij/plugin/services/PreviewJsService.kt", - /\["PREVIEWJS_PACKAGE_VERSION"\] = "\d+\.\d+\.\d+"/, - `["PREVIEWJS_PACKAGE_VERSION"] = "${version}"` + /const val PACKAGE_VERSION = "\d+\.\d+\.\d+"/, + `const val PACKAGE_VERSION = "${version}"` ); await replaceInFile( "integrations/vscode/webpack.config.js",