discoveryjs / discovery

A framework for rapid data (JSON) analysis, shareable serverless reports and dashboards
https://discoveryjs.github.io/discovery/
MIT License
348 stars 7 forks source link

Can't build gh-pages demo with current master #101

Closed Guria closed 1 month ago

Guria commented 2 months ago

I just checked out master and tried to build gh-pages. I've installed dependencies and ran npm run build

$ npm run build-gh-pages

> @discoveryjs/discovery@1.0.0-beta.83 build-gh-pages
> discovery-build -o .gh-pages --clean

No config is used
Build bundles ... ✘ [ERROR] Cannot find module '[...]/lib/lib.js'. Please verify that the package.json has a valid "main" entry [plugin discovery-cli]

    [Error details and stack trace]

✘ [ERROR] Cannot find module '[...]/src/preloader'
Require stack:
- [...]/node_modules/@discoveryjs/cli/lib/shared/bundle.js
- [...]/node_modules/@discoveryjs/cli/lib/build.js
- [...]/node_modules/@discoveryjs/cli/bin/build [plugin discovery-cli]

    [Error details and stack trace]

Error: Build failed with 2 errors:
[...]/node_modules/@discoveryjs/cli/lib/shared/bundle.js:160:34: ERROR: [plugin: discovery-cli] Cannot find module '[...]/lib/lib.js'. Please verify that the package.json has a valid "main" entry
[...]/node_modules/@discoveryjs/cli/lib/static/common.js:3:26: ERROR: [plugin: discovery-cli] Cannot find module '[...]/src/preloader'
Require stack:
- [...]/node_modules/@discoveryjs/cli/lib/shared/bundle.js
- [...]/node_modules/@discoveryjs/cli/lib/build.js
- [...]/node_modules/@discoveryjs/cli/bin/build

    [Error details and stack trace]

Node.js v20.16.0

.lib was completely missing in working directory. And it seems latest npm package doesn't have it too. image

Then I ran transpile script so ./lib has appeared in working directory. But npm run build-gh-pages still fails. image

$ npm run build-gh-pages

> @discoveryjs/discovery@1.0.0-beta.83 build-gh-pages
> discovery-build -o .gh-pages --clean

No config is used
Build bundles ... ✘ [ERROR] Cannot find module '[...]/src/preloader'
Require stack:
- [...]/node_modules/@discoveryjs/cli/lib/shared/bundle.js
- [...]/node_modules/@discoveryjs/cli/lib/build.js
- [...]/node_modules/@discoveryjs/cli/bin/build [plugin discovery-cli]

    node_modules/@discoveryjs/cli/lib/static/common.js:3:26:
      3 │ import { preloader } from '@discoveryjs/discovery/src/preloader';
        ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  This error came from the "onResolve" callback registered here:
    node_modules/@discoveryjs/cli/lib/shared/bundle.js:159:16:
      159 │                 onResolve({ filter: /^@discoveryjs\/discovery(\/|$)/ }, (args) => ({
          ╵                 ~~~~~~~~~

    [Stack trace details omitted for brevity]

Error: Build failed with 1 error:
node_modules/@discoveryjs/cli/lib/static/common.js:3:26: ERROR: [plugin: discovery-cli] Cannot find module '[...]/src/preloader'
Require stack:
- [...]/node_modules/@discoveryjs/cli/lib/shared/bundle.js
- [...]/node_modules/@discoveryjs/cli/lib/build.js
- [...]/node_modules/@discoveryjs/cli/bin/build

    [Stack trace details omitted for brevity]

Node.js v20.16.0

It looks like repo is in the middle of refactoring, but seems you had lack of time to finish it. Tell me if I can be useful to help.

lahmatiy commented 1 month ago

Yes, the repo was undergoing refactoring. The issue with the gh-pages build was due to a missing transpile step, as parts of the repo were moved to TypeScript.

I’ve added npm run transpile to the build-gh-pages script, which should fix the problem.