fxpio / foxy

A fast, reliable, and secure NPM/Yarn/pnpm bridge for Composer
https://foxypkg.com
MIT License
173 stars 21 forks source link

Problems with npm package stisla #29

Closed killua-eu closed 4 years ago

killua-eu commented 5 years ago

For my new project I wanted to have asset management which I didn't use before. I tried foxy and asset-packagist for comparison and figured out I love foxy more. Along my playground work, I found that foxy behaves unfavourably when fetching the stisla package from npm (compared to using https://asset-packagist.org/package/npm-asset/stisla). The difference is, that foxy doesn't build stisla's dist/modules/* directory, whereas asset-packagist (and by extension the composer-asset-plugin which i never made to successfully run when installing stisla) does. After some hours of trying to reconcile the difference, I thought I better ask as there might be some obvious config option to foxy which is not so obvious to me. I'll be happy for any tips & tricks.

p.s.: I'm using yarn as the foxy backend, esp. because it usually works way better then npm for me.

francoispluchino commented 5 years ago

I'm not sure I understand the problem with the construction of the folder dist/modules/*, given that neither Composer Asset Plugin nor Asset Packagist build anything. I looked at the sources of Stisla, but also, I tried a Stisla installation via:

1. Composer Asset Plugin

with resolution package version of npm-asset/boostrap:^4.3.0

{
    "require": {
        "npm-asset/stisla": "^2.3.0"
    },
    "config": {
        "fxp-asset": {
            "resolutions": {
                "npm-asset/bootstrap": "^4.3.0"
            }
        }
    }
}

Results:

Installation of Stisla and dependencies in vendor/npm-asset/*, but no folder vendor/npm/asset/stisla/dist/modules (expected behaviour).

2. Asset Packagist

Results:

Installation of Stisla in vendor/npm-asset/* but no other dependencies, and no folder vendor/npm/asset/stisla/dist/modules (unexpected behavior).

3. Yarn

Results:

Installation of Stisla and dependencies in node_modules/*, but no folder vendor/npm/asset/stisla/dist/modules (expected behaviour).

4. NPM

Results:

Installation error:

Error probably caused by my limited connection because I'm traveling.

5. Foxy with Yarn

Results:

Same as 3. (expected behaviour).

6. Foxy with NPM

Results:

Same as 4.

I guess you're using a framework/tool looking in the folder vendor/npm-asset or vendor/bower-asset to run a compilation, while Foxy is only the bridge between Composer et NPM ou Yarn, and so installs the packages in the folder node_modules. You can try to change the installation folder via the file .yarnrc and add the line --install.modules-folder "./vendor/npm-asset".

If you want to know how Foxy works, you can read the FAQs and especially the section How does the plugin work?.

Can you give me more information about the modules folder?