Giter Site home page Giter Site logo

yohangz / packer-cli Goto Github PK

View Code? Open in Web Editor NEW
87.0 3.0 3.0 5.7 MB

:boom: Full-fledged CLI tool to generate and package node modules compliant with Browser and NodeJS. Packer CLI support all modern style, unit test and script transpiler tools

Home Page: http://bit.ly/packer-cli

License: MIT License

JavaScript 13.11% HTML 44.64% TypeScript 41.40% CSS 0.84%
build-tool reactjs nodejs gulp rollupjs typescript babel sass less stylus stylelint tslint eslint handlebars jsdom mocha jest jasmine istambul spdx

packer-cli's Introduction

Packer CLI travis build license npm version

Packer CLI helps you to kick start new node module projects compliant with NodeJS and Browser, prescribing best practices. Packer encapsulating file-watching, live-reloading, transpiling, bundling and unit test framework integration with coverage and much more, so you don't have to. You will get to enjoy the latest latest JavaScript awesomeness with flexibility to custom fit your project needs. To do so, we provide a generator ecosystem via command line to scaffold complete projects with full control over all exposed workflows.

Explained in detail: Build Node Modules Like a Pro with Packer CLI

📖 Table of Contents

💡 Tech Stack

Rollup Gulp Babel ES Lint Typescript TS Lint Postcss LESS SASS Stylus Style Lint Karma Mocha Chai Jest Jasmine Istanbul React JSdom Handlebars Prettier SPDX NPM YARN Travis CI

✨ Usage

Proceed with next steps if your platform meet following prerequisites.

🔎 Basic Usage

Packer Intro

You can simply run the following command in a preferred directory to generate a new library project using Packer CLI,

npx packer-cli generate my-library

or

npm install packer-cli -g && packer generate my-library

Once project is generated and dependencies are installed, you can use the following NPM scripts:

# Run project on watch mode
npm run watch

# Production build
npm run build

# Run Style and script lint tasks
npm run lint

# Run style lint task
npm run lint:style

# Run script lint task
npm run lint:script

# Run auto format source task
npm run format

# Run unit test suite on development envrionemnt watch mode
npm run test

# Run unit test suite with coverage on development envrionemnt watch mode
npm run test:coverage

# Run unit test suite on continues integration environment mode
npm run test:ci

# Run unit test suite with coverage mode on continues integration environment mode
npm run test:coverage:ci

# Bump package version and push updated package config
npm version major|minor|patch

# Build project and publish to NPM
npm run release

Generated project structure can be viewed here

⚙️ Standalone Usage

You can also use packer CLI standalone on any packer compliant project to customize the NPM scripts generated.

Usage: packer [--version | -v] | [--help | -h] | <command>[<args>]

  Arguments supported with all commands

  + Logging flags
    [--trace]          set console log level to trace
    [--info]           set console log level to information
    [--warn]           set console log level to warning
    [--error]          set console log level to error
    [--silent]         set console log level to silent

  + Other Flags
    [--config | -c]    dynamic packer config path

  Generate a new library project via packer

  generate | g <project name>
    [--skipInstall | -sk]   skip dependency install after project

  These are packer commands can be used on generated project
    build | b                trigger build
      [--perf | -P]          execute build task with rollup performance monitoring
    watch | w                trigger serve on watch mode
    test | t                 execute project test suite
      [--watch | -W]         execute test on watch mode
      [--coverage | -C]      execute test suite with coverage
    clean | c                clean project build artifacts and temporary files generated
    lint | l                 execute lint for project source
      [--style | -sc]        execute only style lint
      [--script | -sr]       execute only script lint
    format | f               auto format project source

⚒️ Build Configuration

Build configuration can be updated after project generation via .packerrc.js. Refer packer configuration options for detailed configuration options list.

🌱 Contributions

Feel free to open an issue or create a PR.

©️ License

Packer-CLI is MIT licensed. Please refer LICENSE for more information.

packer-cli's People

Contributors

aravindakr95 avatar sandaruchamod avatar yohangz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

packer-cli's Issues

Templates directory is remains on src after react support is enabled

Reproduce:
Install packer-cli globally (npm install -g packer-cli) or use npx (npx packer g test-library --skipInstall) to run project generate wizard.
Then 'Are you building a react library?' -> yes -> rest configurations set to default

Issue:
templates directory is remains after success project generate, (.hbs in src/templates) but handlebars are removed from package.json and externals in .packerrc.js"

Expected Result:
templates directory and .hbs support should be removed from src once after react support is enabled.

Packer test failed to run

Reproduce:
Generate project with default configurations -> Run packer test
Issue:
Invalid configuration file. cannot find module karma-mocha. adding karma-mocha to package.json will solve the issue but taking additional space on bundle size.

keywords array is empty after generate the project.

Steps to Reproduce:

  1. Generate new project using ''packer generate sample-library".
  2. Give some keywords seperated by commas (keyword1,keyword2).

Actual Result:

  • keywords array of package.json is empty. ( "keywords" : [] )

Expected Result:

  • keywords array should be " "keywords": ["keyword1","keyword2"] "

Author's email will not bind to the author when author's name is ignored.

Reproduce Error :

  1. Generate new project (refer README.md) then ignore the author's name and provide a valid email.
  2. After a successful generate, go to package.json and check if author's email is bind to the author.

Expected Result : Author's email should be bind to the author object or property.

invalid karma-jasmine package version

Project generation will leads to success with a error, due to a wrong version value in package.json
Fix - update karma-jasmine package version from 2.1.0 to 2.0.1 latest release.

Failing to run on newly created lib

Just followed the readme.
Right after running the install script:

> [email protected] watch /Users/agarciag/Documents/Apps/my-lib
> packer watch

node-resolve: setting options.module is deprecated, please override options.mainFields instead
node-resolve: setting options.jsnext is deprecated, please override options.mainFields instead
node-resolve: setting options.main is deprecated, please override options.mainFields instead
[00:04:03:047] [watch] watch - bundling start
[00:04:08:487] [watch] watch - bundling crashed
{ code: 'FATAL',
  error: 
   { Error: [BABEL] /Users/agarciag/Documents/Apps/my-lib/src/index.ts: Invalid Option: module is not a valid top-level option.
        Maybe you meant to use 'modules'? (While processing: "/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/preset-env/lib/index.js")
    at validateTopLevelOptions (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/preset-env/lib/normalize-options.js:61:13)
    at normalizeOptions (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/preset-env/lib/normalize-options.js:190:3)
    at _default (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/preset-env/lib/index.js:109:37)
    at /Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
    at loadDescriptor (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/full.js:165:14)
    at cachedFunction (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/caching.js:33:19)
    at loadPresetDescriptor (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/full.js:235:63)
    at config.presets.reduce (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/full.js:77:21)
    at Array.reduce (<anonymous>)
    at recurseDescriptors (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/full.js:74:38)
     [stack]: 'Error: [BABEL] /Users/agarciag/Documents/Apps/my-lib/src/index.ts: Invalid Option: module is not a valid top-level option.\n        Maybe you meant to use \'modules\'? (While processing: "/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/preset-env/lib/index.js")\n    at validateTopLevelOptions (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/preset-env/lib/normalize-options.js:61:13)\n    at normalizeOptions (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/preset-env/lib/normalize-options.js:190:3)\n    at _default (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/preset-env/lib/index.js:109:37)\n    at /Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12\n    at loadDescriptor (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/full.js:165:14)\n    at cachedFunction (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/caching.js:33:19)\n    at loadPresetDescriptor (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/full.js:235:63)\n    at config.presets.reduce (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/full.js:77:21)\n    at Array.reduce (<anonymous>)\n    at recurseDescriptors (/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/core/lib/config/full.js:74:38)',
     [message]: '[BABEL] /Users/agarciag/Documents/Apps/my-lib/src/index.ts: Invalid Option: module is not a valid top-level option.\n        Maybe you meant to use \'modules\'? (While processing: "/Users/agarciag/Documents/Apps/my-lib/node_modules/@babel/preset-env/lib/index.js")',
     code: 'PLUGIN_ERROR',
     plugin: 'babel',
     hook: 'transform',
     id: '/Users/agarciag/Documents/Apps/my-lib/src/index.ts' } }

Did I do something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.