Skip to content

Commit

Permalink
Revert deprecated folder removing (#810)
Browse files Browse the repository at this point in the history
* Revert "Remove deprecated ui folder rendering (#808)
This reverts commit 4637895.
  • Loading branch information
const314 authored Feb 28, 2023
1 parent 4637895 commit 950a349
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/devextreme-react-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Developer Express Inc.",
"name": "devextreme-react-generator",
"version": "1.3.5",
"version": "1.3.6",
"description": "DevExtreme React UI and Visualization Components",
"repository": {
"type": "git",
Expand Down
11 changes: 11 additions & 0 deletions packages/devextreme-react-generator/src/component-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ function getIndent(indent: number) {
return Array(indent * 2 + 1).join(' ');
}

const renderReExport: (model: { path: string, fileName: string }) => string = createTempate(
'/** @deprecated Use \'devextreme-react/<#= it.fileName #>\' file instead */\n'
+ 'export * from "<#= it.path #>";\n'
+ 'export { default } from "<#= it.path #>";\n',
);

function generateReExport(path: string, fileName: string): string {
return renderReExport({ path, fileName });
}

const renderObjectEntry: (model: {
key: string;
value: string;
Expand Down Expand Up @@ -609,4 +619,5 @@ export {
IOption,
ISubscribableOption,
IPropTyping,
generateReExport,
};
12 changes: 12 additions & 0 deletions packages/devextreme-react-generator/src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { writeFileSync as writeFile } from 'fs';
import {
dirname as getDirName,
join as joinPaths,
normalize as normalizePath,
relative as getRelativePath,
sep as pathSeparator,
} from 'path';
Expand All @@ -20,6 +21,7 @@ import { convertTypes } from './converter';
import generateIndex, { IReExport } from './index-generator';

import generateComponent, {
generateReExport,
IComponent,
IIndependentEvents,
INestedComponent,
Expand Down Expand Up @@ -246,6 +248,7 @@ function generate({
},
out: {
componentsDir: string,
oldComponentsDir: string,
indexFileName: string
},
widgetsPackage: string
Expand All @@ -268,6 +271,15 @@ function generate({
name: widgetFile.component.name,
path: `./${removeExtension(getRelativePath(indexFileDir, widgetFilePath)).replace(pathSeparator, '/')}`,
});

writeFile(
joinPaths(out.oldComponentsDir, widgetFile.fileName),
generateReExport(
normalizePath(`./${removeExtension(getRelativePath(out.oldComponentsDir, widgetFilePath))}`)
.replace(pathSeparator, '/'),
removeExtension(widgetFile.fileName),
),
);
});

writeFile(out.indexFileName, generateIndex(modulePaths), { encoding: 'utf8' });
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-react/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
metadataPath: './metadata/integration-data.json',
generatedComponentsDir: './src',
coreComponentsDir: './src/core',
oldComponentsDir: './src/ui',
indexFileName: './src/index.ts',
baseComponent: './core/component',
extensionComponent: './core/extension-component',
Expand Down
7 changes: 7 additions & 0 deletions packages/devextreme-react/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const generateSync = require('devextreme-react-generator').default;
const GENERATE = 'generate';
const CLEAN = 'clean';

const OLD_OUTPUTDIR_CREATE = 'output-dir.create';
const GEN_RUN = 'generator.run';

const NPM_CLEAN = 'npm.clean';
Expand All @@ -28,6 +29,10 @@ gulp.task(CLEAN, (c) =>
del([`${config.generatedComponentsDir}\\*`, `!${config.coreComponentsDir}`], c)
);

gulp.task(OLD_OUTPUTDIR_CREATE, (done) =>
mkdir(config.oldComponentsDir, {}, done)
);

gulp.task(GEN_RUN, (done) => {
generateSync({
metaData: JSON.parse(fs.readFileSync(config.metadataPath).toString()),
Expand All @@ -38,6 +43,7 @@ gulp.task(GEN_RUN, (done) => {
},
out: {
componentsDir: config.generatedComponentsDir,
oldComponentsDir: config.oldComponentsDir,
indexFileName: config.indexFileName
},
widgetsPackage: 'devextreme'
Expand All @@ -48,6 +54,7 @@ gulp.task(GEN_RUN, (done) => {

gulp.task(GENERATE, gulp.series(
CLEAN,
OLD_OUTPUTDIR_CREATE,
GEN_RUN
));

Expand Down

0 comments on commit 950a349

Please sign in to comment.