fastify/website

Missing generated file: `static/generated/plugins.json`

HassanBahati opened this issue · 13 comments

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

latest

Plugin version

Docusaurus version: 2.2.0

Node.js version

18.13.0

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

20.04

Description

when running npm run build:webuild , the error bellow is returned

[ERROR] Error: Missing generated file: static/generated/plugins.json. Run the "npm run build:website" once.
    at /home/edna/Desktop/bahati/Workspace/fastify/website-next/docusaurus.config.utils.js:27:13
    at Array.forEach (<anonymous>)
    at Object.checkGeneratedData (/home/edna/Desktop/bahati/Workspace/fastify/website-next/docusaurus.config.utils.js:24:18)
    at Object.<anonymous> (/home/edna/Desktop/bahati/Workspace/fastify/website-next/docusaurus.config.js:14:3)
    at Module._compile (node:internal/modules/cjs/loader:1218:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at module.exports (/home/edna/Desktop/bahati/Workspace/fastify/website-next/node_modules/import-fresh/index.js:32:59)

seems not to complain about this on commenting out 'static/generated/plugins.json', in https://github.com/fastify/website-next/blob/7bec1484ecf970aab3b9ba591869a48536e120ed/docusaurus.config.utils.js#L21

Steps to Reproduce

run npm run build:website

Expected Behavior

No response

Eomm commented

It seems that the generation fails - try to edit the scripts/build-website.sh and run each command to understand which one is failing

(the error message is triggered by the last line npm run build, but the node ./scripts/build-static-data.js should produce those json files

Eomm commented

Is it solved now?

Is it solved now?

No

When I do npm run build:webuild it's return this. IDK why. But it's the starting point. The other errors come from this.

./scripts/download-releases.sh: 34: Bad substitution

Is it solved now?

No

When I do npm run build:webuild it's return this. IDK why. But it's the starting point. The other errors come from this.

./scripts/download-releases.sh: 34: Bad substitution

then something the next error looks something like

/home/edna/Desktop/bahati/Workspace/fastify/website-next/scripts/process-releases.js:126
  for (const fileTree of releasesTree.children) {
                                      ^

TypeError: Cannot read properties of null (reading 'children')

Yeah because the json is empty

High possibility to add the security check in front of all shell script if you don't want to bother with all shell environment.

if [ ! "$BASH_VERSION" ] ; then
    echo "Please use bash to run this script ($0), just execute it directly" 1>&2
    exit 1
fi

One solution is to understand why this error come ./scripts/download-releases.sh: 34: Bad substitution

One solution is to understand why this error come ./scripts/download-releases.sh: 34: Bad substitution

High possibility you are not running the shell script under bash. That is why I recommend the check above.

The problem is you are forcing the shell to use sh in ./scripts/build-website.sh but the script itself required to use bash.
Remove sh to let the script itself determine the proper environment.

https://github.com/fastify/website-next/blob/a378f186b56167024abdd1b90de7f9c190867a3f/scripts/build-website.sh#L13-L16

I will test your solution.

Yeah but now we have tar: unrecognized option '--include' Try 'tar --help' or 'tar --usage' for more information.

Yeah but now we have

GNU tar do not have --include option. We need to change into other solution regarding this option.

For example, using a interim folder.

https://github.com/fastify/website-next/blob/a378f186b56167024abdd1b90de7f9c190867a3f/scripts/download-releases.sh#L25-L26

  mkdir -p "$baseDir/releases/$1/"
  mkdir -p "$baseDir/temp/"
  tar -xzf $outputFile -C "$baseDir/temp/" --strip-components=1
  cp -r "$baseDir/temp/docs" "$baseDir/releases/$1/docs"
  rm -rf "$baseDir/temp/"