npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

joyer-cli

v1.4.8

Published

A new scaffold for web project

Downloads

309

Readme

集成开发环境 joyer-cli

遇到问题怎么办

Node版本

  • 统一使用较新的LTS版本,推荐 v16.20.2 (LTS)(2023-08-10), 安装方式nvm

  • 统一使用npm作为包管理工具,不使用yarn

    • 原因:npm从5.x版本以后已经加入yarn的大部分特性,包括package-lock.json、默认--save、cache重写带来的安装速度提升(不输yarn)等,详见
    • 交叉使用npm和yarn会产生功能类似的重复文件及一些未知风险,使用比例

使用文档

安装joyer-cli

  • npm install joyer-cli -g

使用joyer-cli

重要依赖及选择原因

  • [email protected]

    • 目前为最新的稳定版本,相比3.x编译速度提升了近2倍,更好的代码分离机制,更多的模块类型支持,详见
    • 使用其node api模式而非cli模式,目的在于有利于开发环境同时并存多个webpack版本,缺点是每个文件目录会比较大
    • 疑问点,目前大部分项目应该是在3.x版本下构建,迁移成本?
  • [email protected]

  • @babel/[email protected]

    • 完美解决了babel-polifyll的问题,无需全量打包
  • @babel/[email protected]

问题记录

  • joyer install <template> 原计划到source.jd.com上面专门开一个repo用来存放和维护今后要用到的模板,但由于访问需要登录,故放弃

    • 替代方案:在joyer-cli项目中内置template目录,用于存放模板。缺点:可拓展性差,需要发版才能更新模板,耦合性较强。
    • 后续考虑:可否把模板放到类似github的开源平台进行维护?
    • 结论:在git.jd.com平台建立group作为模板仓库(joyer-template)和组件仓库(vue-components/zepto-components),通过gitlab api来抽取模板和组件
    • 缺点:需要把自己的private token绑定到环境变量JOYER_GIT_TOKEN,这已经是目前能想到的最小成本的方案了,后续待讨论...
    • 更新:绑定了个人的具有时效的access_token,这样就无需使用者再绑定了 @2018-12-19
  • 考虑实现类似joyer upgrade来更新组件库?

    • 开始考虑实现类似joyer-template的方式进行组件安装及更新,但维护成本较高且可能会有版本依赖问题
    • 结论:和军哥讨论后决定使用模板集成组件的方式来维护组件库,把组件库内置到模版中指定的目录,通过joyer install命令来重新安装组件库
  • 考虑替代通过检测process.env的方式来区分域名及环境,原因reading-environment-variables-is-slow-operation

    • 结论:joyer模板中joyer-config新增字段env,然后脚手架通过DefinePlugin设置编译时变量
  • 抽离公共css的过程中发现了问题:optimization.splitChunks.cacheGroups.{cacheGroups}.enforce: true会产生一个空的js文件,目前还没有官方解决方案

  • 然后抽离css过程中发现新问题,在scss中使用@import引入的common.scss不会被抽离

    • 解决方案:编译完成后,将所有文件中引入的common.scss中的内容匹配并移除
  • html-webpack-plugin和html-loader同时使用,会使html-webpack-plugin注入html变量失效

    • 实现基于joyer-config的变量系统,在配置文件中添加env字段用来放置编译相关的变量
    • 困难:webpack.DefinePlugin不能在html文件中定义变量
    • 解决方案:实现webpack plugin用于替换html中指定字符
  • open-browser-webpack-plugin在windows子系统linux(Bash on Windows)中存在问题,不能打开浏览器

    • 使用兼容性更好的opn代替
  • 单页面应用使用history模式时,想利用HtmlWebpackPlugin输出多个index.html文件到各个路由目录,发现它不支持相对路径,导致路由目录下的index.html文件资源引用出错

    • 目前已经合并代码但仍未发布
    • 解决方案:webpack-plugins/fix-html-webpack-plugin-relative-path.js 自行解决