Closed frantic1048 closed 8 years ago
Hey @frantic1048, thanks for the detail!
This seems to be a serial
ordering issue 🤔
What happens if you run npm run s
? And can you package this test repo so that I can clone into quickly?
Thanks!
npm run s
behaves likely to npm run p
.
The repo is here: https://github.com/frantic1048/fly-issue-193
Thanks!
Normally, I put a clean
task at the start of a top-level task, for a clean building on first start-up. e.g. I want to imediately build and pack a release. But I don't use clean
in .watch
sequence.
I could understand the overwritten
. And the removed
means when writting a.txt
, fly will try to remove a.txt
first or ... ?
Well, the problem is that fly.clear
isn't awaited. The command itself "finishes" but not its method. Aka, fly.clear
was run but not completed before your task starts. It's a simple yield
missing somewhere, I bet.
We use fs.writeFile
(docs), so the destination file is entirely replaced.
The only time this doesn't work is if you delete a source file -- the destination copy will still be there.... However, I do the same practice you do in my own projects. I don't have this problem. I have to look closely to see what's different.
Yes, I was gessing there's some reason like that, but I couldn't explain why the output is just like being (not always) inverted.
First time I met this issue, was two weeks ago, I'm packing project for my teammate. Then he tells me some files are missing, and I checked the build folder, some files are not there ( ̄□ ̄)
I first tried splitting the parallel tasks in serial(I don't know why I did this...), it works, but sometimes still fail... I type rm -rf dist && npm run build
like folks meeting trouble type rm -rf node_modules && npm i
, it works (/ω\)
After that, I tried to construct a minimal project to reproduce this issue, used many silly operations but it works well. Finally, I did delete some output file I found the issue happen. Further, I find the condition as described above.
Yeah 😠 annoying issue; thanks for your patience!
I'll have some time to look at it tonight.
@frantic1048 Solved :) Will ship with version 1.4, coming shortly
versions:
Platform: Arch Linux 4.6.5-1-zen x86_64 latest Node: v6.4.0 Fly version: 1.3.1
It's a little hard to describe the issue. First of all, I will explain what the sample contains. And then I describe the operations and what's weird.
sample project
The repo is here: https://github.com/frantic1048/fly-issue-193
overall sturcture:
flyfile.js : just some copy/paste tasks and a clean task, and two top-level task to run tasks in serial/parallel.
package.json : the only dependency is fly, just
npm i
to install it..txt : every .txt file is just Lorem ipsum . Other content also is ok.
reproducing operation
Ensure you have runned
npm install
to get the dependencies ready.Now, the
dist
folder is empty, we run paralleled task.Then
dist
becomes:Every thing works great. Then we run the paralled task the second time.
Then whole
dist
disappeared, even thedist
folder itself. While debug log shows all the *.txt were written.We can type
npm run p
again, then all the files are back. This time we delete some of the output file:Then type
npm run p
, we get:It just like all the output are "inverted", this situation also happens replacing all the
npm run p
bynpm run s
(serial version).And every time running
npm run p
, the debug log shows every output file was written, log like:i.e. I haven't seen any file to output is missing in the log.
Sorry for such long text ~(>_<~)