Summary: mass rename files Reviewed By: passy Differential Revision: D33890034 fbshipit-source-id: 1c654a4f7f5b83eaa56a8c11df863003e8d7bed7
24 lines
863 B
TypeScript
24 lines
863 B
TypeScript
/**
|
|
* 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
|
|
*/
|
|
|
|
import os from 'os';
|
|
import fs from 'fs-extra';
|
|
|
|
// Metro erroneously adds source map comments to the bottom of the file
|
|
// which break checksums on CI environments where paths change and are generally
|
|
// undesired. We manually strip the comment here and write the file back.
|
|
export default async function stripSourceMapComment(out: string) {
|
|
const lines = (await fs.readFile(out, 'utf-8')).split(os.EOL);
|
|
const lastLine = lines[lines.length - 1];
|
|
if (lastLine.startsWith('//# sourceMappingURL=')) {
|
|
console.log(`Updating ${out} to remove sourceMapURL= comment.`);
|
|
await fs.writeFile(out, lines.slice(0, lines.length - 1).join(os.EOL));
|
|
}
|
|
}
|