donejs / bit-docs-donejs-theme

The plugins to produce the DoneJS site.
https://www.npmjs.com/package/bit-docs-donejs-theme
MIT License
2 stars 2 forks source link

Assign is needed? #65

Closed leoj3n closed 6 years ago

leoj3n commented 7 years ago

For that assign statement:

https://github.com/donejs/bit-docs-donejs-theme/blob/f3f30e4b7f5bd08542e4f340e3be17272d8ced50/bit-docs.js#L11

If removed before generating the DoneJS website, the following error happens:

Error: Error loading "bit-docs-donejs-theme@1.3.2#static/js/components/upcoming-events/upcoming-events.stache!can@2.3.28#view/stache/system" at <unknown>
Error loading "bit-docs-donejs-theme@1.3.2#static/js/components/upcoming-events/upcoming-events.stache!can@2.3.28#view/stache/system" from "bit-docs-site@0.0.1#static" at file:/Users/leoj/website/donejs/node_modules/bit-docs/lib/configure/node_modules/bit-docs-generate-html/site/static/build/a57f5957978cb5171aef5ac6ec87cd7d/static.js
Error loading "can@2.3.28#view/stache/system" at file:/Users/leoj/website/donejs/node_modules/bit-docs/lib/configure/node_modules/bit-docs-generate-html/site/static/build/a57f5957978cb5171aef5ac6ec87cd7d/can@2.3.28#view/stache/system.js
ENOENT: no such file or directory, open '/Users/leoj/website/donejs/node_modules/bit-docs/lib/configure/node_modules/bit-docs-generate-html/site/static/build/a57f5957978cb5171aef5ac6ec87cd7d/can@2.3.28#view/stache/system/index.js'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! donejs@1.0.1 document:force: `bit-docs -fd && npm run docs-copy`
npm ERR! Exit status 1

Haven't seen any other plugins do this kind of assignment to the dependencies object.

Why is the assign necessary here?

imaustink commented 7 years ago

@m-mujica do you remember why assign is needed here? We don't understand why.

m-mujica commented 7 years ago

I'm not 100% sure but I think that's just collecting the theme dependencies so the package.json used to create the final build has all dependencies listed?

Each theme/plugin needs to registers its own dependencies so during build time those are installed and loaded correctly through steal.

m-mujica commented 7 years ago

So it makes sense to me that the error happens if you remove that assign, bit-docs-donejs-theme depends on CanJS.

https://github.com/donejs/bit-docs-donejs-theme/blob/f3f30e4b7f5bd08542e4f340e3be17272d8ced50/package.json#L28-L32

I bet if you look at t he package.json in the static/{hash} folder when the assign is removed, can won't be listed as a dependency.

m-mujica commented 7 years ago

I take that back, it probably is a dependency since steal "knows" its version can@2.3.28#view/stache/system

To fix this issue you need to make sure the stache file extension is set to load can/view/stache/system.

In the package.json inside of the static/{hash} folder, the steal object should look like

steal: {
  "plugins": [
    "steal-less", // when I checked this one is generated fine
    "can"            // this one needs to be added by bit-docs-generate-html
  ]
}
leoj3n commented 7 years ago

Yes thank you very much @m-mujica.

Adding "can" to html.package.steal.plugins in donejs/donejs allows us to use bit-docs-generate-html@0.8.0 in donejs/donejs:

https://github.com/donejs/donejs/pull/1030

And then that let's us get rid of the overkill assign:

https://github.com/donejs/bit-docs-donejs-theme/pull/66

Once those are merged this can be closed!

leoj3n commented 6 years ago

Note: #66 still needs to be merged.