Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a6396ee
refactor using theme variables
GoodDayForSurf Feb 4, 2025
91d569a
refactor using theme variables (angular, react)
GoodDayForSurf Feb 4, 2025
da357e1
rename variables mixin
GoodDayForSurf Feb 4, 2025
8dd37eb
Merge branch 'master' of https://github.com/DevExpress/devextreme-cli
GoodDayForSurf Feb 18, 2025
8cc1787
Merge branch 'master' of https://github.com/DevExpress/devextreme-cli
GoodDayForSurf Mar 4, 2025
f627955
remove redundant css @import
GoodDayForSurf Mar 5, 2025
671084d
remove redundant css @import
GoodDayForSurf Mar 5, 2025
009bda6
migrate to create-vite from create-app for React app creating
GoodDayForSurf Mar 5, 2025
84485d3
fix test for react
GoodDayForSurf Mar 5, 2025
d98e86a
fix test for react
GoodDayForSurf Mar 5, 2025
d9a225c
fix test for react
GoodDayForSurf Mar 5, 2025
a0904f0
fix tsconfig for react lint checking
GoodDayForSurf Mar 6, 2025
d021d56
fix tsconfig for react lint checking
GoodDayForSurf Mar 6, 2025
26ba254
fix tsconfig for react lint checking
GoodDayForSurf Mar 6, 2025
19a14c1
fixes for pass lint check
GoodDayForSurf Mar 6, 2025
b510e0b
fixes for testing
GoodDayForSurf Mar 6, 2025
88727f7
fixes for testing
GoodDayForSurf Mar 6, 2025
30dc4d1
fixes for testing
GoodDayForSurf Mar 6, 2025
d3430be
fix lint check on CI
GoodDayForSurf Mar 6, 2025
8c27dfb
fix types in react for lint check
GoodDayForSurf Mar 6, 2025
e371ea9
fix lint checking on CI
GoodDayForSurf Mar 7, 2025
e730fbe
fix lint checking on CI
GoodDayForSurf Mar 7, 2025
1add4cd
fix lint errors for react
GoodDayForSurf Mar 7, 2025
852350c
fix formatting
GoodDayForSurf Mar 7, 2025
9a8a715
remove unused
GoodDayForSurf Mar 7, 2025
011f42e
remove unused
GoodDayForSurf Mar 7, 2025
b86e166
update text on Home page
GoodDayForSurf Mar 10, 2025
e211649
pin create-vite version
GoodDayForSurf Mar 11, 2025
fcbc334
update lock
GoodDayForSurf Mar 11, 2025
c72346b
add ip package
GoodDayForSurf Mar 11, 2025
2d42534
revert lock
GoodDayForSurf Mar 11, 2025
6f21550
revert package
GoodDayForSurf Mar 11, 2025
8ed2e3c
update lock
GoodDayForSurf Mar 11, 2025
bbe164f
update lock
GoodDayForSurf Mar 11, 2025
7953849
update screenshots
GoodDayForSurf Mar 11, 2025
e301e7a
new import paths from devextreme-react
VasilyStrelyaev Mar 14, 2025
f4cbd56
new import paths from devextreme-vue and devextreme-angular
VasilyStrelyaev Mar 14, 2025
0654f04
fix useNavigate imports
VasilyStrelyaev Mar 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
299 changes: 2 additions & 297 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 28 additions & 10 deletions packages/devextreme-cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/devextreme-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@typescript-eslint/parser": "^4.33.0",
"babel-eslint": "^10.1.0",
"cross-env": "^5.2.1",
"create-vite": "6.3.1",
"eslint": "^7.32.0",
"eslint-config-angular": "^0.5.0",
"eslint-config-prettier": "^8.10.0",
Expand Down
35 changes: 11 additions & 24 deletions packages/devextreme-cli/src/applications/application.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ const stringUtils = require('../utility/string');
const typescriptUtils = require('../utility/typescript-extension');
const removeFile = require('../utility/file-operations').remove;
const latestVersions = require('../utility/latest-versions');
const { extractToolingVersion } = require('../utility/extract-tooling-version');
const defaultStyles = [
'devextreme/dist/css/dx.light.css'
];

const getExtension = (appPath) => {
return fs.existsSync(path.join(appPath, 'src', 'App.tsx')) ? '.tsx' : '.js';
return fs.existsSync(path.join(appPath, 'src', 'App.tsx')) ? '.tsx' : '.jsx';
};

const pathToPagesIndex = () => {
const extension = getExtension(process.cwd());
return path.join(process.cwd(), 'src', 'pages', `index${extension}`);
};

const preparePackageJsonForTemplate = (appPath, appName, isTypeScript) => {
const preparePackageJsonForTemplate = (appPath, appName) => {
const dependencies = [
{ name: 'sass', version: '^1.34.1' },
{ name: 'sass-embedded', version: '^1.85.1' },
{ name: 'devextreme-cli', version: latestVersions['devextreme-cli'], dev: true },
{ name: 'react-router-dom', version: '^6.3.0' },
];
Expand Down Expand Up @@ -60,27 +59,25 @@ const create = async(appName, options) => {
layout: stringUtils.classify(layoutType),
isTypeScript: typescriptUtils.isTypeScript(templateType)
});
const toolingVersion = extractToolingVersion(options);
const commandArguments = [`-p=create-react-app${toolingVersion}`, 'create-react-app', appName];

const templateSuffix = templateOptions.isTypeScript ? '-typescript' : '';
const templatePath = path.resolve(__dirname, `../templates/cra-template${templateSuffix}`);
const commandArguments = [`-p=create-vite@${latestVersions['create-vite']}`, 'create-vite', appName];

commandArguments.push(`--template file:${templatePath}`);
commandArguments.push(`--template react${templateOptions.isTypeScript ? '-ts' : ''}`);

await runCommand('npx', commandArguments);

const appPath = path.join(process.cwd(), appName);

modifyIndexHtml(appPath, templateOptions.project);

addTemplate(appPath, appName, templateOptions);
};

const modifyIndexHtml = (appPath, appName) => {
const indexHtmlPath = path.join(appPath, 'public', 'index.html');
const indexHtmlPath = path.join(appPath, 'index.html');

let htmlContent = fs.readFileSync(indexHtmlPath).toString();
htmlContent = htmlContent.replace(/<title>(\w+\s*)+<\/title>/, `<title>${appName}<\/title>`);
htmlContent = htmlContent.replace(/<title>[^<]+<\/title>/, `<title>${appName}<\/title>`);
htmlContent = htmlContent.replace('<body>', '<body class="dx-viewport">');

fs.writeFileSync(indexHtmlPath, htmlContent);
Expand All @@ -97,7 +94,6 @@ const addTemplate = (appPath, appName, templateOptions) => {
);

const manifestPath = path.join(appPath, 'public', 'manifest.json');
const indexPath = path.join(appPath, 'src', templateOptions.isTypeScript ? 'index.tsx' : 'index.js');

const styles = [
'./themes/generated/theme.additional.css',
Expand All @@ -108,15 +104,15 @@ const addTemplate = (appPath, appName, templateOptions) => {
];

templateCreator.moveTemplateFilesToProject(applicationTemplatePath, appPath, templateOptions, getCorrectPath);
removeFile(path.join(appPath, 'src', 'App.css'));
!templateOptions.isTypeScript && removeFile(path.join(appPath, 'src', 'types.js'));

!templateOptions.isTypeScript && removeFile(path.join(appPath, 'src', 'types.jsx'));

if(!templateOptions.empty) {
addSamplePages(appPath, templateOptions);
}

preparePackageJsonForTemplate(appPath, appName, templateOptions.isTypeScript);
updateJsonPropName(manifestPath, appName);
addPolyfills(packageJsonUtils.getPackageJsonPath(), indexPath);
install({}, appPath, styles);
};

Expand All @@ -130,15 +126,6 @@ const install = (options, appPath, styles) => {
packageManager.runInstall({ cwd: appPath });
};

const addPolyfills = (packagePath, indexPath) => {
const packages = [
{ name: 'react-app-polyfill', version: '^1.0.0' }
];

packageJsonUtils.addDependencies(packagePath, packages);
moduleUtils.insertImport(indexPath, './polyfills');
};

const addStylesToApp = (filePath, styles) => {
styles.forEach(style => {
moduleUtils.insertImport(filePath, style);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading