3
3
const { exec} = require ( 'child-process-promise' ) ;
4
4
const { createPatch} = require ( 'diff' ) ;
5
5
const { hashElement} = require ( 'folder-hash' ) ;
6
- const { readdirSync , readFileSync, statSync , writeFileSync} = require ( 'fs' ) ;
6
+ const { readFileSync, writeFileSync} = require ( 'fs' ) ;
7
7
const { readJson, writeJson} = require ( 'fs-extra' ) ;
8
8
const http = require ( 'request-promise-json' ) ;
9
9
const logUpdate = require ( 'log-update' ) ;
@@ -12,14 +12,6 @@ const createLogger = require('progress-estimator');
12
12
const prompt = require ( 'prompt-promise' ) ;
13
13
const theme = require ( './theme' ) ;
14
14
15
- // The following packages are published to NPM but not by this script.
16
- // They are released through a separate process.
17
- const RELEASE_SCRIPT_PACKAGE_SKIPLIST = [
18
- 'react-devtools' ,
19
- 'react-devtools-core' ,
20
- 'react-devtools-inline' ,
21
- ] ;
22
-
23
15
// https://www.npmjs.com/package/progress-estimator#configuration
24
16
const logger = createLogger ( {
25
17
storagePath : join ( __dirname , '.progress-estimator' ) ,
@@ -112,31 +104,38 @@ const getChecksumForCurrentRevision = async cwd => {
112
104
return hashedPackages . hash . slice ( 0 , 7 ) ;
113
105
} ;
114
106
115
- const getPublicPackages = ( ) => {
116
- const packagesRoot = join ( __dirname , '..' , '..' , 'packages' ) ;
117
-
118
- return readdirSync ( packagesRoot ) . filter ( dir => {
119
- if ( RELEASE_SCRIPT_PACKAGE_SKIPLIST . includes ( dir ) ) {
120
- return false ;
121
- }
122
-
123
- const packagePath = join ( packagesRoot , dir , 'package.json' ) ;
124
-
125
- if ( dir . charAt ( 0 ) !== '.' ) {
126
- let stat ;
127
- try {
128
- stat = statSync ( packagePath ) ;
129
- } catch ( err ) {
130
- return false ;
131
- }
132
- if ( stat . isFile ( ) ) {
133
- const packageJSON = JSON . parse ( readFileSync ( packagePath ) ) ;
134
- return packageJSON . private !== true ;
135
- }
136
- }
137
-
138
- return false ;
139
- } ) ;
107
+ const getPublicPackages = isExperimental => {
108
+ if ( isExperimental ) {
109
+ return [
110
+ 'create-subscription' ,
111
+ 'eslint-plugin-react-hooks' ,
112
+ 'jest-react' ,
113
+ 'react' ,
114
+ 'react-art' ,
115
+ 'react-dom' ,
116
+ 'react-is' ,
117
+ 'react-reconciler' ,
118
+ 'react-refresh' ,
119
+ 'react-test-renderer' ,
120
+ 'use-subscription' ,
121
+ 'scheduler' ,
122
+ ] ;
123
+ } else {
124
+ return [
125
+ 'create-subscription' ,
126
+ 'eslint-plugin-react-hooks' ,
127
+ 'jest-react' ,
128
+ 'react' ,
129
+ 'react-art' ,
130
+ 'react-dom' ,
131
+ 'react-is' ,
132
+ 'react-reconciler' ,
133
+ 'react-refresh' ,
134
+ 'react-test-renderer' ,
135
+ 'use-subscription' ,
136
+ 'scheduler' ,
137
+ ] ;
138
+ }
140
139
} ;
141
140
142
141
const handleError = error => {
@@ -199,7 +198,8 @@ const splitCommaParams = array => {
199
198
// It is based on the version of React in the local package.json (e.g. 16.12.0-01974a867).
200
199
// Both numbers will be replaced if the "next" release is promoted to a stable release.
201
200
const updateVersionsForNext = async ( cwd , reactVersion , version ) => {
202
- const packages = getPublicPackages ( join ( cwd , 'packages' ) ) ;
201
+ const isExperimental = reactVersion . includes ( 'experimental' ) ;
202
+ const packages = getPublicPackages ( isExperimental ) ;
203
203
const packagesDir = join ( cwd , 'packages' ) ;
204
204
205
205
// Update the shared React version source file.
0 commit comments