Skip to content

Commit

Permalink
chore: fix ui libraries + their tests
Browse files Browse the repository at this point in the history
  • Loading branch information
valpinkman committed Aug 8, 2023
1 parent ea29896 commit 9e82a95
Show file tree
Hide file tree
Showing 8 changed files with 1,326 additions and 805 deletions.
9 changes: 9 additions & 0 deletions .changeset/great-moose-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@ledgerhq/crypto-icons-ui": patch
"@ledgerhq/icons-ui": patch
"@ledgerhq/native-ui": patch
"@ledgerhq/react-ui": patch
"@ledgerhq/ui-shared": patch
---

publish ui libraries with fixed tests
1 change: 1 addition & 0 deletions libs/ui/examples/next.js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public
3 changes: 2 additions & 1 deletion libs/ui/examples/next.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"clean:full": "npx rimraf .next node_modules public"
},
"dependencies": {
"@ledgerhq/react-ui": "*",
"@ledgerhq/react-ui": "workspace:^",
"next": "13.2.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-is": "*",
"styled-components": "^5.3.3"
}
}
15 changes: 8 additions & 7 deletions libs/ui/examples/webpack.js/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "webpack-example",
"name": "webpack.js-example",
"private": true,
"version": "0.0.1",
"license": "MIT",
Expand All @@ -11,9 +11,10 @@
"clean:full": "npx rimraf dist node_modules"
},
"dependencies": {
"@ledgerhq/react-ui": "*",
"react": "18.2.0",
"react-dom": "18.2.0",
"@ledgerhq/react-ui": "workspace:^",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-is": "*",
"styled-components": "^5.3.3"
},
"devDependencies": {
Expand All @@ -27,8 +28,8 @@
"http-server": "^14.0.0",
"react-refresh": "^0.10.0",
"rimraf": "^3.0.2",
"webpack": "^5.62.2",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.4.0"
"webpack": "^5.88.2",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.15.1"
}
}
17 changes: 1 addition & 16 deletions libs/ui/tests/react.script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,18 @@ const exampleName = process.argv[2] || "";

const UPDATE_SNAPSHOTS = process.env["UPDATE_SNAPSHOTS"];

const addPackageResolutions = `
pnpm json -I -f ./examples/${exampleName}/package.json -e 'this.pnpm={
"overrides": {
"@ledgerhq/react-ui": "../../packages/react/lib",
"@ledgerhq/react-ui>@ledgerhq/ui-shared": "../../packages/shared",
"@ledgerhq/react-ui>@ledgerhq/icons-ui": "../../packages/icons"
}
}'
`;
const rollbackPackageResolutions = `
pnpm json -I -f ./examples/${exampleName}/package.json -e 'delete this.pnpm'
`;
const prepareExample = `npm run clean:full && npm i --no-package-lock --legacy-peer-deps && npm run build`;
const prepareExample = `pnpm clean:full && pnpm i --filter="${exampleName}-example" && pnpm build`;
const runTest = `pnpm concurrently -s=first -k "pnpm --dir examples/${exampleName} serve" "playwright test ${
UPDATE_SNAPSHOTS ? "--update-snapshots" : ""
}"`;

try {
child_process.execSync(addPackageResolutions, { stdio: "inherit" });
child_process.execSync(prepareExample, {
stdio: "inherit",
cwd: `./examples/${exampleName}`,
});
child_process.execSync(runTest, { stdio: "inherit" });
child_process.execSync(rollbackPackageResolutions, { stdio: "inherit" });
} catch (error) {
child_process.execSync(rollbackPackageResolutions, { stdio: "inherit" });
console.error(error.message);
process.exit(error.status);
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"changelog": "changeset add",
"prerelease": "pnpm run build:libs",
"release": "changeset publish",
"build:libs": "pnpm turbo build --no-daemon --filter=\"./libs/**\"",
"build:libs:force": "pnpm -r --filter=\"./libs/**\" build",
"build:libs": "pnpm turbo build --no-daemon --filter=\"./libs/**\" --filter=\"!./libs/ui/examples/**\"",
"build:libs:force": "pnpm -r --filter=\"./libs/**\" --filter=\"!./libs/ui/examples/**\" build",
"build:actions": "pnpm turbo build --filter=@actions/*",
"build:cli": "pnpm turbo build --no-daemon --filter=live-cli",
"build:coin": "pnpm turbo build --no-daemon --filter=\"./libs/coin-**\"",
Expand Down Expand Up @@ -109,6 +109,8 @@
"ui:icons": "pnpm --filter icons-ui",
"ui:crypto-icons": "pnpm --filter crypto-icons-ui",
"ui:shared": "pnpm --filter ui-shared",
"ui:example:next": "pnpm --filter=\"next.js-example\"",
"ui:example:webpack": "pnpm --filter=\"webpack.js-example\"",
"actions": "pnpm --filter @actions/*"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 9e82a95

Please sign in to comment.