Skip to content
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

Webpack warning when running examples #10

Open
rscreene opened this issue May 14, 2018 · 9 comments
Open

Webpack warning when running examples #10

rscreene opened this issue May 14, 2018 · 9 comments

Comments

@rscreene
Copy link

I am trying to run the doca examples using the following commands:

lerna -v
node -v
git clone https://github.com/cloudflare/json-schema-tools.git
cd json-schema-tools
lerna bootstrap
cd workspaces/doca/example-schemas/draft-04
doca init
cd documentation
../../../../../scripts/yarn/bin/yarn install
../../../../../scripts/yarn/bin/yarn start

But I get warnings from webpack and the resulting webpage is only very minimally styled. The output from the above is:

2.11.0
v8.9.1
Cloning into 'json-schema-tools'...
remote: Counting objects: 883, done.
remote: Compressing objects: 100% (390/390), done.
remote: Total 883 (delta 471), reused 862 (delta 451), pack-reused 0
Receiving objects: 100% (883/883), 1.26 MiB | 1.98 MiB/s, done.
Resolving deltas: 100% (471/471), done.
lerna info version 2.11.0
lerna info versioning independent
lerna info Bootstrapping 7 packages
lerna info hoist Finished installing in root
lerna success Bootstrapped 7 packages
Folder documentation has been created.
Importing these schemas from .:
- common/collection.json
- common/identifier.json
- solarsystem/definitions/measurements.json
- solarsystem/definitions/orbit.json
- solarsystem/definitions/planet.json
- solarsystem/dwarfplanet.json
- solarsystem/planet.json
- solarsystem/probe.json
- solarsystem/sun.json
Doca project files has been copied!
Customizing doca project files:
documentation/schemas.js
Trying to yarn add @cloudflare/doca-default-theme for project documentation...
Theme @cloudflare/doca-default-theme at documentation has been successfully installed!
Setting documentation theme to @cloudflare/doca-default-theme. Files changed:
documentation/src/client/main.js
documentation/src/server/html.js
documentation/webpack/build.js
yarn install v1.3.2
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.50s.
yarn run v1.3.2
$ node webpack/index | NODE_ENV=development node src/server
Server started on port 8000
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/solarsystem/planet.json
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/solarsystem/dwarfplanet.json
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/solarsystem/probe.json
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/solarsystem/sun.json
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/documentation/getting-started.json
⚠ 「wdm」: Hash: c48508533cd4cb5aaf7c
Version: webpack 3.12.0
Time: 1817ms
 Asset     Size  Chunks                    Chunk Names
app.js  4.04 MB       0  [emitted]  [big]  app
  [14] ./node_modules/react/react.js 56 bytes {0} [built]
  [33] (webpack)/buildin/module.js 517 bytes {0} [built]
  [81] ./schemas.js 635 bytes {0} [built]
  [91] ./node_modules/react-dom/index.js 59 bytes {0} [built]
 [117] ./node_modules/react-redux/es/index.js 230 bytes {0} [built]
 [154] multi webpack-hot-middleware/client?path=http://198.18.0.254:8080/__webpack_hmr ./src/client/index.js 40 bytes {0} [built]
 [155] (webpack)-hot-middleware/client.js?path=http://198.18.0.254:8080/__webpack_hmr 7.77 kB {0} [built]
 [156] ./node_modules/querystring-es3/index.js 127 bytes {0} [built]
 [159] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]
 [161] (webpack)-hot-middleware/client-overlay.js 2.21 kB {0} [built]
 [166] (webpack)-hot-middleware/process-update.js 4.33 kB {0} [built]
 [167] ./src/client/index.js 710 bytes {0} [built]
 [292] ./src/client/main.js 1.27 kB {0} [built]
 [293] ./node_modules/@cloudflare/doca-default-theme/index.js 100 bytes {0} [built]
 [413] ./src/client/store.js 1.42 kB {0} [built]
    + 406 hidden modules

WARNING in ./src/client/main.js
23:15-89 Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags.
 @ ./src/client/main.js
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client?path=http://198.18.0.254:8080/__webpack_hmr ./src/client/index.js

WARNING in ./src/client/main.js
25:16-91 Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags.
 @ ./src/client/main.js
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client?path=http://198.18.0.254:8080/__webpack_hmr ./src/client/index.js

WARNING in ./src/client/main.js
27:16-91 Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags.
 @ ./src/client/main.js
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client?path=http://198.18.0.254:8080/__webpack_hmr ./src/client/index.js

This is using macOS 10.13.1

Is it something I'm doing wrong?

@handrews
Copy link
Contributor

@rscreene I had an email notification that you maybe had an old version lying around- I don't see that comment here so I assume you checked and you do not?

I remember the "Context can't use RegExps with the 'g' or 'y' flags" warning but I was pretty sure that I'd fixed that. Hm....

The result is definitely very minimally styled. Per the doca workspace README:

For now, it simply displays the getting started text and the processed schemas. We will be gradually making this into a proper theme, but it can serve as a debuggging aid for anyone using the underlying tools or wishing to build their own theme from scratch.

And from the old doca repo's README:

The new @cloudflare/doca does not yet have a fully functioning theme, so this package is still the produciton-ready one. But we will be implementing feature requests on the new code, and moving most open issues to the new repo whenever it makes sense.

So.... yeah, basically it's just a debugging theme for now I'm afraid. We wanted to get the tools out there (there's at least one other tool, for OpenAPI, that is using @cloudflare/json-schema-walker already) rather than wait on getting a full UI designed and written.

@rscreene
Copy link
Author

I tried it on a machine that had never run doca before and I got the same results so I'm guessing its not due to any old versions.

When I said minimally styled I actually meant without any CSS! Sorry for any confusion.

I've been dragged onto other things for the time being. I'll try again when I get back to it.

@genetique-techno
Copy link

I removed the -g option from the RegExps inclient/main.js. That made the warnings go away. From reading https://webpack.js.org/guides/dependency-management/#require-context it seems to me that the -g option isn't necessary.

@handrews
Copy link
Contributor

I removed the -g option from the RegExps inclient/main.js. That made the warnings go away. From reading https://webpack.js.org/guides/dependency-management/#require-context it seems to me that the -g option isn't necessary.

Oh great- so it looks like as long as subdirectories is true it will do what the "g" was trying to do anyway. Would you be willing to open a PR for it?

Yeah, there's no CSS. Or there may be an empty file to make something not complain, I forget. That seemed the best way to make it clear that it's not intended for production use. Maybe I should have put a banner at the top. hmm....

@genetique-techno
Copy link

I'll open a PR for that within a day. FYI, I'll be playing around with these tools a lot this week, so I might find some other things to address. Do you know why the doca-bootstrap-template is no longer supported? I was able to get it up and running, but it doesn't work with our draft-07 schemas of course. Is there any value in trying to PR against that repo for support with these tools or better to make a new template?

@genetique-techno
Copy link

Or, if you know of specific issues in these tools that's blocking draft-07 support, I'd be happy to help out.

@handrews
Copy link
Contributor

handrews commented May 21, 2018

@genetique-techno it's a bit complicated- for personal reasons I'm taking some time away from the tech industry. So I no longer work at Cloudflare, although obviously I still care about this repo, and am still working on the next draft of the JSON Schema specification (which will mostly be core and validation stuff, probably with minimal Hyper-Schema changes since we're just staring to see draft-07 implemented).

So the simple reason there's no UI right now is that I'm dealing with Real Life Stuff and unable to put a lot of time into one myself, and I'm not sure what the plan is within Cloudflare.

@tomlikestorock are there any near-term plans for an open source new theme on top of this new back-end?

Of course, if you want to work on a UI that would be awesome and may be faster, and I'd be happy to answer questions, review code, discuss UI design options, etc. I've thought about this stuff a lot, I just don't have time to code it right now.

As for why the old doca-bootstrap-theme doesn't work, the old doca (on npm as doca) and this new doca (@cloudflare/doca) work with different data structures. The old json-schema-example-loader package changed the data structure around a lot in order to make the UI easier. However, that meant that the output was no longer a valid JSON Hyper-Schema (of any draft). In the long run, that caused more trouble than it was worth for a variety of reasons, not the least of which being that we couldn't use anyone else's schema tools on the output if we wanted to.

So in this repo, @cloudflare/json-schema-apidoc-loader (or, really, @cloudflare/json-schema-transform) still does most of what json-schema-example-loader used to, except the result is still a valid JSON Hyper-Schema of whatever draft it started out as. It just has extra fields which is something JSON Schema allows.

But that means no older doca theme will work with @cloudflare/doca. On the plus side, it should be easier to figure out how to build a theme since if you already know JSON Hyper-Schema, you know 99% of what comes out of the API doc loader as input to the UI. There's no conversion step to learn.

If you want to kick ideas around more, feel free to drop by the JSON Schema slack channel which might be a little better suited than GitHub issues for such things.

@genetique-techno
Copy link

@handrews thanks for providing some background on the state of things--I totally understand Real Life. I'm going to try to make a new template with the draft-07, and I'll hit up the slack for any issues that come up. Thanks again and best of luck with Real Life.

@rscreene
Copy link
Author

Ah, I had assumed that the warnings were the reason that there was no CSS! I'll check back later.

Nice project by the way!

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

No branches or pull requests

3 participants