mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
All JavaScript files for each entrypoint are put in their respective sub-folder of front-end. The HTML files load from the new location and build_release_applications has been updated to load from the correct location. R=aerotwist@chromium.org Bug: 1187573 Change-Id: I4b93f3a2127ef2d3ce7dccefe03f70e79dac1c19 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2818379 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Paul Lewis <aerotwist@chromium.org>
37 lines
984 B
JavaScript
37 lines
984 B
JavaScript
// Copyright 2020 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 {argv} = require('yargs');
|
|
|
|
const ENTRYPOINTS = [
|
|
'devtools_app',
|
|
'inspector',
|
|
'js_app',
|
|
'ndb_app',
|
|
'node_app',
|
|
'toolbox',
|
|
'worker_app',
|
|
];
|
|
|
|
const {template} = argv;
|
|
|
|
if (!template) {
|
|
throw new Error('Must specify --template location with the location of the HTML entrypoint template.');
|
|
}
|
|
|
|
const {outDirectory} = argv;
|
|
|
|
if (!outDirectory) {
|
|
throw new Error('Must specify --out-directory location where the outputs must live.');
|
|
}
|
|
|
|
const templateContent = fs.readFileSync(template, 'utf-8');
|
|
|
|
for (const entrypoint of ENTRYPOINTS) {
|
|
const rewrittenTemplateContent = templateContent.replace(new RegExp('%ENTRYPOINT_NAME%', 'g'), entrypoint);
|
|
fs.writeFileSync(path.join(outDirectory, `${entrypoint}.html`), rewrittenTemplateContent);
|
|
}
|