Skip to content

chore: simplify config, deprecates npm_deps #644

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

Merged
merged 3 commits into from
Mar 18, 2016
Merged

Conversation

mgechev
Copy link
Owner

@mgechev mgechev commented Mar 17, 2016

Fix #629

Still haven't implemented the setters since they will introduce breaking changes and we need to discuss them. Basically, each individual InjectableDependency already includes env and vendor properties. By default all each dependency belongs to both environments (which could be more that is why is used a dependency array instead of dev, prod and both). Once we intent to get the dependencies using DEPENDENCIES we resolve all of them which belong to npm_modules and merge the result with the ones from APP_ASSETS that belong to the environment.

@ludohenin @d3viant0ne let me know if you find anything wrong.

Also, lets discuss the setters for keeping backwards compatibility.

// {src: 'jquery/dist/jquery.min.js', inject: 'libs'},
// {src: 'lodash/lodash.min.js', inject: 'libs'},
];

this.DEV_NPM_DEPENDENCIES = this.DEV_DEPENDENCIES.concat(normalizeDependencies(additional_deps));
this.PROD_NPM_DEPENDENCIES = this.PROD_NPM_DEPENDENCIES.concat(normalizeDependencies(additional_deps));
const oldDeps = this.NPM_DEPENDENCIES;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get what we are doing here but is there a better word than "oldDeps" to convey intent? I can see the future issue questions already. Perhaps "seedDeps" to be consistent in the seed/project theme.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, seedDeps sounds much better.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update it tomorrow and assign the issue to you.

@joshwiens
Copy link
Contributor

Outside of me knit picking naming conventions, I think it's a solid change.

I have seen a few people modify the structure of the project.config (another concat iteration) to pull in other technologies. Something to keep in mind, this is a semver Minor but in reality it's a semver Major for a few projects I can think of off the top of my head. We should add a release note of some sort.

@ludohenin
Copy link
Collaborator

I don't think it completely fixes #579 but looks good for dependencies.

@mgechev
Copy link
Owner Author

mgechev commented Mar 17, 2016

@ludohenin yes, it only partially solves it. It mostly deals with #629

@ludohenin
Copy link
Collaborator

I've mentioned it once already but I find it cleaner to remove the constructor method (it's useless in our case) and to have project.config like this. Don't you think so ?

export class ProjectConfig extends SeedConfig {
  PROJECT_TASKS_DIR = join(process.cwd(), this.TOOLS_DIR, 'tasks', 'project');

  // APP_TITLE = 'Put name of your app here';
  projectDeps: InjectableDependency[] = [
    // {src: 'jquery/dist/jquery.min.js', inject: 'libs'},
    // {src: 'lodash/lodash.min.js', inject: 'libs'},
  ];

  seedDeps:InjectableDependency[] = this.NPM_DEPENDENCIES;

  NPM_DEPENDENCIES = this.seedDeps.concat(this.projectDeps);

  APP_ASSETS: InjectableDependency[] = [
    // {src: `${this.ASSETS_SRC}/css/toastr.min.css`, inject: true},
    // {src: `${this.APP_DEST}/assets/scss/global.css`, inject: true},
    { src: `${this.ASSETS_SRC}/main.css`, inject: true },
  ];
}

@mgechev
Copy link
Owner Author

mgechev commented Mar 18, 2016

@ludohenin yes, it looks cleaner. I don't like that seedDeps becomes an instance member.

@mgechev mgechev assigned ludohenin and unassigned joshwiens Mar 18, 2016
@ludohenin
Copy link
Collaborator

oops, there are conflicts, would you rebase ?

@ludohenin
Copy link
Collaborator

@mgechev Yes you're right about instance members. Then we have to keep has it is.

@mgechev
Copy link
Owner Author

mgechev commented Mar 18, 2016

@ludohenin in the current PR I don't like how we treat the PROD_NPM_DEPENDENCIES, etc. their setters don't do anything and we are not backwards compatible.

@mgechev
Copy link
Owner Author

mgechev commented Mar 18, 2016

@ludohenin I think it looks better now. Let me know if you find anything wrong.

[key: string]: string;
}

const ENVIRONMENTS: Environments = {
DEVELOPMENT: 'dev',
PRODUCTION: 'prod'
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make ENVIRONMENTS interface "usefull", we may have to move ENVIRONMENTS constant as a class instance member, I suppose. And interface should be moved to seed.config.interfaces.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving ENVIRONMENTS will allow extensibility.

@ludohenin
Copy link
Collaborator

@mgechev have added some comments. Otherwise LGTM.

ludohenin added a commit that referenced this pull request Mar 18, 2016
chore: simplify config, deprecates npm_deps
@ludohenin ludohenin merged commit c4aeb80 into master Mar 18, 2016
@ludohenin ludohenin deleted the simplify-config branch March 18, 2016 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge DEV_NPM_DEPENDENCIES and PROD_NPM_DEPENDENCIES
3 participants