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

@roto/pack

v1.0.2

Published

House for developing and using freshes components.

Downloads

8

Readme

Documentation

Usage

yarn add -D @freshes/house

Guide

Core files of house have:

  • src/Runners/DevelopmentRunner.js, to start development environment.
  • src/Runners/ProductionRunner.js, to build production environment.
  • src/Runners/ServerRunner.js, after building production, it will start a Express to set proxy and open web page for preview.

Development

Add new file ./script/development.js in project root path.

// ./script/development.js
import DevelopmentRunner from '@freshes/house/src/Runners/DevelopmentRunner.js'

new DevelopmentRunner()
  .setOptions(require('./configs/options'))
  // set proxy map by http-proxy-middleware
  .setProxy(require('./configs/proxy'))
  // set app browser env by webpack.DefinePlugin
  .setAppEnvs(require('./configs/appEnvs'))
  // extend webpack or express
  .extend(runner => {})
  // Finally run
  .run()

Then edit ./package.json

{
  "scripts": {
    "start": "node ./scripts/development.js"
  }
}

About runner.extend

runner has two built-in builder, they are webpackBuilder and expressBuilder.

new DevelopmentRunner().extend(runner => {
  // you can refer to api documentation, the documentation will be uploaded
  runner.webpackBuilder.xxx
  runner.expressBuilder.xxx
})

Sentry Hash

新增 VERSION_HASH 的环境的变量,默认取当前 git commit 的 hash 值。

webpack externals

新增webpack externals

externals: {
  vue: 'Vue',
  vuex: 'Vuex',
  'vue-router': 'VueRouter'
}

webpack 不会打包 external中的类库, 减少js bundle 体积 当你使用 import Vue from 'vue' 时, webpack会引入window.vue, 所以必须在template 即index.html中引入相关cdn example

<head>
  <script src=//static.34580.cn/cn/public/vue/2.5.3/vue.min.js></script>
  <script src=//static.34580.cn/cn/public/vue-router/3.0.0/vue-router.min.js></script>
  <script src=//static.34580.cn/cn/public/vuex/3.0.0/vuex.min.js></script>
</head>

使用externals 方法:

  1. 升级house yarn add @freshes/house@next

  2. 扩展runnerextend方法

const ProductionRunner = require('@freshes/house/src/Runners/ProductionRunner')

new ProductionRunner()
  .setOptions(require('./configs/options'))
  .setProxy(require('./configs/proxy'))
  .setAppEnvs({
    ...require('./configs/appEnvs'),
    NODE_ENV: 'production'
  })
  .extend(runner => {
    const config = runner.webpackBuilder.create() // webpack config
    const externals = {
      ...config.externals,
      vue: 'Vue',
      vuex: 'Vuex',
      'vue-router': 'VueRouter'
    }
    config.externals = externals
  }).run()