Skip to content

Commit

Permalink
feat: 新增 fetch 包
Browse files Browse the repository at this point in the history
  • Loading branch information
lzxb committed Dec 10, 2024
1 parent 6d5326f commit e336b9f
Show file tree
Hide file tree
Showing 9 changed files with 523 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/fetch/.stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.root
node_modules
*_back
dist
types
**/i18n/**
.rpt2_cache
**.log
coverage
.idea
.git
template
public
5 changes: 5 additions & 0 deletions packages/fetch/.stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Delete this comment line, the template will no longer be written
export default {
extends: [import.meta.resolve('@gez/lint/css')],
rules: {}
};
122 changes: 122 additions & 0 deletions packages/fetch/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
"vcs": {
"enabled": false
},
"overrides": [
{
"include": [
"*.vue"
],
"linter": {
"rules": {
"style": {
"useConst": "off",
"useImportType": "off"
}
}
}
}
],
"files": {
"ignoreUnknown": false,
"ignore": [
"node_modules/**/*",
"node_modules_back/**/*",
"dist/**/*",
"types/**/*",
".rpt2_cache/**/*",
"coverage/**/*",
".idea/**/*",
".git/**/*",
"public/**/*",
".root/**/*",
"**/i18n/**",
"**/svg-icons.ts",
"build.config.ts",
"*.min.js"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 4
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noEmptyInterface": "off",
"noExplicitAny": "off",
"noAssignInExpressions": "off",
"useGetterReturn": "warn",
"noGlobalIsNan": "warn",
"noImplicitAnyLet": "warn",
"noShadowRestrictedNames": "warn",
"useIsArray": "warn",
"noThenProperty": "warn"
},
"security": {
"noGlobalEval": "warn"
},
"complexity": {
"noForEach": "off",
"noThisInStatic": "off",
"noBannedTypes": "off",
"useOptionalChain": "warn",
"noUselessConstructor": "warn",
"noUselessSwitchCase": "warn",
"noStaticOnlyClass": "warn"
},
"style": {
"useFilenamingConvention": {
"level": "warn",
"options": {
"strictCase": true,
"requireAscii": true,
"filenameCases": [
"kebab-case"
]
}
},
"useExponentiationOperator": "off",
"noUselessElse": "off",
"useTemplate": "off",
"noUnusedTemplateLiteral": "off",
"noNonNullAssertion": "off",
"noParameterAssign": "off",
"noArguments": "warn",
"useNodejsImportProtocol": "warn",
"useDefaultParameterLast": "warn"
},
"performance": {
"noDelete": "warn",
"noAccumulatingSpread": "warn"
},
"correctness": {
"noUnsafeOptionalChaining": "warn",
"noVoidTypeReturn": "warn"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "none"
}
},
"json": {
"formatter": {
"enabled": false
}
},
"css": {
"formatter": {
"enabled": false
}
}
}
18 changes: 18 additions & 0 deletions packages/fetch/build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Template generation, do not manually modify
import { defineBuildConfig } from 'unbuild';

export default defineBuildConfig({
clean: true,
entries: [
{
input: './src/',
format: 'esm',
ext: 'mjs',
cleanDist: true,
declaration: true,
esbuild: {
target: 'node22'
}
}
]
});
43 changes: 43 additions & 0 deletions packages/fetch/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "@gez/fetch",
"template": "library-node",
"scripts": {
"lint:css": "stylelint '**/*.{css,vue}' --fix --aei",
"lint:type": "tsc --noEmit",
"test": "vitest --pass-with-no-tests",
"coverage": "vitest run --coverage --pass-with-no-tests",
"lint:js": "biome check --write --no-errors-on-unmatched",
"build": "unbuild"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@gez/lint": "3.0.0-beta.27",
"@types/cli-progress": "^3.11.6",
"@types/node": "22.9.0",
"@vitest/coverage-v8": "2.1.5",
"axios": "^1.7.7",
"cli-progress": "^3.12.0",
"stylelint": "16.10.0",
"typescript": "5.6.3",
"unbuild": "2.0.0",
"vitest": "2.1.5"
},
"version": "0.0.0",
"type": "module",
"private": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
},
"module": "dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"src",
"dist",
"*.mjs",
"template",
"public"
]
}
12 changes: 12 additions & 0 deletions packages/fetch/src/fetch.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { test } from 'vitest';
import { fetchPkgsWithProgress } from '.';

test('base', async () => {
await fetchPkgsWithProgress({
baseURL: 'https://dp-os.github.io/gez/',
urls: ['ssr-html/versions/latest.tgz', 'ssr-html/versions/1.0.tgz'],
timeout: 4500
}).then((...args) => {
console.log(...args);
});
}, 5000);
Loading

0 comments on commit e336b9f

Please sign in to comment.