Skip to content
Snippets Groups Projects
Commit 94bf3a13 authored by Alexander Rose's avatar Alexander Rose
Browse files

added viewer deployment script

parent 9e8a8f3e
No related branches found
No related tags found
No related merge requests found
...@@ -14,69 +14,46 @@ const buildDir = path.resolve(__dirname, '../build/') ...@@ -14,69 +14,46 @@ const buildDir = path.resolve(__dirname, '../build/')
const deployDir = path.resolve(buildDir, 'deploy/') const deployDir = path.resolve(buildDir, 'deploy/')
const localPath = path.resolve(deployDir, 'molstar.github.io/') const localPath = path.resolve(deployDir, 'molstar.github.io/')
if (!fs.existsSync(localPath) || !git(localPath).checkIsRepo()) { function log(command, stdout, stderr) {
fs.mkdirSync(localPath, { recursive: true }) if (command) {
git(deployDir) console.log('\n###', command)
.silent(false) stdout.pipe(process.stdout)
.clone(remoteUrl) stderr.pipe(process.stderr)
.fetch(['--all']) }
} else {
git(localPath)
.silent(false)
.fetch(['--all'])
.reset(['--hard', 'origin/master'])
} }
const viewerBuildPath = path.resolve(buildDir, '../build/viewer/') function copyViewer() {
const viewerDeployPath = path.resolve(localPath, 'viewer/') console.log('\n###', 'copy viewer files')
fse.copySync(viewerBuildPath, viewerDeployPath, { overwrite: true }) const viewerBuildPath = path.resolve(buildDir, '../build/viewer/')
const viewerDeployPath = path.resolve(localPath, 'viewer/')
git(localPath) fse.copySync(viewerBuildPath, viewerDeployPath, { overwrite: true })
.silent(false) }
.add(['-A'])
.commit('updated viewer')
.push()
// #!/usr/bin/env bash
// LEVEL=$1
// DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )";
// cd ${DIR};
// mkdir -p ../build/;
// cd ../build/;
// if [ -d "arose.github.io" ]; then
// cd ./arose.github.io/;
// git fetch --all;
// git reset --hard origin/master;
// cd ../
// else
// git clone "https://github.com/arose/arose.github.io.git";
// fi
// if [ "$LEVEL" = "prerelease" ]; then
// cd ./arose.github.io/ngldev/;
// else
// cd ./arose.github.io/ngl/;
// fi
// cp -r ${DIR}/../data/. ./data/; if (!fs.existsSync(localPath)) {
// cp -r ${DIR}/../examples/css/. ./css/; console.log('\n###', 'create localPath')
// cp -r ${DIR}/../examples/fonts/. ./fonts/; fs.mkdirSync(localPath, { recursive: true })
// cp -r ${DIR}/../examples/js/. ./js/; }
// cp -r ${DIR}/../examples/scripts/. ./scripts/;
// cp -r ${DIR}/../build/docs/. ./api/;
// cp -r ${DIR}/../build/gallery/. ./gallery/;
// cp ${DIR}/../build/scriptsList.json ./scripts/list.json;
// cp ${DIR}/../dist/ngl.js ./js/ngl.js; process.chdir(localPath);
// cd ../; if (!fs.existsSync(path.resolve(localPath, '.git/'))) {
// git add -A; console.log('\n###', 'clone repository')
// if [ "$LEVEL" = "prerelease" ]; then git()
// git commit -m "ngldev update"; .outputHandler(log)
// else .clone(remoteUrl, localPath)
// git commit -m "ngl update"; .fetch(['--all'])
// fi .exec(copyViewer)
// git push; .add(['-A'])
.commit('updated viewer')
.push()
} else {
console.log('\n###', 'update repository')
git()
.outputHandler(log)
.fetch(['--all'])
.reset(['--hard', 'origin/master'])
.exec(copyViewer)
.add(['-A'])
.commit('updated viewer')
.push()
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment