Skip to content

Commit

Permalink
chore(stories): create story packages for offline usage (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwambach authored Mar 18, 2020
1 parent 59c5e82 commit 07bd29b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
dist
dist-electron
.vscode
storage/**/*.zip
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"electron:install": "electron-builder install-app-deps",
"electron:clean": "rm -rf ./dist-electron",
"electron:build": "npm run electron:clean && npm run electron:install && npm run build && electron-builder -mwl --x64 --config electron-builder.json",
"upload-storage": "gsutil rsync -r -x \".DS_Store\" ./storage gs://esa-cfs-storage/$npm_package_version && gsutil -m setmeta -r -h \"Cache-Control: no-cache\" gs://esa-cfs-storage/$npm_package_version/"
"story-packages": "./scripts/create-story-packages.sh",
"upload-storage": "npm run story-packages && gsutil rsync -r -x \".DS_Store\" ./storage gs://esa-cfs-storage/$npm_package_version && gsutil -m setmeta -r -h \"Cache-Control: no-cache\" gs://esa-cfs-storage/$npm_package_version/"
},
"repository": {
"type": "git",
Expand Down
21 changes: 21 additions & 0 deletions scripts/create-story-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Zip each story into a package in ./storage/stories/{storyId}package.zip
# The story content inside the package must be wrapped in a "story-{storyId}" folder
# Usage: Just run './scripts/create-story-package.sh' from the project's root directory

cd storage/stories

for storyId in */; do
tmpDir=/tmp/story-$storyId
mkdir $tmpDir

cp -r ./$storyId/* $tmpDir
lastDir=(`pwd`)

cd /tmp
zip -r $lastDir/$storyId/package.zip ./story-$storyId
cd $lastDir

rm -r $tmpDir
done

0 comments on commit 07bd29b

Please sign in to comment.