Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stable-components-release.md
Comment thread
PanchoutNathan marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@gouvfr-lasuite/ui-components": major
---

Publish the unified component library as the stable 1.0.0 release.
5 changes: 5 additions & 0 deletions packages/ui-codemod/src/mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export const PACKAGE_MAPPINGS = {
"@gouvfr-lasuite/ui-kit": PACKAGES.components,
};

export const PACKAGE_RANGES = {
[PACKAGES.components]: "^1.0.0",
[PACKAGES.tokens]: "^3.1.0",
};

const EXACT_SPECIFIER_MAPPINGS = new Map([
["@gouvfr-lasuite/cunningham-react", PACKAGES.components],
["@gouvfr-lasuite/cunningham-react/style", `${PACKAGES.components}/style`],
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-codemod/src/transform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import jscodeshift from "jscodeshift";
import { mapSpecifier, PACKAGES, PACKAGE_MAPPINGS, sourceIsEnabled } from "./mappings.js";
import { mapSpecifier, PACKAGES, PACKAGE_MAPPINGS, PACKAGE_RANGES, sourceIsEnabled } from "./mappings.js";

const parsers = {
".js": "babel",
Expand Down Expand Up @@ -221,7 +221,7 @@ export function transformPackageJson(sourceText, filePath, options = {}) {
if (!dependencies || typeof dependencies !== "object") continue;
for (const [oldName, newName] of Object.entries(PACKAGE_MAPPINGS)) {
if (!sourceIsEnabled(oldName, source) || !(oldName in dependencies)) continue;
if (!(newName in dependencies)) dependencies[newName] = "^1.0.0";
if (!(newName in dependencies)) dependencies[newName] = PACKAGE_RANGES[newName];
delete dependencies[oldName];
changed = true;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ui-codemod/tests/transform.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test("merges package dependencies and is idempotent", () => {
const first = transformPackageJson(input, "package.json", { source: "all" });
const second = transformPackageJson(first.output, "package.json", { source: "all" });
assert.equal(JSON.parse(first.output).dependencies["@gouvfr-lasuite/ui-components"], "^1.0.0");
assert.equal(JSON.parse(first.output).dependencies["@gouvfr-lasuite/ui-tokens"], "^1.0.0");
assert.equal(JSON.parse(first.output).dependencies["@gouvfr-lasuite/ui-tokens"], "^3.1.0");
assert.equal(second.changed, false);
});

Expand Down Expand Up @@ -92,7 +92,7 @@ test("rewrites legacy @openfun styles and package.json dependencies", () => {
} }, null, 2)}\n`, "package.json", { source: "all" });
const dependencies = JSON.parse(pkg.output).dependencies;
assert.equal(dependencies["@gouvfr-lasuite/ui-components"], "^1.0.0");
assert.equal(dependencies["@gouvfr-lasuite/ui-tokens"], "^1.0.0");
assert.equal(dependencies["@gouvfr-lasuite/ui-tokens"], "^3.1.0");
assert.equal("@openfun/cunningham-react" in dependencies, false);
});

Expand Down
Loading