#!/usr/bin/env bash

set -ex

rm -rf delivery.zip

rm -rf delivery _temp/*

mkdir -p _temp/NoteService/routes
mkdir -p _temp/noteapp

# backend (NoteService)
cp src/backend/routes/notes.js _temp/NoteService/routes/notes.js
cp src/backend/app.js _temp/NoteService/app.js

# frontend (noteapp)
cp src/frontend/src/App.js _temp/noteapp/App.js
cp src/frontend/src/App.css _temp/noteapp/App.css
cp src/frontend/src/constants.js _temp/noteapp/constants.js
cp src/frontend/src/index.js _temp/noteapp/index.js

pushd _temp
  7za a -tzip ../delivery.zip NoteService/* noteapp/*
popd

7za a -tzip source.zip src


# 7za a -tzip delivery.zip _temp/NoteService/* _temp/noteapp/*
# 7za a -tzip -ppassword source.zip src/

# mv _temp/delivery.zip delivery
# mv _temp/source.zip delivery
# rm -rf _temp
rm -rf delivery _temp/*
