Skip to content

Commit

Permalink
Use generators from the internal-tools package (#25566)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaKhD authored Sep 14, 2023
1 parent 812a3f8 commit f58dae0
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 336 deletions.
383 changes: 79 additions & 304 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
"devextreme:inject-descriptions-to-bundle": "dx-tools inject-descriptions --target-path ./packages/devextreme/ts/dx.all.d.ts --artifacts ./artifacts/internal-tools",
"devextreme:inject-descriptions-to-modules": "dx-tools inject-descriptions --collapse-tags --sources ./packages/devextreme/js --artifacts ./artifacts/internal-tools",
"devextreme:inject-descriptions": "npm run devextreme:inject-descriptions-to-bundle && npm run devextreme:inject-descriptions-to-modules",
"angular:build-generator": "cd node_modules/devextreme-angular-generator && npm i --no-audit --no-fund && npm run build:local",
"angular:copy-metadata": "shx mkdir -p ./packages/devextreme-angular/metadata/ && shx cp ./artifacts/internal-tools/NGMetaData.json ./packages/devextreme-angular/metadata/",
"angular:regenerate": "nx regenerate devextreme-angular",
"angular:inject-descriptions": "dx-tools inject-descriptions --sources ./packages/devextreme-angular/npm/dist --artifacts ./artifacts/internal-tools",
"react:build-generator": "cd node_modules/devextreme-react-generator && npm i --no-audit --no-fund && npm run build:local",
"react:copy-metadata": "shx mkdir -p ./packages/devextreme-react/metadata/ && shx cp ./artifacts/internal-tools/integration-data.json ./packages/devextreme-react/metadata/",
"react:regenerate": "nx regenerate devextreme-react",
"tools": "dx-tools",
"tools:discover-declarations": "dx-tools discover-declarations --sources ./packages/devextreme/js --exclude \"js/(renovation|__internal|.eslintrc.js)\" --compiler-options \"{ \\\"typeRoots\\\": [] }\" --artifacts ./artifacts/internal-tools",
"tools:generate-imd": "dx-tools make-integration-metadata --artifacts ./artifacts/internal-tools",
"tools:generate-ng-smd": "dx-tools make-angular-metadata --artifacts ./artifacts/internal-tools",
"tools:discover-metadata": "npm run tools:discover-declarations && npm run tools:generate-imd && npm run tools:generate-ng-smd",
"vue:build-generator": "cd node_modules/devextreme-vue-generator && npm i --no-audit --no-fund && npm run build:local",
"vue:copy-metadata": "shx mkdir -p ./packages/devextreme-vue/metadata/ && shx cp ./artifacts/internal-tools/integration-data.json ./packages/devextreme-vue/metadata/",
"vue:regenerate": "nx regenerate devextreme-vue",
"regenerate-all": "nx run-many -t regenerate",
Expand All @@ -31,7 +28,7 @@
"@types/node": "^18.15.3",
"cheerio": "1.0.0-rc.10",
"codelyzer": "^6.0.2",
"devextreme-internal-tools": "12.0.0-beta.1",
"devextreme-internal-tools": "12.0.0-beta.2",
"eslint": "8.47.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "17.0.0",
Expand Down
6 changes: 0 additions & 6 deletions packages/devextreme-angular/build.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = {
tools: {
metadataGenerator: {
importFrom: 'devextreme-angular-generator/dist/metadata-generator',
sourceMetadataFilePath: './metadata/NGMetaData.json',
deprecatedMetadataFilePath: './metadata/DeprecatedComponentsMetadata.json',
outputFolderPath: './metadata/generated',
Expand All @@ -12,14 +11,12 @@ module.exports = {
generateReexports: true,
},
componentGenerator: {
importFrom: 'devextreme-angular-generator/dist/dot-generator',
metadataFolderPath: './metadata/generated/',
outputFolderPath: './src/ui/',
nestedPathPart: 'nested',
basePathPart: 'base'
},
facadeGenerator: {
importFrom: 'devextreme-angular-generator/dist/facade-generator',
facades: {
'./src/index.ts': {
sourceDirectories: [
Expand All @@ -34,7 +31,6 @@ module.exports = {
]
},
moduleFacadeGenerator: {
importFrom: 'devextreme-angular-generator/dist/module.facade-generator',
moduleFacades: {
'./src/ui/all.ts': {
sourceComponentDirectories: [
Expand All @@ -47,7 +43,6 @@ module.exports = {
}
},
componentNamesGenerator: {
importFrom: 'devextreme-angular-generator/dist/component-names-generator',
componentFilesPath: './src/ui/',
excludedFileNames: [
'nested',
Expand All @@ -60,7 +55,6 @@ module.exports = {
outputFileName: 'tests/src/server/component-names.ts'
},
commonReexportsGenerator: {
importFrom: 'devextreme-angular-generator/dist/common-reexports-generator',
metadataPath: './metadata/NGMetaData.json',
outputPath: './src/'
},
Expand Down
25 changes: 13 additions & 12 deletions packages/devextreme-angular/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ var header = require('gulp-header');
var ngPackagr = require('ng-packagr');
var exec = require('child_process').exec;

var AngularMetadataGenerator = require('devextreme-internal-tools').AngularMetadataGenerator;
var AngularDotGenerator = require('devextreme-internal-tools').AngularDotGenerator;
var AngularFacadeGenerator = require('devextreme-internal-tools').AngularFacadeGenerator;
var AngularModuleFacadeGenerator = require('devextreme-internal-tools').AngularModuleFacadeGenerator;
var AngularCommonReexportsGenerator = require('devextreme-internal-tools').AngularCommonReexportsGenerator;
var AngularComponentNamesGenerator = require('devextreme-internal-tools').AngularComponentNamesGenerator;

const argv = require('yargs')
.default('with-descriptions', false)
.argv;
Expand All @@ -24,8 +31,7 @@ gulp.task('clean.metadata', gulp.series(function() {
}));

gulp.task('generate.metadata', gulp.series('clean.metadata', function(done) {
var MetadataGenerator = require(buildConfig.tools.metadataGenerator.importFrom).default,
generator = new MetadataGenerator();
var generator = new AngularMetadataGenerator();

generator.generate(buildConfig.tools.metadataGenerator);
done();
Expand All @@ -38,32 +44,28 @@ gulp.task('clean.generatedComponents', function(done) {
});

gulp.task('generate.components', gulp.series('generate.metadata', 'clean.generatedComponents', function(done) {
var DoTGenerator = require(buildConfig.tools.componentGenerator.importFrom).default,
generator = new DoTGenerator();
var generator = new AngularDotGenerator();

generator.generate(buildConfig.tools.componentGenerator);
done();
}));

gulp.task('generate.moduleFacades', gulp.series('generate.components', function(done) {
var ModuleFacadeGenerator = require(buildConfig.tools.moduleFacadeGenerator.importFrom).default,
moduleFacadeGenerator = new ModuleFacadeGenerator();
var moduleFacadeGenerator = new AngularModuleFacadeGenerator();

moduleFacadeGenerator.generate(buildConfig.tools.moduleFacadeGenerator);
done();
}));

gulp.task('generate.facades', gulp.series('generate.moduleFacades', function(done) {
var FacadeGenerator = require(buildConfig.tools.facadeGenerator.importFrom).default,
facadeGenerator = new FacadeGenerator();
var facadeGenerator = new AngularFacadeGenerator();

facadeGenerator.generate(buildConfig.tools.facadeGenerator);
done();
}));

gulp.task('generate.common-reexports', function(done) {
var CommonReexportsGenerator = require(buildConfig.tools.commonReexportsGenerator.importFrom).default,
commonReexportsGenerator = new CommonReexportsGenerator();
var commonReexportsGenerator = new AngularCommonReexportsGenerator();

commonReexportsGenerator.generate(buildConfig.tools.commonReexportsGenerator);
done();
Expand Down Expand Up @@ -184,8 +186,7 @@ gulp.task('clean.tests', function() {
});

gulp.task('generate-component-names', function(done) {
var ComponentNamesGenerator = require(buildConfig.tools.componentNamesGenerator.importFrom).default;
var generator = new ComponentNamesGenerator(buildConfig.tools.componentNamesGenerator);
var generator = new AngularComponentNamesGenerator(buildConfig.tools.componentNamesGenerator);

generator.generate();

Expand Down
1 change: 0 additions & 1 deletion packages/devextreme-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"core-js": "^2.6.12",
"del": "^2.2.2",
"devextreme": "~23.2.0",
"devextreme-angular-generator": "https://gitpkg.now.sh/DevExpress/devextreme-angular/packages/devextreme-angular-generator?master",
"gulp": "^4.0.2",
"gulp-header": "^1.8.12",
"gulp-replace": "^0.6.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme-angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"options": {
"script": "regenerate"
},
"dependsOn": ["devextreme-monorepo:\"angular:copy-metadata\"", "devextreme-monorepo:\"angular:build-generator\""]
"dependsOn": ["devextreme-monorepo:\"angular:copy-metadata\""]
}
},
"tags": []
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme-react/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const shell = require('gulp-shell');
const header = require('gulp-header');
const ts = require('gulp-typescript');
const config = require('./build.config');
const generateReactComponents = require('devextreme-internal-tools').generateReactComponents;

const GENERATE = 'generate';
const CLEAN = 'clean';
Expand All @@ -22,8 +23,7 @@ gulp.task(CLEAN, (c) =>
);

gulp.task(GEN_RUN, (done) => {
const generateSync = require('devextreme-react-generator').default;
generateSync({
generateReactComponents({
metaData: JSON.parse(fs.readFileSync(config.metadataPath).toString()),
components: {
baseComponent: config.baseComponent,
Expand Down
1 change: 0 additions & 1 deletion packages/devextreme-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"del": "^3.0.0",
"devextreme-react-generator": "https://gitpkg.now.sh/DevExpress/devextreme-react/packages/devextreme-react-generator?master",
"gulp": "^4.0.2",
"gulp-header": "^2.0.9",
"gulp-shell": "^0.8.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme-react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"options": {
"script": "regenerate"
},
"dependsOn": ["devextreme-monorepo:\"react:copy-metadata\"", "devextreme-monorepo:\"react:build-generator\""]
"dependsOn": ["devextreme-monorepo:\"react:copy-metadata\""]
}
},
"tags": []
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme-vue/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const shell = require('gulp-shell');
const header = require('gulp-header');
const ts = require('gulp-typescript');
const config = require('./build.config');
const generateVueComponents = require('devextreme-internal-tools').generateVueComponents;

const GENERATE = 'generate';
const CLEAN = 'clean';
Expand All @@ -30,8 +31,7 @@ gulp.task(CLEAN, gulp.parallel(OUTPUTDIR_CLEAN, NPM_CLEAN));

gulp.task(GENERATE,
(done) => {
const generateSync = require('devextreme-vue-generator').default;
generateSync(
generateVueComponents(
JSON.parse(fs.readFileSync(config.metadataPath).toString()),
config.baseComponent,
config.configComponent,
Expand Down
1 change: 0 additions & 1 deletion packages/devextreme-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@vue/compiler-sfc": "^3.0.0",
"@vue/test-utils": "2.0.0-beta.7",
"del": "^3.0.0",
"devextreme-vue-generator": "https://gitpkg.now.sh/DevExpress/devextreme-vue/packages/devextreme-vue-generator?master",
"gulp": "^4.0.2",
"gulp-header": "^2.0.9",
"gulp-shell": "^0.6.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme-vue/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"options": {
"script": "regenerate"
},
"dependsOn": ["devextreme-monorepo:\"vue:copy-metadata\"", "devextreme-monorepo:\"vue:build-generator\""]
"dependsOn": ["devextreme-monorepo:\"vue:copy-metadata\""]
}
},
"tags": []
Expand Down

0 comments on commit f58dae0

Please sign in to comment.