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

damonfang-cli

v1.0.3

Published

npx lerna init npx lerna create cli npm link 发布cli到本地为脚本创建执行环境 <!-- 配置入口文件 --> npx lerna add import-local packages/cli npx lerna add npmlog packages/cli <!-- 创建基础命令 封装执行命令 --> npx lerna add commander packages/cli class InitCommand extends Command <!-- 封装命

Downloads

3

Readme

npx lerna init npx lerna create cli npm link 发布cli到本地为脚本创建执行环境

npx lerna add import-local packages/cli npx lerna add npmlog packages/cli

npx lerna add commander packages/cli class InitCommand extends Command

npx lerna create command npx lerna create init npx lerna create utils

cjs兼容esm const esm = import('esm').then(esm => esm.default()) (require同步 import异步 合在一起用同步需要包一层立即执行函数) esm直接引用cjs (packagejson中指定type:module类型 需要指定引用文件后缀 需要处理JSON文件解析[fs-extra] 需要处理注入变量__filename等等)

npx lerna add jest packages/cli --dev npx lerna add execa packages/cli --dev npx lerna add @babel/preset-env packages/cli --dev npx lerna add @babel/core packages/cli --dev 添加babel.config.js 兼容高版本 添加jest.config.js 解析jest语法 packagejson中配置test运行脚本

使用的模板要放在发布的模板里面(如果合在一起, 发布的一些配置会污染使用的模板)

在init模块包里完成create download install 创建:生成模板的的基本对象信息 下载:从对象信息中去下载模板 安装:把模板拷贝到工作目录下(下载到本地的模板会自动生成node_modules和packagejson文件,并且包安装在node_modules下面,如果直接在工作目录下安装会很乱)

homedir() 读取用户主目录 process.cwd() 读取当前目录 path.join(path, 'dir/file') 拼接路径 path.resolve(homedir(), 'dir/file') 拼接绝对路径 pathExsitSync(path) fs.existsSync 文件是否存在 fse.mkdirpSync(dir) fse.ensureDirSync(dir) 创建文件夹 fse.removeSync(dir) 删除文件夹 fse.readdirSync(dir) 读取文件夹 fse.writeFileSync fs.writeFileSync 写文件 fse.copyFile(sourceDir/file, distDir/file) 拷贝文件夹/文件 glob(pattern, options) 过滤文件夹/文件

https://docs.github.com/en/rest https://github.com/settings/tokens https://gitee.com/api/v5/swagger#/getV5ReposOwnerRepoStargazers?ex=no https://gitee.com/profile/personal_access_tokens https://docs.gitlab.com/ee/api/users.html https://www.buctpse.cn/-/profile/personal_access_tokens

token时间会过期 github group项目有时会10054 403更新不上 gitlab group项目默认主分支是main,需要额外兼容(todo)或者管理员配置master为默认主分支(组里的项目不可修改)

node: 16.18.0

安装: npm install -g @damonfang/cli 使用:(模板里必须要有env相关文件还有viteconfigjs中配置的指向env文件内容) [template example] damonfang-cli init damonfang-cli init -t project -tp template-vite -pr aaa -tr test-aaa [commit example]: damonfang-cli commit 发布dev damonfang-cli commit -p 发布release tag

脚手架有修改 npx lerna publish 模板有修改 npm publish

触发条件: push master(会触发master分支) damonfang-cli commit | push dev/* (会触发dev分支) damonfang-cli commit -p(会触发dev分支和master分支)

搭建项目(模板 提交 发布): 1 damonfang-cli init -t project -tp template-vite -pr aaa -tr test-aaa (如果没有传递pr和tr 1.修改.env文件的子路径 2.修改yml文件中的发布目录) 2 damonfang-cli commit -c -p 3 代码平台配置CICD变量 TENCENT_SERVER_HOST TENCENT_SERVER_PASSWORD 4 服务器注册项目执行的runner (注册 gitlab-runner register --url https://www.buctpse.cn/--registration-token GR1348941kRnpy2TjQkACR2JyxpcC) (删除 先在git平台删除runner 在到服务器上执行gitlab-runner verify --delete --name sth 删除不掉直接修改toml配置文件) 5 服务器配置nginx代理 6 手动触发

  1. 模板放在template目录下,按照其他模板相同的目录结构进行放置
  2. npm publish
  3. 在cli-common目录的init包里的createTemplate文件中修改templateList,配置npm包地址然后修改包version(init cli),还需要修改最外层的cli-common的version(package lerna)
  4. npx lerna publish(无反应可单独更新包)

todo

github创建仓库默认是main,需兼容 github action 和 gitlab.yml,需根据不同平台下载