From ec55e0e799e7c792e9da8abaea86a31674513745 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Fri, 7 Jun 2024 10:46:53 -0400 Subject: [PATCH] [WIP] Move @generated signing from build to sync --- scripts/rollup/packaging.js | 20 -------------------- scripts/rollup/wrappers.js | 25 ++++++++++++------------- 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/scripts/rollup/packaging.js b/scripts/rollup/packaging.js index 24b3d79316d4a..7c433fc2dd330 100644 --- a/scripts/rollup/packaging.js +++ b/scripts/rollup/packaging.js @@ -7,7 +7,6 @@ const { readFileSync, writeFileSync, } = require('fs'); -const path = require('path'); const Bundles = require('./bundles'); const { asyncCopyTo, @@ -15,7 +14,6 @@ const { asyncExtractTar, asyncRimRaf, } = require('./utils'); -const {getSigningToken, signFile} = require('signedsource'); const { NODE_ES2015, @@ -127,24 +125,6 @@ async function copyRNShims() { require.resolve('react-native-renderer/src/ReactNativeTypes.js'), 'build/react-native/shims/ReactNativeTypes.js' ); - processGenerated('build/react-native/shims'); -} - -function processGenerated(directory) { - const files = readdirSync(directory) - .filter(dir => dir.endsWith('.js')) - .map(file => path.join(directory, file)); - - files.forEach(file => { - const originalContents = readFileSync(file, 'utf8'); - const contents = originalContents - // Replace {@}format with {@}noformat - .replace(/(\r?\n\s*\*\s*)@format\b.*(\n)/, '$1@noformat$2') - // Add {@}nolint and {@}generated - .replace(/(\r?\n\s*\*)\//, `$1 @nolint$1 ${getSigningToken()}$1/`); - const signedContents = signFile(contents); - writeFileSync(file, signedContents, 'utf8'); - }); } async function copyAllShims() { diff --git a/scripts/rollup/wrappers.js b/scripts/rollup/wrappers.js index e76931bb85b42..7c4b33f9e34b4 100644 --- a/scripts/rollup/wrappers.js +++ b/scripts/rollup/wrappers.js @@ -1,6 +1,5 @@ 'use strict'; -const {signFile, getSigningToken} = require('signedsource'); const {bundleTypes, moduleTypes} = require('./bundles'); const { @@ -392,7 +391,7 @@ ${source}`; /****************** RN_OSS_DEV ******************/ [RN_OSS_DEV](source, globalName, filename, moduleType) { - return signFile(`/** + return `/** ${license} * * @noflow @@ -401,12 +400,12 @@ ${license} * ${getSigningToken()} */ -${source}`); +${source}`; }, /****************** RN_OSS_PROD ******************/ [RN_OSS_PROD](source, globalName, filename, moduleType) { - return signFile(`/** + return `/** ${license} * * @noflow @@ -415,12 +414,12 @@ ${license} * ${getSigningToken()} */ -${source}`); +${source}`; }, /****************** RN_OSS_PROFILING ******************/ [RN_OSS_PROFILING](source, globalName, filename, moduleType) { - return signFile(`/** + return `/** ${license} * * @noflow @@ -429,12 +428,12 @@ ${license} * ${getSigningToken()} */ -${source}`); +${source}`; }, /****************** RN_FB_DEV ******************/ [RN_FB_DEV](source, globalName, filename, moduleType) { - return signFile(`/** + return `/** ${license} * * @noflow @@ -443,12 +442,12 @@ ${license} * ${getSigningToken()} */ -${source}`); +${source}`; }, /****************** RN_FB_PROD ******************/ [RN_FB_PROD](source, globalName, filename, moduleType) { - return signFile(`/** + return `/** ${license} * * @noflow @@ -457,12 +456,12 @@ ${license} * ${getSigningToken()} */ -${source}`); +${source}`; }, /****************** RN_FB_PROFILING ******************/ [RN_FB_PROFILING](source, globalName, filename, moduleType) { - return signFile(`/** + return `/** ${license} * * @noflow @@ -471,7 +470,7 @@ ${license} * ${getSigningToken()} */ -${source}`); +${source}`; }, };