1.0.16 • Published 9 months ago

sd-nodeify v1.0.16

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months 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

9 months ago

1.0.15

9 months ago

1.0.14

9 months ago

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

10.3.0

9 months ago