Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Eslint: check all the JS files (not only app directory)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnzlml authored and tbergquist-godaddy committed May 24, 2018
1 parent a982d15 commit d8c4551
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 33 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"build": "./scripts/buildBundle.sh",
"graphql": "node ./scripts/getSchema.js",
"ios": "yarn react-native run-ios",
"lint": "yarn eslint app --report-unused-disable-directives",
"relay": "yarn relay-compiler --src ./app --schema ./schema.graphql",
"lint": "yarn eslint . --report-unused-disable-directives",
"relay": "yarn relay-compiler --src . --schema ./schema.graphql",
"start": "yarn react-native start",
"test": "node node_modules/jest/bin/jest.js --config=.jest.json",
"test-ci": "./scripts/test.sh",
Expand Down
2 changes: 1 addition & 1 deletion scripts/configureApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
const path = require('path');
const child_process = require('child_process');

const log = message => console.log(`➤ ${message}`);
const log = message => console.log(`➤ ${message}`); // eslint-disable-line no-console

// TODO: fetch .env variables from Vault (or maybe just store the .env file itself in the Vault - this is painful)
const vault = {
Expand Down
74 changes: 44 additions & 30 deletions scripts/releaseFramework.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
// @flow strict

/**
* Script for releasing a new version of the framework
* and putting it on Github as a release
*
*
* You need to have GITHUB_TOKEN present in your environment with correct
* write/read permissions (public_repo)
*/

const fs = require('fs');
const child_process = require('child_process');
const fetch = require('node-fetch');
const path = require('path');

let version = child_process.execSync('git rev-parse --short HEAD').toString().trim();
let version = child_process
.execSync('git rev-parse --short HEAD')
.toString()
.trim();

(async () => {
/**
* Create Github release that points to the latest commit
*/
const release = await (
await fetch(
`https://api.github.com/repos/kiwicom/mobile/releases?access_token=${process.env.GITHUB_TOKEN}`,
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
tag_name: version,
target_commitish: 'master',
name: version,
draft: false,
prerelease: false,
}),
}
)
).json();
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
if (!GITHUB_TOKEN) {
throw Error("Variable 'process.env.GITHUB_TOKEN' is not set.");
}

// create Github release that points to the latest commit
const release = await (await fetch(
`https://api.github.com/repos/kiwicom/mobile/releases?access_token=${GITHUB_TOKEN}`,
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
tag_name: version,
target_commitish: 'master',
name: version,
draft: false,
prerelease: false,
}),
},
)).json();

// Build FAT framework
const buildOutput = child_process.execSync('scripts/buildIOSFramework.sh')
const buildOutput = child_process
.execSync('scripts/buildIOSFramework.sh')
.toString()
.split('\n');

Expand All @@ -49,23 +57,29 @@ let version = child_process.execSync('git rev-parse --short HEAD').toString().tr
/**
* Zip file to its destination to preare for upload
*/
child_process.execSync(`cd ${frameworkFolder} && zip -r ${zippedFatFramework} .`);
child_process.execSync(
`cd ${frameworkFolder} && zip -r ${zippedFatFramework} .`,
);

/**
* Github API doesn't support sending files with unknown `Content-Lenght`. That means we
* cannot send a stream.
*/
const body = fs.readFileSync(zippedFatFramework);
await fetch(
`https://uploads.github.com/repos/kiwicom/mobile/releases/${release.id}/assets?name=${path.basename(zippedFatFramework)}&access_token=${process.env.GITHUB_TOKEN}`,
`https://uploads.github.com/repos/kiwicom/mobile/releases/${
release.id
}/assets?name=${path.basename(
zippedFatFramework,
)}&access_token=${GITHUB_TOKEN}`,
{
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/octet-stream',
'Content-Length': body.length,
},
body
}
body,
},
);
})();
})();

0 comments on commit d8c4551

Please sign in to comment.