summaryrefslogtreecommitdiff
path: root/scripts/cpGHPages.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-08-20 13:31:03 +0200
committerFlorian Dold <florian@dold.me>2021-08-20 13:31:03 +0200
commit859a8734c87d5e5081d7b0aa02cb538a7c801eac (patch)
treed2e9163479eb56ec382c842d62ce39fe30d450a4 /scripts/cpGHPages.ts
downloadnode-vendor-859a8734c87d5e5081d7b0aa02cb538a7c801eac.tar.gz
node-vendor-859a8734c87d5e5081d7b0aa02cb538a7c801eac.tar.bz2
node-vendor-859a8734c87d5e5081d7b0aa02cb538a7c801eac.zip
Squashed 'fflate/' content from commit b786929
git-subtree-dir: fflate git-subtree-split: b786929a368521e9cfcdcf7490a8e77485d5a253
Diffstat (limited to 'scripts/cpGHPages.ts')
-rw-r--r--scripts/cpGHPages.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/cpGHPages.ts b/scripts/cpGHPages.ts
new file mode 100644
index 0000000..b820c80
--- /dev/null
+++ b/scripts/cpGHPages.ts
@@ -0,0 +1,25 @@
+import * as createGit from 'simple-git/promise';
+import { resolve, join } from 'path';
+import { copyFileSync, readdirSync, statSync, unlinkSync } from 'fs';
+
+const baseDir = resolve(__dirname, '..');
+const to = (...paths: string[]) => join(baseDir, ...paths);
+const git = createGit();
+git.log({
+ from: 'HEAD~1',
+ to: 'HEAD'
+}).then(async log => {
+ const hash = log.latest.hash.slice(0, 7);
+ await git.checkout('gh-pages');
+ for (const f of readdirSync(to('.'))) {
+ if (statSync(f).isFile())
+ unlinkSync(to(f));
+ }
+ const files = readdirSync(to('dist'))
+ for (const f of files) {
+ copyFileSync(to('dist', f), to(f));
+ }
+ await git.add(files);
+ await git.commit('Build demo from ' + hash);
+ await git.checkout('master');
+}); \ No newline at end of file