-
-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(dev-utils): new release script with pre-compiled theme support
It looks like jsDelivr supports serving files through github which is a nice workaround for the pre-compiled themes since including the themes apparently breaks package managers due to the giant size. There will be documentation in a following commit, but it'll be setup like: https://cdn.jsdelivr.net/gh/mlaursen/react-md@VERSION/themes/react-md.{PRIMARY}-{SECONDARY}-{SECONDARY_WEIGHT}-{LIGHT|DARK}.min.css This also fixes an error with the pre-compiled themes for the error color due to my "amazing" regex replacement to decrease build time. Since the error color ended up being the same as the first theme color, the error colors were incorrect.
- Loading branch information
Showing
13 changed files
with
212 additions
and
47 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
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
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,93 @@ | ||
import { execSync } from "child_process"; | ||
import log from "loglevel"; | ||
import prompts from "prompts"; | ||
|
||
import { projectRoot } from "./constants"; | ||
import fixChangelogs from "./fixChangelogs"; | ||
import prepublish from "./prepublish"; | ||
import git, { replaceTag, uncommittedFiles, ammendCommit } from "./utils/git"; | ||
|
||
export type ReleaseType = | ||
| "major" | ||
| "minor" | ||
| "patch" | ||
| "premajor" | ||
| "preminor" | ||
| "prepatch" | ||
| "prerelease" | ||
| ""; | ||
|
||
export const RELEASE_TYPES: ReadonlyArray<ReleaseType> = [ | ||
"major", | ||
"minor", | ||
"patch", | ||
"premajor", | ||
"preminor", | ||
"prepatch", | ||
"prerelease", | ||
]; | ||
|
||
export function toReleaseType(value: string): ReleaseType { | ||
if (RELEASE_TYPES.includes(value as ReleaseType)) { | ||
return value as ReleaseType; | ||
} | ||
|
||
return ""; | ||
} | ||
|
||
const run = (command: string): void => { | ||
log.debug(command); | ||
execSync(command, { | ||
cwd: projectRoot, | ||
stdio: "inherit", | ||
}); | ||
}; | ||
|
||
export default async function release( | ||
type: ReleaseType = "", | ||
blog: boolean = !type.startsWith("pre") | ||
): Promise<void> { | ||
// first, update the version since I'll be ammending this commit and tag with | ||
// libsize changes, prettier changelogs, and adding the themes specifically | ||
// for the tag only | ||
run(`npx lerna version ${type} --no-push --yes`); | ||
await fixChangelogs(false, true); | ||
|
||
// run a clean build to create all the dists | ||
await prepublish(false); | ||
|
||
// add the pre-compiled themes to git so they can be included in the tag, but | ||
// then remove them and ammend the commit with them removed so they aren't | ||
// added to the main branch. | ||
git("add -f themes"); | ||
await replaceTag(); | ||
|
||
git("rm -rf themes"); | ||
ammendCommit(); | ||
|
||
if (blog) { | ||
const { blogged } = await prompts({ | ||
type: "confirm", | ||
name: "blogged", | ||
message: "Has the blog been written?", | ||
initial: false, | ||
}); | ||
|
||
if (!blogged) { | ||
process.exit(1); | ||
} | ||
|
||
if (uncommittedFiles()) { | ||
git("add -u"); | ||
await replaceTag(); | ||
} | ||
} | ||
|
||
let distTag = ""; | ||
if (type.startsWith("pre")) { | ||
distTag = " --dist-tag=next"; | ||
} | ||
run(`npx lerna publish from-git${distTag} --yes`); | ||
|
||
git("push --follow-tags --no-verify origin master"); | ||
} |
Oops, something went wrong.