Commit Graph

35 Commits

Author SHA1 Message Date
Sophie Alpert
767f52237c
Use .slice() for all substring-ing (#26677)
- substr is Annex B
- substring silently flips its arguments if they're in the "wrong order", which is confusing
- slice is better than sliced bread (no pun intended) and also it works the same way on Arrays so there's less to remember

---

> I'd be down to just lint and enforce a single form just for the potential compression savings by using a repeated string.

_Originally posted by @sebmarkbage in https://github.com/facebook/react/pull/26663#discussion_r1170455401_
2023-04-19 14:26:01 -07:00
Mengdi Chen
5b8cf20b38
Add Circle CI API token to request header if available (#26519)
Follow up of #26499
A Circle CI team member got back to me. It is indeed not necessary, but
they had a regression not long ago on fetching without token.

https://discuss.circleci.com/t/is-api-token-required-when-fetching-artifacts/47606/5

To mitigate the impact of this kind of issues, let's add this token to
requests' header when it's available.
2023-03-30 16:06:56 -04:00
Mengdi Chen
5cbe6258bc
Remove unnecessary CIRCLE_CI_API_TOKEN checks (#26499)
Token is not required for GET
2023-03-28 16:31:34 -04:00
lauren
6310087f09
[ci] Fix download_base_build_for_sizebot (#26422)
CircleCI now enforces passing a token when fetching artifacts. I'm also
deleting the old request-promise-json dependency because AFAIK we were
only using it to fetch json from circleci about the list of available
artifacts – which we can just do using node-fetch. Plus, the underlying
request package it uses has been deprecated since 2019.
2023-03-17 13:04:20 -07:00
Stefan Sundin
9a7e6bf0d0
Add --no-show-signature to "git show" commands (#23038)
* Add --no-show-signature to "git show" commands.

This fixes errors if the user has configured the following in their ~/.gitconfig:
[log]
showSignature = true

* yarn prettier-all
2022-01-11 12:14:08 -05:00
Andrew Clark
bb0d069359
[build2 -> build] Local scripts
Update all our local scripts to use `build` instead of `build2`.

There are still downstream scripts that depend on `build2`, though, so
we can't remove it yet.
2021-09-21 15:14:09 -04:00
Brian Vaughn
355591add4
Next/experimental release versions include commit date (#21700)
Change format of @next and @experimental release versions from <number>-<sha> to <number>-<sha>-<date> to make them more human readable. This format still preserves the ability for us to easily map a version number to the changes it contains, while also being able to more easily know at a glance how recent a release is.
2021-06-23 13:50:09 -04:00
Andrew Clark
44cdfd6b7a
Use ReactVersions module as package allowlist (#21613)
Instead of keeping a separate allowlist in sync, we use ReactVersions.js
as the source of truth for which packages get published.
2021-06-03 11:45:10 -04:00
Andrew Clark
6736a38b9a
Add single source of truth for package versions (#21608)
The versioning scheme for `@next` releases does not include semver
information. Like `@experimental`, the versions are based only on the
hash, i.e. `0.0.0-<commit_sha>`. The reason we do this is to prevent
the use of a tilde (~) or caret (^) to match a range of
prerelease versions.

For `@experimental`, I think this rationale still makes sense — those
releases are very unstable, with frequent breaking changes. But `@next`
is not as volatile. It represents the next stable release. So, I think
we can afford to include an actual verison number at the beginning of
the string instead of `0.0.0`.

We can also add a label that indicates readiness of the upcoming
release, like "alpha", "beta", "rc", etc.

To prepare for this the new versioning scheme, I updated the build
script. However, **this PR does not enable the new versioning scheme
yet**. I left a TODO above the line that we'll change once we're ready.

We need to specify the expected next version numbers for each package,
somewhere. These aren't encoded anywhere today — we don't specify
version numbers until right before publishing to `@latest`, using an
interactive script: `prepare-release-from-npm`.

Instead, what we can do is track these version numbers in a module. I
added `ReactVersions.js` that acts as the single source of truth for
every package's version. The build script uses this module to build the
`@next` packages.

In the future, I want to start building the `@latest` packages the same
way we do `@next` and `@experimental`. (What we do now is download a
`@next` release from npm and swap out its version numbers.) Then we
could run automated tests in CI to confirm the packages are releasable,
instead of waiting to verify that right before publish.
2021-06-02 20:54:26 -07:00
Andrew Clark
b936ab660a
Update sizebot to new workflow (#20719)
* build-combined: Fix bundle sizes path

* Output COMMIT_SHA in build directory

Alternative to parsing an arbitrary package's version number, or
its `build-info.json`.

* Remove CircleCI environment variable requirement

I think this only reason we needed this was to support passing any
job id to `--build`, instead of requiring the `process_artifacts` job.
And to do that you needed to use the workflows API endpoint, which
requires an API token.

But now that the `--commit` argument exists and automatically finds the
correct job id, we can just use that.

* Add CI job that gets base artifacts

Uses download-experimental script and places the base artifacts into
a top-level folder.

* Migrate sizebot to combined workflow

Replaces the two separate sizebot jobs (one for each channel, stable and
experimental) with a single combined job that outputs size information
for all bundles in a single GitHub comment.

I didn't attempt to simplify the output at all, but we should. I think
what I would do is remove our custom Rollup sizes plugin, and read the
sizes from the filesystem instead. We would lose some information about
the build configuration used to generate each artifact, but that can be
inferred from the filepath. For example, the filepath
`fb-www/ReactDOM-dev.classic.js` already tells us everything we need to
know about the artifact. Leaving this for a follow up.

* Move GitHub status check inside retry loop

The download script will poll the CircleCI endpoint until the build job
is complete; it should also poll the GitHub status endpoint if the
build job hasn't been spawned yet.

* Only run get_base_build on main branch
2021-02-03 08:29:51 -08:00
Brian Vaughn
2d025753e2
Remove --build flag from release scripts (#20723)
Also update instructions to match recent script changes.

Also add reproducible commit SHA to post download instructions to support publishing the Firefox DevTools extension.
2021-02-03 11:11:56 -05:00
Brian Vaughn
c47f3cfa17
Restore experimental build script's ability to auto download latest build (#20717) 2021-02-02 16:40:31 -05:00
Brian Vaughn
db5945efee
Set default release channel for download-experimental-build script (#20663) 2021-01-26 15:17:56 -05:00
Andrew Clark
98313aaa7e
Migrate prepare-release-from-ci to new workflow (#20581)
* Migrate prepare-release-from-ci to new workflow

I added a `--releaseChannel (-r)` argument to script. You must choose
either "stable" or "experimental", because every build job now includes
both channels.

The prepare-release-from-npm script is unchanged since those releases
are downloaded from npm, nt CI.

(As a side note, I think we should start preparing semver releases using
the prepare-release-from-ci script, too, and get rid of
prepare-release-from-npm. I think that was a neat idea originally but
because we already run `npm pack` before storing the artifacts in CI,
there's really not much additional safety; the only safeguard it adds is
the requirement that a "next" release must have already been published.)

* Move validation to parse-params module
2021-01-14 09:20:20 -08:00
Andrew Clark
99554dc36f
Add Flight packages to experimental allowlist (#20486)
- react-fetch
- react-fs
- react-pg
- react-server-dom-webpack
2020-12-18 14:29:48 -08:00
Andrew Clark
1bda600378
Hardcoded allowlist for publishing packages (#20485)
With separate lists for stable and experimental.
2020-12-18 14:20:37 -08:00
Sebastian Markbåge
4469700bb6
Change ReactVersion from CJS to ES module (#18181) 2020-02-28 13:09:02 -08:00
Brian Vaughn
9e158c091b
Updated release script documentation and command names (#17929)
* Updated release script documentation and command names

* Update scripts/release/README.md

Co-Authored-By: Sunil Pai <threepointone@oculus.com>

* Updated README

Co-authored-by: Sunil Pai <threepointone@oculus.com>
2020-02-05 08:52:31 -08:00
Dan Abramov
b979db4e72
Bump Prettier (#17811)
* Bump Prettier

* Reformat

* Use non-deprecated option
2020-01-09 13:54:11 +00:00
Dan Abramov
7c21bf72ac Fix release script to ignore empty package folders 2019-12-16 19:16:58 +00:00
Andrew Clark
54f66731c8
Update release script URL (#17428)
CircleCI API endpoint changed
2019-11-21 13:19:03 -08:00
Andrew Clark
30c5daf943
Remove concurrent apis from stable (#17088)
* Tests run in experimental mode by default

For local development, you usually want experiments enabled. Unless
the release channel is set with an environment variable, tests will
run with __EXPERIMENTAL__ set to `true`.

* Remove concurrent APIs from stable builds

Those who want to try concurrent mode should use the experimental
builds instead.

I've left the `unstable_` prefixed APIs in the Facebook build so we
can continue experimenting with them internally without blessing them
for widespread use.

* Turn on SSR flags in experimental build

* Remove prefixed concurrent APIs from www build

Instead we'll use the experimental builds when syncing to www.

* Remove "canary" from internal React version string
2019-10-15 15:09:19 -07:00
Andrew Clark
a8c6a1b34e
Update release scripts to support experimental releases (#17086)
* Download correct artifacts for release channel

Experimental builds should pull artifacts from the
`process_artifacts_experimental` job.

I think instead of two separate CI workflows, a better approach might
be to build stable artifacts to the `build` directory and the
experimental artifacts to a `build_experimental` directory, and
generate both within the same workflow. This would take some work since
lots of things assume the output directory is `build`, but something
to consider in the future.

* Prevent experimental promotion to stable

Adds a check to the `prepare-stable` script to prevent experimental
builds from being published using stable semver versions.
2019-10-14 14:15:23 -07:00
Andrew Clark
d364d8555f
Set up experimental builds (#17071)
* Don't bother including `unstable_` in error

The method names don't get stripped out of the production bundles
because they are passed as arguments to the error decoder.

Let's just always use the unprefixed APIs in the messages.

* Set up experimental builds

The experimental builds are packaged exactly like builds in the stable
release channel: same file structure, entry points, and npm package
names. The goal is to match what will eventually be released in stable
as closely as possible, but with additional features turned on.

Versioning and Releasing
------------------------

The experimental builds will be published to the same registry and
package names as the stable ones. However, they will be versioned using
a separate scheme. Instead of semver versions, experimental releases
will receive arbitrary version strings based on their content hashes.
The motivation is to thwart attempts to use a version range to match
against future experimental releases. The only way to install or depend
on an experimental release is to refer to the specific version number.

Building
--------

I did not use the existing feature flag infra to configure the
experimental builds. The reason is because feature flags are designed
to configure a single package. They're not designed to generate multiple
forks of the same package; for each set of feature flags, you must
create a separate package configuration.

Instead, I've added a new build dimension called the **release
channel**. By default, builds use the **stable** channel. There's
also an **experimental** release channel. We have the option to add more
in the future.

There are now two dimensions per artifact: build type (production,
development, or profiling), and release channel (stable or
experimental). These are separate dimensions because they are
combinatorial: there are stable and experimental production builds,
stable and experimental developmenet builds, and so on.

You can add something to an experimental build by gating on
`__EXPERIMENTAL__`, similar to how we use `__DEV__`. Anything inside
these branches will be excluded from the stable builds.
This gives us a low effort way to add experimental behavior in any
package without setting up feature flags or configuring a new package.
2019-10-14 10:46:42 -07:00
Brian Vaughn
e8c7ddeef2
Release script filters DevTools NPM pakcages (#16810) 2019-09-17 12:46:13 -07:00
Brian Vaughn
5b007573ac
Release script supports publishing a subset of packages (#16338)
Release script supports publishing a subset of packages (#16338)
2019-08-09 13:12:00 -07:00
Brian Vaughn
7fa5a716e3
Use Circle CI API v2 to get artifacts job ID (#15821) 2019-06-04 13:28:41 -07:00
Brian Vaughn
409066a0a1
Add progress bars to longer running async release tasks (#14322)
* Add progress bars to longer running async release tasks
* Updated to 0.2 progress estimator version
2018-11-26 09:28:37 -08:00
Brian Vaughn
686f1060ad
Publish a local release (canary or stable) to NPM (#14260)
New release scripts.

Learn more at https://github.com/facebook/react/blob/master/scripts/release/README.md
2018-11-23 12:37:18 -08:00
Brian Vaughn
54bfab5d6d
Release script updates private package dependencies also (#13612) 2018-09-10 13:14:34 -07:00
Adrian Carolli
53ef71b8e8 Add bundle linting and tests to the release script (#11662)
* Add bundle linting and tests to the release script

 - add yarn lint-build
- use yarn lint-build in circle ci build.sh
- add yarn lint-build, yarn test-prod, yarn test-build, and yarn test-build-prod to the realse script

* Improve readability of release test messages

* Run prettier

* Updating package versions for release 16.2.0

* Seperate bundle specific tests

- Moved the runYarnTask into utils since its being used two files now
- Uncomment out checks I mistakenly committed

* Revert a bunch of version bump changes

Mistakenly commited by release script

* .js for consistency
2017-11-26 16:47:20 +00:00
HardikModha
2d23a4563e Reading package.json safely in the build script by ignoring the system files. #11544 (#11546) 2017-11-13 18:21:17 +00:00
Brian Vaughn
ac0e670545
Release script tweaks (#11504)
* Added missing params object to execUnlessDry call

* Public package names are no longer hard-coded

* Added "v" prefix to git tag

* Show more accurate in-progress duration

* Properly bucket-bridage params

* Prettier

* Publish command logs stack with error
2017-11-09 16:29:51 +00:00
Clement Hoang
94f44aeba7
Update prettier to 1.8.1 (#10785)
* Change prettier dependency in package.json version 1.8.1

* Update yarn.lock

* Apply prettier changes

* Fix ReactDOMServerIntegration-test.js

* Fix test for ReactDOMComponent-test.js
2017-11-07 18:09:33 +00:00
Brian Vaughn
c371c152ab Release script (#11223)
* First chunk of new release script

* Re-ordered build steps to combine error codes and releases

* Reorganized build files; added stub publish script

* First pass at publis script. Also collect and print dry-run commits/publish commands.

* Deleted old react-release-manager scripts

* Cleaned up release package.json

* Basic README instructions

* Removed unnecessary 'async' keyword from a method

* Wordsmithing

* Tweaked README

* Renamed build -> build-commands and publish -> publish-commands to avoid conflict with .gitignore

* Bump pre-release package versions differently

* Prettier

* Improved CircleCI API token setup instructions message

* Lint fix

* Typofix
2017-10-16 15:01:14 -07:00