-
Notifications
You must be signed in to change notification settings - Fork 5
/
justfile
98 lines (78 loc) · 3.03 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# add node bin script path for recipes
export PATH := "./node_modules/.bin:" + env_var('PATH')
# Default: display available recipes
_help:
@just --list
# –––––––––––––----------------------------------------------------------------
# Setup
# –––––––––––––----------------------------------------------------------------
# Set up the dev environment on a MacOS or GNU/Linux system
setup-dev-env:
scripts/setup-dev-env
# Clean up `dist/` (resetting it to the currently published state) and `test-browser/`
clean:
#!/bin/sh
set -e
rm -rf test-browser
cd dist
git fetch origin
git reset --hard origin/gh-pages
git clean -fdx
# Install node modules
install *params:
npm install {{params}}
# Compile code to `dist/`
build *params:
webpack {{params}}
# Compile code to `dist/`, then watch and recompile on changes
build-watch *params:
webpack --watch {{params}}
# –––––––––––––----------------------------------------------------------------
# Test & related
# –––––––––––––----------------------------------------------------------------
# Run code linting
lint *params:
semistandard {{params}}
# Run tests on the given component ('all' for all components) with optional extra parameters
test component *params:
NODE_ENV=test COMPONENT={{component}} components-run \
npx mocha -- {{params}}
# Run tests for debugging
test-debug component *params:
NODE_ENV=test COMPONENT={{component}} components-run \
npx mocha -- --timeout 3600000 --inspect-brk=40000 {{params}}
# Run tests and generate coverage report
test-cover component *params:
NODE_ENV=test COMPONENT={{component}} nyc --reporter=lcov --reporter=text --report-dir=./coverage \
components-run npx mocha -- {{params}}
# Run tests for ci
test-cover-ci:
NODE_ENV=test COMPONENT=all nyc --reporter=lcov components-run npx mocha -- --timeout 20000
# Run browser tests (assumes browser files are built)
test-browser:
(sleep 1 && open https://l.backloop.dev:8443/?pryvServiceInfoUrl=https://zou.zou/service/info) &
backloop.dev ./test-browser 8443
# Start a `backloop.dev` web server on `dist/`
serve:
(sleep 1 && open https://l.backloop.dev:9443/) &
backloop.dev ./dist 9443
# –––––––––––––----------------------------------------------------------------
# Misc. utils
# –––––––––––––----------------------------------------------------------------
# Run source licensing tool
license:
source-licenser --config-file .licenser.yml ./
# Set version on all `package.json` (root’s and components’)
version version:
npm version --no-git-tag-version --workspaces --include-workspace-root {{version}}
# Publish all components to NPM
publish-npm:
npm publish --workspaces
# Publish browser files in `dist/` (i.e. the `gh-pages` branch)
publish-browser:
#!/bin/sh
set -e
cd dist
git add --all
git commit -m "Updated generated files"
git push