@gluestack/ui-project-detector

中文文档
0.1.1发布于 2023/04/26MITTypeScriptESM + CJS零依赖近 30 天下载 1万

Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.

原始使用文档
文档目录13 节
  1. Commands
  2. Configuration
  3. Jest
  4. Bundle Analysis
  5. Rollup
  6. TypeScript
  7. Continuous Integration
  8. GitHub Actions
  9. Optimizations
  10. Module Formats
  11. Named Exports
  12. Including Styles
  13. Publishing to NPM

TSDX User Guide

Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.

This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use ts-node-dev, plain ts-node, or simple tsc.

If you’re new to TypeScript, checkout this handy cheatsheet

Commands

TSDX scaffolds your new library inside /src.

To run TSDX, use:

npm start # or yarn start

This builds to /dist and runs the project in watch mode so any edits you save inside src causes a rebuild to /dist.

To do a one-off build, use npm run build or yarn build.

To run tests, use npm test or yarn test.

Configuration

Code quality is set up for you with prettier, husky, and lint-staged. Adjust the respective fields in package.json accordingly.

Jest

Jest tests are set up to run with npm test or yarn test.

Bundle Analysis

size-limit is set up to calculate the real cost of your library with npm run size and visualize the bundle with npm run analyze.

Setup Files

This is the folder structure we set up for you:

/src
  index.tsx       # EDIT THIS
/test
  blah.test.tsx   # EDIT THIS
.gitignore
package.json
README.md         # EDIT THIS
tsconfig.json

Rollup

TSDX uses Rollup as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.

TypeScript

tsconfig.json is set up to interpret dom and esnext types, as well as react for jsx. Adjust according to your needs.

Continuous Integration

GitHub Actions

Two actions are added by default:

  • main which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
  • size which comments cost comparison of your library on every pull request using size-limit

Optimizations

Please see the main tsdx optimizations docs. In particular, know that you can take advantage of development-only optimizations:

// ./types/index.d.ts
declare var __DEV__: boolean;

// inside your code...
if (__DEV__) {
  console.log('foo');
}

You can also choose to install and use invariant and warning functions.

Module Formats

CJS, ESModules, and UMD module formats are supported.

The appropriate paths are configured in package.json and dist/index.js accordingly. Please report if any issues are found.

Named Exports

Per Palmer Group guidelines, always use named exports. Code split inside your React app instead of your React library.

Including Styles

There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.

For vanilla CSS, you can include it at the root directory and add it to the files section in your package.json, so that it can be imported separately by your users and run through their bundler's loader.

Publishing to NPM

We recommend using np.

版本与发布记录

@gluestack/ui-project-detector 共发布 11 个版本,首次发布于 2023/02/03;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.1latest2023/04/263 年前
0.1.0-alpha.2next2023/04/253 年前
0.1.0-alpha.12023/04/253 年前
0.1.02023/02/093 年前
0.0.72023/02/093 年前
0.0.62023/02/093 年前

关于 @gluestack/ui-project-detector 的常见问题

@gluestack/ui-project-detector 是什么?

Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.

如何安装 @gluestack/ui-project-detector?

在项目目录运行 npm install @gluestack/ui-project-detector,或使用 pnpm add / yarn add / bun add。

@gluestack/ui-project-detector 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gluestack/ui-project-detector 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@gluestack/ui-project-detector 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=10。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@gluestack/ui-project-detector 可以商用吗?

@gluestack/ui-project-detector 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@gluestack/ui-project-detector 的下载量有多少?

根据 npm 官方下载统计,@gluestack/ui-project-detector 在 2026/10/17 – 2026/11/15 这 30 天内被下载 10,359 次,日均约 345 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gluestack/ui-project-detector 还在维护吗?

最新版本 0.1.1 发布于 2023/04/26(3 年前);至今共发布 11 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/02/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。