Skip to content

Commit

Permalink
feat(*): lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Fenko committed Mar 4, 2020
1 parent 5aadd66 commit f64c8b9
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions bin/demo-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ const parseGitUrl = require('git-url-parse');

/** Config for github */
const defaultConfig = {
gitUsername: 'alfa-bot',
gitEmail: 'ds@alfabank.ru',
commitMessage: 'Deploy Storybook to GitHub Pages',
gitRemote: 'origin',
targetBranch: 'gh-pages'
gitUsername: 'alfa-bot',
gitEmail: 'ds@alfabank.ru',
commitMessage: 'Deploy Storybook to GitHub Pages',
gitRemote: 'origin',
targetBranch: 'gh-pages'
};
/** Dir for merged storybook file */
const ghMergeDir = 'storybook-demo';
/** Custom option for shell.exec */
const execOptions = {
silent: true,
fatal: true
silent: true,
fatal: true
};
/** Temporary dir for builded file = last git commit hash */
const tempOutputDir = shell.exec('git rev-parse HEAD', execOptions).stdout.trim();
/** Current git branch */
const sourceBranch = shell.exec('git rev-parse --abbrev-ref HEAD', execOptions).stdout.trim();
/** Git remote url */
const gitUrl = shell.exec(
`git config --get remote.${defaultConfig.gitRemote}.url`,
execOptions
`git config --get remote.${defaultConfig.gitRemote}.url`,
execOptions
).stdout.trim();
/** Parsed git url */
const parsedGitUrl = parseGitUrl(gitUrl);
Expand Down Expand Up @@ -63,9 +63,9 @@ shell.exec(`git pull -f -q ${gitUrl} ${defaultConfig.targetBranch}`, execOptions
console.log('=> Merge builded storybook');
shell.cd('../');
if (sourceBranch === 'master') {
shell.cp('-rf', `./${tempOutputDir}`, `./${ghMergeDir}/master`);
shell.cp('-rf', `./${tempOutputDir}`, `./${ghMergeDir}/master`);
} else {
shell.cp('-rf', `./${tempOutputDir}`, `./${ghMergeDir}`);
shell.cp('-rf', `./${tempOutputDir}`, `./${ghMergeDir}`);
}
shell.cd(ghMergeDir);

Expand All @@ -77,7 +77,7 @@ shell.exec(`git commit -m "${defaultConfig.commitMessage}"`, execOptions);

// log output url
if (sourceBranch === 'master') {
console.log(`=> Storybook deployed to: ${gitPagesUrl}/master/`);
console.log(`=> Storybook deployed to: ${gitPagesUrl}/master/`);
} else {
console.log(`=> Storybook deployed to: ${gitPagesUrl}/${tempOutputDir}/`);
console.log(`=> Storybook deployed to: ${gitPagesUrl}/${tempOutputDir}/`);
}

0 comments on commit f64c8b9

Please sign in to comment.