Skip to content
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

Re-order postBuild hook #4027

Merged
merged 1 commit into from
May 7, 2015

Conversation

chadhietala
Copy link
Member

Currently the postbuild is not very useful as it is called after everything is already in dist. The results.directory folder points to a directory that is going to get cleaned up soon after. This allows you to write to the final tree right before it is copied to dist.

History

We need to generate some configs off of the app tree, writing that config (a json file) to the destDir of the preprocessor was not merging into the final output. Instead it caused the multiple rebuilds to occur.

Example:

  1. Change router.js
  2. Rebuild happens
  3. Write config
  4. Rebuild occurs again because we wrote the config

We then tried just writing the config to the root of the project and then merging it in during the postBuild hook. The results.directory is not the destDir that ends up in the dist, thus the file was lost again.

/cc @dosco

@rwjblue
Copy link
Member

rwjblue commented May 6, 2015

Seems good. Can you add to the hook ordering tests? Something like https://github.com/ember-cli/ember-cli/blob/master/tests/unit/models/builder-test.js#L184-L189 ?

@stefanpenner
Copy link
Contributor

LGTM, but +1 to tests

Currently the postbuild is not very useful as it is called after everything is already in dist. The `results.directory` folder points to a directory that is going to get cleaned up soon after. This allows you to write to the final tree right before it is copied to dist.
stefanpenner added a commit that referenced this pull request May 7, 2015
@stefanpenner stefanpenner merged commit 9a9ef86 into ember-cli:master May 7, 2015
@chadhietala chadhietala deleted the reorder-postbuild-hook branch May 7, 2015 02:52
homu added a commit that referenced this pull request Oct 15, 2015
…penner

Added a new outputReady builder hook

In #4027 the `postBuild` hook was re-ordered to appear before the `processBuildResult` step. This allowed you to do some work on the final tree before it was output to `dist`. This also meant there was no longer a hook which fired to do work after everything was copied to `dist`, which is something we're trying to do.

This PR re-adds the old hook, fired after `processBuildResult`, but with a new name `postResult` (name was suggested in #4247). I'm open to changing the hook name if there are any better ideas.

This should also resolve #4247
@kjhangiani
Copy link

This patch broke my in-repo addon that I use to create a symlink in /dist after the final build is done. Is there another hook or a recommended method to accomplish this now?

I changed my code to use results.directory instead (which points to the tmp dir), but this does not work, as the symlink does not get copied over, the contents of it do. I need the postBuild dist/ folder to contain an actual symlink

@rwjblue
Copy link
Member

rwjblue commented Oct 24, 2015

There is a recent PR to add another hook for this I believe.

@pangratz
Copy link

This patch broke my in-repo addon that I use to create a symlink in /dist after the final build is done. Is there another hook or a recommended method to accomplish this now?

For the future reader, it's outputReady added in #4955

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants