mirror of
https://github.com/morten-olsen/react-native-debug-console.git
synced 2026-02-08 00:36:26 +01:00
Cleanup
This commit is contained in:
1
__mocks__/fileMock.js
Normal file
1
__mocks__/fileMock.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 'test-file-stub';
|
||||
9
babel.config.js
Normal file
9
babel.config.js
Normal file
@@ -0,0 +1,9 @@
|
||||
module.exports = function(api) {
|
||||
api.cache(true);
|
||||
return {
|
||||
presets: [
|
||||
'babel-preset-expo',
|
||||
'@babel/preset-typescript',
|
||||
],
|
||||
};
|
||||
};
|
||||
9
jest.config.js
Normal file
9
jest.config.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
preset: 'react-native',
|
||||
rootDir: path.join(__dirname, 'packages'),
|
||||
moduleNameMapper: {
|
||||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': path.join(__dirname, '__mocks__', 'fileMock.js'),
|
||||
},
|
||||
};
|
||||
@@ -10,8 +10,11 @@
|
||||
"test": "lerna run --stream test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"lerna": "^3.0.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.5.0",
|
||||
"@babel/preset-typescript": "^7.3.3",
|
||||
"jest": "^24.8.0",
|
||||
"react-test-renderer": "^16.8.6"
|
||||
"lerna": "^3.0.3",
|
||||
"react-test-renderer": "^16.8.6",
|
||||
"typescript": "^3.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
module.exports = function(api) {
|
||||
api.cache(true);
|
||||
return {
|
||||
presets: ['babel-preset-expo'],
|
||||
plugins: [
|
||||
[require.resolve('babel-plugin-module-resolver'), {
|
||||
alias: {
|
||||
'@babel/runtime': '../node_modules/@babel/runtime',
|
||||
}
|
||||
}]
|
||||
]
|
||||
};
|
||||
};
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
log,
|
||||
network,
|
||||
show,
|
||||
} from 'react-native-debug-console';
|
||||
} from 'react-native-debug-console/src';
|
||||
|
||||
network.attach();
|
||||
log.attach(true);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
const config = require('../babel.config');
|
||||
const config = require('../../babel.config');
|
||||
|
||||
module.exports = config;
|
||||
@@ -6,6 +6,7 @@ const path = require('path');
|
||||
module.exports = {
|
||||
watchFolders: [
|
||||
__dirname,
|
||||
path.join(__dirname, '..', 'lib'),
|
||||
path.join(__dirname, '..', '..', 'node_modules'),
|
||||
]
|
||||
};
|
||||
@@ -1,3 +1,3 @@
|
||||
const config = require('../babel.config');
|
||||
const config = require('../../babel.config');
|
||||
|
||||
module.exports = config;
|
||||
@@ -1,4 +1,3 @@
|
||||
module.exports = {
|
||||
preset: "react-native",
|
||||
rootDir: '..',
|
||||
};
|
||||
const config = require('../../jest.config');
|
||||
|
||||
module.exports = config;
|
||||
@@ -5,6 +5,9 @@
|
||||
"repository": {
|
||||
"url": "https://github.com/morten-olsen/react-native-debugger"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"react-native-json-tree": "^1.2.0",
|
||||
|
||||
@@ -65,12 +65,11 @@ class Log {
|
||||
}
|
||||
|
||||
attach(keep) {
|
||||
global.proxyConsole = proxyConsole;
|
||||
const redirected = Object.keys(proxyConsole).reduce((output, key) => ({
|
||||
...output,
|
||||
[key]: keep ? (...args) => proxyConsole[key](...args) : () => {},
|
||||
}), {});
|
||||
window.console = {
|
||||
global.console = {
|
||||
...redirected,
|
||||
error: (...data) => this.error(data, keep),
|
||||
warn: (...data) => this.warn(data, keep),
|
||||
@@ -79,12 +78,14 @@ class Log {
|
||||
debug: (...data) => this.debug(data, keep),
|
||||
verbose: (...data) => this.debug(data, keep),
|
||||
};
|
||||
if (global.ErrorUtils) {
|
||||
/*if (global.ErrorUtils) {
|
||||
global.ErrorUtils.setGlobalHandler((err, fatal) => {
|
||||
this.error([err], keep);
|
||||
});
|
||||
}*/
|
||||
if (global.addEventListener) {
|
||||
global.addEventListener('error', this.handleError);
|
||||
}
|
||||
window.addEventListener('error', this.handleError);
|
||||
}
|
||||
|
||||
detach() {
|
||||
@@ -92,7 +93,9 @@ class Log {
|
||||
window.console[key] = proxies[key];
|
||||
});
|
||||
|
||||
window.removeEventListener('error', this.handleError);
|
||||
if (global.removeEventListener) {
|
||||
global.removeEventListener('error', this.handleError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@ import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import {
|
||||
DevTool,
|
||||
} from 'react-native-debug-console';
|
||||
import Console from 'react-native-debug-console/src/components/DevTool/Console';
|
||||
import ConsoleOutput, { Row as OutputRow} from 'react-native-debug-console/src/components/DevTool/Console/Output';
|
||||
import ConsoleInput from 'react-native-debug-console/src/components/DevTool/Console/Input';
|
||||
} from '../src';
|
||||
import Console from '../src/components/DevTool/Console';
|
||||
import ConsoleOutput, { Row as OutputRow} from '../src/components/DevTool/Console/Output';
|
||||
import ConsoleInput from '../src/components/DevTool/Console/Input';
|
||||
|
||||
import Requests from 'react-native-debug-console/src/components/DevTool/Requests';
|
||||
import RequestsDetails from 'react-native-debug-console/src/components/DevTool/Requests/Details';
|
||||
import RequestsList from 'react-native-debug-console/src/components/DevTool/Requests/List';
|
||||
import Requests from '../src/components/DevTool/Requests';
|
||||
import RequestsDetails from '../src/components/DevTool/Requests/Details';
|
||||
import RequestsList from '../src/components/DevTool/Requests/List';
|
||||
|
||||
import Storage from 'react-native-debug-console/src/components/DevTool/Storage';
|
||||
import StorageKeys from 'react-native-debug-console/src/components/DevTool/Storage/Keys';
|
||||
import StorageValues from 'react-native-debug-console/src/components/DevTool/Storage/Value';
|
||||
import Storage from '../src/components/DevTool/Storage';
|
||||
import StorageKeys from '../src/components/DevTool/Storage/Keys';
|
||||
import StorageValues from '../src/components/DevTool/Storage/Value';
|
||||
|
||||
const createLog = () => {
|
||||
const listeners = [];
|
||||
|
||||
63
tsconfig.json
Normal file
63
tsconfig.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Basic Options */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
// "outDir": "./", /* Redirect output structure to the directory. */
|
||||
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||
// "removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
|
||||
/* Additional Checks */
|
||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
}
|
||||
}
|
||||
27
wallaby.js
Normal file
27
wallaby.js
Normal file
@@ -0,0 +1,27 @@
|
||||
module.exports = function (wallaby) {
|
||||
|
||||
return {
|
||||
files: [
|
||||
'babel.config.js',
|
||||
'packages/**/*.js',
|
||||
'__mocks__/**/*.js',
|
||||
'!packages/**/*.spec.js',
|
||||
'!packages/demo/node_modules/**/*'
|
||||
],
|
||||
|
||||
tests: [
|
||||
'packages/lib/test/*.spec.js',
|
||||
],
|
||||
|
||||
env: {
|
||||
type: 'node',
|
||||
runner: 'node'
|
||||
},
|
||||
|
||||
compilers: {
|
||||
'**/*.js': wallaby.compilers.babel()
|
||||
},
|
||||
|
||||
testFramework: 'jest'
|
||||
};
|
||||
};
|
||||
17
yarn.lock
17
yarn.lock
@@ -254,7 +254,7 @@
|
||||
"@babel/helper-remap-async-to-generator" "^7.1.0"
|
||||
"@babel/plugin-syntax-async-generators" "^7.2.0"
|
||||
|
||||
"@babel/plugin-proposal-class-properties@^7.0.0":
|
||||
"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.5.0":
|
||||
version "7.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.0.tgz#5bc6a0537d286fcb4fd4e89975adbca334987007"
|
||||
integrity sha512-9L/JfPCT+kShiiTTzcnBJ8cOwdKVmlC1RcCf9F0F9tERVrM4iWtWnXtjWCRqNm2la2BxO1MPArWNsU9zsSJWSQ==
|
||||
@@ -713,7 +713,7 @@
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
|
||||
"@babel/plugin-transform-typescript@^7.0.0":
|
||||
"@babel/plugin-transform-typescript@^7.0.0", "@babel/plugin-transform-typescript@^7.3.2":
|
||||
version "7.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.5.0.tgz#a0855287eec87fe83c11e8dad67d431d343b53b1"
|
||||
integrity sha512-z3T4P70XJFUAHzLtEsmJ37BGVDj+55/KX8W8TBSBF0qk0KLazw8xlwVcRHacxNPgprzTdI4QWW+2eS6bTkQbCA==
|
||||
@@ -795,6 +795,14 @@
|
||||
js-levenshtein "^1.1.3"
|
||||
semver "^5.5.0"
|
||||
|
||||
"@babel/preset-typescript@^7.3.3":
|
||||
version "7.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.3.3.tgz#88669911053fa16b2b276ea2ede2ca603b3f307a"
|
||||
integrity sha512-mzMVuIP4lqtn4du2ynEfdO0+RYcslwrZiJHXu4MGaC1ctJiW2fyaeDrtjJGs7R/KebZ1sgowcIoWf4uRpEfKEg==
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
"@babel/plugin-transform-typescript" "^7.3.2"
|
||||
|
||||
"@babel/register@^7.0.0":
|
||||
version "7.4.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.4.4.tgz#370a68ba36f08f015a8b35d4864176c6b65d7a23"
|
||||
@@ -14207,6 +14215,11 @@ typedarray@^0.0.6:
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
|
||||
|
||||
typescript@^3.5.2:
|
||||
version "3.5.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.2.tgz#a09e1dc69bc9551cadf17dba10ee42cf55e5d56c"
|
||||
integrity sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA==
|
||||
|
||||
ua-parser-js@^0.7.18, ua-parser-js@^0.7.19:
|
||||
version "0.7.20"
|
||||
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.20.tgz#7527178b82f6a62a0f243d1f94fd30e3e3c21098"
|
||||
|
||||
Reference in New Issue
Block a user