Closed Etherian closed 7 years ago
Technically, there is a slack, but we've never really used it. Github issues are fine for questions. 👍
Thank you for your rapid reply! I'll open another issue with my question unless you would prefer I ask here.
No problem -- whichever you prefer 😉
Alright. Here, then. 😊 I have a couple questions:
1) When I have a folder that is empty or containing only dotfiles (which I assume Fly ignores?) in the source location, the folder is copied into the target location as a file with the text 'null' in it. Is this expected behavior?
2) When I run the copyFiles
task in this flyfile in my project, the files mentioned in extraJS
(vendor files in node_modules) do not copy. And when I run the release
task, a folder named release is not created and the contents of the draft folder are not copied. Any idea what I'm doing wrong?
Oh, and I am trying to build on Windows 7 x64, if that matters.
You have to specify dot:true
in your fly.source
options. It's a node-glob
built-in behavior.
The extraJS
won't copy because node_modules
is not inside src/**/*
(srcPath
).
Also, you're better off changing your globs from foo/**/*
to foo/**/*.*
or foo/**
. This should fix your release
task & likely iron out some other issues you're having.
Thank you for your help. Changing my globs from foo/**/*
to foo/**
did not persuade the files and folders to copy in the copyFiles
and release
tasks, but pulling the misbehaving lines into their own tasks did!
To clarify,
export async function copyFiles(fly) {
await fly.source(`${srcPath}/**`, {
ignore: [...jsGlobPatterns, ...cssGlobPatterns, ...htmlGlobPatterns]
})
.target(draftPath)
//FIXME: This line fails to copy anything
await fly.source(extraJS).target(`${draftPath}/js`)
}
became
export async function copyFiles(fly) {
await fly.source(`${srcPath}/**`, {
ignore: [...jsGlobPatterns, ...cssGlobPatterns, ...htmlGlobPatterns]
})
.target(draftPath)
// This works!
await fly.start('copyExtraJS')
}
export async function copyExtraJS(fly) {
await fly.source(extraJS).target(`${draftPath}/js`)
}
So, if I understand your response and this behavior, source location(s) can only be set once per task. Further calls to source
do not change the source location(s). Is that right?
If that is the case, I do have one other question: why was release
(below) also fixed by having its fly.source(...).target(...)
line pulled into a separate task? The non-functioning version only contains the one call to source
.
export async function release(fly) {
await fly.clear(draftPath)
await fly.start('build')
await fly.start('test')
await fly.start('cleanRelease')
//FIXME: This line fails to copy anything
await fly.source(`${draftPath}/**`).target(releasePath)
}
became
export async function release(fly) {
await fly.clear(draftPath)
await fly.start('build')
await fly.start('test')
await fly.start('cleanRelease')
// works now
await fly.start('copyToRelease')
}
export async function copyToRelease(fly) {
await fly.source(`${draftPath}/**`).target(releasePath)
}
Hmm.. I just cloned your current repo & ran each task individually as is -- works fine for me on my Mac. Unfortunately I'm on the road right now & don't have access to a Windows machine.
Strange though -- we run all our tests on Window too (automatically) & they pass.
/cc @hzlmn Are you still running that Windows VM? Do you mind checking out the project (commit) & seeing what's happening?
Thanks!
@Etherian I find it odd that nothing happens.
But yes, there is a confirmed bug here. Unfortunately there's an inconsistency in "sourcing" after starting tasks from inside other tasks. (See also https://github.com/flyjs/fly-ava/issues/13.)
Generally though, regardless of the bug, a Task should encapsulate a single action & then you chain them together (as serial
or parallel
) in "parent" Tasks.
You pretty much discovered this with your latest edits. I'd clean it up further by:
export async function clean(fly) {
await fly.clear([draftPath, releasePath])
}
export async function release(fly) {
await fly.start('clean').parallel(['build', 'test', 'copyRelease'])
}
It is odd, isn't it? Yet, those two lines consistently did not copy anything. At one point, I considered that it would be helpful to peek into the data moving between operations. That might be a good idea for a plugin.
Anyway, thank you again for your help. 😄 I can easily work around the trouble now.
@Etherian Is there a location, such as an IRC channel, for discussion of Fly difficulties or issues that are not significant enough to warrant a Github Issue?
Nope. But issues are welcome any time. I may consider revamping the Slack channel in the future though.
Is there a location, such as an IRC channel, for discussion of Fly difficulties or issues that are not significant enough to warrant a Github Issue? If so, it would be helpful to mention it in the README; if not, it might be worthwhile to create one.