Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议将配置文件有package.json平移到kuaizhan.json #1

Open
crzidea opened this issue Jul 25, 2014 · 2 comments
Open

建议将配置文件有package.json平移到kuaizhan.json #1

crzidea opened this issue Jul 25, 2014 · 2 comments

Comments

@crzidea
Copy link

crzidea commented Jul 25, 2014

为了避免混淆,建议将package.json里的快站配置项平移到kuaizhan.json

  • package.json会被npm和node处理,例如mainscriptsbindependencies,将这两个文件混淆不利于将来扩展module
  • 切换运行环境只需要切换kuaizhan.json即可
  • 对于node.js开发者而言,切换package.json,可能会造成npm link/installrun的结果不一致
@fireboy518
Copy link
Contributor

实际上。我们只是名称上有一些混淆,快站的package.json 都是在 project 目录下的,应该还不会影响node.js 的package.json 吧。

您可以稍微给点示例,如果确实影响很大,我们会即刻更新

@crzidea
Copy link
Author

crzidea commented Jul 25, 2014

例如测试的配置文件可能为:

{
  ...
  "api": "test.api.sohu.com"
  ...
}

而线上的配置文件为:

{
  ...
  "api": "api.sohu.com"
  ...
}

这样就造成我们有两个配置文件,假如需要更新express版本号,或者添加依赖:

$ npm rm express --save; npm install express --save
$ npm install async --save

这时测试环境的dependencies已经发生改变,为了保证线上环境配置文件的**_正确**_且**同步**,现有的配置方式只能是手动去修改线上的package.json吗?

当然,像express这种只有后端才会用到的module可能不会出现在dependencies里面,但是如果是一些前后端公用的库呢?例如debugasyncengine.io-client等。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants