Skip to content

Commit

Permalink
Merge pull request #3 from dinbtechit/chore/2024-chores
Browse files Browse the repository at this point in the history
Chore/2024 chores
  • Loading branch information
dinbtechit authored Jan 22, 2024
2 parents 9a8fa01 + 9fc7d8a commit 5af8213
Show file tree
Hide file tree
Showing 49 changed files with 5,155 additions and 127 deletions.
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ updates:
# Maintain dependencies for Gradle dependencies
- package-ecosystem: "gradle"
directory: "/"
target-branch: "next"
schedule:
interval: "daily"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "next"
schedule:
interval: "daily"
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1.1.0

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
Expand Down Expand Up @@ -102,11 +102,11 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
Expand Down Expand Up @@ -155,18 +155,18 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17

# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@v2023.2.1
uses: JetBrains/qodana-action@v2023.2.8
with:
cache-default-branch-only: true

Expand All @@ -186,11 +186,11 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
Expand Down Expand Up @@ -233,11 +233,11 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

## [Unreleased]
### Added
- New Menu for creating controller, module and service
- New File Icons for NestJS.

### Fixed
- Removed deprecated API
- Updated to the latest template changes

### Changed
- Updated icon for `nest-cli.json`.

## [0.0.1]
### Added
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
- Initial NestJS CLI Action - Right click anywhere in the nest project and generate nest components.
- Bug Fixes
Expand Down
6 changes: 5 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ dependencies {

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
jvmToolchain(17)
@Suppress("UnstableApiUsage")
jvmToolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.JETBRAINS
}
}

// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
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.dinbtechit.jetbrainsnestjs
pluginName = jetbrains-nestjs
pluginRepositoryUrl = https://github.com/dinbtechit/jetbrains-nestjs
# SemVer format -> https://semver.org
pluginVersion = 0.0.1
pluginVersion = 0.0.2

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 223
Expand All @@ -19,7 +19,7 @@ platformVersion = 2022.3.3
platformPlugins = JavaScript, PsiViewer:2022.3, com.github.dinbtechit.vscodetheme:1.10.2

# Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion = 8.3
gradleVersion = 8.5

# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
kotlin.stdlib.default.dependency = false
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[versions]
# libraries
annotations = "24.0.1"
annotations = "24.1.0"

# plugins
kotlin = "1.9.0"
changelog = "2.1.2"
gradleIntelliJPlugin = "1.15.0"
kotlin = "1.9.21"
changelog = "2.2.0"
gradleIntelliJPlugin = "1.16.1"
qodana = "0.1.13"
kover = "0.7.3"
kover = "0.7.5"

[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
2 changes: 1 addition & 1 deletion qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

version: 1.0
linter: jetbrains/qodana-jvm-community:latest
projectJDK: 17
projectJDK: "17"
profile:
name: qodana.recommended
exclude:
Expand Down
6 changes: 5 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
rootProject.name = "jetbrains-nestjs"
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

rootProject.name = "IntelliJ Platform Plugin Template"
25 changes: 17 additions & 8 deletions src/main/kotlin/com/github/dinbtechit/jetbrainsnestjs/NestIcons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@ import com.intellij.openapi.util.IconLoader
import javax.swing.Icon

object NestIcons {
@JvmField
val FileType = IconLoader.getIcon("/icons/type.svg", javaClass)
@JvmField
val logo: Icon = IconLoader.getIcon("/icons/nest.svg", javaClass)
@JvmField
val Donate = IconLoader.getIcon("icons/donate.svg", javaClass)
@JvmField
val GitHub = AllIcons.Vcs.Vendors.Github
@JvmField val FileType = IconLoader.getIcon("/icons/nest.svg", javaClass)
@JvmField val FileTypeController = IconLoader.getIcon("/icons/file-controller.svg", javaClass)
@JvmField val FileTypeControllerSpec = IconLoader.getIcon("/icons/file-controller-spec.svg", javaClass)
@JvmField val FileTypeService = IconLoader.getIcon("/icons/file-service.svg", javaClass)
@JvmField val FileTypeServiceSpec = IconLoader.getIcon("/icons/file-service-spec.svg", javaClass)
@JvmField val FileTypeModule = IconLoader.getIcon("/icons/file-module.svg", javaClass)
@JvmField val FileTypeGateway = IconLoader.getIcon("/icons/file-gateway.svg", javaClass)
@JvmField val FileTypeGatewaySpec = IconLoader.getIcon("/icons/file-gateway-spec.svg", javaClass)
@JvmField val FileTypeGuard = IconLoader.getIcon("/icons/file-guard.svg", javaClass)
@JvmField val FileTypeGuardSpec = IconLoader.getIcon("/icons/file-guard-spec.svg", javaClass)
@JvmField val FileTypePipe = IconLoader.getIcon("/icons/file-pipe.svg", javaClass)
@JvmField val FileTypePipeSpec = IconLoader.getIcon("/icons/file-pipe-spec.svg", javaClass)
@JvmField val FileTypeFilter = IconLoader.getIcon("/icons/file-filter.svg", javaClass)
@JvmField val FileTypeFilterSpec = IconLoader.getIcon("/icons/file-filter-spec.svg", javaClass)
@JvmField val logo: Icon = IconLoader.getIcon("/icons/nest.svg", javaClass)
@JvmField val Donate = IconLoader.getIcon("icons/donate.svg", javaClass)
@JvmField val GitHub = AllIcons.Vcs.Vendors.Github
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.github.dinbtechit.jetbrainsnestjs.actions.cli

import ai.grazie.utils.capitalize
import com.github.dinbtechit.jetbrainsnestjs.actions.cli.store.Action
import com.github.dinbtechit.jetbrainsnestjs.actions.cli.store.CLIState
import com.github.dinbtechit.jetbrainsnestjs.actions.cli.util.NestGeneratorFileUtil
import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.components.service
import com.intellij.openapi.editor.event.DocumentEvent
import com.intellij.openapi.editor.event.DocumentListener
import com.intellij.openapi.project.Project
Expand All @@ -14,21 +19,18 @@ import com.intellij.ui.ComboboxSpeedSearch
import com.intellij.ui.TextFieldWithAutoCompletion
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.JBTextField
import com.intellij.ui.dsl.builder.Align
import com.intellij.ui.dsl.builder.TopGap
import com.intellij.ui.dsl.builder.panel
import com.intellij.ui.layout.ComboBoxPredicate
import com.intellij.ui.layout.ComponentPredicate
import com.intellij.util.ui.UIUtil
import com.github.dinbtechit.jetbrainsnestjs.actions.cli.store.Action
import com.github.dinbtechit.jetbrainsnestjs.actions.cli.store.CLIState
import com.github.dinbtechit.jetbrainsnestjs.actions.cli.util.NestGeneratorFileUtil
import com.intellij.openapi.components.service
import com.intellij.ui.dsl.builder.Align
import java.awt.event.ItemEvent
import javax.swing.DefaultComboBoxModel
import javax.swing.JComponent

class GenerateCLIDialog(private val project: Project, val e: AnActionEvent) : DialogWrapper(project) {
class GenerateCLIDialog(private val project: Project, val e: AnActionEvent, val type: String? = null) :
DialogWrapper(project) {
private val autoCompleteField = TextFieldWithAutoCompletion(
project,
CLIOptionsCompletionProvider(CLIOptionsCompletionProvider.options.keys.toList()), false,
Expand Down Expand Up @@ -66,10 +68,10 @@ class GenerateCLIDialog(private val project: Project, val e: AnActionEvent) : Di
}

init {
title = "Nest CLI/Schematics Generate"
title = if (type != null) "Nest ${type.capitalize()} Generate" else "Nest CLI/Schematics Generate"
val state = nestStoreService.store.getState()
comboBox.item = state.type ?: "controller"
autoCompleteField.text = state.parameter
comboBox.item = type ?: (state.type ?: "controller")
autoCompleteField.text = if (type == null) state.parameter else ""
generatePath.text = NestGeneratorFileUtil.computeGeneratePath(comboBox.item, project, directory)
generatePath.isEnabled = false
moduleInfoLabel.text = """<html><b>Updates Module:</b>
Expand All @@ -91,7 +93,7 @@ class GenerateCLIDialog(private val project: Project, val e: AnActionEvent) : Di
generatePath.text = NestGeneratorFileUtil.computeGeneratePath(comboBox.item, project, directory)
}
}
ComboboxSpeedSearch(comboBox)
ComboboxSpeedSearch.installSpeedSearch(comboBox) { comboBox.item }
}

private fun isAppOrLibrarySelected(): Boolean {
Expand All @@ -110,10 +112,10 @@ class GenerateCLIDialog(private val project: Project, val e: AnActionEvent) : Di
}.visible(generatePath.text.trim().isNotBlank())


row("Type:") {}.topGap(TopGap.SMALL)
row("Type:") {}.topGap(TopGap.SMALL).visible(type == null)
row {
cell(comboBox).align(Align.FILL)
}
}.visible(type == null)
row {
cell(
warningLabel.apply {
Expand Down Expand Up @@ -161,7 +163,7 @@ class GenerateCLIDialog(private val project: Project, val e: AnActionEvent) : Di
&& generatePath.text.trim().isNotBlank()
)
}.visibleIf(showModuleLocation)
.visibleIf(TextComponentPredicate(autoCompleteField) {
.visibleIf(TextComponentPredicate(autoCompleteField) {
!it.contains("--skip-import")
})
}
Expand All @@ -183,7 +185,7 @@ class GenerateCLIDialog(private val project: Project, val e: AnActionEvent) : Di
override fun doOKAction() {
nestStoreService.store.dispatch(
Action.GenerateCLIAction(
type = comboBox.item,
type = type ?: comboBox.item,
options = autoCompleteField.text,
filePath = NestGeneratorFileUtil.getFilePath(project, e, directory),
project = project,
Expand Down
Loading

0 comments on commit 5af8213

Please sign in to comment.