Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | // Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
import { execSync, spawn } from 'child_process';
import paths from './paths';
import publish from './publish';
export const createSnapshots = done => {
const command = paths.rootPath('node_modules/.bin/create-snap');
const inputPath = `${paths.generated}/examples/`;
const outputPath = paths.generated;
const stylesPath = paths.rootPath('assets/styles/index.css');
return spawn(command, [inputPath, outputPath, stylesPath], {
cwd: paths.root,
stdio: 'inherit'
});
};
export const lintExamples = done => {
// pass snapshot path to vrt and the output of that as components to lint
execSync(
`
echo Running VRT.... &&
R=$(node scripts/vrt.js --path ${paths.generated}/snapshot.json) &&
echo 'VRT RESULTS:' &&
echo $R;
if [ -z $R ]; then
npm run gulp -- travis:lint:examples --components NONE_CHANGED
else
npm run gulp -- travis:lint:examples --components $(echo $R)
fi
`,
{
cwd: paths.root,
stdio: 'inherit',
env: Object.assign({}, process.env)
}
);
done();
};
export const jest = () =>
spawn(
'node',
[
'./node_modules/.bin/jest',
'--color',
'--bail',
'--ci',
'--silent',
'--maxWorkers=2'
],
{
cwd: paths.root,
stdio: 'inherit'
}
);
export const publishBuild = done => {
if (!process.env.BUILD_SERVER_HOST_NEW) return done();
publish((err, res) => {
if (err) return done(err);
console.log('Successfully published build', res);
done();
});
};
// PR's have this message as well as the "after merge button" commit
export const isMerge = () =>
process.env.TRAVIS_COMMIT_MESSAGE.match(/^Merge|\(\#\d+\)/g);
export const isTag = () => !!process.env.TRAVIS_TAG;
export const shouldPushToBuildServer = () =>
(isMerge() || isTag()) && process.env.BUILD_SERVER_HOST_NEW;
|