Skip to content

Commit d4bf1b7

Browse files
huntiefacebook-github-bot
authored andcommitted
Remove experimental notice from V2 API snapshot and build by default (#52301)
Summary: Pull Request resolved: #52301 Readying for imminent productionisation. Changelog: [Internal] Reviewed By: j-piasecki Differential Revision: D77386064 fbshipit-source-id: 2769545eace4e6c09da0b2f0f34cf74b2fdcb730
1 parent a0d4e18 commit d4bf1b7

File tree

6 files changed

+14
-25
lines changed

6 files changed

+14
-25
lines changed

.github/actions/build-npm-package/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ runs:
129129
run: yarn build
130130
- name: Build types
131131
shell: bash
132-
run: yarn build-types
132+
run: yarn build-types --skip-snapshot
133133
# Continue with publish steps
134134
- name: Set npm credentials
135135
if: ${{ inputs.release-type == 'release' ||

.github/actions/lint/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ runs:
4949
run: yarn run lint-markdown
5050
- name: Build types
5151
shell: bash
52-
run: yarn build-types
52+
run: yarn build-types --skip-snapshot
5353
- name: Run typescript check of generated types
5454
shell: bash
5555
run: yarn test-generated-typescript

.github/workflows/publish-bumped-packages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Build packages
2222
run: yarn build
2323
- name: Build types
24-
run: yarn build-types
24+
run: yarn build-types --skip-snapshot
2525
- name: Set NPM auth token
2626
run: echo "//registry.npmjs.org/:_authToken=$GHA_NPM_TOKEN" > ~/.npmrc
2727
- name: Find and publish all bumped packages

scripts/build-types/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Specifically, it reduces the runtime JavaScript API of `react-native` into two o
1111
- **Generated TypeScript types**\
1212
Public user types for react-native, shipped to npm\
1313
`packages/react-native/types_generated/`
14-
- **‌Public API snapshot (experimental)**\
14+
- **‌Public API snapshot**\
1515
Snapshot file of the public API shape, used by maintainers\
1616
`packages/react-native/ReactNativeApi.d.ts`
1717

@@ -29,11 +29,11 @@ Snapshot file of the public API shape, used by maintainers\
2929
> API snapshot generation is currently **experimental**, and will be folded into the default behaviour when ready.
3030
3131
```sh
32-
# Build types
33-
yarn build-types
32+
# Build types + API snapshot
33+
yarn build-types [--validate]
3434

35-
# Build types + API snapshot (experimental)
36-
yarn build-types --withSnapshot [--validate]
35+
# Build types without API snapshot
36+
yarn build-types --skip-snapshot
3737
```
3838

3939
#### Configuration
@@ -54,7 +54,7 @@ Directory providing TypeScript user types for the `react-native` package, distri
5454
- Preserves doc comments.
5555
- Preserves source file names (for go to definition).
5656

57-
### Public API snapshot (experimental)
57+
### Public API snapshot
5858

5959
`ReactNative.d.ts`
6060

scripts/build-types/index.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const config = {
2020
debug: {type: 'boolean'},
2121
'debug-version-annotations': {type: 'boolean'},
2222
help: {type: 'boolean'},
23-
withSnapshot: {type: 'boolean'},
23+
'skip-snapshot': {type: 'boolean'},
2424
validate: {type: 'boolean'},
2525
},
2626
};
@@ -31,7 +31,7 @@ async function main() {
3131
debug: debugEnabled,
3232
'debug-version-annotations': debugVersionAnnotations,
3333
help,
34-
withSnapshot,
34+
'skip-snapshot': skipSnapshot,
3535
validate,
3636
},
3737
/* $FlowFixMe[incompatible-call] Natural Inference rollout. See
@@ -49,22 +49,14 @@ async function main() {
4949
--debug-version-annotations
5050
Outputs debug info alongside versioned type hashes as
5151
part of the API snapshot contents.
52-
--withSnapshot [Experimental] Include API snapshot generation.
52+
--skip-snapshot Skip API snapshot generation.
5353
--validate Validate if the current API snapshot on disk is up to
5454
date. Exits with an error if differences are detected.
5555
`);
5656
process.exitCode = 0;
5757
return;
5858
}
5959

60-
if (validate && !withSnapshot) {
61-
console.error(
62-
"build-types: '--validate' can only be used with '--withSnapshot'.",
63-
);
64-
process.exitCode = 2;
65-
return;
66-
}
67-
6860
if (debugEnabled) {
6961
debug.enable('build-types:*');
7062
}
@@ -79,10 +71,9 @@ async function main() {
7971
);
8072
await buildGeneratedTypes();
8173

82-
if (withSnapshot) {
74+
if (!skipSnapshot) {
8375
console.log(
84-
styleText(['bold', 'inverse'], ' [Experimental] Building API snapshot ') +
85-
'\n',
76+
styleText(['bold', 'inverse'], ' Building API snapshot ') + '\n',
8677
);
8778
await buildApiSnapshot({validate, debugVersionAnnotations});
8879
}

scripts/build-types/templates/ReactNativeApi.d.ts-template.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ function apiSnapshotTemplate(source: string): string {
1919
* LICENSE file in the root directory of this source tree.
2020
*
2121
* ${signedsource.getSigningToken()}
22-
* @${'nocommit'} EXPERIMENTAL V2 API SNAPSHOT - Continue to use public-api-test.js
23-
* until we productionize this format.
2422
*
2523
* This file was generated by scripts/build-types/index.js.
2624
*/

0 commit comments

Comments
 (0)