lowcode-cli

低代码构建脚手脚

Usage no npm install needed!

<script type="module">
  import lowcodeCli from 'https://cdn.skypack.dev/lowcode-cli';
</script>

README

lowcode-cli VIZ组件脚手架

安装到全局

npm i lowcode-cli -g

脚手架提供的命令

/* 可以在终端输入:lowcode, 打印以下内容 */

Usage: lowcode [options] [command]

Options:
  -h, --help         display help for command

Commands:
  start [port=3001]  start run project
  build              build project
  pack               pack components
  help [command]     display help for command

脚手架的配置

/* runner.config.js */
const path = require('path');

module.exports = {
  publicPath: '/', // 子应用base路径, 默认为包名
  outputPath: './dist', // 打包文件输出地址;配置值时,基于项目根目录,默认为:'./libDist'
  lessVariables: {},
  webpackConfig: (config, options) => {
    config.resolve.alias = {
      '@resources': path.resolve(__dirname, 'src'),
      '@/utils/request': path.resolve(__dirname, 'src/utils/request'),
      '@router': path.resolve(__dirname, 'src/router'),
    };
    config.devServer.proxy = {
      '/api': {
        target: 'http://127.0.0.1:2001/',
        changeOrigin: true,
      }
    };

    config.plugins.push(
      new options.moduleFederationPlugin({
        name: 'app2',
        shared: {
          react: { singleton: true },
          'react-dom': { singleton: true },
        },
      }),
    );

    return config;
  },
};