diff --git a/.tkb b/.tkb index 2ed788cb..c56d96cb 100644 --- a/.tkb +++ b/.tkb @@ -64,7 +64,7 @@ "1dRWJhy45E1Rq5wZAmPHt": { "id": "1dRWJhy45E1Rq5wZAmPHt", "description": "Update README as required", - "columnId": "column-todo" + "columnId": "column-done" }, "5vS1JNXoMhDl5IBljwh2v": { "id": "5vS1JNXoMhDl5IBljwh2v", @@ -89,12 +89,12 @@ "0499BqWDwJ5cxqtC9Nr82": { "id": "0499BqWDwJ5cxqtC9Nr82", "description": "Feel free to star this template, contribute, and/or sponsor the [`terborepo-template`](https://github.com/react18-tools/turborepo-template) project or my [other open-source work](https://github.com/sponsors/mayank1513)", - "columnId": "column-todo" + "columnId": "column-done" }, "IjuAtNquJ4-Ut874rHKIW": { "id": "IjuAtNquJ4-Ut874rHKIW", "description": "You can also fork the [`terborepo-template`](https://github.com/react18-tools/turborepo-template/fork) and add your package to `scripts/featured.json`\n - If approved, your package will be automatically added to FEATURED.md and also published on the home page of this repo.", - "columnId": "column-todo" + "columnId": "column-done" }, "t5d22lVYbF7GuQHzv6DRO": { "id": "t5d22lVYbF7GuQHzv6DRO", @@ -125,6 +125,11 @@ "id": "ltOP38szvwpGAruTRbxOq", "description": "ServerTarget\n- to sync theme with the help of server components --- avoid jitter of unthemed page", "columnId": "column-done" + }, + "hBTyeXLx4fIQE1q5qatqF": { + "id": "hBTyeXLx4fIQE1q5qatqF", + "description": "Add publish scripts for lite version", + "columnId": "column-done" } }, "columns": [ @@ -143,13 +148,10 @@ "id": "column-todo", "title": "To do", "tasksIds": [ - "1dRWJhy45E1Rq5wZAmPHt", "5vS1JNXoMhDl5IBljwh2v", "55DAZwduwTvlaxaJC8hlX", "FDFqCQvLm2mUlnTJ3Gna5", - "O1qAByMoxhHOR-a_guL91", - "0499BqWDwJ5cxqtC9Nr82", - "IjuAtNquJ4-Ut874rHKIW" + "O1qAByMoxhHOR-a_guL91" ] }, { @@ -163,7 +165,11 @@ "id": "column-done", "title": "Done", "tasksIds": [ + "hBTyeXLx4fIQE1q5qatqF", + "1dRWJhy45E1Rq5wZAmPHt", "_BfuX7quWBANpDK1bI7YM", + "IjuAtNquJ4-Ut874rHKIW", + "0499BqWDwJ5cxqtC9Nr82", "ltOP38szvwpGAruTRbxOq", "bjrSIW2boIWsI4h74nxXl", "1jEMZiPKJSVpEMu6ZxfpX", diff --git a/scripts/lite.js b/scripts/lite.js new file mode 100644 index 00000000..78f31c51 --- /dev/null +++ b/scripts/lite.js @@ -0,0 +1,29 @@ +"use strict"; + +const fs = require("node:fs"); +const path = require("node:path"); +const config = require("./rebrand.config.json"); + +const packageJson = require("../lib/package.json"); + +const ref = packageJson.name; +packageJson.peerDependencies.r18gs = `${packageJson.dependencies.r18gs.split(".")[0]}`; +delete packageJson.dependencies.r18gs; +if (Object.keys(packageJson.devDependencies).length === 0) delete packageJson.devDependencies; +packageJson.name = `${ref}-lite`; + +fs.writeFileSync( + path.resolve(__dirname, "../lib/package.json"), + JSON.stringify(packageJson, null, 2), +); + +const readMePath = path.resolve(__dirname, "../lib", "README.md"); + +let readMe = fs.readFileSync(readMePath, { encoding: "utf8" }); +const tmp = "!---"; +const { owner, repo } = config; +readMe = readMe.replace(new RegExp(`${owner}/${repo}`, "g"), tmp); +readMe = readMe.replace(new RegExp(ref, "g"), packageJson.name); +readMe = readMe.replace(new RegExp(tmp, "g"), `${owner}/${repo}`); +readMe = readMe.replace(/## Want Lite Version(.|\n|\r)*You need `r18gs` as a peer-dependency/m, ""); +fs.writeFileSync(readMePath, readMe); diff --git a/scripts/manual-publish.js b/scripts/manual-publish.js index 345c9806..d5095642 100644 --- a/scripts/manual-publish.js +++ b/scripts/manual-publish.js @@ -74,3 +74,6 @@ execSync(`cd lib && pnpm build && npm publish --provenance --access public --tag execSync( `gh release create ${NEW_VERSION} --generate-notes${isLatestRelease ? " --latest" : ""} -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release v${NEW_VERSION}"`, ); + +execSync("node ./scripts/lite.js"); +execSync(`cd lib && pnpm build && npm publish --provenance --access public --tag ${tag}`); diff --git a/scripts/publish.js b/scripts/publish.js index 2048ec54..d071ae10 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -45,3 +45,6 @@ execSync("cd lib && pnpm build && npm publish --provenance --access public"); execSync( `gh release create ${VERSION} --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release v${VERSION}"`, ); + +execSync("node ./scripts/lite.js"); +execSync("cd lib && pnpm build && npm publish --provenance --access public");