Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gulp.dest fails to move files between filesystems in v5 #127

Closed
4 tasks done
proton-ab opened this issue Apr 6, 2024 · 1 comment · Fixed by #131
Closed
4 tasks done

Gulp.dest fails to move files between filesystems in v5 #127

proton-ab opened this issue Apr 6, 2024 · 1 comment · Fixed by #131

Comments

@proton-ab
Copy link

Before you open this issue, please complete the following tasks:

  • use the search bar at the top of the page to search this repository for similar issues or discussions that have already been opened.
  • if you are looking for help from the gulp team or community, open a discussion.
  • if you think there is a problem with the plugin you're using, open a discussion.
  • if you think there is a bug in our code, open this issue.

What were you expecting to happen?

Gulp.dest copies files between filesystems as it happened in v4.

What actually happened?

No files are copied, but they are present in intermediate directory.

Please give us a sample of your gulpfile

import path from 'path';
import os from 'os';

// Gulp specific
import Gulp from 'gulp';

const dirs = {
  tmp: path.join(os.tmpdir(), 'gulp-build-cache'),
  out: 'public/static',
};

// ---

function hash() {
  return Gulp.src(`${dirs.tmp}/**/*.*`)
    .pipe(Gulp.dest(dirs.out))
}

// ---

function css() {
  return Gulp.src('assets/public/**/*.css')
    .pipe(Gulp.dest(dirs.tmp));
}

// ---

export const build = Gulp.series(css, hash);

Terminal output / screenshots

vagrant@debian11:/code$ yarn gulp build
yarn run v1.22.22
$ node ./node_modules/gulp/bin/gulp.js build
[16:12:23] Using gulpfile /code/gulpfile.mjs
[16:12:23] Starting 'build'...
[16:12:23] Starting 'css'...
[16:12:30] Finished 'css' after 7.14 s
[16:12:30] Starting 'hash'...
[16:12:39] Finished 'hash' after 8.38 s
[16:12:39] Finished 'build' after 16 s
Done in 16.90s.
vagrant@debian11:/code$ ls -l /tmp/gulp-build-cache/
total 4
drwxr-xr-x 6 vagrant vagrant 4096 Apr  6 16:11 css
vagrant@debian11:/code$ ls -l public/static
total 0

Please provide the following information:

  • OS & version [e.g. MacOS Catalina 10.15.4]: Debian GNU/Linux 11
  • node version (run node -v): v18.20.1
  • npm version (run npm -v): 10.5.0
  • gulp version (run gulp -v): 5.0.0 (CLI 3.0.0)

Additional information

Changing tmp: path.join(os.tmpdir(), 'gulp-build-cache'), to tmp: 'assets/build', results in working script and files are properly copied from intermediate directory to final one. /tmp and the /code (cwd in which gulp is executed) are on different filesystems.

vagrant@debian11:/code$ sed -i "s#path.join(os.tmpdir(), 'gulp-build-cache')#'assets/build'#g" gulpfile.mjs
vagrant@debian11:/code$ yarn gulp build
yarn run v1.22.22
$ node ./node_modules/gulp/bin/gulp.js build
[16:25:10] Using gulpfile /code/gulpfile.mjs
[16:25:10] Starting 'build'...
[16:25:10] Starting 'css'...
[16:25:14] Finished 'css' after 4.95 s
[16:25:14] Starting 'hash'...
[16:25:21] Finished 'hash' after 6.64 s
[16:25:21] Finished 'build' after 12 s
Done in 13.18s.
vagrant@debian11:/code$ ls -l assets/build
total 4
drwxrwxr-x 1 vagrant www-data 4096 Apr  6 16:25 css
vagrant@debian11:/code$ ls -l public/static
total 4
drwxrwxr-x 1 vagrant www-data 4096 Apr  6 16:24 css
@yocontra
Copy link
Member

yocontra commented Apr 6, 2024

This is due to an issue with glob-stream not resolving absolute paths that was just introduced, will transfer this issue over there.

As a workaround, you can avoid using absolute paths in gulp.src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants