Skip to content

Commit

Permalink
chore: upgrade to protocol v2.1.0 (#457)
Browse files Browse the repository at this point in the history
* chore: upgrade to protocol v2.1.0

* chore: add script to link core-components local dependency

* upgrade core-component version

* Merge branch 'main' into upgrade-protocol-v2.1.0
  • Loading branch information
levalleux-ludo authored Nov 22, 2022
1 parent 22fad3c commit c51243b
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 36 deletions.
84 changes: 51 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
"upgrade:corec:latest": "npm install @bosonprotocol/common@latest @bosonprotocol/core-sdk@latest @bosonprotocol/ethers-sdk@latest @bosonprotocol/ipfs-storage@latest @bosonprotocol/react-kit@latest @bosonprotocol/widgets-sdk@latest",
"upgrade:corec:alpha": "npm install @bosonprotocol/common@alpha @bosonprotocol/core-sdk@alpha @bosonprotocol/ethers-sdk@alpha @bosonprotocol/ipfs-storage@alpha @bosonprotocol/react-kit@alpha @bosonprotocol/widgets-sdk@alpha",
"postinstall": "npx playwright install --with-deps chromium",
"generate": "graphql-codegen"
"generate": "graphql-codegen",
"clean-react-cache": "run-script-os",
"clean-react-cache:default": "rm -rf node_modules/.cache",
"clean-react-cache:win32": "rmdir /S /Q node_modules\\.cache",
"link-cc": "node ./scripts/link-to-local-core-components.js"
},
"lint-staged": {
"src/**/*.+(js|json|ts|tsx)": [
Expand All @@ -39,7 +43,7 @@
},
"dependencies": {
"@bosonprotocol/chat-sdk": "^1.2.1-alpha.4",
"@bosonprotocol/react-kit": "^0.15.0-alpha.0",
"@bosonprotocol/react-kit": "^0.15.0-alpha.1",
"@davatar/react": "^1.10.4",
"@ethersproject/address": "^5.6.1",
"@ethersproject/units": "^5.6.1",
Expand Down Expand Up @@ -124,6 +128,7 @@
"@types/styled-components": "^5.1.25",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"commander": "^9.4.1",
"cross-env": "^7.0.3",
"customize-cra": "^1.0.0",
"eslint-config-prettier": "^8.5.0",
Expand All @@ -142,6 +147,7 @@
"prettier": "^2.7.1",
"react-app-rewire-alias": "^1.1.7",
"react-app-rewired": "^2.2.1",
"run-script-os": "^1.1.6",
"styled-components": "^5.3.5",
"typescript": "^4.7.4",
"webpack-bundle-analyzer": "^4.6.1"
Expand Down
69 changes: 69 additions & 0 deletions scripts/link-to-local-core-components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { program } = require("commander");
const { symlinkSync, existsSync, rmSync, cpSync } = require("fs");
const { resolve } = require("path");

program
.description(
"Link local Core-Components build directories to the current node_modules tree"
)
.argument("<CC_REPO>", "Core Components local repository")
.option("--link", "Use symbolic links instead of hard copy")
.parse(process.argv);

const [ccRepo] = program.args;
const opts = program.opts();
const mode = opts.link ? "link" : "copy";
const folders = ["src", "dist"];

const packages = [
{ path: "common", mode, folders },
{ path: "core-sdk", mode, folders },
{ path: "ethers-sdk", mode, folders },
{ path: "ipfs-storage", mode, folders },
{ path: "metadata", mode, folders },
{ path: "react-kit", mode: "copy", folders } // <-- react-kit symlink causes some problems
];

async function main() {
for (const package of packages) {
for (const folder of package.folders) {
const target = `${resolve(ccRepo, "packages", package.path, folder)}`;
if (!existsSync(target)) {
console.error(`Target ${target} does not exist.`);
continue;
}
const linkPath = `${resolve(
__dirname,
"..",
"node_modules/@bosonprotocol",
package.path,
folder
)}`;
while (existsSync(linkPath)) {
// remove linkPath first
rmSync(linkPath, { recursive: true });
await new Promise((r) => setTimeout(r, 200));
}
if (package.mode === "link") {
console.log(`Create link ${linkPath} --> ${target}`);
symlinkSync(target, linkPath, "junction");
}
if (package.mode === "copy") {
console.log(`Copy ${target} into ${linkPath}`);
cpSync(target, linkPath, {
recursive: true,
force: true,
preserveTimestamps: true
});
}
}
}
}

main()
.then(() => console.log("success"))
.catch((e) => {
console.error(e);
process.exit(1);
});
2 changes: 1 addition & 1 deletion src/lib/utils/hooks/offer/useUpdateSeller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function updateSellerAccount(
authTokenType: typeof authTokenTypes[keyof typeof authTokenTypes];
}
) {
await coreSDK.updateSeller({
await coreSDK.updateSellerAndOptIn({
id: sellerId,
admin:
authTokenType === authTokenTypes.LENS
Expand Down

0 comments on commit c51243b

Please sign in to comment.