Skip to content

Copying files broken by Node v8.5.0 #1438

@dbkr

Description

@dbkr

Node v8.5.0 introduces fs.copyFile and fs.copyFileSync, but Node's native methods do not support giving a directory as the destination path (eg. copyFileSync('bob.txt', 'dest')) but instead require the full path of the destination file (eg. copyFileSync('bob.txt', 'dest/bob.txt')).

lib/jsdoc/fs.js provides the latter behaviour and jsdoc relies on this. lib/jsdoc/fs.js prefers native methods, so on Node v8.5.0 the resulting fs import ends up with the native copyFile and copyFileSync behaviour.

This results in errors like this:

fs.js:1919
  binding.copyFile(src, dest, flags);
          ^

Error: EISDIR: illegal operation on a directory, copyfile '/home/dave/matrix-js-sdk/node_modules/jsdoc/templates/default/static/fonts/OpenSans-Bold-webfont.eot' -> '.jsdoc/matrix-js-sdk/0.8.2/fonts'
    at Object.fs.copyFileSync (fs.js:1919:11)
    at /home/dave/matrix-js-sdk/node_modules/jsdoc/templates/default/publish.js:516:12
    at Array.forEach (<anonymous>)
    at Object.exports.publish (/home/dave/matrix-js-sdk/node_modules/jsdoc/templates/default/publish.js:512:17)
    at Object.module.exports.cli.generateDocs (/home/dave/matrix-js-sdk/node_modules/jsdoc/cli.js:448:35)
    at Object.module.exports.cli.processParseResults (/home/dave/matrix-js-sdk/node_modules/jsdoc/cli.js:399:20)
    at module.exports.cli.main (/home/dave/matrix-js-sdk/node_modules/jsdoc/cli.js:240:14)
    at Object.module.exports.cli.runCommand (/home/dave/matrix-js-sdk/node_modules/jsdoc/cli.js:189:5)
    at /home/dave/matrix-js-sdk/node_modules/jsdoc/jsdoc.js:105:9
    at Object.<anonymous> (/home/dave/matrix-js-sdk/node_modules/jsdoc/jsdoc.js:106:3)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions