Skip to content
/ ko Public
forked from DTStack/ko

Project toolkit base on webpack and babel

Notifications You must be signed in to change notification settings

Cythia828/ko

 
 

Repository files navigation

ko

Project toolkit base on webpack,babel,eslint and prettier.

NPM Status

Getting Started

global install:

npm install ko -g
yarn global add ko

install as devDependencies:

npm install ko -D
yarn add ko -D

Commands

ko build

use webpack to bundle files. The supported options are:

  • --hash: output filename with hash
  • -t,--ts,--typescript: support typescript
  • -e, --env [env]: user defined building environment

ko dev

use webpack-dev-server to start devServer. The supported options are:

  • -p, --port <port>: server start on which port
  • --host <host>: server start on which host
  • -t, --ts: support typescript
  • -a,--analyzer: support building analyzer(internal use webpack-bundle-analyzer)

ko prettier (ko pr) [patterns]

use prettier to format your codes. The supported options are:

  • -w, --write: Edit files in-place. (Beware!)
  • -c, --config <configPath>: set prettier config path

ko eslint [patterns]

use eslint to format your codes.The supported options are:

  • -c, --config <path>: set eslint config path

Configuration

You can configure ko build and ko dev via ko.config.js. User defined webpack configurations like customized entry & output,add plugins or loaders will be merged by webpack when webpack initiate.

ko.config.js

module.exports = {
  entry: './src/app.tsx',
  output: {
    publicPath: isDev ? '/' : '/easyIndex/',
  },
  plugins: [
    new CopyWebpackPlugin(copyConfig),
  ],
  externals: {
    APP_CONF: 'APP_CONF',
  },
  resolve: {
    fallback: {
      fs: false,
      path: false,
      events: false,
      os: require.resolve('os-browserify/browser'),
      crypto: require.resolve('crypto-browserify'),
      stream: require.resolve('stream-browserify'),
    },
  },
  devServer: {
    proxy,
    host: '0.0.0.0',
    port: 8084,
  },
};

All list above will be merged, for more configurations, please read webpack configuration

.koignore

*.DS_Store
*.idea
node_modules*
static*

set ignore patterns for eslint and prettier like .gitignore

Links

About

Project toolkit base on webpack and babel

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 64.9%
  • JavaScript 34.8%
  • Shell 0.3%