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

Support package.json #168

Open
aimad-majdou opened this issue Nov 7, 2017 · 5 comments
Open

Support package.json #168

aimad-majdou opened this issue Nov 7, 2017 · 5 comments

Comments

@aimad-majdou
Copy link

It would be nice if this plugin support yarn (package.json) which iterate through dependencies in package.json and return an array of files defined in the main property of the packages package.json, and the base directory will be node_modules/@bower_components.

I tried as following :

yarnFiles({
	    paths: {
	        bowerDirectory: 'node_modules/@bower_components',
	        bowerJson: 'package.json'
	    }
  })

but it didn't work.

This solution worked for me :

yarnFiles({
	    paths: {
	        bowerDirectory: 'node_modules/@bower_components',
	        bowerrc: '.bowerrc',
	        bowerJson: 'bower.json'
	    }
  })

But I shouldn't rely on the bower.json file, since I'm moving from bower to yarn.

@ck86
Copy link
Owner

ck86 commented Nov 8, 2017

the bowerDirectory should be node_modules and the bowerJson package.json

@aimad-majdou
Copy link
Author

@ck86 I have defined a scope @bower_components for all my bower_components so they are installed inside node_modules/@bower_components this isn't the problem the problem is with bowerJson: 'package.json', I think the problem is from this line (index.js 58) :

bowerJson = opts.paths.bowerJson ? path.resolve(process.cwd(), opts.paths.bowerJson)
                                     : path.resolve(cwd, bowerJson || 'bower.json');

Warning: Variable (bowerJson) might not have been initialized

@aimad-majdou
Copy link
Author

@ck86 I've created a fork that supports package.json, the main-yarn-plugins is helpful when you move from using bower to yarn.
https://github.com/aimad-majdou/main-yarn-files

@Cracky5457
Copy link

Hey aimad,

Your fork is a good idea, but the README is mostly wrong, there is a lot of error like ifyou don't override the configuration on the contrary of main-bower-files which was really working with just a filter as parameter.

This is the only configuration which was working for me

   mainYarnFiles({
        filter: '**/*.js',
        paths: {
            modulesFolder: 'node_modules/@yarn_components',
            jsonFile: 'package.json'
        },
        scope: '@yarn_components'
    }));

@crazy-max
Copy link

I've just migrating from bower/npm to yarn on a project if you want to take a look : https://github.com/neard/neard.github.io

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

No branches or pull requests

4 participants