mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
Bug: 1106746 Change-Id: I7612419d19815ce5ad67c842215f65f93ca90769 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960177 Commit-Queue: Kriti Sapra <kritisapra@google.com> Reviewed-by: Paul Lewis <aerotwist@chromium.org> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
// Copyright 2021 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const [, , targetName, srcDir, targetGenDir, files] = process.argv;
|
|
|
|
const filenames = files.split(',');
|
|
const configFiles = [];
|
|
|
|
for (const fileName of filenames) {
|
|
const output = fs.readFileSync(path.join(srcDir, fileName), {encoding: 'utf8', flag: 'r'});
|
|
|
|
fs.writeFileSync(
|
|
path.join(targetGenDir, fileName + '.js'),
|
|
`// Copyright ${new Date().getFullYear()} The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
const styles = new CSSStyleSheet();
|
|
styles.replaceSync(
|
|
\`${output}
|
|
/*# sourceURL=${fileName} */
|
|
\`);
|
|
export default styles;
|
|
`);
|
|
|
|
configFiles.push(`\"${fileName}\"`);
|
|
}
|
|
|
|
fs.writeFileSync(path.join(targetGenDir, `${targetName}-tsconfig.json`), `{
|
|
"compilerOptions": {
|
|
"composite": true,
|
|
"outDir": "."
|
|
},
|
|
"files": [
|
|
${configFiles.join(',\n ')}
|
|
]
|
|
}
|
|
`);
|