Mryqu's Notes


  • 首页

  • 搜索
close

折腾openui5-sample-app之使用Yarn替换Bower

时间: 2018-09-13   |   分类: FrontEnd     |   阅读: 59 字 ~1分钟

SAP/openui5-sample-app是使用npm下载依赖的后端开发和构建模块,使用bower下载依赖的前端openui5库。 在npm install的过程中提示"npm WARN deprecated bower@1.8.4: We don’t recommend using Bower for new projects. Please consider Yarn and Webpack or Parcel. You can read how to migrate legacy project here: https://bower.io/blog/2017/how-to-migrate-away-from-bower/"。 对于SAP这个小示例,区分前端和后端使用包管理器有点浪费!对于所有的依赖模块,可以要么使用npm,要么使用yarn。

  1. 删除bower_components和dist目录

  2. 安装yarn:

npm install yarn -g
  1. 去掉bower.json 不过其中依赖的openui5/packaged-sap.ui.core、openui5/packaged-sap.m、openui5/packaged-themelib_sap_belize仅仅bower能够获取,在npm仓库里是找不到的。

  2. 修改package.json

  • 去除bower模块
  • 去除postinstall脚本
  • 增加@openui5/sap.m依赖
  • 增加@openui5/sap.ui.core依赖
  • 增加@openui5/themelib_sap_belize依赖 package.json改动
  1. 修改Gruntfile.js npm仓库里的@openui5/sap.m、@openui5/sap.ui.core、@openui5/themelib_sap_belize仅包含openui5/packaged-sap.ui.core、openui5/packaged-sap.m、openui5/packaged-themelib_sap_belize中resources的部分,而不包含test-resources的部分。 对于openui5_connect任务,我认为无需test-resources部分即可。
  • 将openui5库的定位从bower_components目录下改为node_modules目录下的相应位置 Gruntfile.js改动
  1. 构建测试
yarn
grunt build
grunt serve

参考


SAP/grunt-openui5
JS新包管理工具yarn和npm的对比与使用入门

标题:折腾openui5-sample-app之使用Yarn替换Bower
作者:mryqu
声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!

#build# #nodejs# #npm# #yarn# #bower# #包管理器#
Facebook的Page Access Token
折腾openui5-sample-app之使用npm镜像
  • 文章目录
  • 站点概览

Programmer & Architect

662 日志
27 分类
1472 标签
GitHub Twitter FB Page
© 2009 - 2023 Mryqu's Notes
Powered by - Hugo v0.120.4
Theme by - NexT
0%