1.0.16 • Published 1 year ago

sd-nodeify v1.0.16

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

SnickerDoodle Nodeify

description

Installation

To deploy this project run

  npm -i sd-nodeify or yarn add sd-nodeify
 ./node_modules/.bin/sd-nodeify --hack --install
  cd ios && pod install

In your babel.config.js, add a module resolver

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
+   [
+     'module-resolver',
+     {
+       alias: {
+         'crypto': 'react-native-quick-crypto',
+         'stream': 'stream-browserify',
+         'buffer': '@craftzdog/react-native-buffer',
+         'argon':  'react-native-argon2',
+       },
+     },
+   ],
    ...
  ],
    '@babel/plugin-syntax-import-assertions',
    'babel-plugin-transform-typescript-metadata',
    'babel-plugin-parameter-decorator',
    ['@babel/plugin-proposal-decorators', { legacy: true }],
};

In your metro.config.js, add resolver to module_exports

const extraNodeModules = {
  stream: require.resolve('stream-browserify'),
  crypto: require.resolve('react-native-quick-crypto'),
  zlib: require.resolve('browserify-zlib'),
  argon2: require.resolve('react-native-argon2'),
   };
 // rest of your code
   module.exports = {
    ...
   resolver: {
   ...
    extraNodeModules: require('node-libs-react-native'),
   },
}

Add required imports to your index.ts

+ import './shim.js';
+ require('node-libs-react-native/globals.js');
+ import 'reflect-metadata';
+ import setGlobalVars from 'indexeddbshim/dist/indexeddbshim-noninvasive';
+ import SQLite from 'react-native-sqlite-2';
+ import { MobileStorageUtils } from 'sd-nodeify';

To activate indexeddb in your project

 setGlobalVars(global, {
   checkOrigin: false,
   win: SQLite,
 });

In index.ts or whenever you want you can call SnickerdoodleCore

import { SnickerdoodleCore } from '@snickerdoodlelabs/core';
...
new SnickerdoodleCore(
 coreConfig, // Config file for SnickerdoodleCore
 new MobileStorageUtils(),
 undefined,
 undefined,
);
1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

10.3.0

1 year ago