devextreme-cli 1.11.0-alpha.0 → 1.11.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.
Files changed (100) hide show
  1. package/package.json +10 -9
  2. package/src/application.js +40 -20
  3. package/src/applications/application.angular.js +11 -3
  4. package/src/applications/application.nextjs.js +231 -0
  5. package/src/applications/application.react.js +16 -6
  6. package/src/applications/application.vue.js +6 -11
  7. package/src/templates/nextjs/application/.env +1 -0
  8. package/src/templates/nextjs/application/devextreme.json +63 -0
  9. package/src/templates/nextjs/application/next.config.mjs +32 -0
  10. package/src/templates/nextjs/application/public/logo192.png +0 -0
  11. package/src/templates/nextjs/application/public/logo512.png +0 -0
  12. package/src/templates/nextjs/application/public/manifest.json +25 -0
  13. package/src/templates/nextjs/application/public/robots.txt +3 -0
  14. package/src/templates/nextjs/application/src/app/actions/auth.ts +76 -0
  15. package/src/templates/nextjs/application/src/app/auth/[type]/page.tsx +49 -0
  16. package/src/templates/nextjs/application/src/app/layout.tsx +17 -0
  17. package/src/templates/nextjs/application/src/app/lib/session.ts +47 -0
  18. package/src/templates/nextjs/application/src/app/pages/layout.tsx +18 -0
  19. package/src/templates/nextjs/application/src/app-info.tsx +5 -0
  20. package/src/templates/nextjs/application/src/app-navigation.tsx +21 -0
  21. package/src/templates/nextjs/application/src/components/change-password-form/ChangePasswordForm.tsx +86 -0
  22. package/src/templates/nextjs/application/src/components/create-account-form/CreateAccountForm.scss +19 -0
  23. package/src/templates/nextjs/application/src/components/create-account-form/CreateAccountForm.tsx +107 -0
  24. package/src/templates/nextjs/application/src/components/footer/Footer.scss +12 -0
  25. package/src/templates/nextjs/application/src/components/footer/Footer.tsx +5 -0
  26. package/src/templates/nextjs/application/src/components/header/Header.scss +40 -0
  27. package/src/templates/nextjs/application/src/components/header/Header.tsx +38 -0
  28. package/src/templates/nextjs/application/src/components/index.tsx +7 -0
  29. package/src/templates/nextjs/application/src/components/login-form/LoginForm.scss +12 -0
  30. package/src/templates/nextjs/application/src/components/login-form/LoginForm.tsx +101 -0
  31. package/src/templates/nextjs/application/src/components/reset-password-form/ResetPasswordForm.scss +12 -0
  32. package/src/templates/nextjs/application/src/components/reset-password-form/ResetPasswordForm.tsx +78 -0
  33. package/src/templates/nextjs/application/src/components/side-navigation-menu/SideNavigationMenu.scss +71 -0
  34. package/src/templates/nextjs/application/src/components/side-navigation-menu/SideNavigationMenu.tsx +88 -0
  35. package/src/templates/nextjs/application/src/components/theme-switcher/ThemeSwitcher.tsx +21 -0
  36. package/src/templates/nextjs/application/src/components/user-panel/UserPanel.scss +51 -0
  37. package/src/templates/nextjs/application/src/components/user-panel/UserPanel.tsx +55 -0
  38. package/src/templates/nextjs/application/src/dx-styles.scss +106 -0
  39. package/src/templates/nextjs/application/src/index.css +12 -0
  40. package/src/templates/nextjs/application/src/layouts/index.tsx +3 -0
  41. package/src/templates/nextjs/application/src/layouts/side-nav-inner-toolbar/side-nav-inner-toolbar.scss +17 -0
  42. package/src/templates/nextjs/application/src/layouts/side-nav-inner-toolbar/side-nav-inner-toolbar.tsx +133 -0
  43. package/src/templates/nextjs/application/src/layouts/side-nav-outer-toolbar/side-nav-outer-toolbar.scss +10 -0
  44. package/src/templates/nextjs/application/src/layouts/side-nav-outer-toolbar/side-nav-outer-toolbar.tsx +119 -0
  45. package/src/templates/nextjs/application/src/layouts/single-card/single-card.scss +42 -0
  46. package/src/templates/nextjs/application/src/layouts/single-card/single-card.tsx +16 -0
  47. package/src/templates/nextjs/application/src/middleware.ts +46 -0
  48. package/src/templates/nextjs/application/src/theme.tsx +66 -0
  49. package/src/templates/nextjs/application/src/themes/metadata.additional.dark.json +11 -0
  50. package/src/templates/nextjs/application/src/themes/metadata.additional.json +11 -0
  51. package/src/templates/nextjs/application/src/themes/metadata.base.dark.json +8 -0
  52. package/src/templates/nextjs/application/src/themes/metadata.base.json +7 -0
  53. package/src/templates/nextjs/application/src/types.tsx +60 -0
  54. package/src/templates/nextjs/application/src/utils/default-user.tsx +7 -0
  55. package/src/templates/nextjs/application/src/utils/media-query.tsx +56 -0
  56. package/src/templates/nextjs/application/src/variables.scss +53 -0
  57. package/src/templates/nextjs/page/page.scss +0 -0
  58. package/src/templates/nextjs/page/page.tsx +13 -0
  59. package/src/templates/nextjs/sample-pages/home/home.scss +37 -0
  60. package/src/templates/nextjs/sample-pages/home/page.tsx +101 -0
  61. package/src/templates/nextjs/sample-pages/profile/page.tsx +61 -0
  62. package/src/templates/nextjs/sample-pages/profile/profile.scss +19 -0
  63. package/src/templates/nextjs/sample-pages/tasks/page.tsx +112 -0
  64. package/src/templates/nextjs/sample-pages/tasks/tasks.scss +3 -0
  65. package/src/templates/react/application/src/App.tsx +2 -1
  66. package/src/templates/react/application/src/Content.tsx +1 -1
  67. package/src/templates/react/application/src/app-routes.tsx +3 -3
  68. package/src/templates/react/application/src/components/change-password-form/ChangePasswordForm.tsx +1 -1
  69. package/src/templates/react/application/src/components/create-account-form/CreateAccountForm.tsx +1 -1
  70. package/src/templates/react/application/src/components/header/Header.scss +1 -1
  71. package/src/templates/react/application/src/components/login-form/LoginForm.tsx +1 -1
  72. package/src/templates/react/application/src/components/side-navigation-menu/SideNavigationMenu.tsx +2 -2
  73. package/src/templates/react/application/src/components/user-panel/UserPanel.tsx +1 -1
  74. package/src/templates/react/application/src/contexts/auth-hooks.ts +8 -0
  75. package/src/templates/react/application/src/contexts/auth.tsx +7 -5
  76. package/src/templates/react/application/src/contexts/navigation-hooks.ts +22 -0
  77. package/src/templates/react/application/src/contexts/navigation.tsx +3 -17
  78. package/src/templates/react/application/src/dx-styles.scss +3 -3
  79. package/src/templates/react/application/src/layouts/side-nav-inner-toolbar/side-nav-inner-toolbar.tsx +3 -3
  80. package/src/templates/react/application/src/layouts/side-nav-outer-toolbar/side-nav-outer-toolbar.tsx +3 -3
  81. package/src/templates/react/application/src/types.tsx +2 -2
  82. package/src/templates/react/page/page.tsx +1 -1
  83. package/src/templates/react/sample-pages/home/home.tsx +1 -1
  84. package/src/templates/react/sample-pages/index.tsx +3 -3
  85. package/src/templates/react/sample-pages/profile/profile.tsx +1 -1
  86. package/src/templates/react/sample-pages/tasks/tasks.tsx +1 -1
  87. package/src/templates/vue-v3/application/eslint.config.js +32 -0
  88. package/src/templates/vue-v3/application/src/App.vue +1 -1
  89. package/src/templates/vue-v3/application/src/components/header-toolbar.vue +2 -2
  90. package/src/templates/vue-v3/application/src/dx-styles.scss +4 -3
  91. package/src/templates/vue-v3/application/src/layouts/side-nav-inner-toolbar.vue +2 -2
  92. package/src/templates/vue-v3/application/src/layouts/side-nav-outer-toolbar.vue +2 -2
  93. package/src/templates/vue-v3/application/src/main.js +1 -1
  94. package/src/templates/vue-v3/application/src/router.js +5 -5
  95. package/src/utility/latest-versions.js +7 -4
  96. package/src/utility/module.js +13 -5
  97. package/src/utility/prompts/react-app-type.js +17 -0
  98. package/src/utility/run-command.js +10 -2
  99. package/src/utility/template-creator.js +8 -4
  100. package/src/templates/vue-v3/application/vue.config.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import './home.scss';
3
3
 
4
- export default function Home() {
4
+ export function Home() {
5
5
  return (
6
6
  <React.Fragment>
7
7
  <h2 className={'content-block'}>Home</h2>
@@ -1,3 +1,3 @@
1
- export { default as HomePage } from './home/home';
2
- export { default as ProfilePage } from './profile/profile';
3
- export { default as TasksPage } from './tasks/tasks';
1
+ export { Home as HomePage } from './home/home';
2
+ export { Profile as ProfilePage } from './profile/profile';
3
+ export { Tasks as TasksPage } from './tasks/tasks';
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
  import './profile.scss';
3
3
  import Form from 'devextreme-react/form';
4
4
 
5
- export default function Profile() {
5
+ export function Profile() {
6
6
  const [notes, setNotes] = useState(
7
7
  'Sandra is a CPA and has been our controller since 2008. She loves to interact with staff so if you`ve not met her, be certain to say hi.\r\n\r\nSandra has 2 daughters both of whom are accomplished gymnasts.'
8
8
  );
@@ -9,7 +9,7 @@ import DataGrid, {
9
9
  } from 'devextreme-react/data-grid';
10
10
  import './tasks.scss';
11
11
 
12
- export default function Task() {
12
+ export function Tasks() {
13
13
  return (
14
14
  <React.Fragment>
15
15
  <h2>Tasks</h2>
@@ -0,0 +1,32 @@
1
+ import { defineConfig, globalIgnores } from 'eslint/config'
2
+ import globals from 'globals'
3
+ import js from '@eslint/js'
4
+ import pluginVue from 'eslint-plugin-vue'
5
+
6
+ export default defineConfig([
7
+ {
8
+ name: 'app/files-to-lint',
9
+ files: ['**/*.{js,mjs,jsx,vue}'],
10
+ },
11
+
12
+ globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
13
+
14
+ {
15
+ languageOptions: {
16
+ globals: {
17
+ ...globals.browser,
18
+ },
19
+ },
20
+ },
21
+
22
+ js.configs.recommended,
23
+ ...pluginVue.configs['flat/essential'],
24
+
25
+ {
26
+ name: 'disable-unused-vars-in-vue',
27
+ files: ['**/*.vue'],
28
+ rules: {
29
+ 'no-unused-vars': 'off',
30
+ },
31
+ },
32
+ ])
@@ -17,7 +17,7 @@
17
17
  </template>
18
18
 
19
19
  <script>
20
- import AppFooter from "./components/app-footer";
20
+ import AppFooter from "./components/app-footer.vue";
21
21
  import { sizes, subscribe, unsubscribe } from "./utils/media-query";
22
22
  import {
23
23
  getCurrentInstance,
@@ -52,7 +52,7 @@ import auth from "../auth";
52
52
  import { useRouter, useRoute } from 'vue-router';
53
53
  import { ref } from 'vue';
54
54
 
55
- import UserPanel from "./user-panel";
55
+ import UserPanel from "./user-panel.vue";
56
56
  import ThemeSwitcher from './theme-switcher.vue';
57
57
 
58
58
  export default {
@@ -143,7 +143,7 @@ header {
143
143
  }
144
144
 
145
145
  .dx-theme-generic {
146
- .dx-toolbar {
146
+ .header-toolbar {
147
147
  padding: 10px 0;
148
148
  }
149
149
 
@@ -40,12 +40,13 @@ $side-panel-min-width: 60px;
40
40
  margin-top: 20px;
41
41
  }
42
42
 
43
+
43
44
  .responsive-paddings {
44
45
  padding: 20px;
46
+ }
45
47
 
46
- .screen-large & {
47
- padding: 40px;
48
- }
48
+ .screen-large .responsive-paddings {
49
+ padding: 40px;
49
50
  }
50
51
 
51
52
  .dx-card.wide-card {
@@ -57,8 +57,8 @@ import DxDrawer from "devextreme-vue/drawer";
57
57
  import DxScrollView from "devextreme-vue/scroll-view";
58
58
  import DxToolbar, { DxItem } from "devextreme-vue/toolbar";
59
59
 
60
- import HeaderToolbar from "../components/header-toolbar";
61
- import SideNavMenu from "../components/side-nav-menu";
60
+ import HeaderToolbar from "../components/header-toolbar.vue";
61
+ import SideNavMenu from "../components/side-nav-menu.vue";
62
62
  import menuItems from "../app-navigation";
63
63
  import { ref, watch, computed } from 'vue';
64
64
  import { useRoute } from 'vue-router';
@@ -39,8 +39,8 @@ import DxDrawer from "devextreme-vue/drawer";
39
39
  import DxScrollView from "devextreme-vue/scroll-view";
40
40
 
41
41
  import menuItems from "../app-navigation";
42
- import HeaderToolbar from "../components/header-toolbar";
43
- import SideNavMenu from "../components/side-nav-menu";
42
+ import HeaderToolbar from "../components/header-toolbar.vue";
43
+ import SideNavMenu from "../components/side-nav-menu.vue";
44
44
  import { computed, ref, watch} from 'vue';
45
45
  import { useRoute } from 'vue-router';
46
46
 
@@ -2,7 +2,7 @@ import { createApp } from "vue";
2
2
  import router from "./router";
3
3
  import themes from "devextreme/ui/themes";
4
4
 
5
- import App from "./App";
5
+ import App from "./App.vue";
6
6
  import appInfo from "./app-info";
7
7
 
8
8
  themes.initialized(() => {
@@ -1,11 +1,11 @@
1
1
  import auth from "./auth";
2
2
  import { createRouter, createWebHashHistory } from "vue-router";
3
3
 
4
- <%=^empty%>import Home from "./views/home-page";
5
- import Profile from "./views/profile-page";
6
- import Tasks from "./views/tasks-page";
7
- <%=/empty%>import defaultLayout from "./layouts/<%=layout%>";
8
- import simpleLayout from "./layouts/single-card";
4
+ <%=^empty%>import Home from "./views/home-page.vue";
5
+ import Profile from "./views/profile-page.vue";
6
+ import Tasks from "./views/tasks-page.vue";
7
+ <%=/empty%>import defaultLayout from "./layouts/<%=layout%>.vue";
8
+ import simpleLayout from "./layouts/single-card.vue";
9
9
 
10
10
  function loadView(view) {
11
11
  return () => import (/* webpackChunkName: "login" */ `./views/${view}.vue`)
@@ -1,9 +1,12 @@
1
1
  const packageJson = require('../../package.json');
2
2
  module.exports = {
3
- 'devextreme': '25.1.1-alpha',
4
- 'devextreme-react': '25.1.1-alpha',
5
- 'devextreme-vue': '25.1.1-alpha',
6
- 'create-vite': '6.3.1',
3
+ 'devextreme': '25.1.3',
4
+ 'devextreme-react': '25.1.3',
5
+ 'devextreme-vue': '25.1.3',
6
+ 'create-vite': '7.0.0',
7
+ 'create-vue': '3.17.0',
8
+ 'create-next-app': '15.3.4',
9
+ 'jose': '6.0.11',
7
10
  'devextreme-cli': packageJson.version,
8
11
  'devextreme-schematics': 'latest'
9
12
  };
@@ -11,23 +11,31 @@ const addImportValueToExisting = (fileContent, importName, index) => {
11
11
  };
12
12
 
13
13
  const insertImport = (filePath, moduleName, importName, isDefault) => {
14
- const fileContent = fs.readFileSync(filePath).toString();
14
+ const hasUseClientRegExp = /^\s*['"]use client['"];?\s*\n*/;
15
+ let fileContent = fs.readFileSync(filePath).toString();
16
+ const hasUseClient = hasUseClientRegExp.test(fileContent);
17
+ const useClientStr = hasUseClient ? '\'use client\';\n' : '';
18
+
19
+ if(hasUseClient) {
20
+ fileContent = fileContent.replace(hasUseClientRegExp, '');
21
+ }
22
+
15
23
  const indexEndOfImport = findImportModule(fileContent, moduleName);
16
24
 
17
25
  if(indexEndOfImport !== -1) {
18
26
  fs.writeFileSync(filePath, addImportValueToExisting(fileContent, importName, indexEndOfImport));
19
27
  } else if(importName) {
20
28
  const importValue = isDefault ? importName : `{ ${importName} }`;
21
- fs.writeFileSync(filePath, `import ${importValue} from \'${moduleName}\';\n${fileContent}`);
29
+ fs.writeFileSync(filePath, `${useClientStr}import ${importValue} from \'${moduleName}\';\n${fileContent}`);
22
30
  } else {
23
- fs.writeFileSync(filePath, `import \'${moduleName}\';\n${fileContent}`);
31
+ fs.writeFileSync(filePath, `${useClientStr}import \'${moduleName}\';\n${fileContent}`);
24
32
  }
25
33
  };
26
34
 
27
- const insertExport = (filePath, exportName, modulePath) => {
35
+ const insertExport = (filePath, exportName, modulePath, importName = 'default') => {
28
36
  const fileContent = fs.readFileSync(filePath).toString();
29
37
 
30
- fs.writeFileSync(filePath, `${fileContent}export { default as ${exportName} } from \'${modulePath}\';\n`);
38
+ fs.writeFileSync(filePath, `${fileContent}export { ${importName} as ${exportName} } from \'${modulePath}\';\n`);
31
39
  };
32
40
 
33
41
  module.exports = {
@@ -0,0 +1,17 @@
1
+ const prompts = require('./prompts');
2
+
3
+ const choices = [
4
+ { value: 'vite', title: 'React+Vite' },
5
+ { value: 'nextjs', title: 'Next.js-based' }
6
+ ];
7
+
8
+ const question = {
9
+ message: 'Specify the desired React application type:',
10
+ choices: choices
11
+ };
12
+
13
+ const getReactAppType = async(defaultValue) => {
14
+ return await prompts(question, choices, defaultValue);
15
+ };
16
+
17
+ module.exports = getReactAppType;
@@ -17,8 +17,16 @@ module.exports = function(commandName, args = [], customConfig = {}) {
17
17
 
18
18
  console.log(`> ${command} ${args.join(' ')}`);
19
19
 
20
+ const proc = spawn(command, args, config);
21
+
20
22
  return new Promise((resolve, reject) => {
21
- spawn(command, args, config)
22
- .on('exit', (code) => code ? reject(code) : resolve());
23
+ proc.on('exit', (code) => {
24
+ code ? reject(code) : resolve({ proc });
25
+ });
26
+
27
+ if(config.detached) {
28
+ proc.unref();
29
+ resolve({ proc });
30
+ }
23
31
  });
24
32
  };
@@ -7,14 +7,18 @@ const Mustache = require('mustache');
7
7
  const applyTemplateToFile = (filePath, templateOptions) => {
8
8
  const tags = ['<%=', '%>'];
9
9
  const fileContent = fs.readFileSync(filePath);
10
- const content = Mustache.render(fileContent.toString(), templateOptions, {}, tags);
11
10
 
12
- return content;
11
+ if(fileContent.includes(tags[0])) {
12
+ return Mustache.render(fileContent.toString(), templateOptions, {}, tags);
13
+ }
14
+
15
+ return fileContent;
13
16
  };
14
17
 
15
- const addPageToApp = (pageName, pageDir, templatePagesPath, getCorrectExtension) => {
18
+ const addPageToApp = (pageName, pageDir, templatePagesPath, getCorrectExtension, { getPageFileName = () => pageName } = {}) => {
16
19
  fs.readdirSync(templatePagesPath).forEach((pageItem) => {
17
- const pagePath = path.join(pageDir, `${pageName}${getCorrectExtension(extname(pageItem))}`);
20
+ const pagePath = path.join(pageDir, `${getPageFileName(pageName, pageItem)}${getCorrectExtension(extname(pageItem))}`);
21
+
18
22
  if(fs.existsSync(pagePath)) {
19
23
  console.error('The page already exists');
20
24
  process.exit();
@@ -1 +0,0 @@
1
- module.exports = {};