如何仅发布特定文件夹的内容?

时间:2016-06-16 14:55:51

标签: npm

如果我只想包含特定路径,如何精简./src

我的存储库中有./dist./dist个文件。我想有效地仅发布./package.json + .npmignore

的内容

使用./src忽略./src只会忽略./dist文件夹。我想只包含require('my-package/dist/something')的内容,即现在用户需要require('my-package/something')。我想把它./something./dist中包含npm run build cp package.json ./dist # or, if you need to have package.json "main" entry different, # e.g. for being able to use `npm link`, you need to replace "main" value: # sed 's#"main": "./dist/index.js"#"main": "./index.js"#' package.json > ./dist/package.json cd ./dist npm publish

2 个答案:

答案 0 :(得分:4)

我现在的方式是,我创建了一个bash脚本:

m1 <- matrix(c(1,2,1,6,3,7,4,2,6,8,11,15), ncol=4, byrow = TRUE)


# expected outcome, given a range of +/-1 either side

exp.outcome<-matrix(c(TRUE,TRUE,TRUE,FALSE,
                          TRUE,FALSE,TRUE,TRUE,
                          FALSE,FALSE,FALSE,FALSE), 
                          ncol=4, byrow=TRUE)

答案 1 :(得分:0)

为了跨平台兼容性,请使用 shx:

npm run build
shx cp package.json ./dist
shx cd ./dist
npm publish