forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add postpack hook that undoes prepack
Summary: Changelog: [General][Changed] - `eslint-plugin-specs` package has prepack hook that changes `PACKAGE_USAGE` variable of `react-native-modules.js` to `true`. This changed file is can then be published to NPM, but should not be committed to the repo. This diff adds postpack hook that reverts the change, so we do not have to do it manually. Reviewed By: cipolleschi Differential Revision: D38244367 fbshipit-source-id: 818dbdea82e7e4b89094b3e27ae2d63b9e736659
- Loading branch information
1 parent
c942e85
commit 4b158f0
Showing
2 changed files
with
46 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
*/ | ||
|
||
const fs = require('fs'); | ||
|
||
/** | ||
* script to prepare package for publish. | ||
* | ||
* Due to differences to how we consume internal packages, update a flag | ||
*/ | ||
|
||
fs.readFile('./react-native-modules.js', 'utf8', function (readError, source) { | ||
if (readError != null) { | ||
return console.error( | ||
'Failed to read react-native-modules.js for publish', | ||
readError, | ||
); | ||
} | ||
|
||
const result = source.replace( | ||
'const PACKAGE_USAGE = true;', | ||
'const PACKAGE_USAGE = false;', | ||
); | ||
|
||
fs.writeFile( | ||
'./react-native-modules.js', | ||
result, | ||
'utf8', | ||
function (writeError) { | ||
if (writeError != null) { | ||
return console.error( | ||
'Failed to update react-native-modules.js for publish', | ||
writeError, | ||
); | ||
} | ||
}, | ||
); | ||
}); |