Hugo can not find created files by node when using concurrently

130 views Asked by At

I have a node project which I build with concurrently with the following build pipe:

"scripts": {
  "build": "concurrently -g npm:build:*",
  "build:generate-db": "ts-node ./converter/main.ts",
  "build:tailwind": "npx tailwindcss -i ./src/input.css -o ./static/css/build.css --minify",
  "build:hugo": "hugo --minify",
},
  • build: Call's all commands with prefix build in synchron order.
  • build:generate-db: Create .md files for hugo application from a database.
  • build:tailwind: Generates tailwind file and puts it in correct folder
  • build:hugo: Creates hugo website with .md files and tailwind file.

When I run the script hugo is not finding the .md files. When I run the script a second time hugo finds the .md files and create the website correct.

What I tried:

  • First I thought the problem is the time the file write requires (so hugo is trying to find the files before they got written). This is not the case: Even when I sleep 10 seconds after build:generate-db hugo is not able to find the files as well.
  • When I run build:generate-db and than build:hugo it's working.
  • The tailwind file is created correctly. (it's also file write so why is this one working?)
  • When you run the following config it's working:
  "build": "concurrently -g npm:build:* & hugo --minify",
  "build:generate-db": "npm run converter",
  "build:tailwind": "npx tailwindcss -i ./src/input.css -o ./static/css/build.css --minify",

The Converter writes like this:

writeFileSync(`${resultPath}/${data[titleKey]}.md`, JSON.stringify(resultDto, null, 2))

How can I fix this problem?

0

There are 0 answers