Skip to content

Commit 8657002

Browse files
committed
Merge branch 'master' into release
2 parents 609e8d1 + e144b39 commit 8657002

File tree

14 files changed

+4904
-4557
lines changed

14 files changed

+4904
-4557
lines changed

.githooks/pre-push

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
COMMAND="yarn prepush"
4+
5+
$COMMAND
6+
RESULT=$?
7+
if [ $RESULT -ne 0 ]; then
8+
echo "pre-push hook failed $COMMAND"
9+
exit 1
10+
fi
7.13 KB
Binary file not shown.

.yarn/releases/yarn-3.4.1.cjs

Lines changed: 0 additions & 873 deletions
This file was deleted.

.yarn/releases/yarn-4.12.0.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.yarnrc.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
compressionLevel: 0
2+
3+
enableGlobalCache: true
4+
5+
enableTelemetry: false
6+
7+
nmMode: hardlinks-local
8+
19
nodeLinker: node-modules
210

3-
yarnPath: .yarn/releases/yarn-3.4.1.cjs
11+
npmRegistryServer: "https://registry.npmjs.org/"
12+
npmMinimalAgeGate: "14d"
13+
npmPreapprovedPackages: ["@wix/*"]
14+
15+
yarnPath: .yarn/releases/yarn-4.12.0.cjs

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
"build": "node scripts/build/build.js",
3131
"build:local": "./scripts/build/createLocalPackage.sh",
3232
"pre-push": "npm run build:dev && npm run test",
33+
"prepush": "node ./scripts/prepush.js",
34+
"yarnConstraints": "yarn constraints",
35+
"yarnConstraintsFix": "yarn constraints --fix",
3336
"docs:deploy": "./scripts/docs/deployDocs.sh",
3437
"docs:build": "node scripts/docs/buildDocs.js",
3538
"docs:start": "(cd docuilib && yarn start)",
@@ -84,6 +87,7 @@
8487
"@shopify/flash-list": "1.7.6",
8588
"@testing-library/react-hooks": "^8.0.1",
8689
"@testing-library/react-native": "^11.5.1",
90+
"@topcli/spinner": "patch:@topcli/spinner@npm%3A2.1.2#./.yarn/patches/@topcli-spinner-npm-2.1.2-262b584167.patch",
8791
"@types/hoist-non-react-statics": "^3.3.1",
8892
"@types/jest": "^29.5.13",
8993
"@types/lodash": "^4.0.0",
@@ -95,8 +99,10 @@
9599
"@typescript-eslint/eslint-plugin": "^5.3.1",
96100
"@typescript-eslint/parser": "^5.3.1",
97101
"@welldone-software/why-did-you-render": "^3.2.1",
102+
"@yarnpkg/types": "^4.0.1",
98103
"babel-plugin-lodash": "^3.3.4",
99104
"babel-plugin-module-resolver": "^5.0.0",
105+
"chalk": "^4.1.2",
100106
"eslint": "8.19.0",
101107
"eslint-config-wix": "2.0.0",
102108
"eslint-plugin-react": "^7.24.0",
@@ -185,5 +191,6 @@
185191
"!lib/scripts",
186192
"lib/package.json",
187193
"lib/ReactNativeUILib.podspec"
188-
]
194+
],
195+
"packageManager": "[email protected]"
189196
}

scripts/prepush.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/env node
2+
3+
const semver = require('semver');
4+
const fs = require('fs');
5+
const path = require('path');
6+
7+
const nodeVersion = fs.readFileSync(path.resolve(process.cwd(), '.nvmrc'), 'utf-8').trim();
8+
if (!semver.gte(process.version.substring(1), nodeVersion)) {
9+
throw new Error(`Node version must be at least ${nodeVersion}`);
10+
}
11+
12+
const cp = require('child_process');
13+
const {logGreen, logError} = require('./utils');
14+
const {Spinner} = require('@topcli/spinner');
15+
16+
const ARGS = process.argv.slice(2);
17+
const TEST_ARG = 'test';
18+
const TEST_COMMAND = 'yarn test';
19+
20+
const PRE_PUSH_COMMANDS = [
21+
'yarn yarnConstraints',
22+
'yarn dedupe --check',
23+
'yarn lint --quiet',
24+
'yarn build:dev >/dev/null'
25+
];
26+
27+
async function run() {
28+
logGreen('Running pre-push checks...');
29+
const commands = [...PRE_PUSH_COMMANDS];
30+
if (ARGS.includes(TEST_ARG)) {
31+
commands.push(TEST_COMMAND);
32+
}
33+
const promises = commands.map(execute);
34+
const results = await Promise.allSettled(promises);
35+
const failed = results.filter(result => result.status === 'rejected');
36+
if (failed.length > 0) {
37+
logError('Pre-push checks failed!');
38+
failed.forEach(result => logFailedCommand(result.reason));
39+
process.exit(1);
40+
}
41+
process.exit(0);
42+
}
43+
44+
function logFailedCommand({command, stdout, stderr}) {
45+
logError(`${command}:`);
46+
if (stdout) {
47+
logError('STDOUT:');
48+
logError(stdout);
49+
}
50+
if (stderr) {
51+
logError('STDERR:');
52+
logError(stderr);
53+
}
54+
}
55+
56+
async function execute(command) {
57+
const spinner = new Spinner();
58+
return new Promise((resolve, reject) => {
59+
spinner.start(command);
60+
cp.exec(command, {encoding: 'utf-8'}, (error, stdout, stderr) => {
61+
if (error) {
62+
spinner.failed();
63+
reject({command, error, stdout, stderr});
64+
}
65+
spinner.succeed();
66+
resolve();
67+
});
68+
});
69+
}
70+
71+
run();

scripts/utils.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const chalk = require('chalk');
2+
3+
function logDebug() {
4+
console.log(chalk.gray(...arguments));
5+
}
6+
7+
function logGreen() {
8+
console.log(chalk.green(...arguments));
9+
}
10+
11+
function logError() {
12+
// eslint-disable-next-line no-restricted-syntax
13+
console.error(chalk.red(...arguments));
14+
}
15+
16+
17+
module.exports = {
18+
logDebug,
19+
logGreen,
20+
logError
21+
};

src/components/overlay/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {StyleSheet, Image, ImageProps, ImageSourcePropType} from 'react-native';
44
import {Colors} from '../../style';
55
import View from '../view';
66
import Assets from '../../assets';
7+
import Constants from '../../commons/Constants';
78

89
const OVERLY_TYPES = {
910
VERTICAL: 'vertical',
@@ -126,7 +127,7 @@ class Overlay extends PureComponent<OverlayTypes> {
126127
const styles = StyleSheet.create({
127128
container: {
128129
...StyleSheet.absoluteFillObject,
129-
width: undefined
130+
width: Constants.isWeb ? '100%' : undefined
130131
},
131132
top: {
132133
bottom: undefined,

0 commit comments

Comments
 (0)