Move sold items to own dir
This commit is contained in:
parent
93963e41ae
commit
34790c2b0c
|
@ -4,8 +4,5 @@ README.md
|
|||
# Drafts
|
||||
**/_draft.*
|
||||
|
||||
# Sold products
|
||||
**/_sold.*
|
||||
|
||||
# Aspell backups
|
||||
**/*.bak
|
|
@ -5,6 +5,7 @@ node_modules/
|
|||
.env
|
||||
docker-compose.yml
|
||||
orders/*.json
|
||||
sold/
|
||||
|
||||
# frontend build
|
||||
_site/*
|
||||
|
|
3
api.js
3
api.js
|
@ -15,6 +15,7 @@ const jsonBodyParser = express.json()
|
|||
app.listen(process.env.API_PORT||80)
|
||||
const DATA_DIR = `${__dirname}/_src/_data`
|
||||
const SHOP_DIR = `${__dirname}/_src/shop`
|
||||
const SOLD_DIR = `${__dirname}/sold`
|
||||
const ORDERS_DIR = `${__dirname}/orders`
|
||||
// TODO: Use an eleventy hook to save this outside the public _site dir
|
||||
const PRODUCTS_FILE = `${__dirname}/_site/assets/data/products.json`
|
||||
|
@ -272,7 +273,7 @@ app.options('/paid', cors)
|
|||
order.items.forEach((item) => {
|
||||
if (item.sid) {
|
||||
console.log(`Removing product with sid ${item.sid} from store`)
|
||||
run(`./hooks/remove_sid ${item.sid} ${SHOP_DIR}`)
|
||||
run(`./hooks/remove_sid ${item.sid} ${SHOP_DIR} ${SOLD_DIR}`)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
#!/bin/bash
|
||||
# remove_sid
|
||||
#
|
||||
# USAGE: remove_sid sid dir
|
||||
# USAGE: remove_sid sid shop_dir sold_dir
|
||||
|
||||
find "${2}" -type d -name "${1}" -exec mv {} "${3}"
|
||||
|
||||
# https://stackoverflow.com/a/6329624/
|
||||
find "${2}" -type f \( -path "*/${1}/index.*" -o -name "${1}.*" \) \
|
||||
-printf "cp '%h/%f' '%h/_sold.%f'\nrm '%h/%f'" |bash -s
|
||||
#find "${2}" -type f \( -path "*/${1}/index.*" -o -name "${1}.*" \) \
|
||||
# -printf "cp '%h/%f' '%h/_sold.%f'\nrm '%h/%f'" |bash -s
|
||||
|
||||
npm run build
|
||||
# Update website
|
||||
npm run build & (
|
||||
git status
|
||||
git remote -v
|
||||
#git add "${2}" && \
|
||||
#git commit -m "Products sold" && \
|
||||
#git push
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue