Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Allow to configure manifest.json file name #23

Closed
san650 opened this issue Dec 15, 2016 · 1 comment
Closed

Allow to configure manifest.json file name #23

san650 opened this issue Dec 15, 2016 · 1 comment
Labels

Comments

@san650
Copy link
Owner

san650 commented Dec 15, 2016

  • Add a configuration option to give the manifest file a different name
@san650 san650 added the feature label Dec 15, 2016
@san650
Copy link
Owner Author

san650 commented Dec 17, 2016

There are some issues we need to tackle to implement this functionality. The issues have to do with renaming the manifest.ember-web-app.json file on the the build.

These issues involve these ember addons:

  • broccoli-asset-rev
  • ember-cli-fastboot

To support the feature of fingerprinting the images declared in the manifest.js configuration file, we edit the app's broccoli-asset-rev configuration. To be able to edit broccoli-asset-rev configuration, we configure ember-web-app addon to be included before broccoli-asset-rev addon (see this line).

The idea is that we generate the manifest.json file and we want broccoli-asset-rev to process the content of the manifest file to update the name of the images accordingly.

Our first attempt was to add .json extensions to broccoli-asset-rev's replaceExtensions configuration. Although this did the job, it makes ember-cli-fastboot build fail (see #5 #20 and ember-cli/broccoli-asset-rev#91).

Our second attempt was to rename manifest.json to manifest.ember-web-app.json and register ember-web-app.json extension to broccoli-asset-rev's replaceExtensions configuration and then renaming the manifest.ember-web-app.json file back to manifest.json in the postBuild hook.

Although this did it's job, it gave us another error with ember-cli-fastboot (see #24). The error thrown by fastboot was:

$ ember fastboot --serve-assets

[...]

Ember FastBoot running at http://[::]:3000
file changed manifest.js
The Broccoli Plugin: [BroccoliMergeTrees] failed with:
Error: ENOENT: no such file or directory, unlink 'lets-cook/tmp/broccoli_merge_trees-output_path-7k6rfbco.tmp/manifest.ember-web-app.json'
    at Error (native)
    at Object.fs.unlinkSync (fs.js:980:18)
    at FSMonitor._measure (lets-cook/node_modules/heimdalljs-fs-monitor/index.js:66:21)
    at Object.unlinkSync (lets-cook/node_modules/heimdalljs-fs-monitor/index.js:82:30)
    at BroccoliMergeTrees._applyChange (lets-cook/node_modules/broccoli-merge-trees/index.js:183:8)
    at BroccoliMergeTrees.<anonymous> (lets-cook/node_modules/broccoli-merge-trees/index.js:143:21)
    at Array.forEach (native)
    at BroccoliMergeTrees._applyPatch (lets-cook/node_modules/broccoli-merge-trees/index.js:116:9)
    at BroccoliMergeTrees.build (lets-cook/node_modules/broccoli-merge-trees/index.js:102:10)
    at lets-cook/node_modules/broccoli-plugin/read_compat.js:93:34

The broccoli plugin was instantiated at:
    at BroccoliMergeTrees.Plugin (lets-cook/node_modules/broccoli-plugin/index.js:7:31)
    at new BroccoliMergeTrees (lets-cook/node_modules/broccoli-merge-trees/index.js:42:10)
    at BroccoliMergeTrees (lets-cook/node_modules/broccoli-merge-trees/index.js:36:53)
    at Class.module.exports.postprocessTree (lets-cook/node_modules/ember-cli-fastboot/index.js:121:14)
    at lets-cook/node_modules/ember-cli/lib/broccoli/ember-app.js:543:27
    at Array.forEach (native)
    at EmberApp.addonPostprocessTree (lets-cook/node_modules/ember-cli/lib/broccoli/ember-app.js:541:23)
    at EmberApp.toTree (lets-cook/node_modules/ember-cli/lib/broccoli/ember-app.js:1667:15)
    at module.exports (lets-cook/ember-cli-build.js:26:14)
    at CoreObject.module.exports.Task.extend.setupBroccoliBuilder (lets-cook/node_modules/ember-cli/lib/models/builder.js:70:19)

So, broccoli's rebuild breaks when using fastboot's server if we rename files in a postBuild hook.

I'm not sure if this is a bug in FastBoot (likely), but even so, we need to support it so we need a workaround.

Another approach I've tried is to use the postprocessTree hook, the problem is that our postprocessTree hook runs before than broccoli-asset-rev's postprocessTree hook, so we can't use this either.

Current solution

So, the current solution would be to use a separate addon to rename the manifest and configure that addon to run after broccoli-asset-rev. I'm working on ember-web-app-rename. This new addon will be included by ember-web-app and its only concern is to rename the manifest file using a configuration option "ember-web-app": { name: 'manifest.json' }.

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

No branches or pull requests

1 participant