zooniverse-react-components 中文文档教程
Zooniverse-React-Components
Build 适用于 Node 16 和 NPM 8。
存储库名称表示
npm ci
安装依赖项
组件应添加到 src/components
文件夹中,并且导出到 src/index.js
任何默认样式都可以作为手写笔文件添加到 src/css 中。
npm test
运行 mocha 测试
npm version [semver new version]
将运行 helper preversion 和 postversion 脚本。 preversion
将运行测试。 version
将运行 npm run build
,它将构建生产 css 和 js。 postversion
将把更新后的 repo 和更新后的 git 标签推送到 github。
如果
您使用 npm link
来测试您的应用程序中的库,那么您可能需要调整您的 webpack 配置以编译开发中的 javascript 文件。 Webpack 文档确实提供了有关在 Webpack 中使用符号链接包的警告:https://webpack.js.org/configuration/module/#rule-conditions。 Webpack 配置示例:
{
test: /\.jsx?$/,
include: path.resolve(__dirname, 'src'),
exclude: path.resolve(__dirname, 'node_modules'),
use: [
'babel-loader'
// 'eslint-loader' uncomment if you want to use eslint while compiling
]
}
Zooniverse-React-Components
Build works against Node 16 and NPM 8.
What the repo name says
npm ci
to install dependencies
Components should be added to the src/components
folder and an export to src/index.js
Any default styles can be added as a stylus file in src/css
.
npm test
to run mocha tests
npm version [semver new version]
will run helper preversion and postversion scripts. preversion
will run the tests. version
will run npm run build
which will build the production css and js. postversion
will push the updated repo and the updated git tag to github.
Contributing
If you're using npm link
to test the library with your app, then you may need to adjust your webpack configuration for compiling of your javascript files in development. Webpack docs do provide a cautionary note about using symlink packages with Webpack: https://webpack.js.org/configuration/module/#rule-conditions. An example webpack configuration:
{
test: /\.jsx?$/,
include: path.resolve(__dirname, 'src'),
exclude: path.resolve(__dirname, 'node_modules'),
use: [
'babel-loader'
// 'eslint-loader' uncomment if you want to use eslint while compiling
]
}