devextreme-cli 1.3.1 → 1.4.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/index.js +4 -2
- package/package.json +8 -3
- package/src/application.js +19 -19
- package/src/applications/application.angular.js +48 -46
- package/src/applications/application.react.js +76 -39
- package/src/applications/application.vue.js +71 -34
- 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} +9 -8
- 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} +10 -9
- 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} +7 -7
- 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} +8 -8
- 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} +10 -12
- 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/dx-styles.scss +25 -13
- 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.scss +1 -16
- package/src/templates/react/application/src/layouts/side-nav-inner-toolbar/{side-nav-inner-toolbar.js → side-nav-inner-toolbar.tsx} +20 -15
- package/src/templates/react/application/src/layouts/side-nav-outer-toolbar/side-nav-outer-toolbar.scss +0 -9
- package/src/templates/react/application/src/layouts/side-nav-outer-toolbar/{side-nav-outer-toolbar.js → side-nav-outer-toolbar.tsx} +19 -16
- 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 +57 -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/dx-styles.scss +12 -0
- package/src/templates/vue-v2/application/src/layouts/side-nav-inner-toolbar.vue +0 -15
- package/src/templates/vue-v2/application/src/layouts/side-nav-outer-toolbar.vue +0 -9
- package/src/templates/vue-v3/application/devextreme.json +2 -1
- package/src/templates/vue-v3/application/src/dx-styles.scss +12 -0
- package/src/templates/vue-v3/application/src/layouts/side-nav-inner-toolbar.vue +2 -17
- package/src/templates/vue-v3/application/src/layouts/side-nav-outer-toolbar.vue +0 -9
- package/src/themebuider.js +19 -4
- package/src/utility/latest-versions.js +3 -3
- package/src/utility/ng-version.js +35 -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/template-creator.js +11 -6
- package/src/utility/typescript-extension.js +24 -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
|
@@ -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;
|
|
@@ -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
|
+
};
|
|
@@ -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
|
-
}
|