Skip to content

build: use shared logic to build packages #4202

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 2 commits into from
Apr 25, 2017

Conversation

devversion
Copy link
Member

  • No longer creates the whole set of gulp tasks just to build a single package.
  • Makes the package building & releasing more consistent. No extra build:release just for the lib package.

Note: Madge, Payload, Publish Artifacts will be updated in a follow-up.

References #4108

* No longer creates the whole set of gulp tasks just to build a single package.
* Makes the package building & releasing more consistent. No extra `build:release` just for the `lib` package.

References angular#4108
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 21, 2017
@devversion devversion requested a review from jelbourn April 21, 2017 18:09
@@ -8,7 +8,7 @@
"url": "https://github.com/angular/material2.git"
},
"scripts": {
"build": "gulp build:release",
"build": "gulp material:build-release:clean",
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't has to happen in this PR, but can we swap the rule names so that they're consistently verb:subject again? E.g.,
build:material
watch:material
serve:devapp
release:cdk
test:cdk
package:material (create the release package)
publish:material (publishes to npm)
clean:cdk

It would also be good (in a follow-up PR) to have just gulp build, gulp test, etc. that do material, cdk, and examples.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure about that. It's very nice to have like all tasks that belong to a different "package" / "group" be prefixed with the actual name of it.

cdk:clean-build
cdk:build
cdk:build-release
cdk:watch

Copy link
Member

Choose a reason for hiding this comment

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

I think of it as "I want to perform some action. That action will affect xxx". Overall I like the consistency of "verb:action" more than organizing the tasks by target

Copy link
Member Author

@devversion devversion Apr 21, 2017

Choose a reason for hiding this comment

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

Yeah I see that it might be nicer when building different packages on their own. I personally vote for organizing the tasks by target.

It just feels not very consistent and convenient when naming stuff that won't be available in other tasks.

  • copy-assets:demo-app.
  • bundle-theme-scss:material

I would be fine revisiting later in another PR or issue.

/** Create gulp tasks to build the different packages in the project. */
createPackageBuildTasks('cdk');
createPackageBuildTasks('material', ['cdk']);
createPackageBuildTasks('material-examples', ['material']);
Copy link
Member

Choose a reason for hiding this comment

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

Let's just call this one 'examples' for brevity

Copy link
Member Author

Choose a reason for hiding this comment

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

The name in the package.json will be @angular/material-examples. Before I went with material-examples I had another property on createPackageBuildTasks that allows you to specify the task-prefix.

createPackageBuildTasks('material-examples', 'examples', ['material']);

But this just causes confusion because the package and task name are different. Actually the same for lib (= material).

We should try to be as consistent as possible.

Copy link
Member

Choose a reason for hiding this comment

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

The project/repo is already called "material", though; I'd say that part of the name is implicit. As someone working on it, my mental model is just "I want to build the examples" -> "build:examples".

Copy link
Member Author

@devversion devversion Apr 21, 2017

Choose a reason for hiding this comment

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

I totally see what you mean. My only concern is that it is very confusing to have a mismatch of package-name / task-name / source directory name.

));

/** Copies all prebuilt themes into the release package under `prebuilt-themes/` */
task('material:prebuilt-themes', () => {
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to have the name communicate that this doesn't build the themes, just that it copies / packages them up for the release.

(same for 'material:theming-scss')

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

* Task that will build the material package. It will also copy all prebuilt themes and build
* a bundled SCSS file for theming
*/
task('material:prepare-release', sequenceTask(
Copy link
Member

Choose a reason for hiding this comment

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

How do you feel about naming tasks that are not meant to be called from the command line with a leading :?

Copy link
Member Author

Choose a reason for hiding this comment

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

We had that before for a lot of different tasks. But I just don't feel it's necessary. Just makes it harder to remind, if something is "supposed" to be called from the CLI or not.

// There are no type definitions available for these imports.
const inlineResources = require('../../../scripts/release/inline-resources');

export function createPackageBuildTasks(packageName: string, requiredPackages: string[] = [], ) {
Copy link
Member

Choose a reason for hiding this comment

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

Add function description (which should include a list of the tasks created by the function)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM, we can talk more about task naming and have a follow-up PR

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Apr 25, 2017
@mmalerba mmalerba merged commit 2b8f753 into angular:master Apr 25, 2017
@devversion devversion deleted the build/shared-package-tasks branch November 11, 2017 10:20
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants