【发布时间】:2018-08-13 05:03:17
【问题描述】:
我正在开发一个 Web 应用程序,其中 React client 应用程序和 Node Express server API 存在于同一个存储库中,但具有单独的 package.json 文件。结构如下:
root
-client/
--src/
--package.json // manages create-react-app dependencies, scripts
-controllers/
-models/
-routes/
-app.js
-package.json // manages node express server dependencies, scripts
看起来,这些单独的包是系统(即网络应用程序)的子模块。例如,考虑路由的处理方式,服务器无法识别的任何请求都由client 路由器处理:
// app.js
require('./routes/...')(app) // api routes defined first
if (process.env.NODE_ENV === 'production') {
app.use(express.static('client/build'))
const path = require('path')
app.get('*', (req, res) => { // non match fall through to client
res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'))
})
}
服务器 API 未启用 cors。
这些package.json 文件应该共享相同的版本,还是分开进行版本化?
【问题讨论】:
标签: npm versioning package.json semantic-versioning