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

create-oss-app

v1.0.7

Published

Creates a B2-OSS application using the command line.

Downloads

4

Readme

create-oss-app

Creates a B2-OSS application using the command line.

初始化 App

你可以通过以下命令来快速创建一个 App 的模版:

npm init oss-app [--js]

yarn create oss-app [--js]

如果需要使用 JavaScript 而非 TypeScript 可增加 --js 选项

初始化过程需要输入 App id 等信息,最终产生目录结构如下(如 App id 为 demo):

- /demo                 // 目录名以 App id 命名
  - assets              // 资源目录,存放如图片、CSS 等
    - demo.scss         // App Scss 样式表
    - icon.svg          // App 图标
  - components
    - Layout.tsx        // 布局组件
    - Statusbar.tsx     // 底部状态栏组件
  - service
    - demo.ts           // App egg 服务脚本
  - demo.ts             // App 描述文件
  - index.tsx           // 首页
  - pageage.json        // package 依赖等信息
  - store.ts            // Mobx 应用数据

其中 App 描述文件(demo.ts)内容大致如下:

import Icon from './assets/icon.svg';

export default ({
  title: 'Demo App',
  icon: Icon,
});

以下是描述项目的接口类:

interface IAppConfig {
  title: string;              // 应用名称
  icon: any;                  // 应用图标
  menu?: Array<IMenuItem>;    // 菜单
  statusbar?: any;            // 窗口底部状态栏组件
  layout?: any;               // 窗口布局组件
  widgets?: Array<IWidget>;   // Widgets
  store?: any;                // 应用内 store
  mainWindow?: {              // 主窗口配置
    fixed?: boolean;          // 主窗口是否固定大小
    minimumWidth?: number;    // 主窗口最小宽度
    minimumHeight?: number;   // 主窗口最小高度
    maximumWidth?: number;    // 主窗口最大宽度
    maximumHeight?: number;   // 主窗口最大宽度
  };
}

App 的依赖可以添加到 package.json 中,在 app add 过程中会自动安装

/service 目录会作为服务脚本自动注册到 egg 服务器中,除该目录外,App 中的其它文件都遵循 UMI 的约定式路由 自动注册。

调试 App

TODO