chore: 迁移yarn到pnpm

pull/81/head
moonrailgun 3 years ago
parent 55f07bba5c
commit f156fe6410

@ -19,23 +19,24 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.0.2
run_install: true
- name: Install packages
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Check Type
run: cd web && yarn check:type
run: cd web && pnpm check:type
- name: Test
run: yarn test
run: pnpm test
env:
TZ: Asia/Shanghai
- name: Check Build
run: cd web && yarn build
run: cd web && pnpm build

@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn lint-staged
pnpm lint-staged

@ -28,9 +28,9 @@ Nightly版 体验地址: [https://nightly.paw.msgbyte.com/](https://nightly.paw.
#### 编译 web 前端代码
```bash
yarn install
pnpm install
cd web
yarn build
pnpm build
```
使用任意方式代理 `web/dist` 目录即可。
@ -39,6 +39,6 @@ yarn build
#### expo 打开移动端app
```bash
cd app
yarn install
yarn start
pnpm install
pnpm start
```

@ -14,7 +14,8 @@
"prepare": "husky install",
"translation": "node build/script/scanTranslation.js",
"lint:fix": "eslint --fix './**/*.{ts,tsx}'",
"test": "cd web && yarn test"
"preinstall": "npx only-allow pnpm",
"test": "cd web && pnpm test"
},
"lint-staged": {
"src/*.{json,less}": [
@ -34,6 +35,7 @@
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
"commitlint": "^12.1.4",
"dayjs": "^1.10.6",
"esbuild": "^0.12.25",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
@ -46,6 +48,11 @@
"identity-obj-proxy": "^3.0.0",
"lint-staged": "^11.0.0",
"prettier": "^2.3.2",
"typescript": "^4.5.2",
"vinyl-fs": "^3.0.3"
},
"dependencies": {
"react": "17.0.2",
"react-redux": "^7.2.6"
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
packages:
# all packages in subdirs of packages/ and components/
- 'web'
- 'shared'
- 'web/plugins/**'

@ -1,7 +1,7 @@
import React, { useContext, useEffect } from 'react';
import { useStorage } from 'tailchat-shared';
import { parseColorScheme } from '../../web/src/utils/color-scheme-helper';
import { parseColorScheme } from '../utils/color-scheme-helper';
import { sharedEvent } from '../event';
import { useStorage } from '../manager/storage';
const ColorSchemeContext = React.createContext<{
/**

@ -7,7 +7,7 @@
"license": "GPLv3",
"private": true,
"dependencies": {
"@reduxjs/toolkit": "^1.6.0",
"@reduxjs/toolkit": "^1.7.1",
"axios": "^0.21.1",
"crc": "^3.8.0",
"dayjs": "^1.10.6",
@ -17,11 +17,11 @@
"i18next": "^20.3.2",
"i18next-http-backend": "^1.2.6",
"lodash": "^4.17.21",
"react-i18next": "^11.11.0",
"react-i18next": "^11.15.1",
"react-native-storage": "npm:@trpgengine/react-native-storage@^1.0.1",
"react-query": "^3.18.1",
"react-redux": "^7.2.4",
"redux": "^4.1.0",
"react-query": "^3.34.6",
"regenerator-runtime": "^0.13.9",
"socket.io-client": "^4.1.2",
"str2int": "^1.0.0",
"url-regex": "^5.0.0",
"yup": "^0.32.9"
@ -31,7 +31,7 @@
"@types/lodash": "^4.14.170"
},
"peerDependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "17.0.2",
"react-dom": "17.0.2"
}
}

@ -1,4 +1,4 @@
import type { AppState } from 'tailchat-shared/redux/slices';
import type { AppState } from '../slices';
import { useSelector, useDispatch } from 'react-redux';
export function useAppSelector<T>(

@ -1,4 +1,4 @@
import { isValidStr } from 'tailchat-shared';
import { isValidStr } from './string-helper';
/**
* dark

@ -1,20 +0,0 @@
// mock
jest.mock('tailchat-shared/i18n');
jest.mock('@iconify/react', () => ({
Icon: ({ icon }) => `[iconify icon="${icon}"]`,
}));
const ignoreErroMessages = [
/Warning.*not wrapped in act/,
/PluginManifest validation/,
];
// https://github.com/testing-library/react-testing-library#suppressing-unnecessary-warnings-on-react-dom-168
const originalError = console.error;
console.error = (...args) => {
if (ignoreErroMessages.some((re) => re.test(args[0]))) {
return;
}
originalError.call(console, ...args);
};

@ -215,6 +215,9 @@ const config: Configuration = {
configFile: path.resolve(ROOT_PATH, './tsconfig.json'),
}),
],
fallback: {
url: require.resolve('url/'),
},
},
plugins,
};

@ -18,10 +18,10 @@ module.exports = {
testPathIgnorePatterns: ['/node_modules/', '/e2e/cypress/'],
transform: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/../test/fileTransformer.js',
'<rootDir>/test/fileTransformer.js',
},
transformIgnorePatterns: ['/node_modules/'],
setupFiles: ['<rootDir>/../test/setup.js', '<rootDir>/test/setup.js'],
setupFiles: ['<rootDir>/test/setup.js'],
setupFilesAfterEnv: [],
globals: {
window: {},

@ -7,13 +7,13 @@
"license": "GPLv3",
"private": true,
"scripts": {
"build": "yarn plugins:all && cross-env TS_NODE_PROJECT='tsconfig.node.json' webpack --config ./build/webpack.config.ts",
"build": "pnpm plugins:all && cross-env TS_NODE_PROJECT='tsconfig.node.json' webpack --config ./build/webpack.config.ts",
"dev": "cross-env TS_NODE_PROJECT='tsconfig.node.json' NODE_ENV=development webpack serve --config ./build/webpack.config.ts",
"serve": "npx http-server ./dist",
"test": "jest",
"analysis": "cross-env ANALYSIS=true yarn build",
"analysis": "cross-env ANALYSIS=true pnpm build",
"check:type": "tsc --noEmit --skipLibCheck",
"postinstall": "yarn plugins:install",
"preinstall": "npx only-allow pnpm",
"plugins:new": "ministar createPlugin",
"plugins:install": "node plugins/install.js",
"plugins:all": "ministar buildPlugin all",
@ -30,14 +30,14 @@
"is-hotkey": "^0.2.0",
"jsonschema": "^1.4.0",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"memoize-one": "^6.0.0",
"mini-star": "^1.2.9",
"p-min-delay": "^4.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"rc-tree": "^5.3.6",
"react-dom": "17.0.2",
"react-easy-crop": "^3.5.2",
"react-helmet": "^6.1.0",
"react-redux": "^7.2.4",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-transition-group": "^4.4.2",
@ -48,6 +48,7 @@
"str2int": "^1.1.0",
"tailchat-shared": "*",
"tailwindcss": "^2.2.4",
"url": "^0.11.0",
"yup": "^0.32.9"
},
"devDependencies": {
@ -62,7 +63,6 @@
"@types/loadable__component": "^5.13.4",
"@types/mini-css-extract-plugin": "^1.4.3",
"@types/node": "^15.12.5",
"@types/react": "^17.0.11",
"@types/react-dom": "^17.0.8",
"@types/react-helmet": "^6.1.2",
"@types/react-router": "^5.1.15",
@ -83,6 +83,7 @@
"esbuild-loader": "^2.13.1",
"execa": "^5.1.1",
"file-loader": "^6.2.0",
"glob": "^7.2.0",
"html-webpack-plugin": "^5.3.2",
"jest": "^27.4.5",
"less": "^4.1.1",

@ -7,7 +7,7 @@
在web目录执行:
```bash
yarn ministar createPlugin
pnpm ministar createPlugin
```
插件名请准守反域名模式, 如: `com.msgbyte.xxx`

@ -1,76 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@bbob/parser@^2.7.0":
version "2.7.0"
resolved "https://registry.nlark.com/@bbob/parser/download/@bbob/parser-2.7.0.tgz#ed56a1169d9f69e6defe4512ca65cd004a9a6dcc"
integrity sha1-7VahFp2faebe/kUSymXNAEqabcw=
dependencies:
"@bbob/plugin-helper" "^2.7.0"
"@bbob/plugin-helper@^2.7.0":
version "2.7.0"
resolved "https://registry.nlark.com/@bbob/plugin-helper/download/@bbob/plugin-helper-2.7.0.tgz#e24f4a103a2b4daa71674d751af766c791d1d570"
integrity sha1-4k9KEDorTapxZ011Gvdmx5HR1XA=
"@types/prop-types@*":
version "15.7.4"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.4.tgz#fcf7205c25dff795ee79af1e30da2c9790808f11"
integrity sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==
"@types/react-highlight@^0.12.5":
version "0.12.5"
resolved "https://registry.yarnpkg.com/@types/react-highlight/-/react-highlight-0.12.5.tgz#b2af7ca998247b0bc7859b674552df97b366c3b1"
integrity sha512-P8+mTxltxDdQ+99l+pjn40clziSbNrZy5d5zmvG+j3jKzokAhCoCZlIRmmnFgETTYubuqwKjvXSlvesBZcTfvQ==
dependencies:
"@types/react" "*"
"@types/react@*":
version "17.0.34"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.34.tgz#797b66d359b692e3f19991b6b07e4b0c706c0102"
integrity sha512-46FEGrMjc2+8XhHXILr+3+/sTe3OfzSPU9YGKILLrUYbQ1CLQC9Daqo1KzENGXAWwrFwiY0l4ZbF20gRvgpWTg==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"
"@types/scheduler@*":
version "0.16.2"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39"
integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==
csstype@^3.0.2:
version "3.0.9"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.9.tgz#6410af31b26bd0520933d02cbc64fce9ce3fbf0b"
integrity sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw==
highlight.js@^10.5.0:
version "10.7.3"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.3.tgz#697272e3991356e40c3cac566a74eef681756531"
integrity sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==
ip-regex@^4.1.0:
version "4.3.0"
resolved "https://registry.nlark.com/ip-regex/download/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5"
integrity sha1-aHJ1qw9X+naXj/j03dyKI9WZDbU=
react-highlight@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/react-highlight/-/react-highlight-0.14.0.tgz#5aefa5518baa580f96b68d48129d7a5d2dc0c9ef"
integrity sha512-kWE+KXOXidS7SABhVopOgMnowbI3RAfeGZbnrduLNlWrYAED8sycL9l/Fvw3w0PFpIIawB7mRDnyhDcM/cIIGA==
dependencies:
highlight.js "^10.5.0"
tlds@^1.203.0:
version "1.221.1"
resolved "https://registry.nlark.com/tlds/download/tlds-1.221.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftlds%2Fdownload%2Ftlds-1.221.1.tgz#6cf6bff5eaf30c5618c5801c3f425a6dc61ca0ad"
integrity sha1-bPa/9erzDFYYxYAcP0JabcYcoK0=
url-regex@^5.0.0:
version "5.0.0"
resolved "https://registry.npm.taobao.org/url-regex/download/url-regex-5.0.0.tgz#8f5456ab83d898d18b2f91753a702649b873273a"
integrity sha1-j1RWq4PYmNGLL5F1OnAmSbhzJzo=
dependencies:
ip-regex "^4.1.0"
tlds "^1.203.0"

@ -1,27 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@popperjs/core@^2.9.2":
version "2.10.1"
resolved "https://registry.nlark.com/@popperjs/core/download/@popperjs/core-2.10.1.tgz#728ecd95ab207aab8a9a4e421f0422db329232be"
integrity sha1-co7NlasgequKmk5CHwQi2zKSMr4=
deepmerge@^4.2.2:
version "4.2.2"
resolved "https://registry.npm.taobao.org/deepmerge/download/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955"
integrity sha1-RNLqNnm49NT/ujPwPYZfwee/SVU=
shepherd.js@^8.3.1:
version "8.3.1"
resolved "https://registry.nlark.com/shepherd.js/download/shepherd.js-8.3.1.tgz#131eeefc5eb2bc44c9e23d0da139db46b2b55339"
integrity sha1-Ex7u/F6yvETJ4j0NoTnbRrK1Uzk=
dependencies:
"@popperjs/core" "^2.9.2"
deepmerge "^4.2.2"
smoothscroll-polyfill "^0.4.4"
smoothscroll-polyfill@^0.4.4:
version "0.4.4"
resolved "https://registry.nlark.com/smoothscroll-polyfill/download/smoothscroll-polyfill-0.4.4.tgz#3a259131dc6930e6ca80003e1cb03b603b69abf8"
integrity sha1-OiWRMdxpMObKgAA+HLA7YDtpq/g=

@ -1,15 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
js-base64@^3.6.0:
version "3.6.1"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.6.1.tgz#555aae398b74694b4037af1f8a5a6209d170efbe"
integrity sha512-Frdq2+tRRGLQUIQOgsIGSCd1VePCS2fsddTG5dTCqR0JHgltXWfsxnY0gIXPoMeRmdom6Oyq+UMOFg5suduOjQ==
miao-lang@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/miao-lang/-/miao-lang-1.0.3.tgz#276999788f6eee2b600db66a0d72b3f53bcbd6ab"
integrity sha512-AXxAKfRUSFwvF0RMJ8qkUtUbVHdNqGA71k+4/38ikh2mK1iRoiDueuTannVF+9NqzSXi770GKMuGEFXu/+Ithg==
dependencies:
js-base64 "^3.6.0"

@ -1,4 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

@ -1,4 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

@ -1,4 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

@ -1,4 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1

@ -1,24 +0,0 @@
const fs = require('fs-extra');
const glob = require('glob');
const path = require('path');
const execa = require('execa');
const pluginDirs = glob.sync(path.join(__dirname, './com.msgbyte.*'));
console.log(`开始安装插件依赖:\n${pluginDirs.join('\n')}`);
Promise.all(
pluginDirs.map((dir) =>
execa('yarn', {
cwd: dir,
stdout: 'inherit',
stderr: 'inherit',
})
)
)
.then(() => {
console.log('插件依赖安装完毕');
})
.catch((err) => {
console.error('插件依赖安装失败:', err);
});

@ -4,7 +4,6 @@ import { TcProvider, useColorScheme, useLanguage } from 'tailchat-shared';
import clsx from 'clsx';
import { Loadable } from './components/Loadable';
import { ConfigProvider as AntdProvider } from 'antd';
import { parseColorScheme } from './utils/color-scheme-helper';
import { Helmet } from 'react-helmet';
import { useRecordMeasure } from './utils/measure-helper';
import { getPopupContainer, preventDefault } from './utils/dom-helper';

@ -1,5 +1,5 @@
import { useCallback, useRef } from 'react';
import { showToasts, t, GroupPanel as GroupPanelInfo } from 'tailchat-shared';
import { showToasts, GroupPanel as GroupPanelInfo } from 'tailchat-shared';
import type { NodeDragEventParams } from 'rc-tree/lib/contextTypes';
import type { DataNode, EventDataNode } from 'antd/lib/tree';
import type { Key } from 'rc-tree/lib/interface';

@ -1 +1,21 @@
// mock
jest.mock('tailchat-shared/i18n');
jest.mock('@iconify/react', () => ({
Icon: ({ icon }) => `[iconify icon="${icon}"]`,
}));
jest.mock('../src/components/Loadable');
const ignoreErroMessages = [
/Warning.*not wrapped in act/,
/PluginManifest validation/,
];
// https://github.com/testing-library/react-testing-library#suppressing-unnecessary-warnings-on-react-dom-168
const originalError = console.error;
console.error = (...args) => {
if (ignoreErroMessages.some((re) => re.test(args[0]))) {
return;
}
originalError.call(console, ...args);
};

12046
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save