@form8ion/core

中文文档
4.11.3发布于 2026/10/05MITESM + CJS构建来源已验证近 30 天下载 6.9万

core logic for form8ion tools

原始使用文档
文档目录9 节
  1. Table of Contents
  2. Usage
  3. Installation
  4. Example
  5. API
  6. Constants
  7. Contributing
  8. Dependencies
  9. Verification

core

core logic for form8ion tools

Codecov Node CI Workflow Status SLSA Level 2

Table of Contents

Usage

MIT license npm Try @form8ion/core on RunKit node

Installation

$ npm install @form8ion/core --save-prod

Example

import {directoryExists, fileExists} from '@form8ion/core';

(async () => {
  await fileExists('path/to/some/expected/file');
  await directoryExists('path/to/some/expected/directory');
})();

API

fileExists

wrapper around fs.promises.stat() to determine whether a file exists at a given path.

directoryExists

wrapper around fs.promises.stat() to determine whether a directory exists at a given path.

validateOptions

Validates provided options against a joi schema.

schema (required)

joi schema

options (required)

options to compare to the provided schema

applyEnhancers

Processes scaffolding results by applying a list of enhancers (lifters) as a chain, returning the enhanced results. Each enhancer is applied conditionally, based on the results of the predicate supplied with each enhancer.

Takes a single options object as an argument, containing:

results object (required)

Result object from scaffolder execution

enhancers array (required)

List of plugins with lift and test properties for processing the provided results. The test property is a predicate that determines if the enhancer is applicable to the current project. The lift property processes the results if the test predicate returns true.

options object (required)

Options to be provided to the test and lift functions of each enhancer.

writeConfigFile

Writes a config file to the file system in the chosen format

Takes a single options object as an argument, containing:

path string (required)

Path to the folder (without a trailing slash) that will contain the file to be written

name string (required)

Name of the file (without an extension)

config object (required)

The config details to be written to the file

format string (required)

The format for the config file to be written in. The formats from the fileTypes constants that are currently supported include fileTypes.JSON and fileTypes.YAML.

An error is thrown for unsupported formats.

Constants

fileTypes

Constants defined to describe file types used in various form8ion tools

Contributing

PRs Welcome Conventional Commits Commitizen friendly semantic-release Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test

版本与发布记录

@form8ion/core 共发布 68 个版本,首次发布于 2020/07/07;过去 12 个月发布了 19 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
4.11.3latest2026/10/051 个月前
4.11.22026/06/135 个月前
5.0.0-beta.15beta2026/06/115 个月前
5.0.0-beta.142026/06/105 个月前
5.0.0-beta.132026/06/035 个月前
5.0.0-beta.122026/06/025 个月前

其他发布通道:alpha → 2.0.0-alpha.2,release-3.x → 3.3.0,beta → 5.0.0-beta.15。

关于 @form8ion/core 的常见问题

@form8ion/core 是什么?

core logic for form8ion tools

如何安装 @form8ion/core?

在项目目录运行 npm install @form8ion/core,或使用 pnpm add / yarn add / bun add。

@form8ion/core 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/form8ion__core 是否存在。

@form8ion/core 支持 ESM 还是 CommonJS?

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

@form8ion/core 需要什么版本的 Node.js?

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

@form8ion/core 可以商用吗?

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

@form8ion/core 的下载量有多少?

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

@form8ion/core 还在维护吗?

最新版本 4.11.3 发布于 2026/10/05(1 个月前);至今共发布 68 个版本,其中过去 12 个月发布了 19 个;首次发布于 2020/07/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。