[email protected] -- Doesn't build on CI

Created on 20 Jul 2019  路  9Comments  路  Source: doczjs/docz

Bug Report

Describe the bug

If you run docz build on a fresh project (one that doesn't have the .docz folder created), it fails:

npm run docz:build

> @proof/[email protected] docz:build /Users/adierkens/Developer/proof/packages/docs
> docz build

cd: no such file or directory: /Users/adierkens/Developer/proof/packages/docs/.docz
yarn run v1.16.0
error Command "build" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

If you first run docz dev, the .docz folder is created and the docz build command now succeeds

Expected behavior

It builds from a clean state (like on CI builds)

Environment

enhancement pending-user-response v2

Most helpful comment

This is a serious issue we have here... How are we supposed to use this project if we cannot build it from a CI env ?

All 9 comments

This is a serious issue we have here... How are we supposed to use this project if we cannot build it from a CI env ?

Hey,

Maybe not an ideal solution, but you can fix it by running docz dev before building on CI.

To do that :

Add wait-on and kill-port to dev dependencies :

yarn add -D wait-on kill-port # npm i -D wait-on kill-port

Add a build:ci command in package.json :

{
    "scripts": {
        "build": "docz build",
        "build:ci": "kill-port 3000 && (npm run dev &) && wait-on http-get://localhost:3000 && kill-port 3000 && npm run build"
    }
}

And you should be able to build without having a .docz folder.

Hi, many thanks. We were thinking about something that way to test it on a CI too but as you said, it's obviously not a sustainable solution regarding of the size and time gatsby take to start on first run.

We'll keep waiting for the moment until @pedronauck provide a proper way to build this package :)

There's far too much magic in the docz dev command and .docz directory, like installing deps there and creating folders. Would be great to see it not install its own deps on every run and allow the docs build command to run without requiring docz dev first.

Hey @levithomason,

I agree with you the build command should be smarter and not need docz dev to be called first.

I plan to get on that as soon as I finish fixing critical v2 issues 馃憤

This is also tracked here : #1049

Regarding installing its own deps on every run, I think we can get rid of that pretty easily.

Will get on that later, or if someone would like to create a PR I'd be happy to merge.

Hey all !

Thanks @bricelp, @levithomason and @adierkens for raising this issue.

Starting from versions >= 2.0.0-rc.33, docz doesn't install any dependency in the .docz folder 馃帀 !

Try out the latest version :

rm -rf .docz && yarn add docz@next && yarn docz dev # or yarn docz build

Would be great to see it not install its own deps on every run

Docz doesn't do that anymore 馃憤 .

allow the docs build command to run without requiring docz dev first

You can now do that too ! docz build doesn't require docz dev to be called first !

Closing for inactivity.
Feel free to re-open if the issue reoccurs.

@rakannimer Probably deserves its own issue, but I've just discovered that when running build before dev, it will not copy over custom src files (like custom gatsby-theme-docz files). I tried to pre-create the .docz folder with my custom Gatsby theme and it caused some sort of infinite loop when running either build or dev.

Thanks @brandonarbini for reporting.

Definitely worth it's own issue, I think it's being tracked in https://github.com/doczjs/docz/issues/1105

The fix, as you said, is to copy the base directory (defaults to src) to .docz before building and not rely on dev being run before.

If you'd like to submit a PR to fix it I'd be happy to help/review/merge.

If you can't, no problem. I'll get to it later this week !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danburzo picture danburzo  路  3Comments

w0wka91 picture w0wka91  路  3Comments

mariusespejo picture mariusespejo  路  3Comments

YardWill picture YardWill  路  3Comments

albinekb picture albinekb  路  3Comments