-
Notifications
You must be signed in to change notification settings - Fork 137
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
Merge exisiting package.json to package.json created by emberoider build #383
Conversation
c731c83
to
5470816
Compare
This is still the wrong place to do this. It allows a data cycle. Each time the build runs, we read and write from the same file. So future builds get state mixed in from earlier builds. This is the right location to write, but the reading of package.json needs to come earlier, before it gets written out into this location. The |
@ef4 I am not clear about this. Is there any recommendation where it can be done? |
This |
@ef4 I have updated the review with merging all package.json into one package.json file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is closer now, but it's still reading from the output directory. It shouldn't be doing that.
Right now, the code
- Does merging of all addon-provided package.json in
gatherAssets
. - Synthesizes a new assets from all of those which will get written to disk.
- Reads back in its own asset from the output directory, to merge more things into it and write it out again.
Instead, it should stop doing all the asset merging, and directly in build() it should call code that locates all
package.jsonfiles in
inputPaths`, merges them in memory, merges the app's own package.json (also still in memory), and writes out the file once.
packages/core/src/app.ts
Outdated
@@ -680,6 +697,12 @@ export class AppBuilder<TreeNames> { | |||
} | |||
pkg['ember-addon'] = Object.assign({}, pkg['ember-addon'], meta); | |||
const pkgPath = join(this.root, 'package.json'); | |||
if (existsSync(pkgPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still reading from the output directory.
54b7da6
to
8704580
Compare
1. Gather all the package.json from addons 2. Merge them together 3. Take app's package.json and merge with step2 4. Write it to the disk.
^ That was just a rebase on master before I make a few small changes. Overall this is pretty close. |
Thanks. There were just a few small things needed:
|
This uses the same logic from #178. I have reversed the order in which merging is done.
In #178 We merged
new package.json
content withold package.json
content. That's why rebuild failed. If we just reverse the input values to themerge
call it will fix the issue.