0.1.39 • Published 8 days ago

saqu v0.1.39

Weekly downloads
-
License
MIT
Repository
github
Last release
8 days ago

saqu

参考对象

  1. 参考 react-scripts webpack 进行 配置

功能

  • 正常的项目进行打包和开发
  • md文档解析代码块进行渲染
  • import引入替换
  • 支持自动对入口文件进行生成
  • 支持自动生成路由
  • 添加项目app.{ts,tsx,jsx,js}可以对路由之类的进行操作和配置
  • 添加支持直接使用md文件做路由进行渲染md内容

安装

$ npm install saqu # yarn add saqu

命令

Usage: saqu [start|build] [--help|h]
  Displays help information.
Options:
  --help, -h              Displays help information.
Example:
$ saqu  build
$ saqu  start

快速创建项目

$ npx create-saqu my-app

配置参数

import { RspackOptions, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
import express from 'express';
import { MockerProxyRoute, MockerOption } from 'mocker-api';
import { DevServer } from '@rspack/core';
import yargsParser from 'yargs-parser';

/**
 * @description rspack 运行配置
 */
export interface SAquConfig extends RspackOptions {
  /**
   * @description 配置代理,可用于解决跨域等问题
   * @example
   * proxy: {
   *  '/api': {
   *    target: 'http://localhost:3000',
   *    changeOrigin: true,
   *  },
   * },
   * */
  proxy?: DevServer['proxy'];
  /**
   * @description mocker代理
   **/
  proxySetup?: (app: express.Application) =>
    | {
        path?: string | string[] | MockerProxyRoute;
        options?: MockerOption;
      }
    | undefined;
  /**
   * @description 重写环境配置
   */
  overridesRspack?: (
    config: RspackOptions,
    env: 'development' | 'production' | 'preview',
    argvOptions: SAquArgvOptions,
    type: 'server' | 'client',
  ) => Promise<RspackOptions> | RspackOptions;

  /**用来压缩 JS 产物 配置*/
  _JS_minifyOptions?: SwcJsMinimizerRspackPluginOptions;
}

/**
 * @description 命令行参数
 */
export interface SAquArgvOptions extends yargsParser.Arguments {
  /**
   * @description 使用 webpack-bundle-analyzer
   */
  analyze?: boolean;
  /**输出目录*/
  dir?: string;
  /**帮助*/
  help?: boolean;
  /**帮助(简写)*/
  h?: boolean;
}

基础配置

// .saqurc.ts
import { defineConfig } from "saqu"

export default ()=>defineConfig({
  // ...配置
})

重写配置

// .saqurc.ts
import { defineConfig } from "saqu"

export default ()=>defineConfig({
  // ...配置
  overridesRspack:(config,env,argvOptions,type)=>{
    return config;
  }
})

插件使用

// .saqurc.ts
import { defineConfig } from "saqu"
import createRoutes from '@saqu/auto-config-to-routes';

export default ()=>defineConfig({
  // ...配置
  plugins: [new createRoutes()],
})

entry配置

默认入口文件src/index.{js|tsx|jsx}

当使用!开头的路径时,不进行校验文件是否存在(适用于自动生成入口文件)

其他情况会进行校验入口文件是否存在

// .saqurc.ts
import { defineConfig } from "saqu"
import createRoutes from '@saqu/auto-config-to-routes';

export default ()=>defineConfig({
  // ...配置
  entry: '!src/.cache/main.jsx',
})
0.1.39

8 days ago

0.1.38

1 month ago

0.1.37

6 months ago

0.1.36

8 months ago

0.1.10

10 months ago

0.1.11

10 months ago

0.1.12

10 months ago

0.1.13

10 months ago

0.1.14

9 months ago

0.1.15

9 months ago

0.1.0

12 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.8

10 months ago

0.1.7

10 months ago

0.1.9

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.30

8 months ago

0.1.31

8 months ago

0.1.32

8 months ago

0.1.33

8 months ago

0.1.34

8 months ago

0.1.35

8 months ago

0.1.27

9 months ago

0.1.28

8 months ago

0.1.29

8 months ago

0.1.20

9 months ago

0.1.21

9 months ago

0.1.22

9 months ago

0.1.23

9 months ago

0.1.24

9 months ago

0.1.25

9 months ago

0.1.26

9 months ago

0.1.16

9 months ago

0.1.17

9 months ago

0.1.18

9 months ago

0.1.19

9 months ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago