npm.io
0.3.4 • Published 4 years ago

cra-template-level

Licence
Version
0.3.4
Deps
116
Size
136 kB
Vulns
8
Weekly
0

cra-template-level

Usage

  • npx create-react-app [project-name] --template level

  • git repository https://github.com/w-lianfu/cra-template-level.git

  • You can publish this for your own cra-template-*

    • npm login
    • npm publish --access public
  • npm link

  • submodule address

    • https://github.com/react-level/level-base.git

qiankun

qiankun main config
  • qiankun project demo
    • https://github.com/qiankun-react
  • default support as qiankun sub app

registerMicroApps(
  [
    {
      name: 'sub1',
      entry: '//localhost:5001',
      container: '#sub1',
      activeRule: '/sub1',
    },
    {
      name: 'sub2',
      entry: '//localhost:5004',
      container: '#sub2',
      activeRule: '/sub2',
    },
  ],
  {
    beforeLoad: [
      // @ts-ignore
      app => {
        console.log('Before load -- ', app);
      },
    ],
    beforeMount: [
      // @ts-ignore
      app => {
        console.log('Before mount -- ', app);
      },
    ],
    afterMount: [
      // @ts-ignore
      app => {
        console.log('After mount -- ', app);
      },
    ],
    beforeUnmount: [
      // @ts-ignore
      app => {
        console.log('Before unmount -- ', app);
      },
    ],
    afterUnmount: [
      // @ts-ignore
      app => {
        console.log('After unmount -- ', app);
      },
    ],
  },
);

setDefaultMountApp('/home');

start();
qian-sub config

/** qiankun lifecycle */

// bootstarp
const bootstrap = async () => {
  console.log('salary-web-home ~~~ bootstraped ~~~');
};

// mount
const mount = async (props: any) => {
  console.log('salary-web-home ~~~ mount ~~~');
  const container = document.getElementById('root');
  // @ts-ignore
  const root = ReactDOM.createRoot(container);
  root.render(<AppRoot />);
};

// unmount
const unmount = async (props: any) => {
  console.log('salary-web-home ~~~ unmount ~~~ ', props);
  ReactDOM.unmountComponentAtNode(props.container);
};

// update
const update = async (props: any) => {
  console.log('salary-web-home ~~~ update ~~~ props', props);
};

export {
  bootstrap,
  mount,
  unmount,
  update,
};

git commit 提交规范

约定式提交: https://www.conventionalcommits.org/zh-hans/v1.0.0-beta.4/

  • feat: 新增功能/完成任务 (feature)
  • fix: 修复bug
  • test: 单元测试
  • docs: 文档 (documentation)
  • style: 样式
  • refactor: 代码重构
  • pref: 优化相关,比如提升性能/体验
  • ci: CI/CD相关
  • chore: 辅助/其它
  • revert: 恢复变更/回滚到上一个版本
  • little: 微不足道的变更
  • try: 尝试

scope:

  • #task: 完成的任务加任务编号
  • #bug: 修复的bug加bug号
  • #test: 单元测试加任务编号
  • self-test: 自测
  • sub-**: 变更了sub模块的**功能
  • !: 包含破环性变更

重点

  • Bug 修复了bug的,带bug号,例: fix(#11): 修复样式bug
  • Feat 完成了任务/新增了功能的,带任务编号,例: feat(#12): 完成任务-添加视频宣传
  • Test 完成了单元测试功能的,加任务编号,例: test(#13): 登录模块增加单元测试
  • Log 通过 git log 查看:
    • git log --grep=feat
    • git log --grep fix
  • ! 会触发 MAJOR 版本的变更
  • feat 会触发 MINOR 版本的变更
  • fix 会触发 PATCH 版本的变更