Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Commit

Permalink
Fixed microbundle code-splitting types
Browse files Browse the repository at this point in the history
  • Loading branch information
dilan-dio4 committed May 31, 2021
1 parent 2081b89 commit 41aff0c
Show file tree
Hide file tree
Showing 37 changed files with 1,358 additions and 213 deletions.
4 changes: 2 additions & 2 deletions example/src/ProjectUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ export default function ProjectUser() {

useEffect(() => {
console.log("Mobile Apps allowed when not signed in");
db('MOBILE APPS').return().limit(10).all().then(res => {
db('MOBILE APPS').return().limit(10).all().then((res: any[]) => {
setData(res as Record<string, any>[]);
});

onSignIn(() => {
console.log("Signed In!");
db('REACT TEST', true).return().limit(10).all().then(res => {
db('REACT TEST', true).return().limit(10).all().then((res: any[]) => {
setData(res as Record<string, any>[]);
});
});
Expand Down
2 changes: 1 addition & 1 deletion example/src/UseReturnExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const UseReturnExample = () => {
<div className="m-4">
<button className="btn green" onClick={onAddPage}><span>Add<br />Card</span></button>
</div>
{loading ? <div className="loader"></div> : frame.map((ele, index) => <CardElement {...ele} index={index} key={index} />)}
{loading ? <div className="loader"></div> : frame.map((ele: any, index: any) => <CardElement {...ele} index={index} key={index} />)}
</div>
<div className="button-row">
<div className="d-flex align-items-center">
Expand Down
2 changes: 1 addition & 1 deletion example/src/UseReturnStressTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ChildUseReturn = () => {
return (
<div>
<div style={{ display: "flex", alignItems: "center" }}>
{loading ? <div className="loader"></div> : frame.map((ele, index) => <CardElement {...ele} index={index} key={index} />)}
{loading ? <div className="loader"></div> : frame.map((ele: any, index: any) => <CardElement {...ele} index={index} key={index} />)}
</div>
<div className="button-row">
<div className="d-flex align-items-center">
Expand Down
22 changes: 14 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"node": ">=10"
},
"scripts": {
"build": "microbundle-crl --no-compress --format modern,cjs",
"start": "microbundle-crl watch --no-compress --format modern,cjs",
"prepare": "microbundle-crl --no-compress --format modern,cjs",
"build": "npm run clean && microbundle build --jsx React.createElement --external react --no-compress --format modern,cjs",
"start": "npm run clean && microbundle watch --jsx React.createElement --external react --no-compress --format modern,cjs",
"prepare": "npm run clean && microbundle build --jsx React.createElement --external react --no-compress --format modern,cjs",
"genDocs": "typedoc",
"clean": "shx rm -rf dist",
"postinstall": "node ./scripts/postinstall.js",
"test": "echo 'no test specified' || true"
},
Expand All @@ -26,6 +27,7 @@
"@types/node": "^12.12.38",
"@types/react": "^16.9.27",
"@types/react-dom": "^16.9.7",
"@types/styled-components": "^5.1.9",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"cross-env": "^7.0.2",
Expand All @@ -37,10 +39,11 @@
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-standard": "^4.0.1",
"microbundle-crl": "^0.13.10",
"microbundle": "^0.13.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "^3.4.1",
"shx": "^0.3.3",
"typedoc": "^0.20.36",
"typescript": "^3.7.5"
},
Expand All @@ -49,11 +52,14 @@
"scripts"
],
"dependencies": {
"@react-native-community/async-storage": "1.12.1",
"easybasejs": "4.2.11",
"EasyQB": "git+https://github.com/easybase/EasyQB.git",
"@react-native-async-storage/async-storage": "github:easybase/async-storage",
"easybasejs": "4.2.13",
"easyqb": "^1.0.20",
"fast-deep-equal": "^3.1.3",
"object-observer": "^4.0.3",
"react-native-storage": "^1.0.1"
"react-hook-form": "^7.7.1",
"react-hot-toast": "^2.0.0",
"react-native-storage": "^1.0.1",
"styled-components": "^5.3.0"
}
}
4 changes: 2 additions & 2 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function clean() {
function installAsyncStorage() {
try {
console.log("Installing async-storage...");
rootPackageJson.dependencies["@react-native-community/async-storage"] = "^1.12.1";
rootPackageJson.dependencies["@react-native-async-storage/async-storage"] = "^1.12.1";
fs.writeFileSync("../../package.json", JSON.stringify(rootPackageJson, null, 2));
} catch (error) {
console.log("Failed installing asyncStorage.", error, " " + troubleshootString);
Expand Down Expand Up @@ -98,7 +98,7 @@ function linkAsyncStorage() {
});
} else {
// React Native <= 0.59
execute("react-native link @react-native-community/async-storage", {
execute("react-native link @react-native-async-storage/async-storage", {
cwd: "../../",
...execSyncDefaultSettings
});
Expand Down
10 changes: 4 additions & 6 deletions src/EasybaseContext.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { createContext } from "react";
import {
ContextValue,
UseReturnValue
} from "./types/types";
import {
UseReturnValue,
ConfigureFrameOptions,
StatusResponse,
AddRecordOptions,
UpdateRecordAttachmentOptions,
FrameConfiguration,
QueryOptions,
EmailTemplate
} from "./types/jsTypes";
import { SQW } from "EasyQB/types/sq";
import { NewExpression } from "EasyQB/types/expression";
} from "./types/types";
import { SQW } from "easyqb/types/sq";
import { NewExpression } from "easyqb/types/expression";

function Frame(): Record<string, any>[];
function Frame(index: number): Record<string, any>;
Expand Down
8 changes: 3 additions & 5 deletions src/EasybaseProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import deepEqual from "fast-deep-equal";
import {
EasybaseProviderProps,
ContextValue,
UseReturnValue
} from "./types/types";
import {
UseReturnValue,
POST_TYPES,
FrameConfiguration,
FileFromURI,
Expand All @@ -17,7 +15,7 @@ import {
DeleteRecordOptions,
DB_STATUS,
EXECUTE_COUNT
} from "./types/jsTypes"
} from "./types/types";
import imageExtensions from "./assets/image-extensions.json";
import videoExtensions from "./assets/video-extensions.json";
import utilsFactory from "../node_modules/easybasejs/src/EasybaseProvider/utils";
Expand All @@ -27,7 +25,7 @@ import dbFactory from "../node_modules/easybasejs/src/EasybaseProvider/db";
import { gFactory } from "../node_modules/easybasejs/src/EasybaseProvider/g";
import { Observable } from "object-observer";
import * as cache from "./cache";
import { SQW } from "EasyQB/types/sq";
import { SQW } from "easyqb/types/sq";

const g = gFactory();

Expand Down
4 changes: 2 additions & 2 deletions src/cache.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Globals } from "./types/jsTypes";
import { Globals } from "./types/types";
import Storage from 'react-native-storage';

let storage: Storage;

if ((typeof navigator !== 'undefined' && navigator.product === 'ReactNative')) {
import('@react-native-community/async-storage').then(AsyncStorage => {
import('@react-native-async-storage/async-storage').then(AsyncStorage => {
storage = new Storage({ storageBackend: AsyncStorage.default });
})
} else {
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as EasybaseProvider } from './EasybaseProvider';
export { default as useEasybase } from './useEasybase';
export { default as Auth } from './ui/Auth';
export { callFunction } from './callFunction';
159 changes: 0 additions & 159 deletions src/types/jsTypes.ts

This file was deleted.

Loading

0 comments on commit 41aff0c

Please sign in to comment.