Thought cabinet
This commit is contained in:
28
task/inject-importmap
Executable file
28
task/inject-importmap
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
importmap="$1"
|
||||
tmp="$(mktemp)"
|
||||
|
||||
awk '
|
||||
BEGIN {
|
||||
s="<!-- start importmap -->"
|
||||
e="<!-- end importmap -->"
|
||||
}
|
||||
|
||||
FILENAME != "index.html" {
|
||||
d=d $0 "\n"
|
||||
next
|
||||
}
|
||||
$0 == s || $0 == e { print }
|
||||
$0 == s,$0 == e {
|
||||
if(d) {
|
||||
print "<script type=\"importmap\">"
|
||||
printf d;
|
||||
d = ""
|
||||
print "</script>"
|
||||
}
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
' "$importmap" index.html > "$tmp" \
|
||||
&& mv "$tmp" index.html
|
||||
15
task/setup-build
Executable file
15
task/setup-build
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
name="$1"
|
||||
|
||||
task/inject-importmap "targets/${name}.json"
|
||||
rm -rf build/*
|
||||
|
||||
cp -r src/ build/
|
||||
cp -r assets/ build/
|
||||
cp -r lib/ build/
|
||||
|
||||
cp index.html package.json debug.js build/
|
||||
|
||||
mkdir -p build/device
|
||||
cp "device/${name}.js" build/device
|
||||
Reference in New Issue
Block a user