@zeedhi/teknisa-cli 1.36.0 → 1.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/util/project/editCliVersion.js +18 -0
- package/src/util/project/module/.eslintrc.js +4 -2
- package/src/util/project/module/cliVersion.json +1 -0
- package/src/util/project/module/package.json +2 -2
- package/src/util/project/module/public/index.html +1 -1
- package/src/util/project/module/src/App.vue +14 -2
- package/src/util/project/product/.eslintrc.js +4 -2
- package/src/util/project/product/cliVersion.json +1 -0
- package/src/util/project/product/package.json +1 -1
- package/src/util/project/product/public/index.html +1 -1
- package/src/util/project/product/public/metadata/login.json +7 -0
- package/src/util/project/product/src/App.vue +23 -17
- package/src/util/project/product/src/config/devEnvironment.json +1 -1
- package/src/util/project/product/src/controllers/AppController.ts +18 -3
- package/src/util/project/product/src/controllers/LoginController.ts +17 -0
- package/src/util/project/product/src/controllers/index.ts +2 -0
- package/src/util/project/product/src/plugins/zeedhi.ts +16 -1
- package/src/util/project/product/src/{router.ts → router/index.ts} +6 -29
- package/src/util/project/product/src/router/routes.ts +37 -0
- package/src/util/project/product/src/views/Microservice.ts +3 -3
- package/src/util/project/run.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/teknisa-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "Teknisa CLI",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"/src",
|
|
35
35
|
"/bin"
|
|
36
36
|
],
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "dff21e134017e20c4de440406daf73031653df60"
|
|
38
38
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const fs = require('fs-extra')
|
|
3
|
+
|
|
4
|
+
function getCliVersionJsonContent(filePath) {
|
|
5
|
+
const pkg = require(filePath)
|
|
6
|
+
pkg.version = require('../../../package').version
|
|
7
|
+
return pkg
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
editCliVersion = (config) => {
|
|
11
|
+
const filePath = path.resolve(config.targetDir, 'cliVersion.json')
|
|
12
|
+
const content = getCliVersionJsonContent(filePath)
|
|
13
|
+
fs.writeJsonSync(filePath, content, { spaces: 2 })
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = (config) => {
|
|
17
|
+
editCliVersion(config)
|
|
18
|
+
}
|
|
@@ -5,9 +5,11 @@ module.exports = {
|
|
|
5
5
|
es6: true,
|
|
6
6
|
node: true
|
|
7
7
|
},
|
|
8
|
-
ignorePatterns: ["node_modules/", "**/coverage/*", "**/dist/*", "**/types/*", "**/__mocks__/*", "**/*.
|
|
9
|
-
parser: "
|
|
8
|
+
ignorePatterns: ["node_modules/", "**/coverage/*", "**/dist/*", "**/types/*", "**/__mocks__/*", "**/*.d.ts", "**/*.js"],
|
|
9
|
+
parser: "vue-eslint-parser",
|
|
10
10
|
parserOptions: {
|
|
11
|
+
parser: "@typescript-eslint/parser",
|
|
12
|
+
extraFileExtensions: [".vue"],
|
|
11
13
|
project: "./tsconfig.json"
|
|
12
14
|
},
|
|
13
15
|
plugins: [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"scripts": {
|
|
5
5
|
"serve": "vue-cli-service serve",
|
|
6
6
|
"build": "vue-cli-service build",
|
|
7
|
-
"lint": "vue-cli-service lint"
|
|
7
|
+
"lint": "vue-cli-service lint --ext .ts,.vue ./src"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@mdi/font": "^5.
|
|
10
|
+
"@mdi/font": "^6.5.95",
|
|
11
11
|
"@types/execa": "^2.0.0",
|
|
12
12
|
"@types/jest": "^26.0.19",
|
|
13
13
|
"@types/lodash.merge": "^4.6.6",
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-app>
|
|
3
3
|
<zd-page id="main-page" :key="mainPage.path" v-bind="mainPage" />
|
|
4
|
+
|
|
5
|
+
<!-- Modal -->
|
|
6
|
+
<zd-modal v-bind="{ name: 'appModal ' }" />
|
|
7
|
+
|
|
8
|
+
<!-- Alert -->
|
|
9
|
+
<zd-alert v-bind="{ name: 'appAlert ' }" />
|
|
10
|
+
|
|
11
|
+
<!-- Dialog -->
|
|
12
|
+
<zd-dialog v-bind="{ name: 'appDialog ' }" />
|
|
13
|
+
|
|
14
|
+
<!-- Loading -->
|
|
15
|
+
<zd-loading v-bind="{ name: 'appLoading' }" />
|
|
4
16
|
</v-app>
|
|
5
17
|
</template>
|
|
6
18
|
|
|
@@ -8,7 +20,7 @@
|
|
|
8
20
|
import Vue from 'vue';
|
|
9
21
|
import Component from 'vue-class-component';
|
|
10
22
|
import { ZdPage } from '@zeedhi/vue';
|
|
11
|
-
import {
|
|
23
|
+
import { TekLibAuth } from '@zeedhi/tek-lib';
|
|
12
24
|
|
|
13
25
|
@Component({
|
|
14
26
|
components: { ZdPage },
|
|
@@ -74,7 +86,7 @@ export default class App extends Vue {
|
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
public mounted() {
|
|
77
|
-
|
|
89
|
+
TekLibAuth.startLib();
|
|
78
90
|
const colorTheme = localStorage.getItem('MODULES_THEME_COLOR') || '#2d68c3';
|
|
79
91
|
this.$vuetify.theme.themes.light.primary = colorTheme;
|
|
80
92
|
this.$vuetify.theme.themes.light.anchor = colorTheme;
|
|
@@ -5,9 +5,11 @@ module.exports = {
|
|
|
5
5
|
es6: true,
|
|
6
6
|
node: true
|
|
7
7
|
},
|
|
8
|
-
ignorePatterns: ["node_modules/", "**/coverage/*", "**/dist/*", "**/types/*", "**/__mocks__/*", "**/*.
|
|
9
|
-
parser: "
|
|
8
|
+
ignorePatterns: ["node_modules/", "**/coverage/*", "**/dist/*", "**/types/*", "**/__mocks__/*", "**/*.d.ts", "**/*.js"],
|
|
9
|
+
parser: "vue-eslint-parser",
|
|
10
10
|
parserOptions: {
|
|
11
|
+
parser: "@typescript-eslint/parser",
|
|
12
|
+
extraFileExtensions: [".vue"],
|
|
11
13
|
project: "./tsconfig.json"
|
|
12
14
|
},
|
|
13
15
|
plugins: [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-app id="app">
|
|
3
3
|
<component
|
|
4
|
-
v-if="!
|
|
4
|
+
v-if="!isRouteLogin"
|
|
5
5
|
:is="menu.component"
|
|
6
6
|
v-bind="{ ...menu }"
|
|
7
7
|
></component>
|
|
8
8
|
<component
|
|
9
|
-
v-if="!
|
|
9
|
+
v-if="!isRouteLogin"
|
|
10
10
|
:is="header.component"
|
|
11
11
|
v-bind="header"
|
|
12
12
|
></component>
|
|
@@ -37,7 +37,7 @@ import Component from 'vue-class-component';
|
|
|
37
37
|
import { IMenu, IHeader, Menu } from '@zeedhi/common';
|
|
38
38
|
import { Metadata } from '@zeedhi/core';
|
|
39
39
|
import { Config } from '@zeedhi/core';
|
|
40
|
-
import {
|
|
40
|
+
import { TekLibAuth, TekLibLocalStorage } from '@zeedhi/tek-lib';
|
|
41
41
|
|
|
42
42
|
@Component
|
|
43
43
|
export default class App extends Vue {
|
|
@@ -46,8 +46,8 @@ export default class App extends Vue {
|
|
|
46
46
|
public header!: IHeader;
|
|
47
47
|
|
|
48
48
|
public created() {
|
|
49
|
-
|
|
50
|
-
window.addEventListener('
|
|
49
|
+
TekLibAuth.startLib();
|
|
50
|
+
window.addEventListener('afterLogin', this.handleMessageEvent);
|
|
51
51
|
|
|
52
52
|
this.menu = {
|
|
53
53
|
component: 'ZdMenu',
|
|
@@ -83,6 +83,10 @@ export default class App extends Vue {
|
|
|
83
83
|
'ctrl+m': {
|
|
84
84
|
event: '{{AppController.toggleMenu}}',
|
|
85
85
|
},
|
|
86
|
+
esc: {
|
|
87
|
+
event: '{{AppController.closeMenu}}',
|
|
88
|
+
stop: true,
|
|
89
|
+
},
|
|
86
90
|
},
|
|
87
91
|
},
|
|
88
92
|
{
|
|
@@ -105,7 +109,7 @@ export default class App extends Vue {
|
|
|
105
109
|
iconName: 'mdi-logout',
|
|
106
110
|
events: {
|
|
107
111
|
click: () => {
|
|
108
|
-
|
|
112
|
+
TekLibAuth.logoutConfirm();
|
|
109
113
|
},
|
|
110
114
|
},
|
|
111
115
|
},
|
|
@@ -114,26 +118,28 @@ export default class App extends Vue {
|
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
public mounted() {
|
|
117
|
-
this.
|
|
121
|
+
if (!this.isRouteLogin) {
|
|
122
|
+
this.setMenu();
|
|
123
|
+
}
|
|
118
124
|
}
|
|
119
125
|
|
|
120
|
-
private
|
|
121
|
-
|
|
122
|
-
this.setMenu();
|
|
126
|
+
private handleMessageEvent(event: any) {
|
|
127
|
+
this.afterLogin(event.detail.userData);
|
|
123
128
|
}
|
|
124
129
|
|
|
125
|
-
private
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
130
|
+
private async afterLogin(userData: any) {
|
|
131
|
+
await TekLibAuth.startSession(userData);
|
|
132
|
+
this.setMenu();
|
|
129
133
|
}
|
|
130
134
|
|
|
131
135
|
private setMenu() {
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
if (TekLibLocalStorage.getItem('IS_NEXT')) {
|
|
137
|
+
const menu = Metadata.getInstance<Menu>('main-menu');
|
|
138
|
+
menu.items = JSON.parse(<string>localStorage.getItem('MENU')) || [];
|
|
139
|
+
}
|
|
134
140
|
}
|
|
135
141
|
|
|
136
|
-
get
|
|
142
|
+
get isRouteLogin() {
|
|
137
143
|
return this.$route.path === Config.env.loginRoutePath;
|
|
138
144
|
}
|
|
139
145
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"modules": {
|
|
14
14
|
"login": {
|
|
15
15
|
"baseUrl": "http://localhost:8282",
|
|
16
|
-
"routePath": "/
|
|
16
|
+
"routePath": "/auth/login",
|
|
17
17
|
"backgroundImgUrl": "http://localhost:8080/assets/img/teknisa-login-background.jpg",
|
|
18
18
|
"endPoint": "http://localhost:81/<nome do produto>/modules/login/backend/service/index.php"
|
|
19
19
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { IEventParam, Metadata, Singleton } from '@zeedhi/core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
Menu,
|
|
4
|
+
MenuButton,
|
|
5
|
+
AlertService,
|
|
6
|
+
} from '@zeedhi/common';
|
|
7
|
+
import { TekLibAuth } from '@zeedhi/tek-lib';
|
|
4
8
|
|
|
5
9
|
@Singleton
|
|
6
10
|
export class AppController {
|
|
@@ -27,6 +31,17 @@ export class AppController {
|
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
public showMessageExpiredMenu() {
|
|
30
|
-
|
|
34
|
+
TekLibAuth.showMessageExpiredMenu();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public closeMenu({ component }: IEventParam<MenuButton>) {
|
|
38
|
+
const menu = Metadata.getInstance<Menu>(component.menuName);
|
|
39
|
+
if (menu.opened && !menu.miniState) {
|
|
40
|
+
menu.toggleMenu();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public escAction() {
|
|
45
|
+
AlertService.hide();
|
|
31
46
|
}
|
|
32
47
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Config, Singleton } from '@zeedhi/core';
|
|
2
|
+
|
|
3
|
+
@Singleton
|
|
4
|
+
export class LoginController {
|
|
5
|
+
get logo() {
|
|
6
|
+
return Config.env.product.logoUrl;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
get backgroundImgUrl() {
|
|
10
|
+
const url = Config.env.loginBackgroundImgUrl;
|
|
11
|
+
return `url(${url})`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get endPoint() {
|
|
15
|
+
return Config.env.loginEndPoint;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -2,8 +2,13 @@ import Vue from 'vue';
|
|
|
2
2
|
import Zeedhi from '@zeedhi/vue';
|
|
3
3
|
import ZeedhiComponents from '@zeedhi/vuetify';
|
|
4
4
|
import TeknisaComponents from '@zeedhi/teknisa-components-vuetify';
|
|
5
|
+
import TekLibComponents from '@zeedhi/tek-lib';
|
|
5
6
|
import { Icons } from '@zeedhi/common';
|
|
6
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
Messages,
|
|
9
|
+
KeyMap,
|
|
10
|
+
Loader,
|
|
11
|
+
} from '@zeedhi/core';
|
|
7
12
|
import router from '../router';
|
|
8
13
|
import controllers from '../controllers';
|
|
9
14
|
import config from '../config/config';
|
|
@@ -22,6 +27,7 @@ Vue.use(Zeedhi, {
|
|
|
22
27
|
});
|
|
23
28
|
Vue.use(ZeedhiComponents);
|
|
24
29
|
Vue.use(TeknisaComponents);
|
|
30
|
+
Vue.use(TekLibComponents);
|
|
25
31
|
|
|
26
32
|
vuetify.framework.icons.values = Icons.getIcons() as any;
|
|
27
33
|
|
|
@@ -52,3 +58,12 @@ Messages.add({
|
|
|
52
58
|
},
|
|
53
59
|
},
|
|
54
60
|
});
|
|
61
|
+
|
|
62
|
+
const appController = Loader.getInstance('AppController');
|
|
63
|
+
|
|
64
|
+
KeyMap.bind({
|
|
65
|
+
esc: {
|
|
66
|
+
event: () => { appController.escAction(); },
|
|
67
|
+
stop: true,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
@@ -1,40 +1,17 @@
|
|
|
1
1
|
import Vue from 'vue';
|
|
2
2
|
import Router from 'vue-router';
|
|
3
3
|
import { Config, Http } from '@zeedhi/core';
|
|
4
|
-
import {
|
|
5
|
-
import { LibLocalStorage } from '@zeedhi/tek-lib';
|
|
4
|
+
import { TekLibLocalStorage } from '@zeedhi/tek-lib';
|
|
6
5
|
import { LoadingService } from '@zeedhi/common';
|
|
7
|
-
import
|
|
6
|
+
import routes from './routes';
|
|
7
|
+
import Store from '../store';
|
|
8
8
|
|
|
9
9
|
Vue.use(Router);
|
|
10
10
|
|
|
11
11
|
const router = new Router({
|
|
12
12
|
mode: 'history',
|
|
13
|
-
base:
|
|
14
|
-
routes
|
|
15
|
-
{
|
|
16
|
-
path: '/',
|
|
17
|
-
name: 'home',
|
|
18
|
-
component: ZdPage,
|
|
19
|
-
props: () => ({
|
|
20
|
-
path: 'home',
|
|
21
|
-
local: true,
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
path: '/modules/:module/:page',
|
|
26
|
-
name: 'microservice',
|
|
27
|
-
component: () => import('./views/Microservice.vue'),
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
path: '*',
|
|
31
|
-
component: ZdPage,
|
|
32
|
-
props: {
|
|
33
|
-
path: 'notfound',
|
|
34
|
-
local: true,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
13
|
+
base: Config.env.BASE_URL,
|
|
14
|
+
routes,
|
|
38
15
|
});
|
|
39
16
|
|
|
40
17
|
const isOpeningNewModule = function isOpeningNewModule(to: any, from: any) {
|
|
@@ -66,7 +43,7 @@ router.beforeEach(async (to, from, next) => {
|
|
|
66
43
|
}
|
|
67
44
|
}
|
|
68
45
|
|
|
69
|
-
|
|
46
|
+
TekLibLocalStorage.setItem('IS_NEXT', true);
|
|
70
47
|
|
|
71
48
|
if (to.path !== Config.env.loginRoutePath && !localStorage.getItem('LOGIN_TOKEN')) {
|
|
72
49
|
next(Config.env.loginRoutePath);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ZdPage } from '@zeedhi/vue';
|
|
2
|
+
|
|
3
|
+
const routes = [
|
|
4
|
+
{
|
|
5
|
+
path: '/auth/login',
|
|
6
|
+
name: 'login',
|
|
7
|
+
component: ZdPage,
|
|
8
|
+
props: {
|
|
9
|
+
path: 'login',
|
|
10
|
+
local: true,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
path: '/',
|
|
15
|
+
name: 'home',
|
|
16
|
+
component: ZdPage,
|
|
17
|
+
props: () => ({
|
|
18
|
+
path: 'home',
|
|
19
|
+
local: true,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
path: '/modules/:module/:page',
|
|
24
|
+
name: 'microservice',
|
|
25
|
+
component: () => import('../views/Microservice.vue'),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
path: '*',
|
|
29
|
+
component: ZdPage,
|
|
30
|
+
props: {
|
|
31
|
+
path: 'notfound',
|
|
32
|
+
local: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
export default routes;
|
|
@@ -2,7 +2,7 @@ import store from '@/store';
|
|
|
2
2
|
import Vue from 'vue';
|
|
3
3
|
import { Component } from 'vue-property-decorator';
|
|
4
4
|
import { Config } from '@zeedhi/core';
|
|
5
|
-
import {
|
|
5
|
+
import { TekLibLocalStorage } from '@zeedhi/tek-lib';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Microservice
|
|
@@ -29,7 +29,7 @@ export default class Mircroservice extends Vue {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
const productInfo = JSON.stringify({
|
|
32
|
-
PRODUCT_ID:
|
|
32
|
+
PRODUCT_ID: TekLibLocalStorage.getItem('IS_NEXT') ? Config.env.product.id : TekLibLocalStorage.getItem('PRODUCT_ID'),
|
|
33
33
|
PRODUCT_URL: Config.env.product.url,
|
|
34
34
|
PRODUCT_LOGO_URL: Config.env.product.logoUrl,
|
|
35
35
|
PRODUCT_BACKGROUND_IMG_PATH: Config.env.loginBackgroundImgUrl,
|
|
@@ -43,7 +43,7 @@ export default class Mircroservice extends Vue {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
private setProductInfoLocalStorage() {
|
|
46
|
-
if (
|
|
46
|
+
if (TekLibLocalStorage.getItem('IS_NEXT')) {
|
|
47
47
|
localStorage.setItem('PRODUCT_ID', Config.env.product.id);
|
|
48
48
|
}
|
|
49
49
|
localStorage.setItem('PRODUCT_URL', Config.env.product.url);
|
package/src/util/project/run.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const editPackageJson = require('./editPackageJson')
|
|
2
2
|
const renameGitIgnore = require('./renameGitIgnore')
|
|
3
|
+
const editCliVersion = require('./editCliVersion')
|
|
3
4
|
|
|
4
5
|
function run(config) {
|
|
5
6
|
try {
|
|
6
7
|
editPackageJson(config)
|
|
7
8
|
renameGitIgnore(config)
|
|
9
|
+
editCliVersion(config)
|
|
8
10
|
} catch (e) {
|
|
9
11
|
console.error(e)
|
|
10
12
|
process.exit(1)
|