Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
pomahtri committed Jul 18, 2024
1 parent 3fc409b commit 914fc17
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 43 deletions.
15 changes: 0 additions & 15 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,6 @@
],
"cache": true
},
"angular:copy-metadata": {
"dependsOn": [
"tools:discover-metadata"
]
},
"react:copy-metadata": {
"dependsOn": [
"tools:discover-metadata"
]
},
"vue:copy-metadata": {
"dependsOn": [
"tools:discover-metadata"
]
},
"lint": {
"cache": true
},
Expand Down
18 changes: 3 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,10 @@
"license": "MIT",
"author": "Developer Express Inc.",
"scripts": {
"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-to-bundle": "dx-tools inject-descriptions --target-path ./packages/devextreme/ts/dx.all.d.ts --artifacts ./packages/devextreme-metadata/dist",
"devextreme:inject-descriptions-to-modules": "dx-tools inject-descriptions --collapse-tags --sources ./packages/devextreme/js --artifacts ./packages/devextreme-metadata/dist",
"devextreme:inject-descriptions": "npm run devextreme:inject-descriptions-to-bundle && npm run devextreme:inject-descriptions-to-modules",
"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: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",
"react-storybook:start": "nx start devextreme-react-storybook",
"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: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",
"angular:inject-descriptions": "dx-tools inject-descriptions --sources ./packages/devextreme-angular/npm/dist --artifacts ./packages/devextreme-metadata/dist",
"regenerate-all": "nx run-many -t regenerate",
"lint-staged": "lint-staged",
"prepare": "husky install",
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme-angular/build.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
tools: {
metadataGenerator: {
sourceMetadataFilePath: './metadata/NGMetaData.json',
sourceMetadataFilePath: require.resolve('devextreme-metadata/NGMetaData.json'),
deprecatedMetadataFilePath: './metadata/DeprecatedComponentsMetadata.json',
outputFolderPath: './metadata/generated',
nestedPathPart: 'nested',
Expand Down Expand Up @@ -55,7 +55,7 @@ module.exports = {
outputFileName: 'tests/src/server/component-names.ts'
},
commonReexportsGenerator: {
metadataPath: './metadata/NGMetaData.json',
metadataPath: require.resolve('devextreme-metadata/NGMetaData.json'),
outputPath: './src/'
},

Expand Down
3 changes: 2 additions & 1 deletion packages/devextreme-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"typescript": "^4.9.3",
"webpack": "^5.88.2",
"yargs": "^17.7.2",
"zone.js": "0.13.3"
"zone.js": "0.13.3",
"devextreme-metadata": "*"
},
"main": "./src/index.ts",
"keywords": [
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 @@ -40,7 +40,7 @@
"options": {
"script": "regenerate"
},
"dependsOn": ["devextreme-monorepo:\"angular:copy-metadata\""]
"dependsOn": ["devextreme-metadata:build"]
},
"test:dev": {
"executor": "nx:run-script",
Expand Down
7 changes: 7 additions & 0 deletions packages/devextreme-metadata/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "devextreme-metadata",
"publishConfig": {
"directory": "./dist",
"linkDirectory": true
}
}
22 changes: 22 additions & 0 deletions packages/devextreme-metadata/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "devextreme-metadata",
"targets": {
"build": {
"executor": "nx:run-commands",
"outputs": [
"{projectRoot}/dist"
],
"options": {
"parallel": false,
"commands": [
"dx-tools discover-declarations --sources ./packages/devextreme/js --exclude \"js/(renovation|__internal|.eslintrc.js)\" --compiler-options \"{ \\\"typeRoots\\\": [] }\" --artifacts ./packages/devextreme-metadata/dist",
"dx-tools make-integration-metadata --artifacts ./packages/devextreme-metadata/dist",
"dx-tools make-angular-metadata --artifacts ./packages/devextreme-metadata/dist",
"dx-tools make-aspnet-metadata --artifacts ./packages/devextreme-metadata/dist --version 24_1"
]
},
"dependsOn": []
}
},
"implicitDependencies": ["devextreme-main"]
}
2 changes: 1 addition & 1 deletion packages/devextreme-react/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
license: 'LICENSE',
readme: 'README.md'
},
metadataPath: './metadata/integration-data.json',
metadataPath: require.resolve('devextreme-metadata/integration-data.json'),
generatedComponentsDir: './src',
coreComponentsDir: './src/core',
indexFileName: './src/index.ts',
Expand Down
3 changes: 2 additions & 1 deletion packages/devextreme-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"react": "~18.0.0",
"react-dom": "~18.0.0",
"ts-jest": "^29.1.2",
"typescript": "~4.9"
"typescript": "~4.9",
"devextreme-metadata": "*"
},
"publishConfig": {
"directory": "npm",
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 @@ -25,7 +25,7 @@
"options": {
"script": "regenerate"
},
"dependsOn": ["devextreme-monorepo:\"react:copy-metadata\""]
"dependsOn": ["devextreme-metadata:build"]
},
"test": {
"executor": "nx:run-script",
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme-vue/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
license: './LICENSE',
readme: './README.md'
},
metadataPath: './metadata/integration-data.json',
metadataPath: require.resolve('devextreme-metadata/integration-data.json'),
generatedComponentsDir: './src',
coreComponentsDir: './src/core',
indexFileName: './src/index.ts',
Expand Down
3 changes: 2 additions & 1 deletion packages/devextreme-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"typescript": "^4.9.5",
"vue": "3.2.47",
"@vue/shared": "^3.2.47",
"vue-router": "^4.0.16"
"vue-router": "^4.0.16",
"devextreme-metadata": "*"
},
"publishConfig": {
"directory": "npm",
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 @@ -25,7 +25,7 @@
"options": {
"script": "regenerate"
},
"dependsOn": ["devextreme-monorepo:\"vue:copy-metadata\""]
"dependsOn": ["devextreme-metadata:build"]
},
"test": {
"executor": "nx:run-script",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

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

3 changes: 1 addition & 2 deletions tools/scripts/build-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ const MAJOR_VERSION = monorepoVersion.split('.').slice(0, 2).join('_');

// Prepare metadata
sh.cd(ROOT_DIR);
sh.exec('pnpm run tools:discover-declarations');
sh.exec(`pnpm run tools make-aspnet-metadata --version ${MAJOR_VERSION}`);
sh.exec('pnpx nx build devextreme-metadata');

if (!devMode) {
injectDescriptions();
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/common/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';

export const ROOT_DIR = path.join(__dirname, '../../..');
export const ARTIFACTS_DIR = path.join(ROOT_DIR, 'artifacts');
export const INTERNAL_TOOLS_ARTIFACTS = path.join(ARTIFACTS_DIR, 'internal-tools');
export const INTERNAL_TOOLS_ARTIFACTS = require.resolve('devextreme-metadata');
export const TS_ARTIFACTS = path.join(ARTIFACTS_DIR, 'ts');
export const JS_ARTIFACTS = path.join(ARTIFACTS_DIR, 'js');
export const CSS_ARTIFACTS = path.join(ARTIFACTS_DIR, 'css');
Expand Down

0 comments on commit 914fc17

Please sign in to comment.