gitpkg icon indicating copy to clipboard operation
gitpkg copied to clipboard

gitpkg should automatically install dev dependencies and run `build`, `prepare`, etc. scripts if present

Open DetachHead opened this issue 3 years ago • 1 comments

i'm trying to install this package with gitpkg and it doesn't seem to work no matter what i do.

there is a build script in its package.json, which npm usually runs by default when installing git dependencies. gitpkg should be doing the same thing.

i've tried adding a postinstall custom script that just calls the build script

image

{
    "@smui-extra/common": "https://gitpkg.now.sh/detachhead/svelte-material-ui/packages/common?c724f04adf2d9f4e18758387f493a5361de1a3ea&scripts.postinstall=npm%20run%20build"
}

but that didn't work, it seems because it doesn't install the package's devDependencies by default?

> npm i
npm ERR! code 1
npm ERR! path C:\project\node_modules\@smui-extra\common
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run build
npm ERR! > @smui/[email protected] build
npm ERR! > npm run build:js && npm run build:svelte
npm ERR!
npm ERR!
npm ERR! > @smui/[email protected] build:js
npm ERR! > tsc -p . --outDir dist/ --rootDir src/
npm ERR!
npm ERR!
npm ERR! > @smui/[email protected] build:svelte
npm ERR! > svelte-strip strip src/ dist
npm ERR! 'svelte-strip' is not recognized as an internal or external command,
npm ERR! operable program or batch file.

the only custom script it seems to run when provided is postinstall, meaning i can't just make a postinstall script to run npm install otherwise it just gets caught in an infinite loop

DetachHead avatar Nov 07 '22 01:11 DetachHead

got it to work with https://gitpkg.vercel.app/api/pkg?url=DetachHead/svelte-material-ui/packages/accordion&commit=7406097673b76eefe989a89dccd3584e99c3e41c&scripts.postinstall=npm%20install%20--ignore-scripts%26%26%20npm%20run%20build

but yeah it would be nice if it did this automatically without having to manually specify scripts that usually get automatically run anyway

DetachHead avatar Nov 17 '22 05:11 DetachHead