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

Commit f5cbf39

Browse files
author
Sam Minton
committed
Modify setup-django.sh to use yarn instead of bower and npm if available re #286,
currently setup-django makes the assumption that yarn.lock exists which it may not initially. In order to use BS4 and compile from source, we need to move away from bower (at least to install bootstrap, since bower is deprecated), they recommend using yarn instead. Can we get away with simply using npm and django-compressor? The goal is to have: - bootstrap 3 available to the admin - bootstrap 4 available to the front end - icekit .scss files compiled into the project/overridable where necessary - project .scss files that allow for bootstrap variables and overrides and provide a platform to build on that simplifies frontend setups for icekit sites. - can we get away with using only django-compressor or is yarn/alternative a necessary step? - as simple a setup as possible to avoid painful edge cases and implementation nightmares - sourcemaps would be nice Yarn - use bower-away to convert bower.json to yarn (adds yarn specific syntax to package.json) - yarn requires Ruby > 2.3 - you might need to delete bower_components/.DS_Store if bower-away fails with ENOTDIR
1 parent 8ae0e65 commit f5cbf39

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

icekit/bin/setup-django.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ if [[ -n "$WAITLOCK_ENABLE" ]]; then
2323
EOF
2424
fi
2525

26+
if [[ -f yarn.lock ]]; then
27+
waitlock.sh yarn.sh "$ICEKIT_PROJECT_DIR"
2628
# Install Node modules.
2729
waitlock.sh npm-install.sh "$ICEKIT_PROJECT_DIR"
2830

2931
# Install Bower components.
3032
waitlock.sh bower-install.sh "$ICEKIT_PROJECT_DIR"
33+
fi
3134

3235
# Install Python requirements.
3336
waitlock.sh pip-install.sh "$ICEKIT_PROJECT_DIR"

icekit/bin/yarn.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# Install Node modules in the given directory via yarn, if they have changed.
4+
5+
cat <<EOF
6+
# `whoami`@`hostname`:$PWD$ yarn.sh $@
7+
EOF
8+
9+
set -e
10+
11+
DIR="${1:-$PWD}"
12+
13+
mkdir -p "$DIR"
14+
cd "$DIR"
15+
16+
if [[ ! -s package.json ]]; then
17+
cat <<EOF > package.json
18+
{
19+
"name": "$ICEKIT_PROJECT_NAME",
20+
"dependencies": {
21+
},
22+
"private": true
23+
}
24+
EOF
25+
fi
26+
27+
touch package.json.md5
28+
29+
if [[ ! -s package.json.md5 ]] || ! md5sum --status -c package.json.md5 > /dev/null 2>&1; then
30+
echo "Node modules in '$DIR' directory are out of date."
31+
if [[ -d node_modules ]]; then
32+
echo 'Removing old Node modules directory.'
33+
rm -rf node_modules
34+
fi
35+
yarn
36+
md5sum package.json > package.json.md5
37+
fi

0 commit comments

Comments
 (0)