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

@forzoom/shuttle

v0.0.13

Published

<p align="left"> <a href="https://www.npmjs.com/package/@forzoom/shuttle"><img src="https://img.shields.io/npm/v/@forzoom/shuttle.svg?sanitize=true" alt="Version"></a> <a href="https://www.npmjs.com/package/@forzoom/shuttle"><img src="https://img.shie

Downloads

16

Readme

Start

# 全局安装
# npm
npm install @forzoom/shuttle -g
# yarn
yarn global add @forzoom/shuttle

# 或者
# npm
npm install @forzoom/shuttle
# yarn
yarn add @forzoom/shuttle

Usage

目前开发只是暂时告一段落,测试尚不完全,谨慎在生产环境使用。

命令行形式

@forzoom/shuttle库提供了命令行形式

shuttle --help # 查看提示信息
# 将jsVue格式转换成tsClassVue格式
shuttle -s=/path/to/src/component.vue\ # 指定源文件路径
  -d=/path/to/dst/component.vue\ # 指定生成文件路径
  -p=jsVue\ # 指定parser
  -g=tsClassVue\ # 指定generator
  --generator-plugin=addImportStore\ # 指定generator插件
  --generator-plugin=addParamsTypeAnnotation # 指定generator插件
# 将js格式的store转换成ts格式的store
shuttle -s=/path/to/src/component.vue\ # 指定源文件路径
  -d=/path/to/dst/component.vue\ # 指定生成文件路径
  --parser-generator=jsStore\ # 指定parser

parser

支持: jsVuetsClassVue

其中

jsVue格式为

export default {
    name: 'Cmp',
}

tsClassVue格式为

@Component({
    name: 'Cmp',
})
export default class Cmp extends Vue {}

generator

支持: jsVuetsClassVue,其格式类型和解析器中相同

parserGenerator

支持: jsStorejsRouter,用于将js格式的 store、router 文件转换成 ts 格式

// js格式的store
export default {
    namespaced: true,
    state: {
        foo: 'bar',
    },
    // ..
}
// ts格式的store
import { Module } from 'vuex';
export interface MyState {
    foo: string;
}

const m: Module<MyState, RootState> = {
    namespaced: true,
    state: {
        foo: 'bar',
    },
    // ..
}
// js格式的router
const MyPage = resolve => {
    require.ensure([], (require) => {
        resolve(require('@/pages/myPage.vue'));
    }, 'page');
};

export default [
    {
        path: '/my_page',
        name: ROUTE_NAME.MY_PAGE,
        meta: {
            title: 'xxx',
        },
        component: MyPage,
    },
];
// ts格式的router

export default [
    {
        path: '/my_page',
        name: ROUTE_NAME.MY_PAGE,
        meta: {
            title: 'xxx',
        },
        component: () => import(/* webpackChunkName: "page" */ '@/pages/myPage.vue'),
    },
];

generator-plugin

支持: addImportStoreaddParamsTypeAnnotation

其中: addImportStore: 用于处理vue文件时,在必要的时候自动添加import '@/store' addParamsTypeAnnotation: 为函数参数自动添加any类型,为路由钩子自动添加Route类型

使用config file形式

# 查看config file template
shuttle --cfg-tpl
shuttle # 默认寻找pwd下的shuttle.config.json路径,如果没有找到,将不断向上寻找

已知问题

  1. 不支持store.state为function的模式

Test

仅进行部分Test