Skip to content

Instantly share code, notes, and snippets.

View ryoldash's full-sized avatar

Rashiduddin Yoldash ryoldash

View GitHub Profile
@ryoldash
ryoldash / .babelrc
Created January 14, 2019 20:21
How to use Mobx, Typescript, Native Base, mocking REST APIs with JSON Server and Faker.JS in React Native
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
]
]
@ryoldash
ryoldash / package.json
Created January 13, 2019 21:06
How to use Mobx, Typescript, Native Base, mocking REST APIs with JSON Server and Faker.JS in React Native
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"transform": {
"^.+\\.(js)$": "<rootDir>/node_modules/babel-jest",
"\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
@ryoldash
ryoldash / rn-cli.config.js
Created January 13, 2019 20:48
How to use Mobx, Typescript, Native Base, mocking REST APIs with JSON Server and Faker.JS in React Native
module.exports = {
getTransformModulePath() {
return require.resolve("react-native-typescript-transformer");
},
getSourceExts() {
return ["ts", "tsx"];
}
};
@ryoldash
ryoldash / tsconfig.json
Created January 13, 2019 20:32
How to use Mobx, Typescript, NativeBase, mocking REST APIs with JSON Server and Faker.JS in React Native
{
"compilerOptions": {
"baseUrl": ".",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"outDir": "artifacts",
@ryoldash
ryoldash / index.html
Last active October 29, 2018 16:53
Customize webpack configuration of React App created with Create-react-app. Scripts added to index.html
// public/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
@ryoldash
ryoldash / config-overrides.js
Last active December 27, 2019 10:55
Customize webpack configuration of React App created with Create-react-app
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = function override(config, env) {
if (!config.plugins) {
config.plugins = [];
}
config.plugins.push(
(process.env.NODE_ENV === 'production') ?
new CopyWebpackPlugin([{from: 'src/lib/legacyLib.js'}]) :
@ryoldash
ryoldash / webpack.config.js
Last active October 29, 2018 16:52
Customize webpack configuration of React App created with Create-react-app
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
entry: {
main: './src/index.js'
},
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist')
@ryoldash
ryoldash / legacyLib.d.ts
Last active October 29, 2018 16:52
Customize webpack configuration of React App created with Create-react-app
declare namespace legacyLib {
let pageLoadTime: Date;
function authorize(): void;
}
@ryoldash
ryoldash / legacyLib.js
Last active October 29, 2018 16:51
Customize webpack configuration of React App created with Create-react-app
var legacyLib = legacyLib || {};
(function () {
legacyLib.pageLoadTime = new Date();
legacyLib.authorize = function () {
console.log("Authorize function invoked.")
}
})();
@ryoldash
ryoldash / index.html
Last active October 29, 2018 16:51
Customize webpack configuration of React App created with Create-react-app
<!--public/index.html-->
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="/dist/legacyLib.js"></script>
</head>
<body>
</body>