@form8ion/javascript-core

中文文档
13.0.1发布于 2026/08/16MITESM + CJS构建来源已验证近 30 天下载 1.8万

core logic for form8ion tools related to JavaScript, like javascript-scaffolder and lift-javascript

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

coverageShouldBeReported# javascript-core

core logic for form8ion tools related to JavaScript, like javascript-scaffolder and lift-javascript

Node CI Workflow Status Codecov SLSA Level 2 OpenSSF Scorecard

Table of Contents

Usage

MIT license npm node Try @form8ion/javascript-core on RunKit

Installation

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

Example

Import

const {scaffoldChoice} = require('@form8ion/javascript-core');

Execute

(async () => {
  await scaffoldChoice(
    {foo: {scaffold: options => options}},
    'foo',
    {bar: 'baz'}
  );
})();

API

scaffoldChoice

A generic function that executes the scaffolder function from a provided map of options based on the chosen option name.

Takes three unnamed arguments:

choices object (required)
  • keys: string Name of the choice
  • values: object
    • scaffolder: function (required) scaffolds the choice options
choice string (required)

Name of the choice. SHOULD match a key from the choices object.

options object (optional)

options object to be passed as the only argument to the chosen scaffolder

installDependencies

A function that installs the provided package dependencies.

Takes four unnamed arguments:

dependencies list of strings (required)

The list of package names to be installed.

dependenciesType string (required)

Defines if the provided list of package names should be installed as prod or dev dependencies. If "dev" is provided, the list will be installed with the --save-exact flag.

projectRoot string (optional)

Filesystem path to the root of the project

packageManger string (optional)

Specifies the name of the package manager to be used for dependency installation. Defaults to npm

Dependency-types Constants

Constants to define the valid options for dependenciesType

  • PROD_DEPENDENCY_TYPE
  • DEV_DEPENDENCY_TYPE

projectTypes

Constants defining the types of possible JavaScript projects

  • APPLICATION
  • PACKAGE
  • CLI

packageManagers

Constants defining the available package managers

  • NPM
  • YARN

dialects

Constants defining the available JavaScript source dialects

  • COMMON_JS
  • BABEL
  • ESM
  • TYPESCRIPT

projectTypeShouldBePublished

Predicate function to determine if the project-type is one that should be published

Takes one argument:

projectType string (required)

Should be one of the project-type options

coverageShouldBeReported

Predicate function to determine if coverage should be reported

Takes two arguments:

visibility string (required)

visibility of the project (Public or Private)

tests object (required)
  • unit boolean (optional) Whether the project will be unit-tested

writePackageJson

Writes the provided config to the package.json for the project

Accepts an options object as the only argument, with the following properties:

projectRoot string (required)

Filesystem path to the root of the project

config object (required)

The config to be written to the package.json as the entire contents of the file

mergeIntoExistingPackageJson

Merges the provided config into the existing package.json for the project

Accepts an options object as the only argument, with the following properties:

projectRoot string (required)

Filesystem path to the root of the project

config object (required)

The config to be merged with the existing contents of the package.json

Node version categories

Helpers for determining supported node.js versions in categories defined by package support guidelines. Refer to the release schedule for current statuses.

determineLtsNodeMajorVersions

Returns a list of the major LTS versions currently in active or maintenance status, optionally filtered by a provided semver range.

Accepts an options object as the only argument, with the following properties:

withinRange string (optional)

A semver range, compatible with node-semver, to filter the list of active major LTS versions by.

determineSupportedNodeMajorVersions

Returns a list of the major versions currently not in end-of-life status, optionally filtered by a provided semver range.

Accepts an options object as the only argument, with the following properties:

withinRange string (optional)

A semver range, compatible with node-semver, to filter the list of active major LTS versions by.

Contributing

PRs Welcome Conventional Commits Commitizen friendly semantic-release Renovate

Dependencies

$ nvm install
$ npm install

Verification

$ npm test

版本与发布记录

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

版本发布日期距今
13.0.1latest2026/08/162 个月前
13.0.02026/06/085 个月前
13.0.0-beta.2beta2026/06/085 个月前
13.0.0-beta.12026/06/085 个月前
12.4.02025/10/241.1 年前
12.3.02024/11/122 年前

其他发布通道:alpha → 5.1.0-alpha.1,beta → 13.0.0-beta.2。

关于 @form8ion/javascript-core 的常见问题

@form8ion/javascript-core 是什么?

core logic for form8ion tools related to JavaScript, like javascript-scaffolder and lift-javascript

如何安装 @form8ion/javascript-core?

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

@form8ion/javascript-core 支持 TypeScript 吗?

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

@form8ion/javascript-core 支持 ESM 还是 CommonJS?

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

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

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

@form8ion/javascript-core 可以商用吗?

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

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

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

@form8ion/javascript-core 还在维护吗?

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