-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
[22 regression] Breaks gulp with Cannot assign to read only property 'atime' of object '#<Stats>'
#52707
Comments
I'm opening a PR |
Is there a workaround for this with Gulp? I would ask over in but GitHub blocks me from commenting there (permissions of that repo allow certain people to comment only?). |
I found a workaround for my case (but its common case, so maybe it helps someone): I didn't realize new versions of Node.js include const {src, dest, series} = require('gulp')
const {promises} = require('fs')
async function mkDist() {
try { await promises.mkdir('./dist') } catch (e) { if (e.code !== 'EEXIST') throw e }
}
function copy() {
return src([ './src/**', '!./src/**/*.{ts,tsx}', './src/**/*.d.ts', ]).pipe(dest('./dist/'))
}
exports.copyAssets = series(mkDist, copy) to a plain Node.js script using the relatively new import fs from 'fs'
async function mkDist() {
try { await fs.promises.mkdir('./dist') } catch (e) { if (e.code !== 'EEXIST') throw e }
}
await fs.promises.cp('./src', './dist', {
recursive: true,
filter: (src) => src.endsWith('.tsx') || (src.endsWith('.ts') && !src.endsWith('.d.ts')) ? false : true
}) Not bad! It used to be tedious to this sort of thing with plain Node prior to cp+recursive+filter, which I'm sure is why libraries like gulp/vinyl came to exist. |
Version
v22.0.0
Platform
Linux
Subsystem
fs
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should set
stat.atime
to2
What do you see instead?
Additional information
Original bug report: gulpjs/vinyl-fs#350
Caused by #50908
The text was updated successfully, but these errors were encountered: