@zeedhi/teknisa-cli 1.35.0 → 1.41.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/teknisa-cli",
3
- "version": "1.35.0",
3
+ "version": "1.41.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": "9a83974f8b6a8f11b1aa35b10068c87822c3aec3"
37
+ "gitHead": "bce3adcbc8986e99a5467d491971d8d26a1a84fd"
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__/*", "**/*.vue", "**/*.d.ts", "**/*.js"],
9
- parser: "@typescript-eslint/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: [
@@ -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.8.55",
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,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
2
+ <html lang="pt-br">
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
@@ -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 { LibAuth } from '@zeedhi/tek-lib';
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
- LibAuth.getInstance().startLib();
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__/*", "**/*.vue", "**/*.d.ts", "**/*.js"],
9
- parser: "@typescript-eslint/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: [
@@ -7,7 +7,7 @@
7
7
  "lint": "vue-cli-service lint"
8
8
  },
9
9
  "dependencies": {
10
- "@mdi/font": "^5.8.55",
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,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
2
+ <html lang="pt-br">
3
3
  <head>
4
4
  <meta http-equiv="<%= VUE_APP_META_CONTENT_SECURITY_POLICY %>" content="<%= VUE_APP_UPGRADE_INSECURE_REQUESTS %>">
5
5
  <meta charset="utf-8">
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "loginPage",
3
+ "component": "TekLogin",
4
+ "backgroundStyle": "{{LoginController.backgroundImgUrl}}",
5
+ "logo": "{{LoginController.logo}}",
6
+ "endPoint": "{{LoginController.endPoint}}"
7
+ }
@@ -1,12 +1,12 @@
1
1
  <template>
2
2
  <v-app id="app">
3
3
  <component
4
- v-if="!isCleanLayout"
4
+ v-if="!isRouteLogin"
5
5
  :is="menu.component"
6
6
  v-bind="{ ...menu }"
7
7
  ></component>
8
8
  <component
9
- v-if="!isCleanLayout"
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 { LibAuth, LibLocalStorage } from '@zeedhi/tek-lib';
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
- LibAuth.getInstance().startLib();
50
- window.addEventListener('message', this.handleMessageEvent);
49
+ TekLibAuth.startLib();
50
+ window.addEventListener('afterLogin', this.handleMessageEvent);
51
51
 
52
52
  this.menu = {
53
53
  component: 'ZdMenu',
@@ -105,7 +105,7 @@ export default class App extends Vue {
105
105
  iconName: 'mdi-logout',
106
106
  events: {
107
107
  click: () => {
108
- LibAuth.getInstance().logoutConfirm();
108
+ TekLibAuth.logoutConfirm();
109
109
  },
110
110
  },
111
111
  },
@@ -114,26 +114,28 @@ export default class App extends Vue {
114
114
  }
115
115
 
116
116
  public mounted() {
117
- this.setMenu();
117
+ if (!this.isRouteLogin) {
118
+ this.setMenu();
119
+ }
118
120
  }
119
121
 
120
- private async afterLogin(userData: any) {
121
- await LibAuth.getInstance().startSession(userData);
122
- this.setMenu();
122
+ private handleMessageEvent(event: any) {
123
+ this.afterLogin(event.detail.userData);
123
124
  }
124
125
 
125
- private handleMessageEvent(event: any) {
126
- if (event.data.type === 'afterLogin') {
127
- this.afterLogin(event.data.userData);
128
- }
126
+ private async afterLogin(userData: any) {
127
+ await TekLibAuth.startSession(userData);
128
+ this.setMenu();
129
129
  }
130
130
 
131
131
  private setMenu() {
132
- const menu = Metadata.getInstance<Menu>('main-menu');
133
- menu.items = JSON.parse(<string>localStorage.getItem('MENU')) || [];
132
+ if (TekLibLocalStorage.getItem('IS_NEXT')) {
133
+ const menu = Metadata.getInstance<Menu>('main-menu');
134
+ menu.items = JSON.parse(<string>localStorage.getItem('MENU')) || [];
135
+ }
134
136
  }
135
137
 
136
- get isCleanLayout() {
138
+ get isRouteLogin() {
137
139
  return this.$route.path === Config.env.loginRoutePath;
138
140
  }
139
141
  }
@@ -13,7 +13,7 @@
13
13
  "modules": {
14
14
  "login": {
15
15
  "baseUrl": "http://localhost:8282",
16
- "routePath": "/modules/login/autenticacao",
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,6 @@
1
1
  import { IEventParam, Metadata, Singleton } from '@zeedhi/core';
2
2
  import { Menu, MenuButton } from '@zeedhi/common';
3
- import { LibAuth } from '@zeedhi/tek-lib';
3
+ import { TekLibAuth } from '@zeedhi/tek-lib';
4
4
 
5
5
  @Singleton
6
6
  export class AppController {
@@ -9,7 +9,7 @@ export class AppController {
9
9
  public toggleMenu({ component }: IEventParam<MenuButton>) {
10
10
  const menu = Metadata.getInstance<Menu>(component.menuName);
11
11
  menu.toggleMenu();
12
- if (menu.drawer && !menu.miniState) {
12
+ if (menu.opened && !menu.miniState) {
13
13
  if (menu.showSearch) {
14
14
  setTimeout(() => {
15
15
  const searchInput = document.querySelector('.zd-menu-search-input input');
@@ -27,6 +27,6 @@ export class AppController {
27
27
  }
28
28
 
29
29
  public showMessageExpiredMenu() {
30
- LibAuth.getInstance().showMessageExpiredMenu();
30
+ TekLibAuth.showMessageExpiredMenu();
31
31
  }
32
32
  }
@@ -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
+ }
@@ -1,5 +1,7 @@
1
1
  import { AppController } from './AppController';
2
+ import { LoginController } from './LoginController';
2
3
 
3
4
  export default {
4
5
  AppController,
6
+ LoginController,
5
7
  };
@@ -2,6 +2,7 @@ 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
7
  import { Messages } from '@zeedhi/core';
7
8
  import router from '../router';
@@ -22,6 +23,7 @@ Vue.use(Zeedhi, {
22
23
  });
23
24
  Vue.use(ZeedhiComponents);
24
25
  Vue.use(TeknisaComponents);
26
+ Vue.use(TekLibComponents);
25
27
 
26
28
  vuetify.framework.icons.values = Icons.getIcons() as any;
27
29
 
@@ -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 { ZdPage } from '@zeedhi/vue';
5
- import { LibLocalStorage } from '@zeedhi/tek-lib';
4
+ import { TekLibLocalStorage } from '@zeedhi/tek-lib';
6
5
  import { LoadingService } from '@zeedhi/common';
7
- import Store from './store';
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: process.env.BASE_URL,
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
- LibLocalStorage.setItem('IS_NEXT', true);
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 { LibLocalStorage } from '@zeedhi/tek-lib';
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: PRODUCT_ID: LibLocalStorage.getItem('IS_NEXT') ? Config.env.product.id : LibLocalStorage.getItem('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 (LibLocalStorage.getItem('IS_NEXT')) {
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);
@@ -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)