-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some parameters around, update command
- Loading branch information
Showing
8 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,6 @@ | |
"ecmaVersion": "latest" | ||
}, | ||
"rules": { | ||
"operator-linebreak": ["error", "before"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,32 @@ | ||
const { run } = require('./run') | ||
const { isDir, isRepo } = require('./utils') | ||
|
||
function getMainReposFromGit ({ themesDir, pluginsDir }) { | ||
function getMainReposFromGit ({ themesDir, pluginsDir, planet4 }) { | ||
run(`mkdir -p ${themesDir} && mkdir -p ${pluginsDir}`) | ||
|
||
isRepo(`${themesDir}/planet4-master-theme`) | ||
? run('git status', { cwd: `${themesDir}/planet4-master-theme` }) | ||
: run(`git clone [email protected]:greenpeace/planet4-master-theme.git ${themesDir}/planet4-master-theme`) | ||
|
||
run( | ||
`git checkout ${planet4.repos['planet4-master-theme'] || 'main'} || true`, | ||
{ cwd: `${themesDir}/planet4-master-theme` } | ||
) | ||
|
||
isRepo(`${pluginsDir}/planet4-plugin-gutenberg-blocks`) | ||
? run('git status', { cwd: `${pluginsDir}/planet4-plugin-gutenberg-blocks` }) | ||
: run(`git clone --recurse-submodules --shallow-submodule [email protected]:greenpeace/planet4-plugin-gutenberg-blocks.git ${pluginsDir}/planet4-plugin-gutenberg-blocks`) | ||
|
||
run( | ||
`git checkout ${planet4.repos['planet4-plugin-gutenberg-blocks'] || 'main'} || true`, | ||
{ cwd: `${pluginsDir}/planet4-plugin-gutenberg-blocks` } | ||
) | ||
}; | ||
|
||
function getMainReposFromRelease (config, force = false) { | ||
if (!force && | ||
isDir(`${config.themesDir}/planet4-master-theme`) && | ||
isDir(`${config.pluginsDir}/planet4-plugin-gutenberg-blocks`) | ||
if (!force | ||
&& isDir(`${config.themesDir}/planet4-master-theme`) | ||
&& isDir(`${config.pluginsDir}/planet4-plugin-gutenberg-blocks`) | ||
) { | ||
return | ||
} | ||
|
@@ -47,9 +57,9 @@ function installNpmDependencies (config) { | |
} | ||
|
||
function buildAssets (config, force = false) { | ||
if (!force && | ||
isDir(`${config.themesDir}/planet4-master-theme/assets/build`) && | ||
isDir(`${config.pluginsDir}/planet4-plugin-gutenberg-blocks/assets/build`) | ||
if (!force | ||
&& isDir(`${config.themesDir}/planet4-master-theme/assets/build`) | ||
&& isDir(`${config.pluginsDir}/planet4-plugin-gutenberg-blocks/assets/build`) | ||
) { | ||
return | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const { nodeCheck } = require('./lib/node-check') | ||
const { getConfig } = require('./lib/config') | ||
const { run } = require('./lib/run') | ||
const { getMainReposFromRelease, installRepos } = require('./lib/main-repos') | ||
const { isRepo, isDir } = require('./lib/utils') | ||
|
||
/** | ||
* Node version control | ||
*/ | ||
console.log('Node version: ' + process.version) | ||
nodeCheck() | ||
|
||
/** | ||
* Config | ||
*/ | ||
const config = getConfig() | ||
console.log(process.cwd(), '\n', config) | ||
|
||
// self ? and rerun | ||
// base dir | ||
// main repos | ||
// default DB | ||
// default images | ||
|
||
if (isRepo(process.cwd())) { | ||
run('git pull || true', { cwd: `${process.cwd()}` }) | ||
} | ||
|
||
if (isRepo(config.baseDir)) { | ||
run('git pull || true', { cwd: `${config.baseDir}` }) | ||
} | ||
|
||
if (isRepo(`${config.themesDir}/planet4-master-theme`) | ||
&& isRepo(`${config.pluginsDir}/planet4-plugin-gutenberg-blocks`) | ||
) { | ||
run('git pull || true', { cwd: `${config.themesDir}/planet4-master-theme` }) | ||
run('git pull || true', { cwd: `${config.pluginsDir}/planet4-plugin-gutenberg-blocks` }) | ||
installRepos(config) | ||
} else if (isDir(`${config.themesDir}/planet4-master-theme`) | ||
&& isDir(`${config.pluginsDir}/planet4-plugin-gutenberg-blocks`) | ||
) { | ||
getMainReposFromRelease(config, true) | ||
installRepos(config) | ||
} |