Skip to content

Commit

Permalink
fix webpack always clearing console output
Browse files Browse the repository at this point in the history
  • Loading branch information
pavjacko committed Jan 19, 2023
1 parent e4db2ea commit f54d26e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ test/examples/*.js
**/projectTemplate
**/projectTemplates
**/pluginTemplates
**/nodeModuleOverrides
**/supportFiles
**/coreTemplateFiles
packages/rnv/tests
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "renative-wrapper",
"version": "0.37.0-canary.3",
"version": "0.37.0-canary.4",
"description": "🚀🚀🚀 Unified Development Platform. Bootstrap, Develop & Deploy `iOS`, `tvOS`, `Android`, `Android TV`, `Fire TV`, `Android Wear`, `Web`, `Tizen TV`, `Tizen Watch`, `Tizen Mobile`, `LG webOS`, `macOS/OSX`, `Windows`, `KaiOS`, `FirefoxOS`, `Firefox TV`, `Linux` and `Chromecast` platforms",
"keywords": [
"android tv",
Expand Down Expand Up @@ -174,4 +174,4 @@
"ejs": "3.1.7",
"shell-quote": "1.7.3"
}
}
}
13 changes: 12 additions & 1 deletion packages/engine-rn-web/src/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ export const withRNVBabel = (cnf) => {

return {
retainLines: true,
presets: ['module:babel-preset-expo'],
presets: [
[
'module:metro-react-native-babel-preset',
{ useTransformReactJSXExperimental: true }
],
],
...cnf,
plugins: [
[
Expand All @@ -12,6 +17,12 @@ export const withRNVBabel = (cnf) => {
root: [process.env.RNV_MONO_ROOT || '.'],
},
],
// [
// '@babel/plugin-transform-react-jsx',
// {
// runtime: 'automatic',
// },
// ],
...plugins
],

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

function clearConsole() {
// PATCH: WE DO NOT WANT THIS TO HAPPEN
// process.stdout.write(
// process.platform === 'win32' ? '\x1B[2J\x1B[0f' : '\x1B[2J\x1B[3J\x1B[H'
// );
}

module.exports = clearConsole;
15 changes: 14 additions & 1 deletion packages/sdk-webpack/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import axios from 'axios';
import open from 'better-opn';
import path from 'path';
import commandExists from 'command-exists';
import { Common, Constants, EngineManager, Exec, Logger, PlatformManager, PluginManager, ProjectManager } from 'rnv';
import { Common, Constants, EngineManager, Exec, Logger, PlatformManager, PluginManager, ProjectManager, FileUtils } from 'rnv';
// import { fsExistsSync, fsWriteFileSync } from 'rnv/dist/core/systemManager/fileutils';
// import { runServer } from './scripts/start';

const { isPlatformActive } = PlatformManager;
Expand All @@ -30,6 +32,7 @@ const { generateEnvVars } = EngineManager;
const { getModuleConfigs } = PluginManager;
const { REMOTE_DEBUG_PORT } = Constants;
const { executeAsync } = Exec;
const { copyFileSync, fsExistsSync } = FileUtils;

export const waitForUrl = url => new Promise((resolve, reject) => {
let attempts = 0;
Expand Down Expand Up @@ -148,6 +151,16 @@ export const _runWebDevServer = async (c, enableRemoteDebugger) => {
process.env[v] = env[v];
});

try {
const reactDevUtilsPath = require.resolve('react-dev-utils/clearConsole');
if (fsExistsSync(reactDevUtilsPath)) {
copyFileSync(path.join(__dirname, '../nodeModuleOverrides/react-dev-utils/clearConsole.js'), reactDevUtilsPath);
}
} catch (e) {
// Do nothing
logError(e);
}

process.env.PUBLIC_URL = getConfigProp(c, c.platform, 'publicUrl', '.');
process.env.RNV_ENTRY_FILE = getConfigProp(c, c.platform, 'entryFile');
process.env.PORT = c.runtime.port;
Expand Down

0 comments on commit f54d26e

Please sign in to comment.