-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Template users may have some other libraries that they want to provide a varient for
- Loading branch information
1 parent
8fdc1d5
commit 69428fb
Showing
3 changed files
with
62 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
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); |