@currents/nx

中文文档
2.1.1发布于 2023/10/31MITTypeScriptCommonJS零依赖近 30 天下载 1.5万

Nx 的当前插件

中文使用文档
文档目录10 节
  1. 示例
  2. 设置
  3. 使用量
  4. 配置
  5. 设置记录密钥
  6. 设置项目编号
  7. 移徙
  8. 版本 2.0.0
  9. 版本 1.0.0
  10. 释放

NX 插件: 在 Cloud 中调试、 排除和记录 Cypress CI 测试

无 运行 cypress 测试的插件 当前 或者说 对不起 Cypress。 。 。 .

将 Cypress 和 Cypress 等替代云服务融合在一起.

该插件是针对CI环境设计的,并以无头模式运行Cypress. 请使用 @nx/cypress 用于在交互式模式下运行cypress.

示例

见 ./应用程序/网络-e2e 例如,安装:

npx nx run web-e2e:currents --key <recordKey> --ci-build-id hello-currents-nx

设置

安装 npm 依赖性 :

npm i --save-dev @currents/nx cypress-cloud
# install cypress if needed
npm i --save-dev cypress

添加目标 currents 到您的工程配置 :

{
  // ...
  "targets": {
    "currents": {
      "executor": "@currents/nx:currents",
      "options": {
        "record": true,
        "parallel": true,
        "cypressConfig": "apps/app-e2e/cypres.config.ts",
        // "key": "record key obtained from https://app.currents.dev"
        // "ciBuildId: "ci build id, read more at https://currents.dev/readme/guides/cypress-ci-build-id",
        // ... start a dev server if needed
        "devServerTarget": "my-react-app:serve",
        "testingType": "e2e"
      }
    }
  }
  // ...

创建新配置文件 : currents.config.js 旁边 cypress.config.{jt}s

// currents.config.js
module.exports = {
  // Get the record key from https://app.currents.dev, can be any value for self-hosted instance of Sorry Cypress
  recordKey: 'XXX',
  // Set the `projectId` and the record key obtained from https://app.currents.dev or your self-hosted instance of Sorry Cypress
  projectId: 'Ij0RfK',
  // Sorry Cypress users - set the director service URL
  cloudServiceUrl: 'https://cy.currents.dev',
};

添加 cypress-cloud/plugin 改为 cypress.config.{js|ts|mjs}

import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
import { defineConfig } from 'cypress';
import cloudPlugin from 'cypress-cloud/plugin';

export default defineConfig({
  e2e: {
    ...nxE2EPreset(__dirname, {
      bundler: 'vite',
    }),
    specPattern: './src/**/*.cy.ts',
    setupNodeEvents(on, config) {
      return cloudPlugin(on, config);
    },
  },
});

使用量

npx nx run web-e2e:currents --key <recordKey> --ci-build-id hello-currents-nx

配置

选项可以配置在 project.json 在定义执行者时,或者在引用时。 更多信息, 如何配置目标和执行者 : https://nx.dev/reference/project-confignation# 目标。 。 。 .

见 计划.json 的选项。 此插件使用 cypress-cloud 将 Cypress 整合到第三派对服务中 请参考 圆压-云层文档 其他细节.

设置记录密钥

您可以以下列方式设置记录密钥:

  • 设定 key 属性在 project.json
  • 设定 recordKey 内 currents.config.js
  • 设置 CLI 旗 --recordKey
  • 设定 CURRENTS_RECORD_KEY 环境变量

设置项目编号

您可以将工程编号设置如下:

  • 设定 projectId 内 currents.config.js
  • 设定 CURRENTS_PROJECT_ID 环境变量

移徙

版本 2.0.0

版本 1.0.0

  • @nx/cypress 不再需要 - 插件是一个独立执行,不依赖于 @nx/cypress。使用可用的配置选项配置 Cypress 运行的执行.

释放

创建新发布 (changelog, tags + github)

# run this command, review and stage the changelog
cd ./packages/nx && npm run release

释放β通道 :

npx nx publish nx --tag beta --otp CODE

发布最新频道 :

npx nx publish nx --tag latest --otp CODE

版本与发布记录

@currents/nx 共发布 17 个版本,首次发布于 2021/11/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.1.1latest2023/10/313 年前
2.1.02023/10/293 年前
2.0.12023/04/123 年前
2.0.02023/04/053 年前
2.0.0-beta.02023/04/053 年前
1.0.0-beta.22023/01/103 年前

关于 @currents/nx 的常见问题

@currents/nx 是什么?

Nx 的当前插件

如何安装 @currents/nx?

在项目目录运行 npm install @currents/nx,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@nx/devkit( >= 16)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@currents/nx 支持 TypeScript 吗?

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

@currents/nx 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@currents/nx 可以商用吗?

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

@currents/nx 的下载量有多少?

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

@currents/nx 还在维护吗?

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