-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Taskfile.yml
139 lines (126 loc) · 4.63 KB
/
Taskfile.yml
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Task runner for Manifest V3 for Chromium browsers
# =================================================
# As of Aug. 2022 Firefox is not supported.
#
# This task runner requires Task to be installed.
# https://taskfile.dev/#/installation
#
version: "3"
silent: true
vars:
REQDOCS: "task requires the installation of mkdocs: https://www.mkdocs.org/user-guide/installation"
REQPNPM: "task requires the installation of pnpm: https://pnpm.io/installation"
REQSHX: "task requires the installation of shelljs/shx: https://github.com/shelljs/shx"
REQWEXT: "task requires the installation of Web-ext: https://github.com/mozilla/web-ext"
REQMAT: "task requires the installation of Material for MkDocs: https://squidfunk.github.io/mkdocs-material"
tasks:
default:
desc: List the available tasks.
cmds:
- task --list
lint:
desc: Lint the JavaScript files in the `ext` directory.
ignore_error: true
cmds:
# node and dependencies
- cmd: pnpm exec eslint ext/scripts/sw/*.js --stats
- cmd: pnpm exec eslint ext/scripts/*.js --stats
# user commands that are displayed with `task --list`
build:
desc: Creates the submission package for Chrome.
summary: |
Creates a package that is intended for submission to the Chrome Web Store
and Microsoft Edge Add-ons.
Packaged file will be located in /web-ext-artifacts
cmds:
- task: build-chrome
build-chrome:
# edit web-ext-chrome.js to hide files and directories
preconditions:
- sh: pnpm -v
msg: "{{.REQPNPM}}"
- sh: pnpm exec web-ext --version
msg: "{{.REQWEXT}}"
cmds:
- task: dep-copy
- cmd: pnpm exec web-ext --config ext/.web-ext-chrome.js --source-dir ./ext build
ignore_error: true
checks:
desc: Check, run and print the versions of the task commands and dependencies.
ignore_error: true
cmds:
# node and dependencies
- cmd: pnpm exec shx echo -n "Node.js "
- cmd: node --version
- cmd: pnpm exec shx echo -n "pnpm version "
- cmd: pnpm --version
- cmd: pnpm exec shx --version
- cmd: pnpm exec shx echo -n "Web-ext v"
- cmd: pnpm exec web-ext --version
# python and dependencies
- cmd: python --version
- cmd: mkdocs --version
- cmd: pip --version
- cmd: pip show mkdocs-material --quiet
# system tools
- cmd: pnpm exec shx echo ""
- cmd: git --version
- cmd: task --version
dep-copy:
desc: Copies the dependencies from `node_modules` over to the `ext` directory.
preconditions:
- sh: pnpm -v
msg: "{{.REQPNPM}}"
- sh: pnpm exec shx --version
msg: "{{.REQSHX}}"
# use shx for Windows compatibility
cmds:
- cmd: pnpm exec shx cp -f "node_modules/bulma/css/bulma.min.css" "ext/css/bulma.min.css"
- cmd: pnpm exec shx cp -f "node_modules/qunit/qunit/qunit.css" "ext/test/qunit.css"
- cmd: pnpm exec shx cp -f "node_modules/qunit/qunit/qunit.js" "ext/test/qunit.js"
- cmd: pnpm exec shx cp -f "node_modules/linkifyjs/dist/linkify.js" "ext/js/linkify.js"
- cmd: pnpm exec shx cp -f "node_modules/linkify-plugin-ip/dist/linkify-plugin-ip.js" "ext/js/linkify-plugin-ip.js"
- cmd: pnpm exec shx cp -f "node_modules/linkify-element/dist/linkify-element.js" "ext/js/linkify-element.js"
- cmd: pnpm exec shx cp -f "node_modules/dompurify/dist/purify.js" "ext/js/purify.js"
dep-install:
desc: Installs both the dependencies and dev-dependencies contained in the package.json.
preconditions:
- sh: pnpm -v
msg: "{{.REQPNPM}}"
cmds:
- cmd: pnpm install
- task: dep-copy
dep-update:
desc: Updates all dependencies to the latest version and copies them to the `ext` directory.
preconditions:
- sh: pnpm -v
msg: "{{.REQPNPM}}"
- sh: pnpm exec shx --version
msg: "{{.REQSHX}}"
cmds:
- cmd: pnpm update
- cmd: pnpm exec shx echo ""
- task: dep-copy
docs-build:
desc: Build the current documentation in use on https://docs.retrotxt.com.
preconditions:
- sh: pip show mkdocs-material
msg: "{{.REQMAT}}"
- sh: pnpm -v
msg: "{{.REQPNPM}}"
- sh: pnpm mkdocs -V
msg: "{{.REQDOCS}}"
cmds:
- cmd: pnpm mkdocs build
docs-serve:
desc: Run an internal server to view the documentation in `docs`.
preconditions:
# - sh: pip show mkdocs-material
# msg: "{{.REQMAT}}"
- sh: pnpm -v
msg: "{{.REQPNPM}}"
- sh: pnpm mkdocs -V
msg: "{{.REQDOCS}}"
cmds:
- cmd: pnpm mkdocs serve
ignore_error: true # ignore Ctrl-C exit interrupts