diff --git a/packages/eslint-plugin-specs/package.json b/packages/eslint-plugin-specs/package.json index 77bf5df8ad761e..d5cac27cdd5365 100644 --- a/packages/eslint-plugin-specs/package.json +++ b/packages/eslint-plugin-specs/package.json @@ -9,7 +9,8 @@ "directory": "packages/eslint-plugin-specs" }, "scripts": { - "prepack": "node prepack.js" + "prepack": "node prepack.js", + "postpack": "node postpack.js" }, "dependencies": { "@babel/core": "^7.14.0", diff --git a/packages/eslint-plugin-specs/postpack.js b/packages/eslint-plugin-specs/postpack.js new file mode 100644 index 00000000000000..99807d8b086d5f --- /dev/null +++ b/packages/eslint-plugin-specs/postpack.js @@ -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, + ); + } + }, + ); +});