3.0.9 • Published 11 months ago

@fai-hd/hd-sfc-cli-pre v3.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

NPM version NPM downloads pnpm

TypeScript RollupJS ESBuild

安装


pnpm add @fai-hd/hd-sfc-cli -D

yarn add @fai-hd/hd-sfc-cli --dev
npm install @fai-hd/hd-sfc-cli --dev

配置文件

在项目根目录下新建配置文件。脚手架支持以下格式: hd-sfc-cli.config.js, hd-sfc-cli.config.ts, config/hd-sfc-cli.config.ts, config/hd-sfc-cli.config.js

注意: 如果配置文件为 .ts 格式,则该项目下需要 tsconfig.json

import { defineConfig } from "@fai-hd/hd-sfc-cli";

export default defineConfig({
  bundler: "esbuild",
  jsConfig: {
    input: "index.mjs",
    output: "index.src.js",
    outputPath: "[origin]",
  },
  cssConfig: {
    extract: true,
    input: "[origin]",
    output: "[name].src.css",
    outputPath: "/css/",
  },
  tsConfig: {
    useTs: true,
    disableTypeCheck: true,
    rt2PluginOpt: {},
  },
  reloadConfig: {
    port: 5000,
    useHMR: true,
  },
  chokidarConfig: {
    rollupInputFileGlob: "res/**/index.mjs",
    needReloadFileGlob: ["etc/adi.conf"],
  },
  assetsConfig: {
    jspName: "jspName",
    jspPath: "jspPath",
    jspStrFlag: "jspStrFlag",
    jspStrFlagAsync: "jspStrFlagAsync",

    incName: "incName",
    incPath: "incPath",
    incStrFlag: "incStrFlag",
  },
  alias: { "@": "res/js" },
  eol: {
    flag: "lf",
    fileRegex: /\.src\.(css|js)$/,
  },
});

使用


  • Dev
    • hd-sfc-cli dev
  • Build
    • hd-sfc-cli build
  • Build:files
    • hd-sfc-cli build:files filename1 filename2
  • Version
    • hd-sfc-cli --version
  • Help
    • hd-sfc-cli --help
  • Asset
    • hd-sfc-cli asset <资源文件相对路径>

配置项

更多配置内容可参考官网