devextreme-cli 1.3.0 → 1.3.3
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/index.js +4 -2
- package/package.json +8 -3
- package/src/application.js +17 -17
- package/src/applications/application.angular.js +38 -21
- package/src/applications/application.react.js +81 -37
- package/src/applications/application.vue.js +73 -37
- package/src/commands.json +3 -0
- package/src/templates/react/application/src/{App.js → App.tsx} +0 -0
- package/src/templates/react/application/src/{Content.js → Content.tsx} +11 -9
- package/src/templates/react/application/src/UnauthenticatedContent.tsx +46 -0
- package/src/templates/react/application/src/api/{auth.js → auth.tsx} +4 -4
- package/src/templates/react/application/src/{app-info.js → app-info.tsx} +0 -0
- package/src/templates/react/application/src/{app-navigation.js → app-navigation.tsx} +0 -0
- package/src/templates/react/application/src/app-routes.tsx +24 -0
- package/src/templates/react/application/src/components/change-password-form/{change-password-form.js → ChangePasswordForm.tsx} +6 -6
- package/src/templates/react/application/src/components/create-account-form/{create-account-form.scss → CreateAccountForm.scss} +0 -0
- package/src/templates/react/application/src/components/create-account-form/{create-account-form.js → CreateAccountForm.tsx} +7 -7
- package/src/templates/react/application/src/components/footer/{footer.scss → Footer.scss} +0 -0
- package/src/templates/react/application/src/components/footer/{footer.js → Footer.tsx} +1 -1
- package/src/templates/react/application/src/components/header/{header.scss → Header.scss} +0 -0
- package/src/templates/react/application/src/components/header/{header.js → Header.tsx} +4 -3
- package/src/templates/react/application/src/components/index.tsx +7 -0
- package/src/templates/react/application/src/components/login-form/{login-form.scss → LoginForm.scss} +0 -0
- package/src/templates/react/application/src/components/login-form/{login-form.js → LoginForm.tsx} +6 -6
- package/src/templates/react/application/src/components/reset-password-form/{reset-password-form.scss → ResetPasswordForm.scss} +0 -0
- package/src/templates/react/application/src/components/reset-password-form/{reset-password-form.js → ResetPasswordForm.tsx} +7 -7
- package/src/templates/react/application/src/components/side-navigation-menu/{side-navigation-menu.scss → SideNavigationMenu.scss} +0 -0
- package/src/templates/react/application/src/components/side-navigation-menu/{side-navigation-menu.js → SideNavigationMenu.tsx} +8 -10
- package/src/templates/react/application/src/components/user-panel/{user-panel.scss → UserPanel.scss} +0 -0
- package/src/templates/react/application/src/components/user-panel/{user-panel.js → UserPanel.tsx} +8 -8
- package/src/templates/react/application/src/contexts/{auth.js → auth.tsx} +6 -5
- package/src/templates/react/application/src/contexts/navigation.tsx +35 -0
- package/src/templates/react/application/src/layouts/{index.js → index.tsx} +0 -0
- package/src/templates/react/application/src/layouts/side-nav-inner-toolbar/{side-nav-inner-toolbar.js → side-nav-inner-toolbar.tsx} +12 -9
- package/src/templates/react/application/src/layouts/side-nav-outer-toolbar/{side-nav-outer-toolbar.js → side-nav-outer-toolbar.tsx} +11 -10
- package/src/templates/react/application/src/layouts/single-card/{single-card.js → single-card.tsx} +2 -1
- package/src/templates/react/application/src/{polyfills.js → polyfills.tsx} +0 -0
- package/src/templates/react/application/src/types.tsx +53 -0
- package/src/templates/react/application/src/utils/{default-user.js → default-user.tsx} +0 -0
- package/src/templates/react/application/src/utils/{media-query.js → media-query.tsx} +4 -3
- package/src/templates/react/application/src/utils/{patches.js → patches.tsx} +1 -1
- package/src/templates/react/page/{page.js → page.tsx} +0 -0
- package/src/templates/react/sample-pages/home/{home.js → home.tsx} +0 -0
- package/src/templates/react/sample-pages/{index.js → index.tsx} +0 -0
- package/src/templates/react/sample-pages/profile/{profile.js → profile.tsx} +0 -0
- package/src/templates/react/sample-pages/tasks/{tasks.js → tasks.tsx} +1 -1
- package/src/templates/vue-v2/application/devextreme.json +2 -1
- package/src/templates/vue-v2/application/src/router.js +3 -3
- package/src/templates/vue-v2/sample-pages/{home.vue → home-page.vue} +0 -0
- package/src/templates/vue-v2/sample-pages/{profile.vue → profile-page.vue} +0 -0
- package/src/templates/vue-v2/sample-pages/{tasks.vue → tasks-page.vue} +0 -0
- package/src/templates/vue-v3/application/devextreme.json +2 -1
- package/src/templates/vue-v3/application/src/router.js +4 -4
- package/src/templates/vue-v3/sample-pages/{home.vue → home-page.vue} +0 -0
- package/src/templates/vue-v3/sample-pages/{profile.vue → profile-page.vue} +0 -0
- package/src/templates/vue-v3/sample-pages/{tasks.vue → tasks-page.vue} +0 -0
- package/src/utility/prompts/layout.js +9 -21
- package/src/utility/prompts/prompts.js +24 -8
- package/src/utility/prompts/typescript.js +18 -0
- package/src/utility/prompts/vue-version.js +9 -21
- package/src/utility/run-command.js +5 -2
- package/src/utility/template-creator.js +11 -6
- package/src/utility/typescript-extension.js +24 -0
- package/src/.DS_Store +0 -0
- package/src/templates/.DS_Store +0 -0
- package/src/templates/react/application/src/UnauthenticatedContent.js +0 -35
- package/src/templates/react/application/src/app-routes.js +0 -24
- package/src/templates/react/application/src/components/index.js +0 -7
- package/src/templates/react/application/src/contexts/navigation.js +0 -34
- package/src/templates/vue-v2/.DS_Store +0 -0
- package/src/templates/vue-v2/application/.DS_Store +0 -0
- package/src/templates/vue-v2/application/src/.DS_Store +0 -0
- package/src/templates/vue-v3/.DS_Store +0 -0
- package/src/templates/vue-v3/application/.DS_Store +0 -0
- package/src/templates/vue-v3/application/src/.DS_Store +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import Drawer from 'devextreme-react/drawer';
|
|
2
2
|
import ScrollView from 'devextreme-react/scroll-view';
|
|
3
3
|
import React, { useState, useCallback, useRef } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { useNavigate } from 'react-router';
|
|
5
5
|
import { Header, SideNavigationMenu, Footer } from '../../components';
|
|
6
6
|
import './side-nav-outer-toolbar.scss';
|
|
7
7
|
import { useScreenSize } from '../../utils/media-query';
|
|
8
8
|
import { Template } from 'devextreme-react/core/template';
|
|
9
9
|
import { useMenuPatch } from '../../utils/patches';
|
|
10
|
+
<%=#isTypeScript%>import type { SideNavToolbarProps } from '../../types';<%=/isTypeScript%>
|
|
10
11
|
|
|
11
|
-
export default function SideNavOuterToolbar({ title, children }) {
|
|
12
|
-
const scrollViewRef = useRef();
|
|
13
|
-
const
|
|
12
|
+
export default function SideNavOuterToolbar({ title, children }<%=#isTypeScript%>: React.PropsWithChildren<SideNavToolbarProps><%=/isTypeScript%>) {
|
|
13
|
+
const scrollViewRef = useRef<%=#isTypeScript%><ScrollView><%=/isTypeScript%>(null);
|
|
14
|
+
const navigate = useNavigate();
|
|
14
15
|
const { isXSmall, isLarge } = useScreenSize();
|
|
15
16
|
const [patchCssClass, onMenuReady] = useMenuPatch();
|
|
16
17
|
const [menuStatus, setMenuStatus] = useState(
|
|
@@ -40,6 +41,7 @@ export default function SideNavOuterToolbar({ title, children }) {
|
|
|
40
41
|
? MenuStatus.Closed
|
|
41
42
|
: prevMenuStatus
|
|
42
43
|
);
|
|
44
|
+
return true;
|
|
43
45
|
}, [isLarge]);
|
|
44
46
|
|
|
45
47
|
const onNavigationChanged = useCallback(({ itemData: { path }, event, node }) => {
|
|
@@ -48,19 +50,18 @@ export default function SideNavOuterToolbar({ title, children }) {
|
|
|
48
50
|
return;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
scrollViewRef.current
|
|
53
|
+
navigate(path);
|
|
54
|
+
scrollViewRef.current<%=#isTypeScript%>?<%=/isTypeScript%>.instance.scrollTo(0);
|
|
53
55
|
|
|
54
56
|
if (!isLarge || menuStatus === MenuStatus.TemporaryOpened) {
|
|
55
57
|
setMenuStatus(MenuStatus.Closed);
|
|
56
58
|
event.stopPropagation();
|
|
57
59
|
}
|
|
58
|
-
}, [
|
|
60
|
+
}, [navigate, menuStatus, isLarge]);
|
|
59
61
|
|
|
60
62
|
return (
|
|
61
63
|
<div className={'side-nav-outer-toolbar'}>
|
|
62
64
|
<Header
|
|
63
|
-
className={'layout-header'}
|
|
64
65
|
menuToggleEnabled
|
|
65
66
|
toggleMenu={toggleMenu}
|
|
66
67
|
title={title}
|
|
@@ -80,12 +81,12 @@ export default function SideNavOuterToolbar({ title, children }) {
|
|
|
80
81
|
<div className={'container'}>
|
|
81
82
|
<ScrollView ref={scrollViewRef} className={'layout-body with-footer'}>
|
|
82
83
|
<div className={'content'}>
|
|
83
|
-
{React.Children.map(children, item => {
|
|
84
|
+
{React.Children.map(children, (item<%=#isTypeScript%>: any<%=/isTypeScript%>) => {
|
|
84
85
|
return item.type !== Footer && item;
|
|
85
86
|
})}
|
|
86
87
|
</div>
|
|
87
88
|
<div className={'content-block'}>
|
|
88
|
-
{React.Children.map(children, item => {
|
|
89
|
+
{React.Children.map(children, (item<%=#isTypeScript%>: any<%=/isTypeScript%>) => {
|
|
89
90
|
return item.type === Footer && item;
|
|
90
91
|
})}
|
|
91
92
|
</div>
|
package/src/templates/react/application/src/layouts/single-card/{single-card.js → single-card.tsx}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ScrollView from 'devextreme-react/scroll-view';
|
|
3
3
|
import './single-card.scss';
|
|
4
|
+
<%=#isTypeScript%>import type { SingleCardProps } from '../../types';<%=/isTypeScript%>
|
|
4
5
|
|
|
5
|
-
export default function SingleCard({ title, description, children }) {
|
|
6
|
+
export default function SingleCard({ title, description, children }<%=#isTypeScript%>: React.PropsWithChildren<SingleCardProps><%=/isTypeScript%>) {
|
|
6
7
|
return (
|
|
7
8
|
<ScrollView height={'100%'} width={'100%'} className={'with-footer single-card'}>
|
|
8
9
|
<div className={'dx-card content'}>
|
|
File without changes
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import dxTreeView, { ItemClickEvent } from 'devextreme/ui/tree_view';
|
|
2
|
+
import { ClickEvent } from 'devextreme/ui/button';
|
|
3
|
+
import { EventInfo } from 'devextreme/events';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
export interface HeaderProps {
|
|
7
|
+
menuToggleEnabled: boolean;
|
|
8
|
+
title?: string;
|
|
9
|
+
toggleMenu: (e: ClickEvent) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface SideNavigationMenuProps {
|
|
13
|
+
selectedItemChanged: (e: ItemClickEvent) => void;
|
|
14
|
+
openMenu: (e: React.PointerEvent) => void;
|
|
15
|
+
compactMode: boolean;
|
|
16
|
+
onMenuReady: (e: EventInfo<dxTreeView>) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface UserPanelProps {
|
|
20
|
+
menuMode: 'context' | 'list';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface User {
|
|
24
|
+
email: string;
|
|
25
|
+
avatarUrl: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type AuthContextType = {
|
|
29
|
+
user?: User;
|
|
30
|
+
signIn: (email: string, password: string) => Promise<{isOk: boolean, data?: User, message?: string}>;
|
|
31
|
+
signOut: () => void;
|
|
32
|
+
loading: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface SideNavToolbarProps {
|
|
36
|
+
title: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface SingleCardProps {
|
|
40
|
+
title?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type Handle = () => void;
|
|
45
|
+
|
|
46
|
+
interface NavigationData {
|
|
47
|
+
currentPath: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type NavigationContextType = {
|
|
51
|
+
setNavigationData?: ({ currentPath }: NavigationData) => void;
|
|
52
|
+
navigationData: NavigationData;
|
|
53
|
+
}
|
|
File without changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect } from 'react';
|
|
2
|
+
<%=#isTypeScript%>import type { Handle } from '../types';<%=/isTypeScript%>
|
|
2
3
|
|
|
3
4
|
export const useScreenSize = () => {
|
|
4
5
|
const [screenSize, setScreenSize] = useState(getScreenSize());
|
|
@@ -35,7 +36,7 @@ export const useScreenSizeClass = () => {
|
|
|
35
36
|
return 'screen-x-small';
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
let handlers = [];
|
|
39
|
+
let handlers<%=#isTypeScript%>: Handle[]<%=/isTypeScript%> = [];
|
|
39
40
|
const xSmallMedia = window.matchMedia('(max-width: 599.99px)');
|
|
40
41
|
const smallMedia = window.matchMedia('(min-width: 600px) and (max-width: 959.99px)');
|
|
41
42
|
const mediumMedia = window.matchMedia('(min-width: 960px) and (max-width: 1279.99px)');
|
|
@@ -47,9 +48,9 @@ const largeMedia = window.matchMedia('(min-width: 1280px)');
|
|
|
47
48
|
});
|
|
48
49
|
});
|
|
49
50
|
|
|
50
|
-
const subscribe = handler => handlers.push(handler);
|
|
51
|
+
const subscribe = (handler<%=#isTypeScript%>: Handle<%=/isTypeScript%>) => handlers.push(handler);
|
|
51
52
|
|
|
52
|
-
const unsubscribe = handler => {
|
|
53
|
+
const unsubscribe = (handler<%=#isTypeScript%>: Handle<%=/isTypeScript%>) => {
|
|
53
54
|
handlers = handlers.filter(item => item !== handler);
|
|
54
55
|
};
|
|
55
56
|
|
|
@@ -12,5 +12,5 @@ export function useMenuPatch() {
|
|
|
12
12
|
setTimeout(() => setEnabled(false));
|
|
13
13
|
}, [enabled]);
|
|
14
14
|
|
|
15
|
-
return [enabled ? 'pre-init-blink-fix' : '', onMenuReady]
|
|
15
|
+
return [enabled ? 'pre-init-blink-fix' : '', onMenuReady]<%=#isTypeScript%> as [string, () => void]<%=/isTypeScript%>;
|
|
16
16
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -15,7 +15,7 @@ export default function Task() {
|
|
|
15
15
|
|
|
16
16
|
<DataGrid
|
|
17
17
|
className={'dx-card wide-card'}
|
|
18
|
-
dataSource={dataSource}
|
|
18
|
+
dataSource={dataSource<%=#isTypeScript%> as any<%=/isTypeScript%>}
|
|
19
19
|
showBorders={false}
|
|
20
20
|
focusedRowEnabled={true}
|
|
21
21
|
defaultFocusedRowIndex={0}
|
|
@@ -3,9 +3,9 @@ import Router from "vue-router";
|
|
|
3
3
|
|
|
4
4
|
import auth from "./auth";
|
|
5
5
|
|
|
6
|
-
<%=^empty%>import Home from "./views/home";
|
|
7
|
-
import Profile from "./views/profile";
|
|
8
|
-
import Tasks from "./views/tasks";
|
|
6
|
+
<%=^empty%>import Home from "./views/home-page";
|
|
7
|
+
import Profile from "./views/profile-page";
|
|
8
|
+
import Tasks from "./views/tasks-page";
|
|
9
9
|
<%=/empty%>import defaultLayout from "./layouts/<%=layout%>";
|
|
10
10
|
import simpleLayout from "./layouts/single-card";
|
|
11
11
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import auth from "./auth";
|
|
2
2
|
import { createRouter, createWebHashHistory } from "vue-router";
|
|
3
3
|
|
|
4
|
-
<%=^empty%>import Home from "./views/home";
|
|
5
|
-
import Profile from "./views/profile";
|
|
6
|
-
import Tasks from "./views/tasks";
|
|
4
|
+
<%=^empty%>import Home from "./views/home-page";
|
|
5
|
+
import Profile from "./views/profile-page";
|
|
6
|
+
import Tasks from "./views/tasks-page";
|
|
7
7
|
<%=/empty%>import defaultLayout from "./layouts/<%=layout%>";
|
|
8
8
|
import simpleLayout from "./layouts/single-card";
|
|
9
9
|
|
|
@@ -40,7 +40,7 @@ const router = new createRouter({
|
|
|
40
40
|
{
|
|
41
41
|
path: "/tasks",
|
|
42
42
|
name: "tasks",
|
|
43
|
-
meta: {
|
|
43
|
+
meta: {
|
|
44
44
|
requiresAuth: true,
|
|
45
45
|
layout: defaultLayout
|
|
46
46
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const prompts = require('./prompts');
|
|
2
|
+
|
|
3
|
+
const choices = [
|
|
3
4
|
{ value: 'side-nav-outer-toolbar', title: 'Side navigation (outer toolbar)' },
|
|
4
5
|
{ value: 'side-nav-inner-toolbar', title: 'Side navigation (inner toolbar)' }
|
|
5
6
|
];
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
return layoutName;
|
|
8
|
+
const question = {
|
|
9
|
+
message: 'Specify desired application layout:',
|
|
10
|
+
choices: choices
|
|
12
11
|
};
|
|
13
12
|
|
|
14
|
-
const getLayoutInfo = (
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
type: 'select',
|
|
18
|
-
name: 'layout',
|
|
19
|
-
message: 'Specify desired application layout:',
|
|
20
|
-
choices: layouts
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
return runPrompts(questions, getValidLayoutName(layoutName));
|
|
13
|
+
const getLayoutInfo = async(defaultValue) => {
|
|
14
|
+
return await prompts(question, choices, defaultValue);
|
|
25
15
|
};
|
|
26
16
|
|
|
27
|
-
module.exports =
|
|
28
|
-
getLayoutInfo
|
|
29
|
-
};
|
|
17
|
+
module.exports = getLayoutInfo;
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
const prompts = require('prompts');
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const run = async(question, choices, defaultValue) => {
|
|
4
|
+
question = Object.assign({}, question, {
|
|
5
|
+
type: 'select',
|
|
6
|
+
name: 'answer',
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const { answer } = await askQuestion(question, getDefaultValue(choices, defaultValue));
|
|
10
|
+
|
|
11
|
+
return answer;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const askQuestion = async(question, validateValue) => {
|
|
4
15
|
if(validateValue) {
|
|
5
|
-
|
|
6
|
-
|
|
16
|
+
return {
|
|
17
|
+
answer: validateValue
|
|
7
18
|
};
|
|
8
|
-
return new Promise((resolve, reject) => {
|
|
9
|
-
resolve(optionData);
|
|
10
|
-
});
|
|
11
19
|
}
|
|
12
20
|
|
|
13
|
-
return await prompts(
|
|
21
|
+
return await prompts(question);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getDefaultValue = (choices, answer) => {
|
|
25
|
+
if(!answer || !choices.some((choice) => answer === choice.value)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return answer;
|
|
14
30
|
};
|
|
15
31
|
|
|
16
|
-
module.exports =
|
|
32
|
+
module.exports = run;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const prompts = require('./prompts');
|
|
2
|
+
|
|
3
|
+
const choices = [
|
|
4
|
+
{ value: 'typescript', title: 'TypeScript' },
|
|
5
|
+
{ value: 'javascript', title: 'JavaScript' }
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
const question = {
|
|
9
|
+
message: 'Specify desired template type:',
|
|
10
|
+
choices: choices
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getTemplateTypeInfo = async(defaultValue) => {
|
|
14
|
+
if(defaultValue === undefined) return 'javascript';
|
|
15
|
+
return await prompts(question, choices, defaultValue);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports = getTemplateTypeInfo;
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const prompts = require('./prompts');
|
|
2
|
+
|
|
3
|
+
const choices = [
|
|
3
4
|
{ value: 'v2', title: 'Vue version (v2)' },
|
|
4
5
|
{ value: 'v3', title: 'Vue version (v3)' }
|
|
5
6
|
];
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
return `v${versionValue}`;
|
|
8
|
+
const question = {
|
|
9
|
+
message: 'What version do you want?',
|
|
10
|
+
choices: choices
|
|
12
11
|
};
|
|
13
12
|
|
|
14
|
-
const getVersionInfo = (
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
type: 'select',
|
|
18
|
-
name: 'version',
|
|
19
|
-
message: 'What version do you want?',
|
|
20
|
-
choices: versions
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
return runPrompts(questions, getValidVersion(versionValue));
|
|
13
|
+
const getVersionInfo = async(defaultValue) => {
|
|
14
|
+
return await prompts(question, choices, `v${defaultValue}`);
|
|
25
15
|
};
|
|
26
16
|
|
|
27
|
-
module.exports =
|
|
28
|
-
getVersionInfo
|
|
29
|
-
};
|
|
17
|
+
module.exports = getVersionInfo;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
const spawn = require('child_process').spawn;
|
|
2
2
|
|
|
3
|
+
const isWin = /^win/.test(process.platform);
|
|
4
|
+
|
|
3
5
|
module.exports = function(commandName, args = [], customConfig = {}) {
|
|
4
6
|
const forceNoCmd = customConfig.forceNoCmd;
|
|
5
|
-
const command =
|
|
7
|
+
const command = isWin && !forceNoCmd ? `${commandName}.cmd` : commandName;
|
|
6
8
|
const config = {
|
|
7
9
|
stdio: 'inherit',
|
|
8
|
-
windowsVerbatimArguments: true
|
|
10
|
+
windowsVerbatimArguments: true,
|
|
11
|
+
shell: isWin ? false : true
|
|
9
12
|
};
|
|
10
13
|
|
|
11
14
|
if(customConfig) {
|
|
@@ -12,9 +12,9 @@ const applyTemplateToFile = (filePath, templateOptions) => {
|
|
|
12
12
|
return content;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const addPageToApp = (pageName, pageDir, templatePagesPath) => {
|
|
15
|
+
const addPageToApp = (pageName, pageDir, templatePagesPath, getCorrectExtension) => {
|
|
16
16
|
fs.readdirSync(templatePagesPath).forEach((pageItem) => {
|
|
17
|
-
const pagePath = path.join(pageDir, `${pageName}${extname(pageItem)}`);
|
|
17
|
+
const pagePath = path.join(pageDir, `${pageName}${getCorrectExtension(extname(pageItem))}`);
|
|
18
18
|
if(fs.existsSync(pagePath)) {
|
|
19
19
|
console.error('The page already exists');
|
|
20
20
|
process.exit();
|
|
@@ -25,19 +25,19 @@ const addPageToApp = (pageName, pageDir, templatePagesPath) => {
|
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const moveTemplateFilesToProject = (templateFolder, appPath, templateOptions, pathToFileRelativelyRoot) => {
|
|
28
|
+
const moveTemplateFilesToProject = (templateFolder, appPath, templateOptions, getCorrectPath, pathToFileRelativelyRoot) => {
|
|
29
29
|
const relativePath = pathToFileRelativelyRoot || '';
|
|
30
30
|
const pathToFiles = path.join(templateFolder, relativePath);
|
|
31
31
|
|
|
32
32
|
fs.readdirSync(pathToFiles).forEach(file => {
|
|
33
|
-
const pathToAppFile = path.join(appPath, relativePath, file);
|
|
33
|
+
const pathToAppFile = getCorrectPath(extname(file), path.join(appPath, relativePath, file), templateOptions.isTypeScript);
|
|
34
34
|
const nextFilePath = path.join(pathToFiles, file);
|
|
35
35
|
|
|
36
36
|
if(fs.lstatSync(nextFilePath).isDirectory()) {
|
|
37
37
|
if(!fs.existsSync(pathToAppFile)) {
|
|
38
38
|
fs.mkdirSync(pathToAppFile);
|
|
39
39
|
}
|
|
40
|
-
moveTemplateFilesToProject(templateFolder, appPath, templateOptions, path.join(relativePath, file));
|
|
40
|
+
moveTemplateFilesToProject(templateFolder, appPath, templateOptions, getCorrectPath, path.join(relativePath, file));
|
|
41
41
|
} else {
|
|
42
42
|
const content = applyTemplateToFile(nextFilePath, templateOptions);
|
|
43
43
|
fs.writeFileSync(pathToAppFile, content);
|
|
@@ -45,7 +45,12 @@ const moveTemplateFilesToProject = (templateFolder, appPath, templateOptions, pa
|
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
const getTempaltePath = (app) => {
|
|
49
|
+
return path.join(__dirname, '..', 'templates', app);
|
|
50
|
+
};
|
|
51
|
+
|
|
48
52
|
module.exports = {
|
|
49
53
|
moveTemplateFilesToProject,
|
|
50
|
-
addPageToApp
|
|
54
|
+
addPageToApp,
|
|
55
|
+
getTempaltePath
|
|
51
56
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const devextremeConfigUtils = require('./devextreme-config');
|
|
3
|
+
|
|
4
|
+
const isTypeScript = (templateType) => templateType === 'typescript';
|
|
5
|
+
|
|
6
|
+
const setFileExtension = (filePath, isTypeScript) => {
|
|
7
|
+
const { dir, name } = path.parse(filePath);
|
|
8
|
+
const ext = '.' + (isTypeScript ? 'tsx' : 'js');
|
|
9
|
+
|
|
10
|
+
return path.join(dir, name + ext);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getTemplateType = (engine) => {
|
|
14
|
+
const devextremeConfig = devextremeConfigUtils.read();
|
|
15
|
+
return devextremeConfig[engine]
|
|
16
|
+
? devextremeConfig[engine].template
|
|
17
|
+
: 'javascript';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
isTypeScript,
|
|
22
|
+
setFileExtension,
|
|
23
|
+
getTemplateType
|
|
24
|
+
};
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/templates/.DS_Store
DELETED
|
Binary file
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Switch, Route, Redirect } from 'react-router-dom';
|
|
3
|
-
import { SingleCard } from './layouts';
|
|
4
|
-
import { LoginForm, ResetPasswordForm, ChangePasswordForm, CreateAccountForm } from './components';
|
|
5
|
-
|
|
6
|
-
export default function UnauthenticatedContent() {
|
|
7
|
-
return (
|
|
8
|
-
<Switch>
|
|
9
|
-
<Route exact path='/login' >
|
|
10
|
-
<SingleCard title="Sign In">
|
|
11
|
-
<LoginForm />
|
|
12
|
-
</SingleCard>
|
|
13
|
-
</Route>
|
|
14
|
-
<Route exact path='/create-account' >
|
|
15
|
-
<SingleCard title="Sign Up">
|
|
16
|
-
<CreateAccountForm />
|
|
17
|
-
</SingleCard>
|
|
18
|
-
</Route>
|
|
19
|
-
<Route exact path='/reset-password' >
|
|
20
|
-
<SingleCard
|
|
21
|
-
title="Reset Password"
|
|
22
|
-
description="Please enter the email address that you used to register, and we will send you a link to reset your password via Email."
|
|
23
|
-
>
|
|
24
|
-
<ResetPasswordForm />
|
|
25
|
-
</SingleCard>
|
|
26
|
-
</Route>
|
|
27
|
-
<Route exact path='/change-password/:recoveryCode' >
|
|
28
|
-
<SingleCard title="Change Password">
|
|
29
|
-
<ChangePasswordForm />
|
|
30
|
-
</SingleCard>
|
|
31
|
-
</Route>
|
|
32
|
-
<Redirect to={'/login'} />
|
|
33
|
-
</Switch>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { withNavigationWatcher } from './contexts/navigation';<%=^empty%>
|
|
2
|
-
import { HomePage, TasksPage, ProfilePage } from './pages';<%=/empty%>
|
|
3
|
-
|
|
4
|
-
const routes = [<%=^empty%>
|
|
5
|
-
{
|
|
6
|
-
path: '/tasks',
|
|
7
|
-
component: TasksPage
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
path: '/profile',
|
|
11
|
-
component: ProfilePage
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
path: '/home',
|
|
15
|
-
component: HomePage
|
|
16
|
-
}
|
|
17
|
-
<%=/empty%>];
|
|
18
|
-
|
|
19
|
-
export default routes.map(route => {
|
|
20
|
-
return {
|
|
21
|
-
...route,
|
|
22
|
-
component: withNavigationWatcher(route.component)
|
|
23
|
-
};
|
|
24
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as Header } from './header/header';
|
|
2
|
-
export { default as Footer } from './footer/footer';
|
|
3
|
-
export { default as LoginForm } from './login-form/login-form';
|
|
4
|
-
export { default as ResetPasswordForm } from './reset-password-form/reset-password-form';
|
|
5
|
-
export { default as CreateAccountForm } from './create-account-form/create-account-form';
|
|
6
|
-
export { default as ChangePasswordForm } from './change-password-form/change-password-form';
|
|
7
|
-
export { default as SideNavigationMenu } from './side-navigation-menu/side-navigation-menu';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React, { useState, createContext, useContext, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
const NavigationContext = createContext({});
|
|
4
|
-
const useNavigation = () => useContext(NavigationContext);
|
|
5
|
-
|
|
6
|
-
function NavigationProvider(props) {
|
|
7
|
-
const [navigationData, setNavigationData] = useState({});
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<NavigationContext.Provider
|
|
11
|
-
value={{ navigationData, setNavigationData }}
|
|
12
|
-
{...props}
|
|
13
|
-
/>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function withNavigationWatcher(Component) {
|
|
18
|
-
return function (props) {
|
|
19
|
-
const { path } = props.match;
|
|
20
|
-
const { setNavigationData } = useNavigation();
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
setNavigationData({ currentPath: path });
|
|
24
|
-
}, [path, setNavigationData]);
|
|
25
|
-
|
|
26
|
-
return React.createElement(Component, props);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
NavigationProvider,
|
|
32
|
-
useNavigation,
|
|
33
|
-
withNavigationWatcher
|
|
34
|
-
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|