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

nornj-cli-legacy

v0.4.2

Published

The CLI for scaffolding NornJ template projects, and do more things

Downloads

3

Readme

NornJ-cli-legacy

The CLI for scaffolding NornJ template projects, and do more things.

NPM Version code style: prettier NPM Downloads

安装

npm install -g nornj-cli-legacy

使用方法

创建项目初始代码

  • 在当前目录下创建新项目目录:
njl init

# 请按上下键选择项目模板
Please select a project template:
> react-mst-universal
  react-mst-app
  react-mst
  react-mobx
  other

# 如果选择了other,则可输入任意模板名称
Template Name: anyTemplateName

# 输入新建的项目目录名称
Project Name: projectName

添加新页面

  • 进入已有项目目录后,输入如下命令创建新页面:
njl add-page [pageName]  # 或njl ap

# 请选择生成时要使用的页面模板
Which page template do you want to use?
> default  # 增删改查
  chart    # 图表
  form     # 表单
  empty    # 空页面

# 输入新创建的页面名称
Page Name: pageName

添加新组件

  • 进入已有项目目录后,输入如下命令创建新组件:
njl add-component [componentName]  # 或njl ac

# 请选择生成时要使用的组件模板
Which component template do you want to use?
> default       # 默认
  stateless     # 无状态组件
  higher-order  # 高阶组件

# 输入新创建的组件名称
Component Name: componentName

添加新Store

  • 进入已有项目目录后,输入如下命令创建新Store:
njl add-store [storeName]  # 或njl as

# 请选择生成时要使用的Store模板
Which store template do you want to use?
> default       # 默认使用axios
  default-fetch # 使用fetch

# 输入新创建的Store名称
Store Name: storeName

选择项目模板

| 名称 | 描述 | 模板源码地址 | |:---------------|:-------------------------|:--------------------------| | react-mst-universal | 基于React+Mobx-state-tree的单页面项目组件开发规范默认使用JSX样式开发默认集成了styled-jsxcss-modules请求数据使用axiosecharts组件使用echarts-for-react集成了可增强JSX开发的插件babel-plugin-nornj-in-jsx预置eslintstylelintprettier,可在格式化时对代码风格进行自动检查并修复 | https://github.com/joe-sky/nornj-cli/tree/master/templates/react-mst-universal | | react-mst-app | react-mst-universal的h5版,配置同上 | https://github.com/joe-sky/nornj-cli/tree/master/templates/react-mst-app | | react-mst | 基于React+Mobx-state-tree的单页面项目组件开发规范默认使用NornJ | https://github.com/joe-sky/nornj-cli/tree/master/templates/react-mst | | react-mobx | 基于React+Mobx的多页面项目 | https://github.com/joe-sky/nornj-cli/tree/master/templates/react-mobx | | joe-sky/react-mobx-html | 基于React+Mobx的多页面项目(html版) | https://github.com/joe-sky/react-mobx-html | | joe-sky/react-mobx-ftl | 基于React+Mobx的多页面项目(FreeMarker版) | https://github.com/joe-sky/react-mobx-ftl |

使用自定义模板

  1. 在github上创建一个新的模板项目即可,结构类似于react-mobx-htmlreact-mobx-ftl

  2. 然后使用以下命令即可下载并初始化:

njl init

# 请按上下键选择项目模板
Please select a project template:
  react-mst-universal
  react-mst-app
  react-mst
  react-mobx
> other

# 选择other,然后按照github地址输入"用户(或组织)名/项目名",例如"https://github.com/joe-sky/react-mobx-html"中的"joe-sky/react-mobx-htm"
Template Name: UserName/ProjectName

查看cli当前版本

njl -v

cli版本更新

njl upgrade  # 更新cli版本到最新版

安装npm包

npm install相同,区别在于部署在私服上的包会自动从私服安装:

njl install  # 或njl i

更新npm包

npm update相同,区别在于部署在私服上的包会自动从私服更新:

njl update  # 或njl up

可选择使用npm国内镜像

当网络访问npm比较慢时,可选择使用npm国内镜像来安装。方法为在各命令后添加--cnpm参数:

njl init --cnpm
njl upgrade --cnpm
njl install --cnpm
njl update --cnpm

相关文档

License

MIT