From c67e86e4e782e5eaba6d5ed68f93cc87dc035ad6 Mon Sep 17 00:00:00 2001 From: HoMeTown Date: Thu, 27 Jun 2024 18:57:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=9D=E5=A7=8B=E5=8C=96font-slim?= =?UTF-8?q?=E5=B7=A5=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/FUNDING.yml | 2 + .github/workflows/ci.yml | 87 +++++++++++ .github/workflows/release.yml | 29 ++++ .gitignore | 11 ++ .npmrc | 2 + .vscode/settings.json | 280 ++++++++++++++++++++++++++++++++++ LICENSE | 21 +++ build.config.ts | 12 ++ eslint.config.js | 18 +++ package.json | 73 +++++++++ pnpm-workspace.yaml | 5 + src/index.ts | 2 + test/index.test.ts | 7 + tsconfig.json | 14 ++ 14 files changed, 563 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 .vscode/settings.json create mode 100644 LICENSE create mode 100644 build.config.ts create mode 100644 eslint.config.js create mode 100644 package.json create mode 100644 pnpm-workspace.yaml create mode 100644 src/index.ts create mode 100644 test/index.test.ts create mode 100644 tsconfig.json diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..0924a7e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: [antfu] +opencollective: antfu diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d53d872 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,87 @@ +name: CI + +on: + push: + branches: + - main + + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v3 + + - name: Set node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Setup + run: npm i -g @antfu/ni + + - name: Install + run: nci + + - name: Lint + run: nr lint + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v3 + + - name: Set node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Setup + run: npm i -g @antfu/ni + + - name: Install + run: nci + + - name: Typecheck + run: nr typecheck + + test: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + node: [lts/*] + os: [ubuntu-latest, windows-latest, macos-latest] + fail-fast: false + + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v3 + + - name: Set node ${{ matrix.node }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + + - name: Setup + run: npm i -g @antfu/ni + + - name: Install + run: nci + + - name: Build + run: nr build + + - name: Test + run: nr test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6e63087 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Release + +permissions: + contents: write + +on: + push: + tags: + - 'v*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v3 + + - name: Set node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - run: npx changelogithub + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..95f9ee9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +.cache +.DS_Store +.idea +*.log +*.tgz +coverage +dist +lib-cov +logs +node_modules +temp diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..7969496 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +ignore-workspace-root-check=true +shell-emulator=true diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2cf93e8 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,280 @@ +{ + // ========== Visuals ========== + "editor.cursorSmoothCaretAnimation": "on", + "editor.fontFamily": "Input Mono, monospace", + "editor.guides.bracketPairs": "active", + "editor.lineNumbers": "interval", + "editor.renderWhitespace": "boundary", + "window.autoDetectColorScheme": true, + "workbench.colorTheme": "Vitesse Dark", + "workbench.editor.tabActionLocation": "left", + "workbench.fontAliasing": "antialiased", + "workbench.iconTheme": "catppuccin-mocha", + "workbench.list.smoothScrolling": true, + "workbench.preferredDarkColorTheme": "Vitesse Dark", + "workbench.preferredLightColorTheme": "Vitesse Dark", + "workbench.productIconTheme": "icons-carbon", + "workbench.sideBar.location": "right", + "workbench.startupEditor": "newUntitledFile", + "workbench.tree.expandMode": "singleClick", + "workbench.tree.indent": 10, + + // ========== Editor ========== + "debug.onTaskErrors": "debugAnyway", + "diffEditor.ignoreTrimWhitespace": false, + "editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?", + "editor.find.addExtraSpaceOnTop": false, + "editor.inlineSuggest.enabled": true, + "editor.multiCursorModifier": "ctrlCmd", + "editor.suggestSelection": "first", + "editor.tabSize": 2, + "editor.unicodeHighlight.invisibleCharacters": false, + "editor.stickyScroll.enabled": true, + "editor.hover.sticky": true, + "editor.codeActionsOnSave": { + "source.fixAll": "never", + "source.fixAll.eslint": "explicit", + "source.organizeImports": "never" + }, + "explorer.confirmDelete": false, + "explorer.confirmDragAndDrop": false, + "files.eol": "\n", + "files.insertFinalNewline": true, + "files.simpleDialog.enable": true, + "git.autofetch": true, + "git.confirmSync": false, + "git.enableSmartCommit": true, + "git.untrackedChanges": "separate", + "scm.diffDecorationsGutterWidth": 2, + "terminal.integrated.cursorBlinking": true, + "terminal.integrated.cursorStyle": "line", + "terminal.integrated.fontWeight": "300", + "terminal.integrated.persistentSessionReviveProcess": "never", + "terminal.integrated.tabs.enabled": true, + "workbench.editor.closeOnFileDelete": true, + "workbench.editor.highlightModifiedTabs": true, + "workbench.editor.limit.enabled": true, + "workbench.editor.limit.perEditorGroup": true, + "workbench.editor.limit.value": 5, + "search.exclude": { + "**/*.snap": true, + "**/*.svg": true, + "**/.git": true, + "**/.github": false, + "**/.nuxt": true, + "**/.output": true, + "**/.pnpm": true, + "**/.vscode": true, + "**/.yarn": true, + "**/assets": true, + "**/bower_components": true, + "**/dist/**": true, + "**/logs": true, + "**/node_modules": true, + "**/out/**": true, + "**/package-lock.json": true, + "**/pnpm-lock.yaml": true, + "**/public": true, + "**/temp": true, + "**/yarn.lock": true, + "**/CHANGELOG*": true, + "**/LICENSE*": true, + }, + + // ========== Global Level Config, needs to put in User Settings ========== + "window.dialogStyle": "custom", + "window.nativeTabs": true, // this is great, macOS only + "window.title": "${rootName}", // this make tabs more readable + "window.titleBarStyle": "custom", + "extensions.autoUpdate": "onlyEnabledExtensions", + + // ========== Extension configs ========== + "emmet.showSuggestionsAsSnippets": true, + "emmet.triggerExpansionOnTab": false, + "errorLens.enabledDiagnosticLevels": [ + "warning", + "error" + ], + "errorLens.excludeBySource": [ + "cSpell", + "Grammarly", + "eslint" + ], + + // ESLint config: https://github.com/antfu/eslint-config + "eslint.codeAction.showDocumentation": { + "enable": true + }, + "eslint.quiet": true, + // Silent the stylistic rules in you IDE, but still auto fix them + "eslint.rules.customizations": [ + { "rule": "style/*", "severity": "off" }, + { "rule": "format/*", "severity": "off" }, + { "rule": "*-indent", "severity": "off" }, + { "rule": "*-spacing", "severity": "off" }, + { "rule": "*-spaces", "severity": "off" }, + { "rule": "*-order", "severity": "off" }, + { "rule": "*-dangle", "severity": "off" }, + { "rule": "*-newline", "severity": "off" }, + { "rule": "*quotes", "severity": "off" }, + { "rule": "*semi", "severity": "off" } + ], + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "html", + "markdown", + "json", + "jsonc", + "yaml", + "toml" + ], + + "github.copilot.enable": { + "*": true, + "markdown": true, + "plaintext": false, + }, + "cSpell.allowCompoundWords": true, + "cSpell.language": "en,en-US", + "css.lint.hexColorLength": "ignore", + "githubIssues.workingIssueFormatScm": "#${issueNumberLabel}", + "githubPullRequests.fileListLayout": "tree", + "gitlens.codeLens.authors.enabled": false, + "gitlens.codeLens.enabled": false, + "gitlens.codeLens.recentChange.enabled": false, + "gitlens.menus": { + "editor": { + "blame": false, + "clipboard": true, + "compare": true, + "history": false, + "remote": false + }, + "editorGroup": { + "blame": true, + "compare": false + }, + "editorTab": { + "clipboard": true, + "compare": true, + "history": true, + "remote": true + }, + "explorer": { + "clipboard": true, + "compare": true, + "history": true, + "remote": true + }, + "scm": { + "authors": true + }, + "scmGroup": { + "compare": true, + "openClose": true, + "stash": true + }, + "scmGroupInline": { + "stash": true + }, + "scmItem": { + "clipboard": true, + "compare": true, + "history": true, + "remote": false, + "stash": true + } + }, + "i18n-ally.autoDetection": false, + "i18n-ally.displayLanguage": "en", + "i18n-ally.ignoredLocales": [], + "iconify.annotations": true, + "iconify.inplace": true, + "svg.preview.mode": "svg", + + // I only use Prettier for manually formatting + "prettier.enable": false, + "prettier.printWidth": 200, + "prettier.semi": false, + "prettier.singleQuote": true, + + // ========== File Nesting ========== + // this might not be up to date with the repo, please check yourself + // https://github.com/antfu/vscode-file-nesting-config + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.expand": false, + "explorer.fileNesting.patterns": { + "*.asax": "$(capture).*.cs, $(capture).*.vb", + "*.ascx": "$(capture).*.cs, $(capture).*.vb", + "*.ashx": "$(capture).*.cs, $(capture).*.vb", + "*.aspx": "$(capture).*.cs, $(capture).*.vb", + "*.bloc.dart": "$(capture).event.dart, $(capture).state.dart", + "*.c": "$(capture).h", + "*.cc": "$(capture).hpp, $(capture).h, $(capture).hxx", + "*.cjs": "$(capture).cjs.map, $(capture).*.cjs, $(capture)_*.cjs", + "*.component.ts": "$(capture).component.html, $(capture).component.spec.ts, $(capture).component.css, $(capture).component.scss, $(capture).component.sass, $(capture).component.less", + "*.cpp": "$(capture).hpp, $(capture).h, $(capture).hxx", + "*.cs": "$(capture).*.cs", + "*.cshtml": "$(capture).cshtml.cs", + "*.csproj": "*.config, *proj.user, appsettings.*, bundleconfig.json", + "*.css": "$(capture).css.map, $(capture).*.css", + "*.cxx": "$(capture).hpp, $(capture).h, $(capture).hxx", + "*.dart": "$(capture).freezed.dart, $(capture).g.dart", + "*.ex": "$(capture).html.eex, $(capture).html.heex, $(capture).html.leex", + "*.go": "$(capture)_test.go", + "*.java": "$(capture).class", + "*.js": "$(capture).js.map, $(capture).*.js, $(capture)_*.js", + "*.jsx": "$(capture).js, $(capture).*.jsx, $(capture)_*.js, $(capture)_*.jsx", + "*.master": "$(capture).*.cs, $(capture).*.vb", + "*.mjs": "$(capture).mjs.map, $(capture).*.mjs, $(capture)_*.mjs", + "*.module.ts": "$(capture).resolver.ts, $(capture).controller.ts, $(capture).service.ts", + "*.pubxml": "$(capture).pubxml.user", + "*.resx": "$(capture).*.resx, $(capture).designer.cs, $(capture).designer.vb", + "*.tex": "$(capture).acn, $(capture).acr, $(capture).alg, $(capture).aux, $(capture).bbl, $(capture).blg, $(capture).fdb_latexmk, $(capture).fls, $(capture).glg, $(capture).glo, $(capture).gls, $(capture).idx, $(capture).ind, $(capture).ist, $(capture).lof, $(capture).log, $(capture).lot, $(capture).out, $(capture).pdf, $(capture).synctex.gz, $(capture).toc, $(capture).xdv", + "*.ts": "$(capture).js, $(capture).d.ts.map, $(capture).*.ts, $(capture)_*.js, $(capture)_*.ts", + "*.tsx": "$(capture).ts, $(capture).*.tsx, $(capture)_*.ts, $(capture)_*.tsx", + "*.vbproj": "*.config, *proj.user, appsettings.*, bundleconfig.json", + "*.vue": "$(capture).*.ts, $(capture).*.js, $(capture).story.vue", + "*.xaml": "$(capture).xaml.cs", + "+layout.svelte": "+layout.ts,+layout.ts,+layout.js,+layout.server.ts,+layout.server.js,+layout.gql", + "+page.svelte": "+page.server.ts,+page.server.js,+page.ts,+page.js,+page.gql", + ".clang-tidy": ".clang-format, .clangd, compile_commands.json", + ".env": "*.env, .env.*, .envrc, env.d.ts", + ".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*", + ".project": ".classpath", + "//": "Last update at 4/29/2023, 2:04:58 PM", + "BUILD.bazel": "*.bzl, *.bazel, *.bazelrc, bazel.rc, .bazelignore, .bazelproject, WORKSPACE", + "CMakeLists.txt": "*.cmake, *.cmake.in, .cmake-format.yaml, CMakePresets.json", + "I*.cs": "$(capture).cs", + "artisan": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, server.php, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, webpack.mix.js, windi.config.*", + "astro.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "cargo.toml": ".clippy.toml, .rustfmt.toml, cargo.lock, clippy.toml, cross.toml, rust-toolchain.toml, rustfmt.toml", + "composer.json": ".php*.cache, composer.lock, phpunit.xml*, psalm*.xml", + "default.nix": "shell.nix", + "deno.json*": "*.env, .env.*, .envrc, api-extractor.json, deno.lock, env.d.ts, import-map.json, import_map.json, jsconfig.*, tsconfig.*, tsdoc.*", + "dockerfile": ".dockerignore, docker-compose.*, dockerfile*", + "flake.nix": "flake.lock", + "gatsby-config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, gatsby-browser.*, gatsby-node.*, gatsby-ssr.*, gatsby-transformer.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "gemfile": ".ruby-version, gemfile.lock", + "go.mod": ".air*, go.sum", + "go.work": "go.work.sum", + "mix.exs": ".credo.exs, .dialyzer_ignore.exs, .formatter.exs, .iex.exs, .tool-versions, mix.lock", + "next.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, next-env.d.ts, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "nuxt.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "package.json": ".browserslist*, .circleci*, .commitlint*, .cz-config.js, .czrc, .dlint.json, .dprint.json, .editorconfig, .eslint*, .firebase*, .flowconfig, .github*, .gitlab*, .gitpod*, .huskyrc*, .jslint*, .lintstagedrc*, .markdownlint*, .node-version, .nodemon*, .npm*, .nvmrc, .pm2*, .pnp.*, .pnpm*, .prettier*, .releaserc*, .sentry*, .simple-git-hooks*, .stackblitz*, .styleci*, .stylelint*, .tazerc*, .textlint*, .tool-versions, .travis*, .versionrc*, .vscode*, .watchman*, .xo-config*, .yamllint*, .yarnrc*, Procfile, apollo.config.*, appveyor*, azure-pipelines*, bower.json, build.config.*, commitlint*, crowdin*, dangerfile*, dlint.json, dprint.json, eslint*, firebase.json, grunt*, gulp*, jenkins*, lerna*, lint-staged*, nest-cli.*, netlify*, nodemon*, npm-shrinkwrap.json, nx.*, package-lock.json, package.nls*.json, phpcs.xml, pm2.*, pnpm*, prettier*, pullapprove*, pyrightconfig.json, release-tasks.sh, release.config.*, renovate*, rollup.config.*, rspack*, simple-git-hooks*, stylelint*, tslint*, tsup.config.*, turbo*, typedoc*, unlighthouse*, vercel*, vetur.config.*, webpack*, workspace.json, xo.config.*, yarn*", + "pubspec.yaml": ".metadata, .packages, all_lint_rules.yaml, analysis_options.yaml, build.yaml, pubspec.lock, pubspec_overrides.yaml", + "pyproject.toml": ".pdm.toml, pdm.lock, pyproject.toml", + "quasar.conf.js": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, quasar.extensions.json, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "readme*": "authors, backers*, changelog*, citation*, code_of_conduct*, codeowners, contributing*, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors*", + "remix.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, remix.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "rush.json": ".browserslist*, .circleci*, .commitlint*, .cz-config.js, .czrc, .dlint.json, .dprint.json, .editorconfig, .eslint*, .firebase*, .flowconfig, .github*, .gitlab*, .gitpod*, .huskyrc*, .jslint*, .lintstagedrc*, .markdownlint*, .node-version, .nodemon*, .npm*, .nvmrc, .pm2*, .pnp.*, .pnpm*, .prettier*, .releaserc*, .sentry*, .simple-git-hooks*, .stackblitz*, .styleci*, .stylelint*, .tazerc*, .textlint*, .tool-versions, .travis*, .versionrc*, .vscode*, .watchman*, .xo-config*, .yamllint*, .yarnrc*, Procfile, apollo.config.*, appveyor*, azure-pipelines*, bower.json, build.config.*, commitlint*, crowdin*, dangerfile*, dlint.json, dprint.json, eslint*, firebase.json, grunt*, gulp*, jenkins*, lerna*, lint-staged*, nest-cli.*, netlify*, nodemon*, npm-shrinkwrap.json, nx.*, package-lock.json, package.nls*.json, phpcs.xml, pm2.*, pnpm*, prettier*, pullapprove*, pyrightconfig.json, release-tasks.sh, release.config.*, renovate*, rollup.config.*, rspack*, simple-git-hooks*, stylelint*, tslint*, tsup.config.*, turbo*, typedoc*, unlighthouse*, vercel*, vetur.config.*, webpack*, workspace.json, xo.config.*, yarn*", + "shims.d.ts": "*.d.ts", + "svelte.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, houdini.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, mdsvex.config.js, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vite.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "vite.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*", + "vue.config.*": "*.env, .babelrc*, .codecov, .cssnanorc*, .env.*, .envrc, .htmlnanorc*, .lighthouserc.*, .mocha*, .postcssrc*, .terserrc*, api-extractor.json, ava.config.*, babel.config.*, contentlayer.config.*, cssnano.config.*, cypress.*, env.d.ts, formkit.config.*, formulate.config.*, histoire.config.*, htmlnanorc.*, jasmine.*, jest.config.*, jsconfig.*, karma*, lighthouserc.*, playwright.config.*, postcss.config.*, puppeteer.config.*, rspack.config.*, svgo.config.*, tailwind.config.*, tsconfig.*, tsdoc.*, uno.config.*, unocss.config.*, vitest.config.*, webpack.config.*, windi.config.*" + }, +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fdecb26 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 FEHHair + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/build.config.ts b/build.config.ts new file mode 100644 index 0000000..0bd008c --- /dev/null +++ b/build.config.ts @@ -0,0 +1,12 @@ +import { defineBuildConfig } from 'unbuild' + +export default defineBuildConfig({ + entries: [ + 'src/index', + ], + declaration: true, + clean: true, + rollup: { + emitCJS: true, + }, +}) diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..694a0e5 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,18 @@ +// @ts-check +import antfu from '@antfu/eslint-config' + +export default antfu( + { + ignores: [ + // eslint ignore globs here + 'node_modules', + '.vscode', + '.github', + ], + }, + { + rules: { + // overrides + }, + }, +) diff --git a/package.json b/package.json new file mode 100644 index 0000000..8bb72ca --- /dev/null +++ b/package.json @@ -0,0 +1,73 @@ +{ + "name": "font-slim", + "type": "module", + "version": "0.0.0", + "packageManager": "pnpm@9.1.1", + "description": "This project can help you extract some of the font files you want and reduce the volume of the font files in the project", + "author": "HoMeTown ", + "license": "MIT", + "funding": "https://github.com/sponsors/FEHHair", + "homepage": "https://github.com/FEHHair/FontSlim#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/FEHHair/FontSlim.git" + }, + "bugs": "https://github.com/FEHHair/FontSlim/issues", + "keywords": [], + "sideEffects": false, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + } + }, + "main": "./dist/index.mjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "./dist/*", + "./dist/index.d.ts" + ] + } + }, + "files": [ + "dist" + ], + "scripts": { + "build": "unbuild", + "dev": "unbuild --stub", + "lint": "eslint .", + "prepublishOnly": "nr build", + "release": "bumpp && npm publish", + "start": "esno src/index.ts", + "test": "vitest", + "typecheck": "tsc --noEmit", + "prepare": "simple-git-hooks" + }, + "devDependencies": { + "@antfu/eslint-config": "^2.18.1", + "@antfu/ni": "^0.21.12", + "@antfu/utils": "^0.7.8", + "@types/node": "^20.12.12", + "bumpp": "^9.4.1", + "eslint": "^9.3.0", + "esno": "^4.7.0", + "lint-staged": "^15.2.2", + "pnpm": "^9.1.1", + "rimraf": "^5.0.7", + "simple-git-hooks": "^2.11.1", + "typescript": "^5.4.5", + "unbuild": "^2.0.0", + "vite": "^5.2.11", + "vitest": "^1.6.0" + }, + "simple-git-hooks": { + "pre-commit": "pnpm lint-staged" + }, + "lint-staged": { + "*": "eslint --fix" + } +} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..cfd3c81 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,5 @@ +packages: + - playground + - docs + - packages/* + - examples/* diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..e1c8f2c --- /dev/null +++ b/src/index.ts @@ -0,0 +1,2 @@ +export const one = 1 +export const two = 2 diff --git a/test/index.test.ts b/test/index.test.ts new file mode 100644 index 0000000..401553c --- /dev/null +++ b/test/index.test.ts @@ -0,0 +1,7 @@ +import { describe, expect, it } from 'vitest' + +describe('should', () => { + it('exported', () => { + expect(1).toEqual(1) + }) +}) diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..745e9d6 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ESNext", + "lib": ["ESNext"], + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "strict": true, + "strictNullChecks": true, + "esModuleInterop": true, + "skipDefaultLibCheck": true, + "skipLibCheck": true + } +}