aurelia / cli

The Aurelia 1 command line tool. Use the CLI to create projects, scaffold components, and bundle your app for release.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aurelia-cli 1.0.0 copy-files.ts does not work with au-build command

nenadvicentic opened this issue · comments

I'm submitting a bug report

  • Library Version:
    1.0.0

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    10.15.3

  • Language:
    TypeScript 3.4.5

  • Loader/bundler:
    RequireJS

Current behavior:
Coping files, defined as bellow, does not work any longer when project is created with Aurelia-CLI 1.0.0, command au build

    "copyFiles": {
        "src/static/**": "../wwwroot"
    }

Exception is thrown during au build:

{ uid: 7,
  name: 'copyFiles',
  branch: false,
  error:
   { Error: Invalid output folder
       at DestroyableTransform.normalize [as _transform] (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\vinyl-fs\lib\dest\prepare.js:26:17)
       at DestroyableTransform.Transform._read (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\readable-stream\lib\_stream_transform.js:184:10)
       at DestroyableTransform.Transform._write (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\readable-stream\lib\_stream_transform.js:172:83)
       at doWrite (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\readable-stream\lib\_stream_writable.js:428:64)
       at writeOrBuffer (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\readable-stream\lib\_stream_writable.js:417:5)
       at DestroyableTransform.Writable.write (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\readable-stream\lib\_stream_writable.js:334:11)
       at Pumpify.Duplexify._write (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\duplexify\index.js:208:22)
       at doWrite (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\readable-stream\lib\_stream_writable.js:428:64)
       at writeOrBuffer (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\readable-stream\lib\_stream_writable.js:417:5)
       at Pumpify.Writable.write (D:\dev\SchmidIT\ImmoMapping\Web\src\ImmoMapping.Website\ClientApp\node_modules\readable-stream\lib\_stream_writable.js:334:11)
     domainEmitter:
      Pumpify {
        _readableState: [ReadableState],
        readable: true,
        domain: [Domain],
        _events: [Object],
        _eventsCount: 7,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: true,
        allowHalfOpen: true,
        _writable: [DestroyableTransform],
        _readable: [DestroyableTransform],
        _readable2: [DestroyableTransform],
        _autoDestroy: false,
        _forwardDestroy: false,
        _forwardEnd: true,
        _corked: 0,
        _ondrain: null,
        _drained: true,
        _forwarding: false,
        _unwrite: [Function: clear],
        _unread: [Function: clear],
        _ended: false },
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        members: [] },
     domainThrown: false },
  duration: [ 0, 15972758 ],
  time: 1559652709168 }

Reason is new implementation of copy-files.ts task using:

return gulp.src(files, { since: gulp.lastRun(copyFiles) }) // etc...

Older version of file, using gulp-changed-in-place works as expected:

return gulp.src(files, { since: gulp.lastRun(copyFiles) })
    .pipe(changedInPlace({ firstPass: true }))
  • What is the expected behavior?
    Files from src/static folder should be copied to the output dir

  • What is the motivation / use case for changing the behavior?
    This is a bug.

Just as the error message "Invalid output folder".

You config is not right, should be

"copyFiles": {
        "src/static/**": "wwwroot"
    }

@3cp Folder parth is, unfortunately, correct.

My app is in ClientApp folder of .NET Core project, thus it has to copy data in wwwroot in the root of the project. More... this configuration path works perfectly fine when I replace copy-files.ts with older version using changed-in-place, as I described.

Thx. I will do more testing. You can probably temporarily get away from the issue by removing since lastrun.

I can reproduce your error. But it might due to you glob syntax is not exactly right, can you try this:

"copyFiles": {
        "src/static/**/*": "../wwwroot"
    }

When you try to watch "src/static/**", it caused some issue.

** If a "globstar" is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches. It does not crawl symlinked directories.

What you want is "**/*" to match files, not folders.

@3cp I tested it also. Copying works with "**/*". Thanks a lot!

It's shame that simple replacement of npm package responsible for path matching produces such inconsistencies.

Glad it helps. That gulp error message is bit out of context.

I guess this can be closed.