sptc

0.0.18 • Public • Published

Simple Pretreat Toolkit CLI

This project is developing..


sptc

Usage: sptc [options]

sptc

Options:
  -V, --version            output the version number
  -f, --filename <string>  Sptc filename.
  -d, --defines <string>   Macro definition switches. If you want to use multiple switches, separate them with ",".
                           (default: "")
  -h, --help               display help for command

sptcd

Usage: sptc http server [options]

A simple http server

Options:
  -V, --version           output the version number
  -p, --port <number>     Serve port. (default: 9090)
  -l, --locally           Only accepts local connections.
  -w, --workdir <string>  Specify the working directory. (default: ".")
  -r, --router <string>   Specify a file as the router entry. If specified, all requests will pass to this file.
  -e, --exts <string>     Specify the valid extensions of executable sptc files. (default: ".sjs,.shtml")
  -n, --workers <number>  Workers count. (default: 1)
  -s, --slient            Slient mode.
  -h, --help              display help for command

webpack loader

Usage:

Webpack configuration:

{
  test: /\.(jsx?)$/,
  exclude: /node_modules/,
  options: {
    file: path.resolve(__dirname+'/sptc.inject.js'),
  },
  loader: 'sptc/dist/webpack.loader.js',
}



**sptc.inject.js**

module.exports={
  EXTENDS: (ctx)=>({
    get_module_dir: _=>{
      return ctx.fn.replace(/\\+/g, '/').replace(/(^.*?src\/modules\/[^/]+).*$/, '$1')+'/'
    },
    IS_NODE_TARGET: ctx.webpackLoaderThis.target==='node',
  }),
  TPLS: [
    /\.jsx?$/, ctx=>{
      let {str, fn}=ctx
      return `console.log("// ${fn}")\n`+str
    }
  ],
}


Readme

Keywords

none

Package Sidebar

Install

npm i sptc

Weekly Downloads

204

Version

0.0.18

License

none

Unpacked Size

37.9 kB

Total Files

31

Last publish

Collaborators

  • treemonster1993