refactor: 重构 zip 管理逻辑

pull/29/head
954270063@qq.com 2021-06-04 09:57:36 +08:00
parent 04d0642806
commit cd64e87f52
12 changed files with 1331 additions and 18 deletions

View File

@ -3,6 +3,4 @@
# pkgName=$(cat ../package.json .name | sed 's/\"//g')
yarn build:zip
git add dist.zip
yarn lint-staged

View File

@ -11,7 +11,7 @@ import {
} from '../../src/helpers/is';
describe('对 src/helpers/is.ts 进行测试', () => {
it('测试 isArray() 执行结果是否符合预期', () => {
it('测试 isArray() 执行结果是否符合预期', () => {
expect(isArray([0])).toBe(true);
expect(isArray([])).toBe(true);
expect(isArray({})).toBe(false);
@ -21,7 +21,7 @@ describe('对 src/helpers/is.ts 进行测试', () => {
expect(isArray(null)).toBe(false);
});
it('测试 isDate() 执行结果是否符合预期', () => {
it('测试 isDate() 执行结果是否符合预期', () => {
expect(isDate(new Date())).toBe(true);
expect(isDate({})).toBe(false);
expect(isDate([])).toBe(false);
@ -31,7 +31,7 @@ describe('对 src/helpers/is.ts 进行测试', () => {
expect(isDate(null)).toBe(false);
});
it('测试 isEmptyArray() 执行结果是否符合预期', () => {
it('测试 isEmptyArray() 执行结果是否符合预期', () => {
expect(isEmptyArray([])).toBe(true);
expect(isEmptyArray([0])).toBe(false);
expect(isEmptyArray({})).toBe(false);
@ -41,7 +41,7 @@ describe('对 src/helpers/is.ts 进行测试', () => {
expect(isEmptyArray(null)).toBe(false);
});
it('测试 isEmptyObject() 执行结果是否符合预期', () => {
it('测试 isEmptyObject() 执行结果是否符合预期', () => {
expect(isEmptyObject({})).toBe(true);
expect(isEmptyObject({ a: 0 })).toBe(false);
expect(isEmptyObject([0])).toBe(false);
@ -52,7 +52,7 @@ describe('对 src/helpers/is.ts 进行测试', () => {
expect(isEmptyObject(null)).toBe(false);
});
it('测试 isFunction 执行结果是否符合预期', () => {
it('测试 isFunction() 执行结果是否符合预期', () => {
expect(
isFunction(() => {
return;
@ -71,7 +71,7 @@ describe('对 src/helpers/is.ts 进行测试', () => {
expect(isFunction(null)).toBe(false);
});
it('测试 isNull() 执行结果是否符合预期', () => {
it('测试 isNull() 执行结果是否符合预期', () => {
expect(isNull(null)).toBe(true);
expect(isNull({ a: 0 })).toBe(false);
expect(isNull([0])).toBe(false);
@ -81,7 +81,7 @@ describe('对 src/helpers/is.ts 进行测试', () => {
expect(isNull(undefined)).toBe(false);
});
it('测试 isPlainObject() 执行结果是否符合预期', () => {
it('测试 isPlainObject() 执行结果是否符合预期', () => {
expect(isPlainObject({})).toBe(true);
expect(isPlainObject({ a: 0 })).toBe(true);
expect(isPlainObject([0])).toBe(false);
@ -92,7 +92,7 @@ describe('对 src/helpers/is.ts 进行测试', () => {
expect(isPlainObject(null)).toBe(false);
});
it('测试 isString() 执行结果是否符合预期', () => {
it('测试 isString() 执行结果是否符合预期', () => {
expect(isString('')).toBe(true);
expect(isString({})).toBe(false);
expect(isString({ a: 0 })).toBe(false);
@ -103,7 +103,7 @@ describe('对 src/helpers/is.ts 进行测试', () => {
expect(isString(null)).toBe(false);
});
it('测试 isUndefined() 执行结果是否符合预期', () => {
it('测试 isUndefined() 执行结果是否符合预期', () => {
expect(isUndefined(undefined)).toBe(true);
expect(isUndefined('')).toBe(false);
expect(isUndefined({})).toBe(false);

View File

@ -27,7 +27,7 @@ describe('对 src/helpers/url.ts 进行测试', () => {
);
});
it('测试 combineURL() 执行结果是否正确', () => {
it('测试 combineURL() 执行结果是否符合预期', () => {
expect(combineURL('https://www.server.com', 'api')).toBe(
'https://www.server.com/api',
);
@ -39,7 +39,7 @@ describe('对 src/helpers/url.ts 进行测试', () => {
);
});
it('测试 dynamicInterpolation() 执行结果是否正确', () => {
it('测试 dynamicInterpolation() 执行结果是否符合预期', () => {
expect(
dynamicInterpolation('https://www.server.com/api/user/:id', {
id: 1,

BIN
dist.zip

Binary file not shown.

BIN
download/v2.0.0-rc-1.zip Normal file

Binary file not shown.

View File

@ -37,7 +37,7 @@ const banner = `/**
* @description ${pkg.description}
* @date ${dayjs().format('YYYY-MM-DD')}
* @author ${pkg.author}
* @github ${pkg.repository.url}
* @github ${pkg.repository.url.replace('git+', '')}
* @issues ${pkg.bugs.url}
*/`;

View File

@ -8,7 +8,7 @@ const pkg = require('../package.json');
const zip = archiver('zip');
const distPath = path.resolve(__dirname, '..', 'dist');
const distZipName = 'dist.zip';
const distZipName = `download/${pkg.version}.zip`;
const distZipPath = path.resolve(__dirname, '..', distZipName);
console.log();

View File

@ -67,6 +67,7 @@ export interface AxiosAdapterUpload {
export interface AxiosAdapterDownload {
(config: AxiosAdapterDownloadOptions): AxiosAdapterTask | void;
}
export interface AxiosPlatform {
request: AxiosAdapterRequest;
upload: AxiosAdapterUpload;

View File

@ -1,15 +1,15 @@
import axios from './axios';
export {
export type {
AxiosRequestConfig,
AxiosRequestFormData,
AxiosResponse,
AxiosResponseError,
} from './core/Axios';
export {
export type {
AxiosAdapterRequestConfig,
AxiosAdapter,
AxiosPlatform,
} from './core/adapter';
export { AxiosInstance, AxiosStatic } from './axios';
export type { AxiosInstance, AxiosStatic } from './axios';
export default axios;

1
website/docs/index.md Normal file
View File

@ -0,0 +1 @@
# Hello VitePress

14
website/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "website",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:serve": "vitepress serve docs"
},
"devDependencies": {
"vitepress": "^0.14.0"
}
}

1299
website/yarn.lock Normal file

File diff suppressed because it is too large Load Diff