cloudflare / cloudflare/json-schema-tools

Error: Cannot find module '@cloudflare/json-hyper-schema' and other start-up bumps...

Open
#15 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
341
Forks
32
PR merge metrics
No merged PRs in 30d

Description

hi there :wave:

i'm trying to get up and running using `doca`. i was able to init a local docs app:

```
doca init -i path/to/my/project/files/ -o ./docs
Folder docs has been created.
Importing these schemas from path/to/my/project/files/:
- manifest.json
- manifest.schema.json
Doca project files has been copied!
Customizing doca project files:
docs/schemas.js
Trying to yarn add @cloudflare/doca-default-theme for project docs...
Theme @cloudflare/doca-default-theme at docs has been successfully installed!
Setting docs theme to @cloudflare/doca-default-theme. Files changed:
docs/src/client/main.js
docs/src/server/html.js
docs/webpack/build.js
```

i then `cd ./docs && npm i` which runs fine but when i try to run the resulting app, i get `Error: Cannot find module '@cloudflare/json-hyper-schema'`

if i install that dependency via `npm i @cloudflare/json-hyper-schema --save`, i'm able to run `npm run build:nojs` but then the resulting app is empty - `open build/index.html` shows what looks like empty boilerplate.

looking at the `schemas.js` and `getting-started.json` files, i see:

```
>>cat ./schemas.js
import { fromJS } from 'immutable';

export default fromJS([
// The "getting started" schema, which is automatically added to this
// list by the scaffolding process, provides table-of-contents links
// for the sections in src/client/introduction.js. You are free
// to customize or remove both the schema and the introduction component.
require('./getting-started.json'),

]);
```

and

```
>>cat ./getting-started.json
{
"id": "/getting/started",
"title": "Getting started",
"cfHidden": true,
"links": [
{
"title": "Endpoints",
"href": "about:endpoints"
},
{
"title": "Requests",
"href": "about:requests"
},
{
"title": "Responses",
"href": "about:responses"
},
{
"title": "Resource Identifiers",
"href": "about:identifiers"
}
]
}
```

not sure where i went wrong but fwiw, i'm doing perhaps two things that are unexpected / not handled: 1) i'm running `npm` (not `yarn`) and 2) my data and schema are located in the same directory (`manifest.json` and `manifest.schema.json` where the former is my actual data and the later is the schema file using `$schema: "http://json-schema.org/draft-07/schema#"`)

any pointers you could provide would be much appreciated 🙏

Contributor guide

Open the contributing guide

Research direction

Reproduce the setup with `doca init`, `npm i`, and `npm run build:nojs`, then inspect the generated `schemas.js`, `getting-started.json`, and the startup error for the missing `@cloudflare/json-hyper-schema` dependency. Done means the generated app starts successfully and the resulting `build/index.html` is populated rather than empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.