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

@manpacker/generator

v1.10.0

Published

Frontend generator build project

Downloads

35

Readme

npm npm bundle size npm NPM nodei.co

Explain

Manpacker is a set of build engine based on webpack to build engine package. Entry file supported file extension js or ts Support for multi-portal file build, Files must be in the build root directory.

.manpackeric

Project default initialization file, Can be a javascript script file, or a json configuration file. Example: json

{"output": "view"}

You can also set the manpacker field in the package.json file. Example:

{"manpacker": {"root": "src"}}

Final input result, Merge .manpackeric config item.

{"root": "src", "output": "view"}

You can customize the project initialization file name. Example: Custom name: development.ic.js

npx manpacker --ci development.ic.js
manpacker --ci development.ic.js

Install

npm i @manpacker/generator -D

Usage

CLI

Start the local development environment.

manpacker server
manpacker server --ic [value] -c [config] --port [number]

Construction of production environment engineering project.

manpacker build
manpacker build --ic [value] -c [config]

API

const manpacker = require('@manpacker/generator')

method

.compile

Core compilation method

const { compile } = require('@manpacker/generator')
compile({ env, ic, config })

|param|type|explain| |-----|----|-------| |env|string|env: NDOE_ENV variabl| |ic|object|.manpackeric config item object| |config|function|manpacker.webpack.js return funtion|

.Commander

Commander is Create command-line class.

const { Commander } = require('@manpacker/generator')

let { version } = require('./package.json')
let commander = new Commander({ version })

Explain commander methods

|method|explain| |------|-------| |build|Default build production environment, enter project directory| |server|Launch Development Environment, Local Interconnect Service, default Port 8090| |parse|Compile registration command Lint|

.createCssLoader

Create css loader generator.

const { createCssLoader } = require('@manpacker/generator')

|param|type|explain| |-----|----|-------| |ic|object|code>.manpackeric config item object| |...loader|[object,string]|style loader|

Example:

createCssLoader(ic, { loader: 'resolve-url-loader' }, { loader: 'sass-loader' })
createCssLoader(ic, 'resolve-url-loader', 'sass-loader')

.createURILoader

Create URI file loader generator.

|param|teype|explain| |-----|-----|-------| |dir|string|create new dir for URI file.|

.createEslintLoader

Create Eslint loader generator.

|param|teype|explain| |-----|-----|-------| |rgx|RegExp|Create eslint loader.|

.manpackeric

Default root file name: .manpackeric Configuration item description:

|name|type|value|description| |----|----|-----|-----------| |root|string|default: src| Source directory for building the project| |output|string|default: view|Directory output after build| |ext|string|default:htm|Extension of the outputted page| |cdn|string|default: "/"|Domain name for static Resource, "publicPath" attribute value| |define|object|dedalut: {NODE_ENV: process.env.NODE_ENV}|Define constants in a project, eslintrc set global key-value| |pages|object|default: {}|Multi-portal file page configuration Example| |remUnit|number|default: 100|Conversion of px with 750px Design Diagram, Minimum cardinality.| |isPx2rem|boolean|default:true|Pixel unit px conversion rem| |injectStyle|array|default:[]|Global style files that need to be injected, Avoid repeating reference, Example| |isCssExtract|boolean|default: fasle|Extract css separate files| |isMergeCommon|boolean|default:false|When multiple portal files are used, the common code section is extracted| |minChunks|number|default: 2|If isMergeCommon:true, Extracts the minimum entry file number of files for the public code.| |isCssModule|boolean|default:false|Whether styles are introduced as css templates, Example| |isMiniHTML|boolean|default:true|Compressed page.| |template|string|default:'template.html'|Build-time template file.| |map|string|default: ' '|Source map file URI| |isEslint|boolean|default: true|Start the eslint-loader feature by default| |isZip|boolean|default: false|Compressed project are zip’s ext. | |proxy|object|default: {}|Resolve browser request interface joint cross-domain. |

.pages

Ingress File header Settin. Example: Entry files index.js

{"page": {"index": "Test title"}}

More entry files index.tslist.ts, and so on.

{"pages": {"index": "Test title", "list": "List test title"}}

.injectStyle

Inject global style file, Avoid manual introduction Example:

{"injectStyle": ["./common/style/mixins.scss", "./common/style/varable.scss"]}
{"injectStyle": ["./common/style/index.scss"]}

.isCssModule

Introduction of css style to work with Modular approach. Example: index.scss

.frame {margin: auto;}

index.jsx

import Style from './index.scss'

<div class={Style.frame}></div>

.proxy

{
  '/api': {
    'target': 'https://maindomain.com',
    'changeOrigin': true,
    'secure': true,
    'pathRewrite': {
      '^/api': ''
    },
    'logLevel': 'debug'
  }
}
API: http://localhost:8090/api/home => https://maindomain.com/home

postcss.config.js

Specific reference: postcss

This generator includes plugins: postcss-preset-env postcss-import postcss-url cssnano Extend the postcss plug-in the root directory: create file postcss.config.js

manpacker.webpack.js

Default root file name: manpacker.webpack.js

module.exports = ic => {
  // webpack config item.
  return {}
}

The parameter ic is the injected initialization parameter object. Webpack configuration items can be set based on ic

Npm

link