Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 9098ac3

Browse files
Merge remote-tracking branch 'origin/master'
2 parents cccc809 + 715f488 commit 9098ac3

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

infra/default.nix

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ rec
77
cp ${./main.js} main.js
88
# Can't be called 'main' otherwise lambda tries to load it
99
cp "${handler}/bin/handler" main_hs
10-
cp ${deckdeckgo-starter-dist}/dist.tar dist.tar
10+
cp ${deckdeckgo-starter-dist}/dist.zip dist.zip
1111
mkdir $out
12-
${pkgs.zip}/bin/zip -r $out/function.zip main.js main_hs dist.tar
12+
${pkgs.zip}/bin/zip -r $out/function.zip main.js main_hs dist.zip
1313
'';
1414

1515
# TODO: move all other builders to this
@@ -62,7 +62,7 @@ rec
6262
deckdeckgo-starter-dist =
6363
with
6464
{ napalm = import pkgs.sources.napalm { inherit pkgs;} ; };
65-
pkgs.runCommand "deckdeckgo-starter" { buildInputs = [ pkgs.nodejs ]; }
65+
pkgs.runCommand "deckdeckgo-starter" { buildInputs = [ pkgs.nodejs pkgs.zip ]; }
6666
''
6767
cp -r ${napalm.buildPackage pkgs.sources.deckdeckgo-starter {}}/* .
6868
chmod +w -R _napalm-install
@@ -71,7 +71,7 @@ rec
7171
npm run build
7272
mkdir -p $out
7373
pushd dist
74-
tar -cvf $out/dist.tar *
74+
zip -r $out/dist.zip *
7575
popd
7676
'';
7777

@@ -147,7 +147,7 @@ rec
147147
AWS_DEFAULT_REGION=us-east-1 \
148148
AWS_ACCESS_KEY_ID=dummy \
149149
AWS_SECRET_ACCESS_KEY=dummy_key \
150-
DECKGO_STARTER_DIST=${deckdeckgo-starter-dist}/dist.tar \
150+
DECKGO_STARTER_DIST=${deckdeckgo-starter-dist}/dist.zip \
151151
ghci -Wall handler/app/Test.hs handler/src/**/*.hs
152152
}
153153
@@ -228,7 +228,7 @@ rec
228228
AWS_DEFAULT_REGION=us-east-1 \
229229
AWS_ACCESS_KEY_ID=dummy \
230230
AWS_SECRET_ACCESS_KEY=dummy_key \
231-
DECKGO_STARTER_DIST=${deckdeckgo-starter-dist}/dist.tar \
231+
DECKGO_STARTER_DIST=${deckdeckgo-starter-dist}/dist.zip \
232232
TEST_TOKEN_PATH=${./token} ${handler}/bin/test
233233
echo "Tests were run"
234234

infra/handler/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dependencies:
4444
- wai
4545
- wai-cors
4646
- wai-lambda
47-
- tar
47+
- zip-archive
4848

4949
ghc-options:
5050
- -Wall

infra/handler/src/DeckGo/Handler.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import System.Environment
5454
import System.FilePath
5555
import UnliftIO
5656
import qualified Cases
57-
import qualified Codec.Archive.Tar as Tar
57+
import qualified Codec.Archive.Zip as Zip
5858
import qualified Crypto.Hash as Hash
5959
import qualified Data.Aeson as Aeson
6060
import qualified Data.Aeson.Types as Aeson
@@ -1235,6 +1235,11 @@ listPresentationObjects
12351235
listPresentationObjects env bucket pprefix =
12361236
listObjects env bucket (Just $ unPresentationPrefix pprefix)
12371237

1238+
zipExtract :: FilePath -> FilePath -> IO ()
1239+
zipExtract dest archivePath = do
1240+
archive <- Zip.toArchive <$> BL.readFile archivePath
1241+
Zip.extractFilesFromArchive [ Zip.OptDestination dest ] archive
1242+
12381243
withPresentationFiles
12391244
:: Username
12401245
-> PresShortname
@@ -1244,7 +1249,7 @@ withPresentationFiles
12441249
withPresentationFiles uname psname presentationInfo act = do
12451250
deckgoStarterDist <- getEnv "DECKGO_STARTER_DIST"
12461251
Temp.withSystemTempDirectory "dist" $ \dir -> do
1247-
Tar.extract dir deckgoStarterDist
1252+
zipExtract dir deckgoStarterDist
12481253

12491254
-- Here we deal with workbox' precache by updating index.html and then
12501255
-- propagate the new etag (md5) through precache-manifest.js and

infra/lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ resource "aws_lambda_function" "api" {
2424
DECKGO_PRESENTATIONS_URL = aws_route53_record.www_site_beta.fqdn
2525
META_BUCKET_NAME = aws_s3_bucket.meta.bucket
2626
BUCKET_NAME = aws_s3_bucket.presentations.bucket
27-
DECKGO_STARTER_DIST = "dist.tar"
27+
DECKGO_STARTER_DIST = "dist.zip"
2828
}
2929
}
3030
}

infra/nix/sources.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"homepage": "https://deckdeckgo.com",
66
"owner": "deckgo",
77
"repo": "deckdeckgo-starter",
8-
"rev": "c92dad40ce2b0009477767f1f9b6ac227a551a6e",
9-
"sha256": "0cgp41pc68qsnx7dmqilpv3jf98j1q3k6fi3qqp14b2djzr71cr2",
8+
"rev": "9afca4a201d35a22b94cec9d56a9244cd7099832",
9+
"sha256": "022md776ab1hxxxq27n15807n6pwgcv6gd2wmiiyxklmvfiv70ib",
1010
"type": "tarball",
11-
"url": "https://github.com/deckgo/deckdeckgo-starter/archive/c92dad40ce2b0009477767f1f9b6ac227a551a6e.tar.gz",
11+
"url": "https://github.com/deckgo/deckdeckgo-starter/archive/9afca4a201d35a22b94cec9d56a9244cd7099832.tar.gz",
1212
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313
},
1414
"elasticmq": {

0 commit comments

Comments
 (0)