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

@iovx/iv-tool

v1.1.5

Published

微风平台基本打包工具库, 用于支持cli开发

Downloads

9

Readme

iv-tool

npm

node deps tests builds builds2 coverage licenses PR's welcome

基础打包工具

  • 支持 typescript 工具库打包

配置

优先级 iv.config.js > iv.json > .ivrc


module.exports = function() {
  return {
     "tsFiles": "demo/**/*.ts",
      "dist": "./",
      "cwd": "demo",
      "compress": {
        "dist": false
      },
      "clean": [
        "demo/dist/es",
        "demo/dist/lib"
      ]
  }
}

cli

// 打包产出 dist | es | dist
iv build 
// 开启监控模式,实时打包
iv start 
// 启动开发服务器
iv server 
// 生成项目打包文件
iv build:page 

详细


/**
 * @typedef {{
 *   log(...args),
 *   warn(...args),
 *   info(...args),
 *   success(...args),
 *   error(...args),
 * }} Log
 * @typedef {{script:string, env:{NODE_ENV:string},log:Log, args:string[]}} IVOptions
 */
/**
 * @param {IVOptions} options
 * @return {{cwd: string, pageOptions: {root: string, inject: {cdnUrl: string, apiUrl: string, baseUrl: string, core: {router: string}, nav: {home: string, member: string, console: string, passport: string, explore: string, docs: string, poster: string}, domain: string, loginUrl: string, callback: string}, page: {name: string, title: string, filename: string}, useDll: boolean, dll: {name: string, entry: string[]}[], server: {port: number, proxy: {"/local": {target: string, pathRewrite: {"^/local": string}}}}}, deployOptions: {url: string}}}
 */
module.exports = (options) => {
  const { script, log, env } = options;
  const flag = env.NODE_ENV === 'production';
  const isDevMode = script === 'start';
  log.info('当前模式:', isDevMode ? '开发模式' : '生产模式');
  return {
    cwd: '.',
    pageOptions: {
      root: '.',
      inject: {
        cdnUrl: flag ? 'https://static.example.io/cdn' : '/local',
        apiUrl: flag ? 'https://api.example.io/api' : '//api.assure.com/api',
        baseUrl: flag ? 'https://api.example.io' : '//api.assure.com',
        core: {
          router: 'browser',
        },
        nav: {
          home: flag ? '//www.example.io/' : isDevMode ? '//member.assure.com' : '//member.assure.com',
          member: flag ? '//i.example.io/' : isDevMode ? '//member.assure.com' : '//member.assure.com',
          console: flag ? '//console.example.io/' : isDevMode ? '//console.assure.com' : '//console.assure.com',
          passport: flag ? '//passport.example.io/' : isDevMode ? '//passport.assure.com' : '//passport.assure.com',
          explore: flag ? '//explore.example.io/' : isDevMode ? '//explore.assure.com' : '//explore.assure.com',
          docs: flag ? '//docs.example.io/' : isDevMode ? '//docs.assure.com' : '//docs.assure.com',
          poster: flag ? '//wiki.example.io/' : '//i.assure.io/',
        },
        domain: flag ? 'example.io' : 'assure.com',
        loginUrl: flag ? 'https://passport.example.io/' : isDevMode ? '//passport.assure.com' : '//passport.assure.com',
        callback: flag ? 'http://www.example.io/' : 'http://www.assure.com/',
      },
      page: {
        name: 'index',
        title: '微风文件管理中心',
        filename: 'index.html',
      },
      useDll: true,
      dll: [
        {
          name: 'bundle',
          entry: ['react', 'react-dom', 'react-router', 'react-redux', 'redux-saga', 'react-router-dom', 'axios'],
        },
      ],
      server: {
        port: 7227,
        proxy: {
          '/local': {
            target: 'http://127.0.0.1:8028/static/cdn',
            pathRewrite: { '^/local': '' },
          },
        },
      },
    },
    // const apiUrl = 'http://open.ixvz.io/api/file/upload';
    deployOptions: {
      url: 'http://open.ixvz.io/api/file/upload',
    },
  };
};