diff --git a/.gitattributes b/.gitattributes index 43c8d7f4e..f1de91784 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,5 +10,7 @@ *.yml text eol=lf *.scss text eol=lf *.vue text eol=lf +*.ts text eol=lf +*.html text eol=lf *.png binary \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c0b3eaf8f..95e90e19a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4287,7 +4287,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -4708,7 +4708,7 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true }, @@ -4724,7 +4724,7 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, @@ -5992,7 +5992,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, diff --git a/templates-generator/angular-config.js b/templates-generator/angular-config.js new file mode 100644 index 000000000..9167641af --- /dev/null +++ b/templates-generator/angular-config.js @@ -0,0 +1,171 @@ +module.exports = { + sourcePath: 'packages/devextreme-cli/testing/sandbox/angular/my-app/', + targetPath: 'packages/devextreme-schematics/', + sourceGlob: '**/*.{js,scss,json,html,ts}', + ignoreList: [ + 'node_modules/**/*.*', + 'src/{themes/generated,environments}/**/*.*', + 'src/{polyfills,test,app/app.module,main}.ts', + 'src/{dx-styles,styles}.scss', + 'src/index.html', + 'e2e/{tsconfig.json,protractor.conf.js}', + '{package-lock,package}.json', + 'tsconfig.{app,spec}.json', + 'tsconfig.json', + 'angular.json', + 'tslint.json', + 'karma.conf.js' + ], + replaceRules: [ + { + glob: 'src/themes/metadata.base.json', + definitions: [ + { + before: /"baseTheme": "[^"]*"/, + after: '"baseTheme": "material.orange.light"' + } + ] + }, + { + glob: 'src/themes/metadata.additional.json', + definitions: [ + { + before: /"baseTheme": "[^"]*"/, + after: '"baseTheme": "material.orange.dark"' + } + ] + }, + { + glob: 'src/themes/metadata.*.json', + definitions: [ + { + before: /"items": \[[^\]]*],/, + after: '"items": [],' + }, + { + before: /"assetsBasePath": "[^"]*"/, + after: '"assetsBasePath": "<%= path %>../../node_modules/devextreme/dist/css/"' + } + ] + }, + { + glob: 'devextreme.json', + definitions: [ + { + before: 'angular', + after: '<%= engine %>' + }, + { + before: /src/g, + after: '<%= sourcePath %>' + } + ] + }, + { + glob: '{src/app/shared/services/app-info.service.ts,e2e/src/app.e2e-spec.ts}', + definitions: [ + { + before: 'My App', + after: '<%= title %>' + } + ] + }, + { + glob: 'src/app/pages/home/home.component.html', + definitions: [ + { + before: 'My App', + after: '<%= project %>' + } + ] + }, + { + glob: 'src/app/app-navigation.ts', + definitions: [ + { + before: /export const navigation = [^;]*?;/, + after: 'export const navigation = [];' + } + ] + }, + { + glob: 'src/app/shared/components/side-navigation-menu/side-navigation-menu.component.ts', + definitions: [ + { + before: /\(DxTreeViewComponent[^\)]*?\)/, + after: '(DxTreeViewComponent<% if(requireStaticFlag) { %>, { static: true }<% } %>)' + } + ] + }, + { + glob: 'src/app/app.component.html', + definitions: [ + { + before: /side-nav-(inner|outer)-toolbar/g, + after: '<%= layout %>' + } + ] + }, + { + glob: 'src/app/app.component.ts', + definitions: [ + { + before: 'app', + after: '<%= prefix %>' + }, + { + before: /app.component/g, + after: '<%= name %>.component' + }, + { + before: 'AppComponent', + after: '<%= strings.classify(name) %>Component' + } + ] + } + ], + removeRules: [ + { + glob: 'src/app/app-routing.module.ts', + definitions: [ + /import { HomeComponent } [^\n]*?\n/, + /import { ProfileComponent } [^\n]*?\n/, + /import { DisplayDataComponent } [^\n]*?\n/, + /import { DxDataGridModule, DxFormModule } [^\n]*?\n/, + /{[^}]*?path: 'display-data'[^}]*?},\s+/, + /{[^}]*?path: 'profile'[^}]*?},\s+/, + /{[^}]*?path: 'home'[^}]*?},\s+/, + /},[^}]*?path: '\*\*'[^}]*/, + /, {\s?useHash: true\s?}/, + ', DxDataGridModule, DxFormModule', + /,\s+declarations: [^\]]*?]/ + ] + } + ], + moveRules: [ + { + glob: 'src/app/pages/**/*.*', + definition: + { + sourcePath: 'src/app/', + targetPath: 'packages/devextreme-schematics/src/add-sample-views/files/' + } + }, + { + glob: '{src/**/!(app.component).*,devextreme.json,e2e/**/*.*}', + definition: + { + sourcePath: '', + targetPath: 'packages/devextreme-schematics/src/add-layout/files/' + } + }, + { + glob: 'src/app/app.component.{scss,ts,html}', + definition: + { + sourcePath: 'src/app/app', + targetPath: 'packages/devextreme-schematics/src/add-layout/files/src/app/__name__' + } + } + ] +}; diff --git a/templates-generator/react-config.js b/templates-generator/react-config.js index e467f64d5..b0034b81b 100644 --- a/templates-generator/react-config.js +++ b/templates-generator/react-config.js @@ -2,7 +2,18 @@ module.exports = { sourcePath: 'packages/devextreme-cli/testing/sandbox/react/my-app/', targetPath: 'packages/devextreme-cli/templates/react/application/', sourceGlob: '**/*.{js,scss,json}', - updateRules: [ + ignoreList: [ + 'src/themes/generated/*.*', + 'node_modules/**/*.*', + 'public/*.*', + 'src/App.test.js', + 'src/setupTests.js', + 'src/serviceWorker.js', + 'src/index.js', + 'package.json', + 'package-lock.json' + ], + replaceRules: [ { glob: 'src/app-routes.js', definitions: [ @@ -45,25 +56,9 @@ module.exports = { glob: 'src/App.js', definitions: [ { - before: 'SideNavOuterToolbar', + before: /SideNav(Outer|Inner)Toolbar/, after: '<%=layout%>' }, - { - before: 'SideNavInnerToolbar', - after: '<%=layout%>' - }, - { - before: 'import \'devextreme/dist/css/dx.common.css\';\n', - after: '' - }, - { - before: 'import \'./themes/generated/theme.base.css\';\n', - after: '' - }, - { - before: 'import \'./themes/generated/theme.additional.css\';\n', - after: '' - }, { before: '))}', after: '))}<%=^empty%>' @@ -78,7 +73,7 @@ module.exports = { glob: 'src/themes/metadata.additional.json', definitions: [ { - before: /"baseTheme": ".*?"/, + before: /"baseTheme": "[^"]*?"/, after: '"baseTheme": "material.orange.dark"' } ] @@ -87,21 +82,31 @@ module.exports = { glob: 'src/themes/metadata.base.json', definitions: [ { - before: /"baseTheme": ".*?"/, + before: /baseTheme": "[^"]*?"/, after: '"baseTheme": "material.orange.light"' } ] }, { - glob: 'src/themes/metadata.**.json', + glob: 'src/themes/metadata.*.json', definitions: [ { - before: /"items":\s+\[[^]*?\]/, + before: /"items":\s+\[[^\]]*?\]/, after: '"items": []' } ] } ], + removeRules: [ + { + glob: 'src/App.js', + definitions: [ + 'import \'devextreme/dist/css/dx.common.css\';\n', + 'import \'./themes/generated/theme.base.css\';\n', + 'import \'./themes/generated/theme.additional.css\';\n', + ] + }, + ], moveRules: [ { glob: 'src/pages/**/*.*', @@ -117,16 +122,5 @@ module.exports = { targetPath: 'packages/devextreme-cli/templates/react/application/' } } - ], - ignoreList: [ - 'src/themes/generated/*.*', - 'node_modules/**/*.*', - 'public/*.*', - 'src/App.test.js', - 'src/setupTests.js', - 'src/serviceWorker.js', - 'src/index.js', - 'package.json', - 'package-lock.json' ] };