broccolijs / broccoli-funnel

MIT License
66 stars 37 forks source link

funnel is copying the entire folder instead of a single file #103

Open danielo515 opened 6 years ago

danielo515 commented 6 years ago

Hello,

I'm using the latest version of broccoli funnel 2.0.1, along with 1.2.0, which is being used by babel-transpiler:

├─┬ broccoli-babel-transpiler@6.1.4
│ └── broccoli-funnel@1.2.0

I am having problems selecting single files. This is my configuration:

const info = new Funnel(appRoot, {
    files: ["plugin.info", 'styles/tiddlywiki.files'],
    annotation: "Metadata files",
});

As you can see, I only want to copy two files, however funnel is copying all the files that are on the folder, producing big problems to me. One of the problems is that I can not merge trees unless I specify the option overwrite to true. Is this a bug with the latest version or may be a problem with babel-transpiler ?

Here is how I have the merge trees, and js configured:

const info = new Funnel(appRoot, {
    files: ["plugin.info", 'styles/tiddlywiki.files'],
    annotation: "Metadata files",
});

js = uglify(js, {
    annotation: 'Uglify js files',
    uglify: {
        warnings: true,
        sourceMap: !process.env.PRODUCTION,
        output: { comments: 'some' }
    }
});

module.exports = new Merge([js,  info], { overwrite: true, annotation: "Final output" });

Thanks in advance

danielo515 commented 6 years ago

Ok, I isolated the problem by trying the different funnel trees in isolation with merge-trees. The latest version of funnel is working perfectly, just the desired files are copied, however babel-transpiler is copying the entire directory, no matter if they are js files, styles or whatever. Not sure how to proceed

danielo515 commented 6 years ago

I solved the problem by passing a funnel tree to the babel plugin instead of the approot. This way works, but feels wrong to create a funnel tree just to select the correct files for a plugin that already should be able to select the correct files.

This is what I did:

let js = new Funnel(appRoot, {
    include: ['**/*.js']
})

js = babel(js, {
    annotation: 'JS source code'
    , filterExtensions: ['js']
    , presets: [
        ['env', {
            'targets': {
                'browsers': ["last 2 versions"]
            }
        }]
    ]
});