elixir-lang / ex_doc

ExDoc produces HTML and EPUB documentation for Elixir projects
http://elixir-lang.org
Other
1.48k stars 331 forks source link

Could not find matching doc/dist/app*.css [0.18.0] #792

Closed ellispritchard closed 7 years ago

ellispritchard commented 7 years ago

Works fine in 0.17.1:

* Updating ex_doc (Hex package)
  Checking package (https://repo.hex.pm/tarballs/ex_doc-0.17.1.tar)
  Using locally cached package
tapper_plug $ mix docs
==> ex_doc
Compiling 16 files (.ex)
Generated ex_doc app
==> tapper_plug
Compiling 4 files (.ex)
Generated tapper_plug app
Docs successfully generated.
View them at "doc/index.html".

Breaks in 0.18.0:

* Updating ex_doc (Hex package)
  Checking package (https://repo.hex.pm/tarballs/ex_doc-0.18.0.tar)
  Using locally cached package
tapper_plug $ mix docs
==> ex_doc
Compiling 15 files (.ex)
Generated ex_doc app
==> tapper_plug
Compiling 4 files (.ex)
Generated tapper_plug app
** (RuntimeError) could not find matching /Users/ellispritchard/Dev/Other/ElixirProj/tapper_plug/doc/dist/app*.css
    (ex_doc) lib/ex_doc/formatter/html/templates.ex:222: ExDoc.Formatter.HTML.Templates.relative_asset/3
    (ex_doc) lib/ex_doc/formatter/html/templates/head_template.eex:9: ExDoc.Formatter.HTML.Templates.head_template/2
    (ex_doc) lib/ex_doc/formatter/html/templates/extra_template.eex:1: ExDoc.Formatter.HTML.Templates.extra_template/4
    (ex_doc) lib/ex_doc/formatter/html.ex:119: anonymous fn/3 in ExDoc.Formatter.HTML.generate_extras/3
    (elixir) lib/enum.ex:1270: Enum."-map/2-lists^map/1-0-"/2
    (ex_doc) lib/ex_doc/formatter/html.ex:38: ExDoc.Formatter.HTML.run/2
    (ex_doc) lib/mix/tasks/docs.ex:205: anonymous fn/6 in Mix.Tasks.Docs.run/3
    (elixir) lib/enum.ex:1826: Enum."-reduce/3-lists^foldl/2-0-"/3

Config, see: https://github.com/Financial-Times/tapper_plug/blob/master/mix.exs

😢

tmbb commented 7 years ago

Same here. Works fine from the Github repo so I suspect @josevalim might have uploaded the wrong thing?

tmbb commented 7 years ago

Yup, the version on Hex is missing the formatters/ directory (in what follows, deps/ is the dependencies directory of a project I'm testing this on and ../ex_doc is a clone of the GitHub repo):

$ diff deps/ex_doc/ ../ex_doc/ -qr --strip-trailing-cr
Only in ../ex_doc/: .ebert.yml
Only in ../ex_doc/: .eslintrc
Only in deps/ex_doc/: .fetch
Only in ../ex_doc/: .git
Only in ../ex_doc/: .gitattributes
Only in ../ex_doc/: .gitignore
Only in deps/ex_doc/: .hex
Only in ../ex_doc/: .travis.yml
Only in ../ex_doc/: _build
Only in ../ex_doc/: assets
Only in ../ex_doc/: bin
Only in ../ex_doc/: deps
Only in ../ex_doc/: doc
Only in ../ex_doc/: formatters
Only in ../ex_doc/: gulpfile.js
Only in ../ex_doc/: mix.lock
Only in ../ex_doc/: package.json
Only in ../ex_doc/: test
Only in ../ex_doc/: yarn.lock
tmbb commented 7 years ago

I don't know exactly what is the publishing procedure used by the ExDoc team, but I think that the formatter/ directory is automatically generated by a node script. Is it possible that what's been published is a version in which the formatter/ directory hasn't been generated?

josevalim commented 7 years ago

Yup, my bad. I will be home in a couple hours and publish a new version. --

José Valimwww.plataformatec.com.br http://www.plataformatec.com.br/Founder and Director of R&D

tmbb commented 7 years ago

@josevalim I don't know if you've identified the problem yet, but it's not what I've said above. Between 0.17 and 0.18 you've moved the assets to the formatter/ directory. That directory isn't included in the :files options of the Hex package, which by default includes the priv/ directory, but not the formatters directory you've added.

I had no idea this :files keyword even existed, as everything I've used is included in the default included files and directories and this should definitely serve as a warning for package owners. This is a kind of problem that's only visible when you publish the package to Hex and test the downloaded version. After your own advice of moving :ex_doc_makeup's assets away from priv/, my (unreleased) package also has this problem, which of course I've never noticed because I've never downloaded it from Hex xD

josevalim commented 7 years ago

Yup! We just need to add formatter to :files and we should be good to go! --

José Valimwww.plataformatec.com.br http://www.plataformatec.com.br/Founder and Director of R&D

Gazler commented 7 years ago

@tmbb :files is documented here btw https://hex.pm/docs/publish It states:

A list of files and directories to include in the package. Has to include mix.exs. Defaults to standard project directories, so you usually don't need to set this property.

It is commonly used for publishing Erlang packages since the rebar.config file is usually required. You can see the defaults here https://github.com/hexpm/hex/blob/1561609f8a4e7d508ceec0bfcf70074f3c05de09/lib/mix/tasks/hex.publish.ex#L76:L78

Defaults to `["lib", "priv", "mix.exs", "README*",
 "readme*", "LICENSE*", "license*", "CHANGELOG*", "changelog*", "src"]`.
tmbb commented 7 years ago

I know, I've read it now :) Everything has been working quite magically, so I've never worried about it. It's definitely my fault for not having read the manual in full, but I think this is is a pretty serious problem.

These kinds of bugs don't show up in testing, because testing uses the local package, and apparently it happens to the best (I assume José has read the manual). I'll open an issue on Hex to discuss this.

josevalim commented 7 years ago

0.18.1 is out!