@gouvfr-lasuite/integration

中文文档
1.0.3发布于 2025/04/17ESM + CJS零依赖近 30 天下载 1.9万

The @gouvfr-lasuite/integration npm package helps services of La Suite numérique with already-made React and HTML templates of common La Suite UIs.

原始使用文档
文档目录4 节
  1. Usage
  2. Development
  3. Building
  4. Publishing a new npm package

@gouvfr-lasuite/integration npm package

The @gouvfr-lasuite/integration npm package helps services of La Suite numérique with already-made React and HTML templates of common La Suite UIs.

For now, it helps developers integrate:

  • a La Suite branded homepage
  • the Gaufre ("waffle") button that lets users of a service easily switch between La Suite services.

Usage

npm install @gouvfr-lasuite/integration

If you use React, you can directly consume the exposed React components.

If you use anything else, you can copy and paste content from the HTML templates in the dist/html folder.

CSS is also available. Depending on whether or not you use the DSFR, you can use different CSS files from dist/css.

Precise documentation on usage is available on integration.lasuite.numerique.gouv.fr.

Development

This folder is meant to generate the @gouvfr-lasuite/integration npm package.

It's a vite app.

To start, npm install a first time and copy the example env file: cp .env.example .env. Make sure the API env var targets a running API. If you don't want to use the production one, you can run one locally easily: the API is exposed via the /website server, go check the README there.

Then, run the local dev server with npm run dev.

The main dev file is src/dev/dev.tsx where a small testing React router is used to render the different React components while developing.

Building

Run npm run build to build all the dist/ files which are: React components, CSS files and HTML templates.

Internally, building all of this is a bit different than your usual vite app. We actually use 3 vite configs, and running npm run build runs them all:

React components

The default build generates the React components in es6 and commonjs files with the vite "lib" mode. Everything in src/index.ts is exposed in the generated file.

CSS

The css-config build generates the CSS files. They all go through purgecss. The list of CSS files to generate is in the css vite config.

CSS is rendered like that, and not through the main vite config, because CSS rendering in lib mode doesn't allow us to easily generate multiple CSS files while using the postcss-config.

HTML files

The html-config generates the HTML files.

HTML files are not written by hand: they are generated from the React components. The html vite config checks the src/html.tsx file and renders HTML files for every template listed.

Publishing a new npm package

  • run npm version with either major, minor or patch to bump the version. There is no precise versioning strategy for now, but following semver is a good idea. So: breaking changes should be major updates, new features should be minor updates and bug fixes should be patch updates.
  • add a new entry in the CHANGELOG.md file to describe the changes.
  • :warning: make sure your local .env file uses production values.
  • run npm pack to generate a new tarball locally. It's an easy to verify manually that the package is good before publishing it.
  • run npm publish to publish the package on npm.
  • commit your changes.
  • create a git tag on this new commit: integration-vX.X.X.
  • push the main branch and the new tag on github.

版本与发布记录

@gouvfr-lasuite/integration 共发布 13 个版本,首次发布于 2024/05/02;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.3latest2025/04/171.6 年前
1.0.22024/06/282 年前
1.0.12024/05/162 年前
1.0.02024/05/162 年前
0.1.82024/05/162 年前
0.1.72024/05/152 年前

关于 @gouvfr-lasuite/integration 的常见问题

@gouvfr-lasuite/integration 是什么?

The @gouvfr-lasuite/integration npm package helps services of La Suite numérique with already-made React and HTML templates of common La Suite UIs.

如何安装 @gouvfr-lasuite/integration?

在项目目录运行 npm install @gouvfr-lasuite/integration,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-dom(*)、typescript(*)、@types/react(*)、@types/react-dom(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gouvfr-lasuite/integration 支持 TypeScript 吗?

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

@gouvfr-lasuite/integration 支持 ESM 还是 CommonJS?

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

@gouvfr-lasuite/integration 可以商用吗?

@gouvfr-lasuite/integration 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@gouvfr-lasuite/integration 的下载量有多少?

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

@gouvfr-lasuite/integration 还在维护吗?

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