简体   繁体   English

NPM 发布 - 在 npm 安装期间将文件安装为根文件,而不是在 node_modules 内

[英]NPM publish - install files as root files during npm install instead of inside node_modules

I am trying to publish a boilerplate project as an npm package.我正在尝试将样板项目发布为 npm package。 I have tried other solutions on the site.我在网站上尝试了其他解决方案。 I want the below project files to be installed as root project files instead of node_modules.我希望将以下项目文件安装为根项目文件而不是 node_modules。 I want to publish the package in such a way that doing npm install add these files in the root.我想以这样的方式发布 package,即安装 npm 将这些文件添加到根目录中。 Is there any way to achieve the same?有没有办法达到同样的效果? Help will be highly appreciated.帮助将不胜感激。 Thanks谢谢

在此处输入图像描述

I was able to achieve the same using postinstall in package.json.我能够在 package.json 中使用postinstall来实现相同的效果。 Using the same command I am copying the template from my GitHub to the root directory.使用相同的命令,我将模板从 GitHub 复制到根目录。

"scripts": {   
   "postinstall" : "npm i degit && npx degit tal1992/svelte-webcomponents --force"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM