timkendrick / recursive-copy

Simple, flexible file copy utility
97 stars 18 forks source link

.gitignore, .npmignore will not be recognized with dot prop true #15

Closed JennieJi closed 5 years ago

timkendrick commented 5 years ago

Hi there – I've just tested with .gitignore and .npmignore and it seems to work fine.

Example shell script that demonstrates copying these files:

# Create a new project
mkdir recursive-copy-test && cd recursive-copy-test
npm init -y
npm install --save recursive-copy

# Add some dummy files to the "src" directory
mkdir src
echo "/dist/" > src/.gitignore
echo "/dist/" > src/.npmignore
echo "Hello, world" > src/README.md

# Use recursive-copy to copy "src" to "dest"
node - <<EOF
const copy = require('recursive-copy');
copy('src', 'dest', { dot: true }, (error, results) => {
  if (error) {
    console.error('Copy failed: ' + error);
  } else {
    console.info('Copied ' + results.length + ' files');
  }
})
EOF

# List the contents of the "dest" folder, including hidden files
ls -al dest

I'm closing the issue but feel free to reopen if you think I've made a mistake.