Skip to content

Commit 834d846

Browse files
committed
Merge branch 'master' into fix/picker_multiValue
2 parents 969e143 + 5feef63 commit 834d846

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+981
-58
lines changed

.buildkite/pipeline.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
steps:
2+
- block: ":rocket: Release!"
3+
prompt: "Fill out the details for release"
4+
if: 'build.message =~ /^release\$/i'
5+
fields:
6+
- text: "VERSION"
7+
key: "version"
8+
9+
- label: ":hammer_and_pick: Build"
10+
command:
11+
- "nvm install"
12+
- "npm install"
13+
- "npm run test"
14+
- "npm run build"
15+
- "[[ $BUILDKITE_PULL_REQUEST == 'false' ]] && npm run bkRelease && npm run demo || true"

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"scripts": {
1515
"release": "node ./scripts/release.js",
16-
"jenkinsRelease": "node ./scripts/jenkinsRelease.js"
16+
"demoRelease": "node ./scripts/demoRelease.js"
1717
},
1818
"devDependencies": {
1919
"react-native-ui-lib": "*",

demo/scripts/jenkinsRelease.js renamed to demo/scripts/demoRelease.js

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,34 @@ const exec = require('shell-utils').exec;
22
const semver = require('semver');
33
const _ = require('lodash');
44
const p = require('path');
5+
const cp = require('child_process');
56

67
// Workaround JS
7-
const isRelease = process.env.RELEASE_BUILD === 'true';
8-
const branch = process.env.BRANCH;
98

10-
const ONLY_ON_BRANCH = `origin/${branch || 'master'}`;
9+
const isRelease = process.env.BUILDKITE_MESSAGE.match(/^release$/i);
10+
let VERSION;
11+
if (isRelease) {
12+
VERSION = cp.execSync(`buildkite-agent meta-data get version`).toString();
13+
}
14+
1115
const VERSION_TAG = isRelease ? 'latest' : 'snapshot';
1216
const VERSION_INC = 'patch';
1317

1418
function run() {
1519
if (!validateEnv()) {
1620
return;
1721
}
18-
setupGit();
1922
createNpmRc();
2023
versionTagAndPublish();
2124
}
2225

2326
function validateEnv() {
24-
if (!process.env.JENKINS_CI) {
27+
if (!process.env.CI) {
2528
throw new Error('releasing is only available from CI');
2629
}
27-
28-
if (!process.env.JENKINS_MASTER) {
29-
console.log('not publishing on a different build');
30-
return false;
31-
}
32-
33-
if (process.env.GIT_BRANCH !== ONLY_ON_BRANCH) {
34-
console.log(`not publishing on branch ${process.env.GIT_BRANCH}`);
35-
return false;
36-
}
37-
3830
return true;
3931
}
4032

41-
function setupGit() {
42-
exec.execSyncSilent('git config --global push.default simple');
43-
exec.execSyncSilent(`git config --global user.email "${process.env.GIT_EMAIL}"`);
44-
exec.execSyncSilent(`git config --global user.name "${process.env.GIT_USER}"`);
45-
const remoteUrl = new RegExp('https?://(\\S+)').exec(exec.execSyncRead('git remote -v'))[1];
46-
exec.execSyncSilent(`git remote add deploy "https://${process.env.GIT_USER}:${process.env.GIT_TOKEN}@${remoteUrl}"`);
47-
// exec.execSync(`git checkout ${ONLY_ON_BRANCH}`);
48-
}
49-
5033
function createNpmRc() {
5134
exec.execSync('rm -f package-lock.json');
5235
const npmrcPath = p.resolve(`${__dirname}/.npmrc`);
@@ -57,7 +40,7 @@ function versionTagAndPublish() {
5740
const currentPublished = findCurrentPublishedVersion();
5841
console.log(`current published version: ${currentPublished}`);
5942

60-
const version = isRelease ? process.env.VERSION : `${currentPublished}-snapshot.${process.env.BUILD_ID}`;
43+
const version = isRelease ? VERSION : `${currentPublished}-snapshot.${process.env.BUILDKITE_BUILD_NUMBER}`;
6144
console.log(`Publishing version: ${version}`);
6245

6346
tryPublishAndTag(version);

docuilib/docusaurus.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
1515
organizationName: 'wix', // Usually your GitHub org/user name.
1616
projectName: 'react-native-ui-lib', // Usually your repo name.
1717
customFields: {
18-
expoSnackLink: 'https://snack.expo.io/@ethanshar/rnuilib_snack?platform=ios&supportedPlatforms=ios,android'
18+
expoSnackLink: 'https://snack.expo.io/@ethanshar/rnuilib_snack?platform=ios&supportedPlatforms=ios,android',
19+
stars: '3.8',
1920
},
2021
plugins: ['docusaurus-plugin-sass'],
2122
presets: [

docuilib/sidebars.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
Create as many sidebars as you want.
1010
*/
1111

12+
const componentsCategories = {
13+
Basic: 'basic',
14+
Form: 'form',
15+
Overlays: 'overlays',
16+
Layout: 'layoutsAndTemplates',
17+
Lists: 'lists',
18+
Incubator: 'incubator'
19+
};
20+
1221
module.exports = {
1322
// By default, Docusaurus generates a sidebar from the docs folder structure
1423
// tutorialSidebar: [{type: 'autogenerated', dirName: '.'}]
@@ -34,14 +43,14 @@ module.exports = {
3443
{
3544
type: 'category',
3645
label: 'Components',
37-
items: ['Basic', 'Form', 'Overlays', 'Layout', 'Native', 'Incubator'].map(category => {
46+
items: ['Basic', 'Form', 'Overlays', 'Layout', 'Lists', 'Native', 'Incubator'].map(category => {
3847
return {
3948
type: 'category',
4049
label: category,
4150
items: [
4251
{
4352
type: 'autogenerated',
44-
dirName: `components/${category.toLowerCase()}`
53+
dirName: `components/${componentsCategories[category]}`
4554
}
4655
]
4756
};

docuilib/src/components/MainSection.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import GoldStarSvg from '@site/static/img/goldStar.svg';
88

99
export default () => {
1010
const {siteConfig} = useDocusaurusContext();
11+
console.warn('ethan - siteConfig', siteConfig.customFields.stars)
1112

1213
return (
1314
<div className={styles.main}>
@@ -18,7 +19,7 @@ export default () => {
1819
</p>
1920
<div className={styles.gitStars}>
2021
<GoldStarSvg width={16} height={16} style={{margin: 4}}/>
21-
<span>3.7k</span>
22+
<span>{siteConfig.customFields.stars}k</span>
2223
</div>
2324

2425
<div className={styles.buttons}>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bump:patch": "npm version patch",
4242
"demo": "./scripts/demo.sh",
4343
"release": "node ./scripts/release.js",
44-
"jenkinsRelease": "node ./scripts/jenkinsRelease.js"
44+
"bkRelease": "node ./scripts/bkRelease.js"
4545
},
4646
"dependencies": {
4747
"babel-plugin-transform-inline-environment-variables": "^0.0.2",

scripts/jenkinsRelease.js renamed to scripts/bkRelease.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
const exec = require('shell-utils').exec;
2+
const cp = require('child_process');
23
const semver = require('semver');
34
const _ = require('lodash');
45
const p = require('path');
56

67
// Workaround JS
7-
const isRelease = process.env.RELEASE_BUILD === 'true';
8-
const branch = process.env.BRANCH;
98

10-
const ONLY_ON_BRANCH = `origin/${branch || 'master'}`;
9+
// Export buildkite variables for Release build
10+
// We cast toString() because function returns 'object'
11+
const isRelease = process.env.BUILDKITE_MESSAGE.match(/^release$/i);
12+
let VERSION;
13+
if (isRelease) {
14+
VERSION = cp.execSync(`buildkite-agent meta-data get version`).toString();
15+
}
16+
1117
const VERSION_TAG = isRelease ? 'latest' : 'snapshot';
1218
const VERSION_INC = 'patch';
13-
1419
function run() {
1520
if (!validateEnv()) {
1621
return;
@@ -21,20 +26,9 @@ function run() {
2126
}
2227

2328
function validateEnv() {
24-
if (!process.env.JENKINS_CI) {
29+
if (!process.env.CI) {
2530
throw new Error('releasing is only available from CI');
2631
}
27-
28-
if (!process.env.JENKINS_MASTER) {
29-
console.log('not publishing on a different build');
30-
return false;
31-
}
32-
33-
if (process.env.GIT_BRANCH !== ONLY_ON_BRANCH) {
34-
console.log(`not publishing on branch ${process.env.GIT_BRANCH}`);
35-
return false;
36-
}
37-
3832
return true;
3933
}
4034

@@ -57,7 +51,7 @@ function versionTagAndPublish() {
5751
const currentPublished = findCurrentPublishedVersion();
5852
console.log(`current published version: ${currentPublished}`);
5953

60-
const version = isRelease ? process.env.VERSION : `${currentPublished}-snapshot.${process.env.BUILD_ID}`;
54+
const version = isRelease ? VERSION : `${currentPublished}-snapshot.${process.env.BUILDKITE_BUILD_NUMBER}`;
6155
console.log(`Publishing version: ${version}`);
6256

6357
tryPublishAndTag(version);
@@ -85,6 +79,7 @@ function tryPublishAndTag(version) {
8579
}
8680
}
8781

82+
8883
function tagAndPublish(newVersion) {
8984
console.log(`trying to publish ${newVersion}...`);
9085
exec.execSync(`npm --no-git-tag-version version ${newVersion}`);

scripts/build-docs.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const childProcess = require('child_process');
22
const fs = require('fs');
3+
const _ = require('lodash');
34

45
const COMPONENTS_DOCS_DIR = './docs/components';
56

@@ -43,10 +44,11 @@ components.forEach(component => {
4344

4445
/* Props */
4546
content += `## API\n`;
46-
component.props.forEach(prop => {
47+
component.props?.forEach(prop => {
4748
content += `### ${prop.name}\n`;
4849
content += `${prop.description} \n`;
49-
content += `<span style={{color: 'grey'}}>${prop.type}</span>\n\n`;
50+
// content += `<span style={{color: 'grey'}}>${_.escape(prop.type)}</span>\n\n`;
51+
content += `<code>${_.escape(prop.type)}</code>\n\n`;
5052
});
5153

5254
if (!fs.existsSync(`${COMPONENTS_DOCS_DIR}/${component.category}`)) {

scripts/demo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
pushd demo
44
npm install
5-
npm run jenkinsRelease
5+
npm run demoRelease
66
popd
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "ActionBar",
3+
"category": "basic",
4+
"description": "Quick actions bar, each action support Button component props",
5+
"extends": ["View"],
6+
"extendsLink": ["https://github.com/wix/react-native-ui-lib/blob/master/src/components/view/index.tsx"],
7+
"modifiers": ["margin", "padding"],
8+
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ActionBarScreen.tsx",
9+
"images": ["https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/ActionBar/ActionBar.gif?raw=true"],
10+
"props": [
11+
{"name": "actions", "type": "ButtonProps[]", "description": "The actions for the action bar", "required": true},
12+
{"name": "height", "type": "number", "description": "Height", "default": "48"},
13+
{"name": "backgroundColor", "type": "string", "description": "Background color", "default": "Colors.white"},
14+
{"name": "centered", "type": "boolean", "description": "Should action be equally centered"},
15+
{
16+
"name": "keepRelative",
17+
"type": "boolean",
18+
"description": "Keep the action bar position relative instead of it absolute position"
19+
},
20+
{
21+
"name": "useSafeArea",
22+
"type": "boolean",
23+
"description": "In iOS, use safe area, in case component attached to the bottom",
24+
"default": "true"
25+
},
26+
{"name": "style", "type": "ViewStyle", "description": "Component's style"}
27+
]
28+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "ActionSheet",
3+
"category": "overlays",
4+
"description": "Cross platform Action Sheet, with a support for native iOS solutions",
5+
"extends": ["Dialog"],
6+
"extendsLink": ["https://github.com/wix/react-native-ui-lib/blob/master/src/components/dialog/index.tsx"],
7+
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/ActionSheetScreen.tsx",
8+
"images": ["https://media.giphy.com/media/l0HUpXOR6RqB2ct5S/giphy.gif"],
9+
"props": [
10+
{"name": "visible", "type": "boolean", "description": "Whether to show the action sheet or not"},
11+
{
12+
"name": "title",
13+
"type": "string",
14+
"description": "Title of the action sheet",
15+
"note": "If both 'title' and 'message' are not passed will not render the title view at all"
16+
},
17+
{"name": "message", "type": "string", "description": "Message of the action sheet"},
18+
{
19+
"name": "cancelButtonIndex",
20+
"type": "number",
21+
"description": "Index of the option represents the cancel action (to be displayed as the separated bottom bold button)"
22+
},
23+
{
24+
"name": "destructiveButtonIndex",
25+
"type": "number",
26+
"description": "Index of the option represents the destructive action (will display red text. Usually used for delete or abort actions)"
27+
},
28+
{
29+
"name": "options",
30+
"type": "Array<ButtonProps>",
31+
"description": "List of options for the action sheet, follows the Button prop types (supply 'label' string and 'onPress' function)"
32+
},
33+
{
34+
"name": "onDismiss",
35+
"type": "DialogProps['onDismiss']",
36+
"description": "Called when dismissing the action sheet (usually used for setting 'visible' prop to false)"
37+
},
38+
{
39+
"name": "onModalDismissed",
40+
"type": "DialogProps['onDialogDismissed']",
41+
"description": "Called once the modal has been dismissed",
42+
"note": "iOS only, modal only"
43+
},
44+
{"name": "useNativeIOS", "type": "boolean", "description": "Should use the native action sheet for iOS"},
45+
{
46+
"name": "showCancelButton",
47+
"type": "boolean",
48+
"description": "When passed (only with useNativeIOS), will display a cancel button at the bottom (overrides cancelButtonIndex)"
49+
},
50+
{
51+
"name": "containerStyle",
52+
"type": "ViewStyle",
53+
"description": "Add or override style of the action sheet (wraps the title and actions)"
54+
},
55+
{
56+
"name": "dialogStyle",
57+
"type": "ViewStyle",
58+
"description": "Add or override style of the dialog wrapping the action sheet"
59+
},
60+
{"name": "optionsStyle", "type": "ViewStyle", "description": "Add or override style of the options list"},
61+
{"name": "renderTitle", "type": "() => JSX.Element", "description": "Render custom title"},
62+
{
63+
"name": "renderAction",
64+
"type": "\n(\noption: ButtonProps, \nindex: number, \nonOptionPress: ActionSheetOnOptionPress\n) => JSX.Element",
65+
"description": "Render custom action",
66+
"note": "You will need to call 'onOptionPress' so the option's 'onPress' will be called"
67+
},
68+
{
69+
"name": "useSafeArea",
70+
"type": "boolean",
71+
"description": "In iOS, use safe area, in case component attached to the bottom"
72+
},
73+
{"name": "testID", "type": "string", "description": "The test id for e2e tests"}
74+
]
75+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "AnimatedImage",
3+
"category": "basic",
4+
"description": "Image component that fades-in the image with animation once it's loaded",
5+
"extends": ["Image"],
6+
"extendsLink": ["https://github.com/wix/react-native-ui-lib/blob/master/src/components/image/index.tsx"],
7+
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/AnimatedImageScreen.js",
8+
"images": ["https://media.giphy.com/media/l0HU7jj0ivEFyZIA0/giphy.gif"],
9+
"props": [
10+
{
11+
"name": "animationDuration",
12+
"type": "number",
13+
"description": "Duration for the fade animation when the image is loaded",
14+
"default": "300"
15+
},
16+
{"name": "loader", "type": "JSX.element", "description": "A component to render while the image is loading"},
17+
{"name": "containerStyle", "type": "ViewStyle", "description": "Additional spacing styles for the container"}
18+
]
19+
}

0 commit comments

Comments
 (0)