diff --git a/README.md b/README.md index b0a85b9a19af137b0a9174163346486ebe850858..043668a218ce34cd7fafd11f0da749b2172919f2 100644 --- a/README.md +++ b/README.md @@ -133,14 +133,17 @@ To get syntax highlighting for shader and graphql files add the following to Vis ## Publish -## Prerelease +### Prerelease npm version prerelease # asumes the current version ends with '-dev.X' npm publish --tag next -## Release +### Release npm version 0.X.0 # provide valid semver string npm publish +## Deploy + node ./scripts/deploy.js # currently updates the viewer on molstar.org/viewer + ## Contributing Just open an issue or make a pull request. All contributions are welcome. diff --git a/package-lock.json b/package-lock.json index 805fc449db497a93f5966f9ed63d5a797ff6f079..91b209bb516fc912f62571744d4237dd141b6399 100644 Binary files a/package-lock.json and b/package-lock.json differ diff --git a/package.json b/package.json index e629d822c9002bfde24e30eabb1dbecdfa7f466a..44be598d223bc8ea086be627f13ad82fbf2ee40c 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "css-loader": "^2.1.1", "extra-watch-webpack-plugin": "^1.0.3", "file-loader": "^3.0.1", + "fs-extra": "^8.0.1", "graphql-code-generator": "^0.18.2", "graphql-codegen-time": "^0.18.2", "graphql-codegen-typescript-template": "^0.18.2", @@ -78,6 +79,7 @@ "raw-loader": "^2.0.0", "resolve-url-loader": "^3.1.0", "sass-loader": "^7.1.0", + "simple-git": "^1.113.0", "style-loader": "^0.23.1", "ts-jest": "^24.0.2", "tslint": "^5.17.0", diff --git a/scripts/deploy.js b/scripts/deploy.js new file mode 100644 index 0000000000000000000000000000000000000000..0468eb50f5c04d8b1f0fc1e9a6941ae2fe2a464c --- /dev/null +++ b/scripts/deploy.js @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +const git = require('simple-git') +const path = require('path') +const fs = require("fs") +const fse = require("fs-extra") + +const remoteUrl = "https://github.com/molstar/molstar.github.io.git" +const buildDir = path.resolve(__dirname, '../build/') +const deployDir = path.resolve(buildDir, 'deploy/') +const localPath = path.resolve(deployDir, 'molstar.github.io/') + +if (!fs.existsSync(localPath) || !git(localPath).checkIsRepo()) { + fs.mkdirSync(localPath, { recursive: true }) + git(deployDir) + .silent(false) + .clone(remoteUrl) + .fetch(['--all']) +} else { + git(localPath) + .silent(false) + .fetch(['--all']) + .reset(['--hard', 'origin/master']) +} + +const viewerBuildPath = path.resolve(buildDir, '../build/viewer/') +const viewerDeployPath = path.resolve(localPath, 'viewer/') +fse.copySync(viewerBuildPath, viewerDeployPath, { overwrite: true }) + +git(localPath) + .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/; +// cp -r ${DIR}/../examples/css/. ./css/; +// cp -r ${DIR}/../examples/fonts/. ./fonts/; +// 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; + +// cd ../; +// git add -A; +// if [ "$LEVEL" = "prerelease" ]; then +// git commit -m "ngldev update"; +// else +// git commit -m "ngl update"; +// fi +// git push;