当前位置: 首页 > news >正文

网站的连接二维码怎么做湖北seo

网站的连接二维码怎么做,湖北seo,自助下单网站咋做,邯郸房产信息网恋家网前言 项目中会用到工具库、函数库以及一些跟框架绑定的组件,如果这些基础模块每个项目都实现一套,维护起来那真的头大,你说呢😉 搭建流程 准备工作 创建文件夹myLib、安装Git以及pnpm 目录大概就系这样子: myLib ├…

前言

项目中会用到工具库、函数库以及一些跟框架绑定的组件,如果这些基础模块每个项目都实现一套,维护起来那真的头大,你说呢😉

搭建流程

准备工作

创建文件夹myLib、安装Git以及pnpm

目录大概就系这样子:

myLib
├── .husky
│   ├── commit-msg
│   └── pre-commit
├── packages
│   └── utils
│       ├── lib
│       │   ├── index.cjs.js
│       │   ├── index.esm.js
│       │   └── index.d.ts
│       ├── src
│       │   └── index.ts
│       ├── rollup.config.js
│       ├── tsconfig.json
│       └── package.json
├── .eslintrc.js
├── .prettierrc
├── commitlint.config.js
├── pnpm-workspace.yaml
├── tsconfig.json
└── package.json

配置Typescript

pnpm add -D -w typescript tslib
pnpm tsc --init

tsconfig.json

{
    "files": [],
    "references": [
      { "path": "./packages/utils" }
    ]
  }

 pnpm-workspace.yaml

packages:
  - 'packages/*'

package.json

  "scripts": {
    "postinstall": "husky install",
    "lint": "eslint packages/**/*.{ts,js} --fix"
  }

子包

tsconfig.json配置 

{
  "compilerOptions": {
    "rootDir": "./src",
    "declaration": true,
    "declarationDir": "./lib",
    "emitDeclarationOnly": true,
    "module": "esnext",
    "target": "es6",
    "moduleResolution": "node",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true
  },
  "include": ["src/**/*"]
}

Rollup打包

pnpm add -D rollup @rollup/plugin-node-resolve @rollup/plugin-commonjs @rollup/plugin-typescript typescript

rollup.config.js

import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';

export default {
  input: "src/index.ts",
  output: [
{
    file:"lib/index.cjs.js",
    format:"cjs",
},
{
    file:"lib/index.esm.js",
    format:"esm",
},
  ],
  plugins:[
    resolve(),
    commonjs(),
    typescript()
  ]
};

package.json

  "scripts": {
    "build": "rollup -c"
  } 

git commit 验证

记得用git先初始化下仓库

pnpm add -D -w husky @commitlint/{config-conventional,cli}
pnpm husky install

pnpm dlx husky-init --pm=pnpm

npx husky add .husky/commit-msg 'npx --no-install commitlint --edit "$1"'

commitlint.config.js

module.exports = {
  extends: ['@commitlint/config-conventional']
}; 

配置Eslint和Prettier

 pnpm add -D -w eslint prettier eslint-config-prettier eslint-plugin-prettier

eslint.config.js

const path = require('path');
const { ESLint } = require('eslint');
const tsParser = require('@typescript-eslint/parser');
const tsPlugin = require('@typescript-eslint/eslint-plugin');
const prettierPlugin = require('eslint-plugin-prettier');

module.exports = [
  {
    files: ['packages/**/src/**/*.{ts,js}'],
    ignores: ['node_modules'],
    languageOptions: {
      parser: tsParser,
      parserOptions: {
        ecmaVersion: 2020
      },
    },
    plugins: {
      '@typescript-eslint': tsPlugin,
      prettier: prettierPlugin,
    },
    rules: {
      'prettier/prettier': 'error',
      'no-unused-vars': 'off',
      '@typescript-eslint/no-unused-vars': 'warn',
    },
  },
]

.prettierrc

{
    "singleQuote": true,
    "trailingComma": "all",
    "printWidth": 80
  } 

.husky/pre-commit

pnpm run lint 

打包

最后

整体的框框已经搭建起来,把需要的工具、函数和组件写入即可,发布子包到私有仓库即可内部使用啦~

http://www.mmbaike.com/news/27171.html

相关文章:

  • 吉林省建设银行网站杭州关键词优化测试
  • 做公司网站有没有必要唐山seo
  • 搭建网站需要的软件百度推广的效果
  • 做网站首页psseo工作
  • 企业网站维护费用白山网络推广
  • 大连网站建设怎么做怎样制作网站
  • 零基础网站建设教学培训班网站推广步骤
  • 精能集团有限公司两学一做网站培训seo去哪家机构最好
  • 优惠券网站建设制作网站开发公司排名
  • 清河县做网站seo技术自学
  • 网站建设与维护公司seo信息是什么
  • 九江市网站建设阿里云建站
  • 东明网站建设武汉百度百科
  • 社交网站怎么做今日热搜榜排行榜
  • 制作网站对话框关于手机的软文营销
  • 南宁网站优化推广方案网络营销的作用
  • 企业网站建设论文网络营销与直播电商好就业吗
  • 互联网开发工资一般多少淘宝优化关键词的步骤
  • 做网站代理工作安全吗廊坊百度推广seo
  • 如何提升网站转化率网络推广的平台有哪些
  • 国有企业投资建设项目临沂seo优化
  • wordpress同步到今日头条百度关键词优化快速排名软件
  • 合肥建站优化网络营销包括的主要内容有
  • java做的网站怎么打开网页对网络营销的理解
  • 文化传播 wordpress成都关键词优化服务
  • 网站建设历史一个新手怎么去运营淘宝店铺
  • 泰安网站建设关键词排名方法
  • 深圳外贸建站及推广seo推广怎么收费
  • 什么网站可以做单词书百度上怎么免费开店
  • 中山品牌网站建设推广身边的网络营销案例