You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ma...@apache.org on 2022/05/26 14:50:50 UTC

[camel-karavan] branch main updated: Version 0.0.16 (#356)

This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new 50d0ea0  Version 0.0.16 (#356)
50d0ea0 is described below

commit 50d0ea0f2a91798995392710af2c1025c0ddb143
Author: Marat Gubaidullin <ma...@gmail.com>
AuthorDate: Thu May 26 10:50:45 2022 -0400

    Version 0.0.16 (#356)
---
 karavan-app/pom.xml                      |  2 +-
 karavan-app/src/main/webapp/package.json |  2 +-
 karavan-designer/package.json            |  2 +-
 karavan-generator/pom.xml                |  2 +-
 karavan-vscode/package.json              |  2 +-
 karavan-vscode/src/utils.ts              | 52 +++++++++++++++++---------------
 6 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/karavan-app/pom.xml b/karavan-app/pom.xml
index ea2e1c8..7932f8e 100644
--- a/karavan-app/pom.xml
+++ b/karavan-app/pom.xml
@@ -18,7 +18,7 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <modelVersion>4.0.0</modelVersion>
         <groupId>org.apache.camel.karavan</groupId>
-        <version>0.0.15</version>
+        <version>0.0.16</version>
     <artifactId>karavan</artifactId>
     <properties>
         <compiler-plugin.version>3.8.1</compiler-plugin.version>
diff --git a/karavan-app/src/main/webapp/package.json b/karavan-app/src/main/webapp/package.json
index d7c065c..d5a8f95 100644
--- a/karavan-app/src/main/webapp/package.json
+++ b/karavan-app/src/main/webapp/package.json
@@ -1,6 +1,6 @@
 {
   "name": "karavan",
-  "version": "0.0.15",
+  "version": "0.0.16",
   "private": true,
   "scripts": {
     "copy-designer": "cp -r ../../../../karavan-designer/src/designer src && cp -r ../../../../karavan-designer/src/kamelets src && cp -r ../../../../karavan-designer/src/components src && cp -r ../../../../karavan-designer/src/eip src",
diff --git a/karavan-designer/package.json b/karavan-designer/package.json
index 02aa7fa..55bb3f5 100644
--- a/karavan-designer/package.json
+++ b/karavan-designer/package.json
@@ -1,6 +1,6 @@
 {
   "name": "karavan-designer",
-  "version": "0.0.15",
+  "version": "0.0.16",
   "license": "Apache-2.0",
   "scripts": {
     "start": "react-scripts start",
diff --git a/karavan-generator/pom.xml b/karavan-generator/pom.xml
index 23d2b4e..310d67e 100644
--- a/karavan-generator/pom.xml
+++ b/karavan-generator/pom.xml
@@ -19,7 +19,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.camel.karavan</groupId>
     <artifactId>karavan-generator</artifactId>
-    <version>0.0.15</version>
+    <version>0.0.16</version>
     <properties>
         <compiler-plugin.version>3.8.1</compiler-plugin.version>
         <maven.compiler.parameters>true</maven.compiler.parameters>
diff --git a/karavan-vscode/package.json b/karavan-vscode/package.json
index 69caad9..2fbcba2 100644
--- a/karavan-vscode/package.json
+++ b/karavan-vscode/package.json
@@ -4,7 +4,7 @@
   "displayName": "Karavan",
   "icon": "icons/karavan.png",
   "description": "Apache Camel Mastering Tool",
-  "version": "0.0.15",
+  "version": "0.0.16",
   "license": "Apache-2.0",
   "preview": true,
   "bugs": {
diff --git a/karavan-vscode/src/utils.ts b/karavan-vscode/src/utils.ts
index 3cd2682..0765cce 100644
--- a/karavan-vscode/src/utils.ts
+++ b/karavan-vscode/src/utils.ts
@@ -1,12 +1,12 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
+ * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
+ * the License.  You may obtain a copy of the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -20,7 +20,7 @@ import * as path from "path";
 import * as shell from 'shelljs';
 import { CamelDefinitionYaml } from "karavan-core/lib/api/CamelDefinitionYaml";
 
-export function save(relativePath: string, text: string){
+export function save(relativePath: string, text: string) {
     if (vscode.workspace.workspaceFolders) {
         const uriFolder: vscode.Uri = vscode.workspace.workspaceFolders[0].uri;
         const uriFile: vscode.Uri = vscode.Uri.file(path.join(uriFolder.path, relativePath));
@@ -30,7 +30,7 @@ export function save(relativePath: string, text: string){
     }
 }
 
-export function deleteFile(fullPath: string){
+export function deleteFile(fullPath: string) {
     if (vscode.workspace.workspaceFolders) {
         fs.rmSync(path.resolve(fullPath));
     }
@@ -38,7 +38,7 @@ export function deleteFile(fullPath: string){
 
 export function getRalativePath(fullPath: string): string {
     const root = vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0].uri.path : "";
-    const normalizedRoot = vscode.Uri.file(root).fsPath ;
+    const normalizedRoot = vscode.Uri.file(root).fsPath;
     const relativePath = path.resolve(fullPath).replace(normalizedRoot + path.sep, '');
     return relativePath;
 }
@@ -47,10 +47,12 @@ export function readKamelets(context: vscode.ExtensionContext): string[] {
     const dir = path.join(context.extensionPath, 'kamelets');
     const yamls: string[] = fs.readdirSync(dir).filter(file => file.endsWith("yaml")).map(file => fs.readFileSync(dir + "/" + file, 'utf-8'));
     try {
-        const kameletsPath: string = vscode.workspace.getConfiguration().get("Karavan.kameletsPath") || '';
-        const kameletsDir = path.isAbsolute(kameletsPath) ? kameletsPath : path.resolve(kameletsPath);
-        const customKamelets: string[] = fs.readdirSync(kameletsDir).filter(file => file.endsWith("yaml")).map(file => fs.readFileSync(kameletsDir + "/" + file, 'utf-8'));
-        if (customKamelets && customKamelets.length > 0) yamls.push(...customKamelets);
+        const kameletsPath: string | undefined = vscode.workspace.getConfiguration().get("Karavan.kameletsPath");
+        if (kameletsPath && kameletsPath.trim().length > 0) {
+            const kameletsDir = path.isAbsolute(kameletsPath) ? kameletsPath : path.resolve(kameletsPath);
+            const customKamelets: string[] = fs.readdirSync(kameletsDir).filter(file => file.endsWith("yaml")).map(file => fs.readFileSync(kameletsDir + "/" + file, 'utf-8'));
+            if (customKamelets && customKamelets.length > 0) yamls.push(...customKamelets);
+        }
     } catch (e) {
 
     }
@@ -72,7 +74,7 @@ export function parceYaml(filename: string, yaml: string): [boolean, string?] {
     }
 }
 
-export function disableStartHelp(){
+export function disableStartHelp() {
     const config = vscode.workspace.getConfiguration();
     config.update("Karavan.showStartHelp", false);
 }
@@ -87,23 +89,23 @@ export function nameFromTitle(title: string): string {
     return title.replace(/[^a-z0-9+]+/gi, "-").toLowerCase();
 }
 
-export function getAllFiles (dirPath, arrayOfFiles: string[]): string[]  {
+export function getAllFiles(dirPath, arrayOfFiles: string[]): string[] {
     const files = fs.readdirSync(dirPath)
-  
+
     arrayOfFiles = arrayOfFiles || []
-  
-    files.forEach(function(file) {
-      if (fs.statSync(dirPath + "/" + file).isDirectory()) {
-        arrayOfFiles = getAllFiles(dirPath + "/" + file, arrayOfFiles)
-      } else {
-        arrayOfFiles.push(path.join(dirPath, "/", file))
-      }
+
+    files.forEach(function (file) {
+        if (fs.statSync(dirPath + "/" + file).isDirectory()) {
+            arrayOfFiles = getAllFiles(dirPath + "/" + file, arrayOfFiles)
+        } else {
+            arrayOfFiles.push(path.join(dirPath, "/", file))
+        }
     })
     return arrayOfFiles
-  }
+}
 
 export function getYamlFiles(baseDir: string): string[] {
-    const result:string[] = [];
+    const result: string[] = [];
     getAllFiles(baseDir, []).filter(f => f.endsWith(".yaml")).forEach(f => {
         result.push(f);
     })
@@ -111,7 +113,7 @@ export function getYamlFiles(baseDir: string): string[] {
 }
 
 export function getPropertyFiles(baseDir: string): string[] {
-    const result:string[] = [];
+    const result: string[] = [];
     getAllFiles(baseDir, []).filter(f => f.endsWith(".properties")).forEach(f => {
         result.push(f);
     })
@@ -119,14 +121,14 @@ export function getPropertyFiles(baseDir: string): string[] {
 }
 
 export function getJsonFiles(baseDir: string): string[] {
-    const result:string[] = [];
+    const result: string[] = [];
     getAllFiles(baseDir, []).filter(f => f.endsWith(".json")).forEach(f => {
         result.push(f);
     })
     return result;
 }
 
-export function getIntegrationFiles(baseDir: string): string[]{
+export function getIntegrationFiles(baseDir: string): string[] {
     return getYamlFiles(baseDir).filter(f => {
         const yaml = fs.readFileSync(path.resolve(f)).toString('utf8');
         return !f.startsWith(baseDir + path.sep + "target") && CamelDefinitionYaml.yamlIsIntegration(yaml);