Skip to content

feat: Implementation of flag to install Angular Material on new or init #1038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion addon/ng2/blueprints/ng2/files/__path__/system-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ barrels.forEach((barrelName: string) => {
cliSystemConfigPackages[barrelName] = { main: 'index' };
});

<% if(isMaterial) { %>
cliSystemConfigPackages['@angular2-material/core']
= { format: 'cjs', defaultExtenstion: 'js', main: 'core.js' };
<% } %>

/** Type declaration for ambient System. */
declare var System: any;

// Apply the CLI SystemJS configuration.
System.config({
map: {
'@angular': 'vendor/@angular',
'@angular': 'vendor/@angular', <% if(isMaterial) { %>
'@angular2-material': 'vendor/@angular2-material', <% } %>
'rxjs': 'vendor/rxjs',
'main': 'main.js'
},
Expand Down
3 changes: 2 additions & 1 deletion addon/ng2/blueprints/ng2/files/angular-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module.exports = function(defaults) {
'es6-shim/es6-shim.js',
'reflect-metadata/**/*.+(ts|js|js.map)',
'rxjs/**/*.+(js|js.map)',
'@angular/**/*.+(js|js.map)'
'@angular/**/*.+(js|js.map)'<% if(isMaterial) { %>,
'@angular2-material/**/*.js' <% } %>
]
});
};
3 changes: 2 additions & 1 deletion addon/ng2/blueprints/ng2/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",<% if(isMaterial) { %>
"@angular2-material/core": "2.0.0-alpha.5-2", <% } %>
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
Expand Down
6 changes: 4 additions & 2 deletions addon/ng2/blueprints/ng2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module.exports = {
{ name: 'source-dir', type: String, default: 'src', aliases: ['sd'] },
{ name: 'prefix', type: String, default: 'app', aliases: ['p'] },
{ name: 'style', type: String, default: 'css' },
{ name: 'mobile', type: Boolean, default: false }
{ name: 'mobile', type: Boolean, default: false },
{ name: 'material', type: Boolean, default: false }
],

afterInstall: function (options) {
Expand Down Expand Up @@ -38,7 +39,8 @@ module.exports = {
prefix: options.prefix,
styleExt: this.styleExt,
refToTypings: refToTypings,
isMobile: options.mobile
isMobile: options.mobile,
isMaterial: options.material
};
},

Expand Down
6 changes: 4 additions & 2 deletions addon/ng2/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module.exports = Command.extend({
{ name: 'source-dir', type: String, default: 'src', aliases: ['sd'] },
{ name: 'style', type: String, default: 'css' },
{ name: 'prefix', type: String, default: 'app', aliases: ['p'] },
{ name: 'mobile', type: Boolean, default: false }
{ name: 'mobile', type: Boolean, default: false },
{ name: 'material', type: Boolean, default: false }
],

anonymousOptions: ['<glob-pattern>'],
Expand Down Expand Up @@ -103,7 +104,8 @@ module.exports = Command.extend({
sourceDir: commandOptions.sourceDir,
style: commandOptions.style,
prefix: commandOptions.prefix,
mobile: commandOptions.mobile
mobile: commandOptions.mobile,
material: commandOptions.material
};

if (!validProjectName(packageName)) {
Expand Down
3 changes: 2 additions & 1 deletion addon/ng2/commands/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const NewCommand = Command.extend({
{ name: 'source-dir', type: String, default: 'src', aliases: ['sd'] },
{ name: 'style', type: String, default: 'css' },
{ name: 'prefix', type: String, default: 'app', aliases: ['p'] },
{ name: 'mobile', type: Boolean, default: false }
{ name: 'mobile', type: Boolean, default: false },
{ name: 'material', type: Boolean, default: false }
],

run: function (commandOptions, rawArgs) {
Expand Down
3 changes: 2 additions & 1 deletion lib/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"properties": {
"main": "string",
"tsconfig": "string",
"mobile": "boolean"
"mobile": "boolean",
"material": "boolean"
},
"additionalProperties": false
},
Expand Down