Skip to content

Commit

Permalink
Add angular config (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
egaluza authored Apr 16, 2020
1 parent a32e9fb commit eac4fab
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions package-lock.json

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

171 changes: 171 additions & 0 deletions templates-generator/angular-config.js
Original file line number Diff line number Diff line change
@@ -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__'
}
}
]
};
60 changes: 27 additions & 33 deletions templates-generator/react-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -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%>'
Expand All @@ -78,7 +73,7 @@ module.exports = {
glob: 'src/themes/metadata.additional.json',
definitions: [
{
before: /"baseTheme": ".*?"/,
before: /"baseTheme": "[^"]*?"/,
after: '"baseTheme": "material.orange.dark"'
}
]
Expand All @@ -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/**/*.*',
Expand All @@ -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'
]
};

0 comments on commit eac4fab

Please sign in to comment.