Skip to content

Commit

Permalink
feat: Update to BlueBase 6 (#180)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This plugin will stop working with BlueBase versions below 6
  • Loading branch information
artalat committed Aug 26, 2020
1 parent 0e64383 commit 4c44dc0
Show file tree
Hide file tree
Showing 57 changed files with 6,184 additions and 3,099 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ node_js:
script:
- yarn run test
- yarn run build
- yarn run size
after_success:
- test $TRAVIS_BRANCH = "master" && yarn run doc
- npx semantic-release@beta
- yarn run report-coverage
- yarn run report-coverage
9 changes: 6 additions & 3 deletions bluebase/expo/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ const deepmerge = require('deepmerge');
*/
export default (input: any) => {
return deepmerge(input, {

// app.json is generated from manifest
manifest: {
name: 'My BlueBase App'
}
name: 'My BlueBase App',

ios: {
userInterfaceStyle: 'automatic',
},
},
});
};
68 changes: 30 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,14 @@
"remark-preset-lint-recommended"
]
},
"size-limit": [
{
"limit": "42 KB",
"webpack": false,
"path": "dist/**/*.js",
"running": false
}
],
"scripts": {
"start": "yarn run storybook",
"clean": "rimraf coverage dist tmp",
"watch": "tsc -w -p tsconfig.json",
"watch:test": "jest --watch",
"lint": "tslint -t stylish --project \"tsconfig.json\"",
"info": "npm-scripts-info",
"build": "run-s clean && run-p build:* && cp -r ./dist/src/* ./dist && rm -r ./dist/src && yarn run size",
"build": "run-s clean && run-p build:* && cp -r ./dist/src/* ./dist && rm -r ./dist/src",
"build:main": "tsc -p tsconfig.json && babel ./src --out-dir dist --ignore \"**/__tests__\",\"**/__stories__\" --extensions \".ts,.tsx,.js,.jsx\"",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.ts\" --write",
Expand All @@ -51,7 +43,6 @@
"reset": "git clean -dfx && git reset --hard && npm i",
"all": "run-s reset test cov:check doc:html",
"prepublishOnly": "yarn remove expo react-native",
"size": "size-limit",
"storybook:start": "bluebase storybook:start",
"storybook-native": "bluebase storybook-native:start",
"storybook": "start-storybook -p 6006 --config-dir ./bluebase/storybook/configs",
Expand All @@ -77,28 +68,29 @@
"node": ">=8.9"
},
"dependencies": {
"@bluebase/components": "^5.20.0",
"@bluebase/components": "^6.3.0",
"deepmerge": "^4.2.2",
"expo": "^35.0.0",
"expo-web-browser": "^8.0.0",
"react-native": "^0.59.8",
"tslib": "^1.10.0"
"expo": "^38.0.0",
"expo-web-browser": "~8.3.1",
"lodash.get": "^4.4.2",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
"tslib": "^2.0.1"
},
"devDependencies": {
"@babel/cli": "^7.7.7",
"@babel/core": "^7.7.7",
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.4",
"@bluebase/babel-preset-bluebase": "^2.4.1",
"@bluebase/cli-essentials": "^0.0.5",
"@bluebase/code-standards": "2.2.4",
"@bluebase/core": "^5.8.0",
"@bluebase/plugin-json-schema-components": "^2.5.2",
"@bluebase/plugin-launcher": "^1.1.0",
"@bluebase/plugin-material-ui": "^2.10.1",
"@bluebase/plugin-react-native-paper": "^2.2.0",
"@bluebase/code-standards": "2.8.0",
"@bluebase/core": "^6.0.0",
"@bluebase/plugin-json-schema-components": "^3.2.1",
"@bluebase/plugin-launcher": "^1.2.0",
"@bluebase/plugin-material-ui": "^3.4.1",
"@bluebase/plugin-react-native-paper": "^3.1.0",
"@bluebase/plugin-react-navigation": "^0.0.1-alpha.23",
"@bluebase/plugin-react-router": "^0.0.1-alpha.21",
"@bluebase/plugin-responsive-grid": "^0.0.7",
"@bluebase/plugin-vector-icons": "^0.2.0",
"@bluebase/plugin-vector-icons": "^0.3.0",
"@bluebase/storybook-addon": "^3.0.0",
"@blueeast/tslint-config-blueeast": "^0.7.0",
"@storybook/addon-actions": "^5.2.8",
Expand All @@ -110,44 +102,44 @@
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/enzyme-async-helpers": "^0.9.1",
"@types/jest": "^24.0.24",
"@types/react": "^16.9.17",
"@types/lodash.get": "^4.4.6",
"@types/react": "~16.9.41",
"@types/react-dom": "^16.9.4",
"@types/react-loadable": "^5.5.3",
"@types/react-native": "^0.60.25",
"@types/react-native": "~0.62.13",
"@types/react-test-renderer": "^16.9.1",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^24.9.0",
"babel-loader": "^8.0.6",
"babel-jest": "^26.3.0",
"babel-loader": "^8.1.0",
"babel-preset-bluebase": "^2.3.0",
"babel-preset-expo": "^8.0.0",
"babel-preset-expo": "^8.2.3",
"codacy-coverage": "^3.4.0",
"codecov": "^3.6.1",
"codecov": "^3.7.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-async-helpers": "^0.9.1",
"jest": "^24.9.0",
"jest-enzyme": "^7.1.2",
"jest-expo": "^36.0.1",
"jest-expo": "^38.0.0",
"jsdom": "^15.2.1",
"mockdate": "^2.0.5",
"npm-run-all": "^4.1.3",
"opn-cli": "^5.0.0",
"prettier": "^1.19.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-native-gesture-handler": "^1.5.2",
"react-native-reanimated": "^1.4.0",
"react": "16.11.0",
"react-dom": "16.11.0",
"react-native-gesture-handler": "~1.6.0",
"react-native-reanimated": "~1.9.0",
"react-native-typescript-transformer": "^1.2.13",
"react-test-renderer": "^16.12.0",
"react-test-renderer": "^16.13.1",
"remark-cli": "^6.0.1",
"remark-preset-lint-recommended": "^3.0.2",
"schedule": "^0.5.0",
"size-limit": "^0.21.1",
"trash-cli": "^3.0.0",
"ts-jest": "^24.2.0",
"tslint": "5.20.1",
"typedoc": "^0.15.5",
"typescript": "3.7.4",
"typescript": "~3.9.5",
"waait": "^1.0.5"
},
"peerDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions src/__tests__/components.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test('Plugin should load translations from web', async () => {
const { components } = require('../components/index.web');
expect(components.AppearanceSettingList).toBeDefined();
});
7 changes: 7 additions & 0 deletions src/__tests__/lang.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { isPromise } from '@bluebase/core';

test('Plugin should load translations from web', async () => {
const { lang } = require('../lang/index.web');
expect(isPromise(lang['bluebase.intl.messages.ur'])).toBe(true);
expect(isPromise(lang['bluebase.intl.messages.ur-roman'])).toBe(true);
});
4 changes: 4 additions & 0 deletions src/__tests__/layouts.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test('Plugin should load translations from web', async () => {
const { layouts } = require('../layouts/index.web');
expect(layouts.SettingsPageDesktop).toBeDefined();
});
4 changes: 4 additions & 0 deletions src/__tests__/settings.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test('Plugin should load translations from web', async () => {
const { settings } = require('../settings/index.web');
expect(settings.CallSupportSetting).toBeDefined();
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { BlueBaseApp, getComponent } from '@bluebase/core';

import DarkModeSetting from '../../../settings/DarkModeSetting';
import JsonSchema from '@bluebase/plugin-json-schema-components';
import MUI from '@bluebase/plugin-material-ui';
import Plugin from '../../../index';
import React from 'react';
import ThemeSelectionSetting from '../../../settings/ThemeSelectionSetting';
import { mount } from 'enzyme';
import { waitForElement } from 'enzyme-async-helpers';

const AppearanceSettingList = getComponent('AppearanceSettingList');

describe('AppearanceSettingList', () => {
it('should render nothing if there no developer configs', async () => {
// mount components

const wrapper: any = mount(
<BlueBaseApp plugins={[Plugin, MUI, JsonSchema]}>
<AppearanceSettingList />
</BlueBaseApp>
);
await waitForElement(wrapper, 'SettingList');

expect(wrapper.find(DarkModeSetting).exists()).toBe(true);
expect(wrapper.find(ThemeSelectionSetting).exists()).toBe(true);
wrapper.unmount();
});
});
4 changes: 3 additions & 1 deletion src/components/AppearanceSettingList/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { AppearanceSettingList } from './AppearanceSettingList';

export * from './AppearanceSettingList';
export { AppearanceSettingList as default } from './AppearanceSettingList';
export default AppearanceSettingList;
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { BlueBaseApp, getComponent } from '@bluebase/core';

import DeveloperSetting from '../../../settings/DeveloperSetting';
import JsonSchema from '@bluebase/plugin-json-schema-components';
import MUI from '@bluebase/plugin-material-ui';
import Plugin from '../../../index';
import React from 'react';
import VersionSetting from '../../../settings/VersionSetting';
import { mount } from 'enzyme';
import { waitForElement } from 'enzyme-async-helpers';
import VersionSetting from '../../../settings/VersionSetting';
import DeveloperSetting from '../../../settings/DeveloperSetting';

const InformationSettingList = getComponent('InformationSettingList');

Expand Down
4 changes: 3 additions & 1 deletion src/components/InformationSettingList/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { InformationSettingList } from './InformationSettingList';

export * from './InformationSettingList';
export { InformationSettingList as default } from './InformationSettingList';
export default InformationSettingList;
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { BlueBaseApp, getComponent } from '@bluebase/core';

import JsonSchema from '@bluebase/plugin-json-schema-components';
import LanguageSetting from '../../../settings/LanguageSetting';
import MUI from '@bluebase/plugin-material-ui';
import Plugin from '../../../index';
import React from 'react';
import TextDirectionSetting from '../../../settings/TextDirectionSetting';
import { mount } from 'enzyme';
import { waitForElement } from 'enzyme-async-helpers';

const LanguageSettingList = getComponent('LanguageSettingList');

describe('LanguageSettingList', () => {
it('should render nothing if there no developer configs', async () => {
// mount components

const wrapper: any = mount(
<BlueBaseApp plugins={[Plugin, MUI, JsonSchema]}>
<LanguageSettingList />
</BlueBaseApp>
);
await waitForElement(wrapper, 'SettingList');

expect(wrapper.find(LanguageSetting).exists()).toBe(true);
expect(wrapper.find(TextDirectionSetting).exists()).toBe(true);
wrapper.unmount();
});
});
4 changes: 3 additions & 1 deletion src/components/LanguageSettingList/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { LanguageSettingList } from './LanguageSettingList';

export * from './LanguageSettingList';
export { LanguageSettingList as default } from './LanguageSettingList';
export default LanguageSettingList;
4 changes: 3 additions & 1 deletion src/components/LegalSettingList/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { LegalSettingList } from './LegalSettingList';

export * from './LegalSettingList';
export { LegalSettingList as default } from './LegalSettingList';
export default LegalSettingList;
4 changes: 3 additions & 1 deletion src/components/LinkingSettingItem/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { LinkingSettingItem } from './LinkingSettingItem';

export * from './LinkingSettingItem';
export { LinkingSettingItem as default } from './LinkingSettingItem';
export default LinkingSettingItem;
4 changes: 3 additions & 1 deletion src/components/PrivacyPolicy/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { PrivacyPolicy } from './PrivacyPolicy';

export * from './PrivacyPolicy';
export { PrivacyPolicy as default } from './PrivacyPolicy';
export default PrivacyPolicy;
4 changes: 3 additions & 1 deletion src/components/SettingList/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { SettingList } from './SettingList';

export * from './SettingList';
export { SettingList as default } from './SettingList';
export default SettingList;
8 changes: 4 additions & 4 deletions src/components/SettingsAppIcon/SettingsAppIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import React from 'react';
import { Theme } from '@bluebase/core';

export interface SettingsAppIconStyles {
iconColor: { color: TextStyle['color'] },
root: StyleProp<ViewStyle>
iconColor: { color: TextStyle['color'] },
root: StyleProp<ViewStyle>
}

export interface SettingsAppIconProps {
size: number;
styles?: Partial<SettingsAppIconStyles>
size: number;
styles?: Partial<SettingsAppIconStyles>
}

export const SettingsAppIcon = ({ size, styles: _styles }: SettingsAppIconProps) => {
Expand Down
4 changes: 3 additions & 1 deletion src/components/SettingsAppIcon/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { SettingsAppIcon } from './SettingsAppIcon';

export * from './SettingsAppIcon';
export { SettingsAppIcon as default } from './SettingsAppIcon';
export default SettingsAppIcon;
4 changes: 3 additions & 1 deletion src/components/SupportSettingList/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { SupportSettingList } from './SupportSettingList';

export * from './SupportSettingList';
export { SupportSettingList as default } from './SupportSettingList';
export default SupportSettingList;
4 changes: 3 additions & 1 deletion src/components/TermsOfService/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
import { TermsOfService } from './TermsOfService';

export * from './TermsOfService';
export { TermsOfService as default } from './TermsOfService';
export default TermsOfService;
1 change: 1 addition & 0 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './useScreenProps';
9 changes: 9 additions & 0 deletions src/hooks/useScreenProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useBlueBase, useIntl, useTheme } from '@bluebase/core';

export function useScreenProps() {
const BB = useBlueBase();
const intl = useIntl();
const { theme } = useTheme();

return { BB, intl, theme };
}
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { VERSION } from './version';
import { components } from './components';
import { createPlugin } from '@bluebase/core';
import { createSettingsRoutes } from './lib';
import { defaultConfigs } from './configs';
import { lang } from './lang';
import { layouts } from './layouts';
import { routes } from './routes';
import { settings } from './settings';
export { SettingsPageProps } from './layouts/SettingsPage';
export { createSettingsRoutes } from './lib';

export * from './components/exports';
export { createSettingsRoutes };

export default createPlugin({
description: 'A settings app for the BlueBase framework!',
Expand Down
Loading

0 comments on commit 4c44dc0

Please sign in to comment.