问题描述
当我考虑在ES6中重写它时,即将向NPM发布一个模块,以将其作为未来的前提,并学习ES6。我已经用Babel蜕皮到ES5,并运行测试。但我不知道如何进行:
I was about to publish a module to NPM, when I thought about rewriting it in ES6, to both future-proof it, and learn ES6. I've used Babel to transpile to ES5, and run tests. But I'm not sure how to proceed:
- 我是否透视,并将结果/输出文件夹发布到NPM?
- 我的结果文件夹是否包含在我的Github repo中?
- 还是要保留2个回执,一个是Github的ES6代码+ gulp脚本,透明的结果+ NPM的测试?
简而言之:我需要采取哪些步骤将ES6中写入的模块发布到NPM而仍然允许人们浏览/分支原始代码?
In short: what steps do I need to take to publish a module written in ES6 to NPM, while still allowing people to browse/fork the original code?
推荐答案
迄今为止我看到的模式是保持es6文件在 src
目录中,并将您的内容在npm的预发布中创建到 lib
目录。
The pattern I have seen so far is to keep the es6 files in a src
directory and build your stuff in npm's prepublish to the lib
directory.
您将需要一个.npmignore文件,类似于.gitignore,但忽略 src
而不是 lib
。
You will need an .npmignore file, similar to .gitignore but ignoring src
instead of lib
.
这篇关于如何发布ES6中写入的模块到NPM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!