generated from react18-tools/turborepo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update scripts for publishing lite mode
- using r18gs as peer dependency
- Loading branch information
1 parent
01532c7
commit d0087e2
Showing
4 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters