![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
build-this-branch
Advanced tools
Script to automate creating built branches for testing npm packages without publishing to npm.
Support this project by ⭐️ starring and sharing it. Follow me to see what other cool projects I'm working on! ❤️
Run in your npm package Git repository from the branch you want to build:
npx build-this-branch
⚠️ Warning: This command will force-push to the remote branch
built/<current branch>
. Make sure there are no unsaved changes there. You can configure the built branch name with--built-branch <branch name>
.
If you use this command often, install it globally so it's on disk:
npm install -g build-this-branch
When globally installed, you can use it without npx
:
build-this-branch
Flag | Description |
---|---|
-c, --build-command <command> | The command to build the branch. (default: npm run build ) |
-b, --built-branch <branch name> | The name of the built branch. Defaults to prefixing "built/" to the current branch or tag name. |
-r, --remote <remote> | The remote to push to. (default: origin ) |
-d, --dry | Dry run mode. Will not build, commit, or push to the remote. |
-h, --help | Show help |
--version | Show version |
A built branch is a Git branch that contains published assets so it can be installed with npm from GitHub:
# Installs from github.com/organization/repository/tree/built-branch
npm install 'organization/repository#built-branch'
Built branches are useful for quickly testing changes and can be preferrable over permanently publishing a prerelease to npm.
When you want to test-install an in-development npm package by publishing it to a GitHub branch instead of npm.
But you can prepublish private test packages on npm too!
Personally, I prefer to use GitHub + Git over npm for testing packages because I'll have more control with better "prepublish" management.
A built branch is impermanent because it constantly gets force-pushed, and the branch can be easily deleted via commandline or GitHub UI. On top of that, it's easily sharable by link—to install or to look at the source.
npm requires version bumping every test package, has a strict Unpublish policy, and does not make it easy to view the code before installing.
Use-cases:
npm link
because of symlink complexities.npm install <project path>
or npm pack
+ npm install <tarball>
(eg. testing in remote environment or providing a shareable test package).You can accomplish something similar by manually running the following commands:
$ npm run build
$ git add --force dist
$ git commit -nam built
$ git push
However, this will not yield the same exact output as npm publish
because:
There can be missing distribution files (eg. files outside of dist
). build-this-branch uses npm-packlist —the same library npm publish
uses—to detect publish files declared via package.json#files
and .npmignore
.
Irrelevant files are committed (eg. source files). This can slow down installation or even interfere with the library behavior. For example, if your project has development configuration files, they can accidentally be read by the dependent tooling.
npm hooks are not executed. build-this-branch simulates package packing and runs hooks prepare
and prepack
.
This script does the following to make a built branch:
npm run build
)prepare
& prepack
npm hooksbuilt/
namespaceYes, if it's being installed from a Git client that's authorized to access the private repository.
Although it won't be possible if the client doesn't have access, if you're comfortable publishing the built assets to a branch on another repository (given it's minified, mangled), you can use the --remote <remote>
flag to push to another repository that the client has access to.
You want to test a built branch hosted on a private repository Repo A, but GitHub Actions on the consuming project Repo B doesn't have access to the private repository so npm install
fails.
To work around this, you push the built branch to Repo B to install it from there:
$ npx build-this-branch --remote git@github.com:repo-b.git --branch test-pkg
✔ Successfully built branch! Install with command:
→ npm i 'repo-b#test-pkg'
Yes. build-this-branch can be useful for packages that don't have a build step because it filters out non-publish files.
Creating a banch only with publish files will make bring the testing environment closer to the publish environment.
To use in a project without a build step, pass in an empty build command:
$ npx build-this-branch -c
FAQs
Script to automate creating built branches
We found that build-this-branch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.