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

nicholasjiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-paimon-webui.git


The following commit(s) were added to refs/heads/main by this push:
     new b2ebaa9  [Improvement] Support generate license script and update 
gitignore (#184)
b2ebaa9 is described below

commit b2ebaa9f1435c03e1afe8c7e989db3af3bc45193
Author: xiaomo <wegi...@gmail.com>
AuthorDate: Thu Feb 1 14:17:40 2024 +0800

    [Improvement] Support generate license script and update gitignore (#184)
---
 .gitignore                               |  12 +--
 paimon-web-ui/.eslintignore              |   3 +-
 paimon-web-ui/.eslintrc-auto-import.json |  85 ---------------------
 paimon-web-ui/README.md                  |   7 ++
 paimon-web-ui/apiWeb.json                |   4 -
 paimon-web-ui/auto-imports.d.ts          |  94 -----------------------
 paimon-web-ui/components.d.ts            |  31 --------
 paimon-web-ui/httpData/.gitignore        |   6 --
 paimon-web-ui/httpData/apiWeb.json       |   4 -
 paimon-web-ui/license.node.js            | 125 +++++++++++++++++++++++++++++++
 paimon-web-ui/package.json               |   3 +-
 paimon-web-ui/pom.xml                    |  98 ++++++++++++++++++++++++
 paimon-web-ui/src/assets/logo.svg        |  18 +++++
 paimon-web-ui/tsconfig.node.json         |   3 +-
 14 files changed, 261 insertions(+), 232 deletions(-)

diff --git a/.gitignore b/.gitignore
index af5d853..594e5a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,13 @@ target/
 .vim
 .tmp
 node/
+paimon-web-ui/.idea
+paimon-web-ui/.vscode
+paimon-web-ui/auto-imports.d.ts
+paimon-web-ui/components.d.ts
+paimon-web-ui/.eslintrc-auto-import.json
+paimon-web-ui/httpData
+paimon-web-ui/apiWeb.json
 logs/*
 .mvn/
 .www
@@ -67,8 +74,3 @@ coverage
 *.njsproj
 *.sln
 *.sw?
-
-# paimon-web-ui
-paimon-web-ui/auto-imports.d.ts
-paimon-web-ui/httpData
-paimon-web-ui/apiWeb.json
diff --git a/paimon-web-ui/.eslintignore b/paimon-web-ui/.eslintignore
index a0c8ea1..4493cbd 100644
--- a/paimon-web-ui/.eslintignore
+++ b/paimon-web-ui/.eslintignore
@@ -15,4 +15,5 @@
  * limitations under the License.
  */
 
-mock/**.js
+mock
+license.node.js
diff --git a/paimon-web-ui/.eslintrc-auto-import.json 
b/paimon-web-ui/.eslintrc-auto-import.json
deleted file mode 100644
index 883b20f..0000000
--- a/paimon-web-ui/.eslintrc-auto-import.json
+++ /dev/null
@@ -1,85 +0,0 @@
-{
-  "globals": {
-    "Component": true,
-    "ComponentPublicInstance": true,
-    "ComputedRef": true,
-    "EffectScope": true,
-    "InjectionKey": true,
-    "PropType": true,
-    "Ref": true,
-    "VNode": true,
-    "WritableComputedRef": true,
-    "acceptHMRUpdate": true,
-    "computed": true,
-    "createApp": true,
-    "createPinia": true,
-    "customRef": true,
-    "defineAsyncComponent": true,
-    "defineComponent": true,
-    "defineStore": true,
-    "effectScope": true,
-    "getActivePinia": true,
-    "getCurrentInstance": true,
-    "getCurrentScope": true,
-    "h": true,
-    "inject": true,
-    "isProxy": true,
-    "isReactive": true,
-    "isReadonly": true,
-    "isRef": true,
-    "mapActions": true,
-    "mapGetters": true,
-    "mapState": true,
-    "mapStores": true,
-    "mapWritableState": true,
-    "markRaw": true,
-    "nextTick": true,
-    "onActivated": true,
-    "onBeforeMount": true,
-    "onBeforeRouteLeave": true,
-    "onBeforeRouteUpdate": true,
-    "onBeforeUnmount": true,
-    "onBeforeUpdate": true,
-    "onDeactivated": true,
-    "onErrorCaptured": true,
-    "onMounted": true,
-    "onRenderTracked": true,
-    "onRenderTriggered": true,
-    "onScopeDispose": true,
-    "onServerPrefetch": true,
-    "onUnmounted": true,
-    "onUpdated": true,
-    "provide": true,
-    "reactive": true,
-    "readonly": true,
-    "ref": true,
-    "resolveComponent": true,
-    "setActivePinia": true,
-    "setMapStoreSuffix": true,
-    "shallowReactive": true,
-    "shallowReadonly": true,
-    "shallowRef": true,
-    "storeToRefs": true,
-    "toRaw": true,
-    "toRef": true,
-    "toRefs": true,
-    "toValue": true,
-    "triggerRef": true,
-    "unref": true,
-    "useAttrs": true,
-    "useCssModule": true,
-    "useCssVars": true,
-    "useLink": true,
-    "useRoute": true,
-    "useRouter": true,
-    "useSlots": true,
-    "watch": true,
-    "watchEffect": true,
-    "watchPostEffect": true,
-    "watchSyncEffect": true,
-    "useDialog": true,
-    "useLoadingBar": true,
-    "useMessage": true,
-    "useNotification": true
-  }
-}
diff --git a/paimon-web-ui/README.md b/paimon-web-ui/README.md
index f0c8e16..32992dd 100644
--- a/paimon-web-ui/README.md
+++ b/paimon-web-ui/README.md
@@ -62,3 +62,10 @@ pnpm lint
 # License
 
 [Apache 2.0 License.](/LICENSE)
+
+You can run this command to automatically generate the corresponding protocol 
before commit.
+
+```sh
+pnpm run gen:license
+```
+
diff --git a/paimon-web-ui/apiWeb.json b/paimon-web-ui/apiWeb.json
deleted file mode 100644
index b576de9..0000000
--- a/paimon-web-ui/apiWeb.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "paths": {},
-  "disable": []
-}
\ No newline at end of file
diff --git a/paimon-web-ui/auto-imports.d.ts b/paimon-web-ui/auto-imports.d.ts
deleted file mode 100644
index 92e4ec9..0000000
--- a/paimon-web-ui/auto-imports.d.ts
+++ /dev/null
@@ -1,94 +0,0 @@
-/* eslint-disable */
-/* prettier-ignore */
-// @ts-nocheck
-// noinspection JSUnusedGlobalSymbols
-// Generated by unplugin-auto-import
-export {}
-declare global {
-  const EffectScope: typeof import('vue')['EffectScope']
-  const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
-  const computed: typeof import('vue')['computed']
-  const createApp: typeof import('vue')['createApp']
-  const createNewCatalog: typeof 
import('./src/api/models/catalog/index')['createNewCatalog']
-  const createPinia: typeof import('pinia')['createPinia']
-  const customRef: typeof import('vue')['customRef']
-  const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
-  const defineComponent: typeof import('vue')['defineComponent']
-  const defineStore: typeof import('pinia')['defineStore']
-  const effectScope: typeof import('vue')['effectScope']
-  const getActivePinia: typeof import('pinia')['getActivePinia']
-  const getAllCatalogs: typeof 
import('./src/api/models/catalog/index')['getAllCatalogs']
-  const getCurrentInstance: typeof import('vue')['getCurrentInstance']
-  const getCurrentScope: typeof import('vue')['getCurrentScope']
-  const getDatabasesByCatalogId: typeof 
import('./src/api/models/catalog/index')['getDatabasesByCatalogId']
-  const h: typeof import('vue')['h']
-  const inject: typeof import('vue')['inject']
-  const isProxy: typeof import('vue')['isProxy']
-  const isReactive: typeof import('vue')['isReactive']
-  const isReadonly: typeof import('vue')['isReadonly']
-  const isRef: typeof import('vue')['isRef']
-  const mapActions: typeof import('pinia')['mapActions']
-  const mapGetters: typeof import('pinia')['mapGetters']
-  const mapState: typeof import('pinia')['mapState']
-  const mapStores: typeof import('pinia')['mapStores']
-  const mapWritableState: typeof import('pinia')['mapWritableState']
-  const markRaw: typeof import('vue')['markRaw']
-  const nextTick: typeof import('vue')['nextTick']
-  const onActivated: typeof import('vue')['onActivated']
-  const onBeforeMount: typeof import('vue')['onBeforeMount']
-  const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
-  const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
-  const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
-  const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
-  const onDeactivated: typeof import('vue')['onDeactivated']
-  const onErrorCaptured: typeof import('vue')['onErrorCaptured']
-  const onLogin: typeof import('./src/api/models/login/index')['onLogin']
-  const onLogout: typeof import('./src/api/models/login/index')['onLogout']
-  const onMounted: typeof import('vue')['onMounted']
-  const onRenderTracked: typeof import('vue')['onRenderTracked']
-  const onRenderTriggered: typeof import('vue')['onRenderTriggered']
-  const onScopeDispose: typeof import('vue')['onScopeDispose']
-  const onServerPrefetch: typeof import('vue')['onServerPrefetch']
-  const onUnmounted: typeof import('vue')['onUnmounted']
-  const onUpdated: typeof import('vue')['onUpdated']
-  const provide: typeof import('vue')['provide']
-  const reactive: typeof import('vue')['reactive']
-  const readonly: typeof import('vue')['readonly']
-  const ref: typeof import('vue')['ref']
-  const request: typeof import('./src/api/request')['default']
-  const resolveComponent: typeof import('vue')['resolveComponent']
-  const setActivePinia: typeof import('pinia')['setActivePinia']
-  const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
-  const shallowReactive: typeof import('vue')['shallowReactive']
-  const shallowReadonly: typeof import('vue')['shallowReadonly']
-  const shallowRef: typeof import('vue')['shallowRef']
-  const storeToRefs: typeof import('pinia')['storeToRefs']
-  const toRaw: typeof import('vue')['toRaw']
-  const toRef: typeof import('vue')['toRef']
-  const toRefs: typeof import('vue')['toRefs']
-  const toValue: typeof import('vue')['toValue']
-  const triggerRef: typeof import('vue')['triggerRef']
-  const types: typeof import('./src/api/types')['default']
-  const unref: typeof import('vue')['unref']
-  const useAttrs: typeof import('vue')['useAttrs']
-  const useCssModule: typeof import('vue')['useCssModule']
-  const useCssVars: typeof import('vue')['useCssVars']
-  const useDialog: typeof import('naive-ui')['useDialog']
-  const useLink: typeof import('vue-router')['useLink']
-  const useLoadingBar: typeof import('naive-ui')['useLoadingBar']
-  const useLocaleHooks: typeof 
import('./src/composables/locales')['useLocaleHooks']
-  const useMessage: typeof import('naive-ui')['useMessage']
-  const useNotification: typeof import('naive-ui')['useNotification']
-  const useRoute: typeof import('vue-router')['useRoute']
-  const useRouter: typeof import('vue-router')['useRouter']
-  const useSlots: typeof import('vue')['useSlots']
-  const watch: typeof import('vue')['watch']
-  const watchEffect: typeof import('vue')['watchEffect']
-  const watchPostEffect: typeof import('vue')['watchPostEffect']
-  const watchSyncEffect: typeof import('vue')['watchSyncEffect']
-}
-// for type re-export
-declare global {
-  // @ts-ignore
-  export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, 
PropType, Ref, VNode, WritableComputedRef } from 'vue'
-}
diff --git a/paimon-web-ui/components.d.ts b/paimon-web-ui/components.d.ts
deleted file mode 100644
index f5a670e..0000000
--- a/paimon-web-ui/components.d.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
-or more 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
-
-  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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License. */
-
-/* eslint-disable */
-/* prettier-ignore */
-// @ts-nocheck
-// generated by unplugin-vue-components
-// We suggest you to commit this file into source control
-// Read more: https://github.com/vuejs/core/pull/3399
-export {}
-
-declare module 'vue' {
-  export interface GlobalComponents {
-    RouterLink: typeof import('vue-router')['RouterLink']
-    RouterView: typeof import('vue-router')['RouterView']
-  }
-}
diff --git a/paimon-web-ui/httpData/.gitignore 
b/paimon-web-ui/httpData/.gitignore
deleted file mode 100644
index fb1e814..0000000
--- a/paimon-web-ui/httpData/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-openApiHistory/
-request/
-db.json
-httpHistory.json
-log.err.txt
-store.json
\ No newline at end of file
diff --git a/paimon-web-ui/httpData/apiWeb.json 
b/paimon-web-ui/httpData/apiWeb.json
deleted file mode 100644
index b576de9..0000000
--- a/paimon-web-ui/httpData/apiWeb.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "paths": {},
-  "disable": []
-}
\ No newline at end of file
diff --git a/paimon-web-ui/license.node.js b/paimon-web-ui/license.node.js
new file mode 100644
index 0000000..f9e16e3
--- /dev/null
+++ b/paimon-web-ui/license.node.js
@@ -0,0 +1,125 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+or more 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
+
+  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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License. */
+
+const fs = require('fs');
+const path = require('path');
+
+const filePath = path.resolve(__dirname, './src');
+
+const xmlLicenses = `
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more 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
+
+  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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+`
+
+const tsLicenses = `
+/* Licensed to the Apache Software Foundation (ASF) under one
+or more 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
+
+  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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License. */
+`
+
+function fileDisplay(filePath) {
+  fs.readdir(filePath, function (err, files) {
+    if (err) {
+      console.warn('get file list error: ' + err);
+    } else {
+      for (let index = 0; index < files.length; index++) {
+        const filename = files[index];
+        const filedir = path.join(filePath, filename);
+        fs.stat(filedir, function (eror, stats) {
+          if (eror) {
+            console.warn('get file stat error: ' + eror);
+          } else {
+            const isFile = stats.isFile();
+            const isDir = stats.isDirectory();
+            if (isFile) {
+              const res = read(filedir);
+              const fileName = path.basename(filedir);
+              res && console.log('success file: ' + fileName);
+            }
+            if (isDir) {
+              fileDisplay(filedir)
+            }
+          }
+        })
+      }
+    }
+  });
+}
+
+function read(fPath) {
+  var data = fs.readFileSync(fPath, "utf-8");
+  return write(data, fPath)
+}
+
+function write(data, fPath) {
+  if (data.includes('Apache') && data.includes('License')) {
+    return true
+  }
+
+  const fileName = path.basename(fPath);
+  let license;
+  if (fileName.endsWith('.ts') || fileName.endsWith('.js') || 
fileName.endsWith('.css') || fileName.endsWith('.scss')) {
+    license = tsLicenses
+  }
+  if (fileName.endsWith('.vue') || fileName.endsWith('.html')) {
+    license = xmlLicenses
+  }
+  
+
+  if (license) {
+    const newFile = `${license}\n${data}`
+
+    fs.writeFileSync(`${fPath}`, newFile, { encoding: 'utf-8' });
+    return true
+  }
+
+  else {
+    console.error(`not found license in file: ${fPath}. Please add more 
license manually!`)
+    return false
+  }
+}
+
+fileDisplay(filePath);
diff --git a/paimon-web-ui/package.json b/paimon-web-ui/package.json
index e5105cc..ebb6a17 100644
--- a/paimon-web-ui/package.json
+++ b/paimon-web-ui/package.json
@@ -10,7 +10,8 @@
     "preview": "vite preview",
     "build-only": "vite build",
     "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
-    "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix 
--ignore-path .gitignore",
+    "lint": "eslint src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts 
--fix",
+    "gen:license": "node ./license.node.js",
     "format": "prettier --write src/"
   },
   "dependencies": {
diff --git a/paimon-web-ui/pom.xml b/paimon-web-ui/pom.xml
new file mode 100644
index 0000000..4ea96da
--- /dev/null
+++ b/paimon-web-ui/pom.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more 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
+
+  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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.paimon</groupId>
+        <artifactId>paimon-webui</artifactId>
+        <version>0.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>paimon-web-ui</artifactId>
+    <packaging>pom</packaging>
+    <name>Paimon : Web : UI</name>
+
+    <properties>
+        <node.version>v18.0.0</node.version>
+        <npm.version>9.4.1</npm.version>
+        <frontend-maven-plugin.version>1.12.0</frontend-maven-plugin.version>
+    </properties>
+
+    <profiles>
+        <profile>
+            <id>web</id>
+            <build>
+                <finalName>${project.artifactId}-${project.version}</finalName>
+                <plugins>
+                    <plugin>
+                        <groupId>com.github.eirslett</groupId>
+                        <artifactId>frontend-maven-plugin</artifactId>
+                        <version>${frontend-maven-plugin.version}</version>
+                        <executions>
+                            <execution>
+                                <id>install node and npm</id>
+                                <goals>
+                                    <goal>install-node-and-npm</goal>
+                                </goals>
+                                <configuration>
+                                    <nodeVersion>${node.version}</nodeVersion>
+                                    <npmVersion>${npm.version}</npmVersion>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>npm install</id>
+                                <goals>
+                                    <goal>npm</goal>
+                                </goals>
+                                <phase>generate-resources</phase>
+                                <configuration>
+                                    <arguments>install --force</arguments>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>npm fund</id>
+                                <goals>
+                                    <goal>npm</goal>
+                                </goals>
+                                <phase>generate-resources</phase>
+                                <configuration>
+                                    <arguments>fund</arguments>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>npm run build</id>
+                                <goals>
+                                    <goal>npm</goal>
+                                </goals>
+                                <configuration>
+                                    <arguments>run build</arguments>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
\ No newline at end of file
diff --git a/paimon-web-ui/src/assets/logo.svg 
b/paimon-web-ui/src/assets/logo.svg
index ffb904f..3fe437b 100644
--- a/paimon-web-ui/src/assets/logo.svg
+++ b/paimon-web-ui/src/assets/logo.svg
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more 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
+
+  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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
 <svg id="_图层_2" data-name="图层 2" xmlns="http://www.w3.org/2000/svg"; viewBox="0 
0 307.34 218.61">
   <defs>
     <style>
diff --git a/paimon-web-ui/tsconfig.node.json b/paimon-web-ui/tsconfig.node.json
index dee96be..7dde418 100644
--- a/paimon-web-ui/tsconfig.node.json
+++ b/paimon-web-ui/tsconfig.node.json
@@ -12,5 +12,6 @@
     "module": "ESNext",
     "moduleResolution": "Bundler",
     "types": ["node"]
-  }
+  },
+  "exclude": ["./license.node.js"]
 }

Reply via email to