Skip to content

chore(tools): Improve deps, assets and system in project.config #579

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
3 tasks
ludohenin opened this issue Mar 4, 2016 · 5 comments
Closed
3 tasks

chore(tools): Improve deps, assets and system in project.config #579

ludohenin opened this issue Mar 4, 2016 · 5 comments

Comments

@ludohenin
Copy link
Collaborator

Extensibility of the config members is too complex ...

  • DEV_NPM_DEPENDENCIES / PROD_NPM_DEPENDENCIES
  • SYSTEM_CONFIG_DEV & SYSTEM_BUILDER_CONFIG
  • APP_ASSETS

... I'll work out something to make it more elegant than this:

export class ProjectConfig extends SeedConfig {
  //...

  DEV_NPM_DEPENDENCIES: InjectableDependency[] = [
    ...this.DEV_NPM_DEPENDENCIES,
    ...this.normalizeDependencies([
      { src: 'materialize-css/dist/css/materialize.min.css', inject: true }
    ])
  ];

  PROD_NPM_DEPENDENCIES: InjectableDependency[] = [
    ...this.PROD_NPM_DEPENDENCIES,
    ...this.normalizeDependencies([
      { src: 'materialize-css/dist/css/materialize.min.css', inject: true }
    ])
  ];

  APP_ASSETS: InjectableDependency[] = [
    { src: `${this.ASSETS_SRC}/prism.min.js`,  inject: 'libs' },
    { src: `${this.ASSETS_SRC}/prism.css`, inject: true },
    ...this.APP_ASSETS
  ];

  DEV_DEPENDENCIES = this.DEV_NPM_DEPENDENCIES.concat(this.APP_ASSETS);
  PROD_DEPENDENCIES = this.PROD_NPM_DEPENDENCIES.concat(this.APP_ASSETS);

  FONTS_SRC = [
    'node_modules/materialize-css/dist/font/**/*'
  ];

  SYSTEM_CONFIG_DEV = {
  defaultJSExtensions: true,
    paths: {
      [this.BOOTSTRAP_MODULE]: `${this.APP_BASE}${this.BOOTSTRAP_MODULE}`,
      'config': `${this.APP_ROOT}config`,
      'angular2/*': `${this.APP_BASE}angular2/*`,
      'rxjs/*': `${this.APP_BASE}rxjs/*`,
      '*': `${this.APP_BASE}node_modules/*`
    },
    packages: {
      angular2: { defaultExtension: false },
      rxjs: { defaultExtension: false },
      moment: { main: 'moment.js' },
      lodash: { main: 'lodash.js' }
    }
  };

  SYSTEM_CONFIG = this.SYSTEM_CONFIG_DEV;

  SYSTEM_BUILDER_CONFIG = {
    defaultJSExtensions: true,
    paths: {
      [`${this.TMP_DIR}/*`]: `${this.TMP_DIR}/*`,
      '*': 'node_modules/*'
    },
    packages: {
      angular2: { defaultExtension: false },
      rxjs: { defaultExtension: false },
      moment: { main: 'moment.js' },
      lodash: { main: 'lodash.js' }
    }
  };
}
@TheDonDope
Copy link
Contributor

@ludohenin 598efd5 introduced an example override, what is your opinion on it? :)

@ludohenin
Copy link
Collaborator Author

What do you think adding getters for all computed config options (also related to #630) ?
This way we prevent DEV_DEST (for instance) to be set be before we redefine DIST_DIR in project conf.

get DEV_DEST() { return `${this.DIST_DIR}/dev`; }

// cc @mgechev @d3viant0ne

@ludohenin ludohenin self-assigned this Mar 14, 2016
@joshwiens
Copy link
Contributor

@ludohenin Sounds like a viable way to make the change mentions in #630 without stepping on a bunch of existing projects.

@NathanWalker - Thoughts? Advanced Seed is one of the larger extension projects.

@mgechev
Copy link
Owner

mgechev commented Mar 15, 2016

Sounds good to me.

@mgechev
Copy link
Owner

mgechev commented Mar 27, 2016

#644 fixed 1. and 3.

I think we can close this issue for now until we have further plans on it.

@mgechev mgechev closed this as completed Mar 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants