Skip to content

Commit 4c1ece7

Browse files
committed
basic solidarity setup
1 parent bdaf8e4 commit 4c1ece7

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

checks/react-native.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "http://json.schemastore.org/solidaritySchema",
3+
"config" : {
4+
"output" : "verbose"
5+
},
6+
"requirements": {
7+
"Node": [{ "rule": "cli", "binary": "node"}],
8+
"Watchman": [
9+
{
10+
"rule": "cli",
11+
"binary": "watchman",
12+
"error": "Please install watchman on this machine. Refer to the official Watchman installation instructions for additional help.",
13+
"platform": ["darwin", "linux"]
14+
}
15+
],
16+
"React Native": [
17+
{ "rule": "cli", "binary": "react-native" }
18+
],
19+
"Android": [
20+
{
21+
"rule": "env",
22+
"variable": "ANDROID_HOME",
23+
"error": "The ANDROID_HOME environment variable must be set to your local SDK. Refer to getting started docs for help."
24+
}
25+
],
26+
"Xcode": [
27+
{ "rule": "cli", "binary": "xcodebuild", "platform": "darwin" },
28+
{ "rule": "cli", "binary": "xcrun", "platform": "darwin" }
29+
]
30+
}
31+
}

src/extensions/functions/getSolidaritySettings.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { SolidarityRunContext, SolidaritySettings } from '../../types'
22
import * as JSON5 from 'json5'
33
import * as path from 'path'
44

5+
export const isURI = (path) => !!path.match(/\w+:(\/?\/?)[^\s]+/)
6+
57
export const loadFile = (context, filePath) => {
68
const { filesystem } = context
79
if (filesystem.exists(filePath)) {
@@ -34,18 +36,19 @@ export const loadWebCheck = async (context, checkOption) => {
3436
})
3537

3638
// Load check from web
37-
const checkURL = `https:\/\/raw.githubusercontent.com/infinitered/solidarity/master/${checkOption}`
39+
const checkURL = isURI(checkOption) ? checkOption : `https:\/\/raw.githubusercontent.com/infinitered/solidarity/master/checks/${checkOption}.json`
3840
const result = await api.get(checkURL)
3941
// console.log(result)
4042
if (result.ok) {
41-
checkSpinner.succeed(checkURL)
42-
return result.data
43+
checkSpinner.succeed(`Found ${checkOption}`)
44+
const solidarityData = JSON5.parse(result.data)
45+
return solidarityData
4346
} else {
44-
checkSpinner.fail(`Unable to find a known check for ${checkOption}`)
47+
checkSpinner.fail(`Unable to find a known check stack for ${checkOption}`)
4548
print.info(
46-
`https://github.com/infinitered/solidarity/checks for options.`
49+
`Check https://github.com/infinitered/solidarity/checks for options.`
4750
)
48-
throw(`ERROR: ${result.status} - ${result.problem}`)
51+
throw(`ERROR: Request failed (${result.status} - ${result.problem})`)
4952
}
5053
}
5154

0 commit comments

Comments
 (0)