annotate tasks.py @ 150:3ce355e4f388 default tip

bye jest; hi vitest. new working test for styles.ts
author drewp@bigasterisk.com
date Mon, 08 May 2023 17:27:44 -0700
parents 845ba03729f9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
126
9a57f8c556d2 add depgraph task
drewp@bigasterisk.com
parents: 108
diff changeset
1 import os
0
drewp@localhost
parents:
diff changeset
2 from invoke import task # pytype: disable=import-error
drewp@localhost
parents:
diff changeset
3
drewp@localhost
parents:
diff changeset
4
drewp@localhost
parents:
diff changeset
5 @task
60
0d0638bd98be use pnpm
drewp@bigasterisk.com
parents: 50
diff changeset
6 def setup_js(ctx):
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
7 if 0: # only reasonable on bang,but dash tries to rebuild it
92
8db5ba7e12b9 pnpm install is slow & broken over nfs with a mismatching abspath
drewp@bigasterisk.com
parents: 90
diff changeset
8 ctx.run('pnpm install --dir=$PWD')
0
drewp@localhost
parents:
diff changeset
9
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
10
68
f357cd36c26e pnpm install is cheap; do it all the time
drewp@bigasterisk.com
parents: 60
diff changeset
11 @task(pre=[setup_js])
0
drewp@localhost
parents:
diff changeset
12 def serve_demo(ctx):
35
29d8ed02a275 build and tests, including jsonld
drewp@bigasterisk.com
parents: 33
diff changeset
13 ctx.run('webfsd -Fp 8021')
0
drewp@localhost
parents:
diff changeset
14
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
15
68
f357cd36c26e pnpm install is cheap; do it all the time
drewp@bigasterisk.com
parents: 60
diff changeset
16 @task(pre=[setup_js])
0
drewp@localhost
parents:
diff changeset
17 def build(ctx):
60
0d0638bd98be use pnpm
drewp@bigasterisk.com
parents: 50
diff changeset
18 ctx.run(f'pnpm run build', pty=True)
29
45ed53428e74 fix configs to run tests (all in one bundle though)
drewp@bigasterisk.com
parents: 25
diff changeset
19
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
20
68
f357cd36c26e pnpm install is cheap; do it all the time
drewp@bigasterisk.com
parents: 60
diff changeset
21 @task(pre=[setup_js])
29
45ed53428e74 fix configs to run tests (all in one bundle though)
drewp@bigasterisk.com
parents: 25
diff changeset
22 def build_forever(ctx):
60
0d0638bd98be use pnpm
drewp@bigasterisk.com
parents: 50
diff changeset
23 ctx.run(f'pnpm run build_forever', pty=True)
9
26d3e4860adc working on porting graph_view to n3.js. also working on making tests run
drewp@bigasterisk.com
parents: 0
diff changeset
24
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
25
68
f357cd36c26e pnpm install is cheap; do it all the time
drewp@bigasterisk.com
parents: 60
diff changeset
26 @task(pre=[setup_js])
9
26d3e4860adc working on porting graph_view to n3.js. also working on making tests run
drewp@bigasterisk.com
parents: 0
diff changeset
27 def test(ctx):
60
0d0638bd98be use pnpm
drewp@bigasterisk.com
parents: 50
diff changeset
28 ctx.run(f'pnpm run test', pty=True)
29
45ed53428e74 fix configs to run tests (all in one bundle though)
drewp@bigasterisk.com
parents: 25
diff changeset
29
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
30
68
f357cd36c26e pnpm install is cheap; do it all the time
drewp@bigasterisk.com
parents: 60
diff changeset
31 @task(pre=[setup_js])
29
45ed53428e74 fix configs to run tests (all in one bundle though)
drewp@bigasterisk.com
parents: 25
diff changeset
32 def test_forever(ctx):
60
0d0638bd98be use pnpm
drewp@bigasterisk.com
parents: 50
diff changeset
33 ctx.run(f'pnpm run test_forever', pty=True)
90
6077fdc9ed44 inv release
drewp@bigasterisk.com
parents: 68
diff changeset
34
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
35
90
6077fdc9ed44 inv release
drewp@bigasterisk.com
parents: 68
diff changeset
36 @task
6077fdc9ed44 inv release
drewp@bigasterisk.com
parents: 68
diff changeset
37 def release(ctx):
142
845ba03729f9 fix registry path
drewp@bigasterisk.com
parents: 135
diff changeset
38 ctx.run('pnpm whoami --registry https://bigasterisk.com/js/')
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
39 diffs = ctx.run('hg status')
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
40 if diffs.stdout.strip():
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
41 print(" ^^ commit these diffs first")
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
42 return
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
43 v = ctx.run('pnpm version minor').stdout.strip()
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
44 ctx.run(f'hg commit --message "release {v}"')
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
45 build(ctx)
135
a6490559ce73 WIP trying to make a usable release module
drewp@bigasterisk.com
parents: 133
diff changeset
46 install_to_bigasterisk_lib(ctx, 'streamed-graph.*',
133
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
47 f'lib/streamed-graph/{v}/')
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
48 # this fails with ENEEDAUTH:
142
845ba03729f9 fix registry path
drewp@bigasterisk.com
parents: 135
diff changeset
49 ctx.run(f'pnpm publish --registry https://bigasterisk.com/js/', pty=True)
133
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
50
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
51
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
52 def install_to_bigasterisk_lib(ctx, distFile, libPath):
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
53 filesRoot = '/my/site/homepage/newsrc/files'
133
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
54 outdir = f'{filesRoot}/{libPath}'
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
55 ctx.run(f'mkdir -p {outdir}')
133
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
56 ctx.run(f'cp dist/{distFile} {outdir}')
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
57 print('rebuild bigasterisk:')
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
58 ctx.run('cd /my/site/homepage; inv build')
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
59 ctx.run(
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
60 "curl -s -o/dev/null -w '%{url_effective} %{http_code} bytes=%{size_download}\n' "
133
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
61 + "https://bigasterisk.com/" + libPath + distFile,
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
62 pty=True)
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
63
108
5e6840229a05 rewrite freeStatements rendering to put more planning in layout
drewp@bigasterisk.com
parents: 92
diff changeset
64
5e6840229a05 rewrite freeStatements rendering to put more planning in layout
drewp@bigasterisk.com
parents: 92
diff changeset
65 @task
5e6840229a05 rewrite freeStatements rendering to put more planning in layout
drewp@bigasterisk.com
parents: 92
diff changeset
66 def dev(ctx):
126
9a57f8c556d2 add depgraph task
drewp@bigasterisk.com
parents: 108
diff changeset
67 ctx.run('pnpm dev')
9a57f8c556d2 add depgraph task
drewp@bigasterisk.com
parents: 108
diff changeset
68
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
69
126
9a57f8c556d2 add depgraph task
drewp@bigasterisk.com
parents: 108
diff changeset
70 @task
9a57f8c556d2 add depgraph task
drewp@bigasterisk.com
parents: 108
diff changeset
71 def deps(ctx):
130
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
72 ctx.run(
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
73 'node_modules/.bin/depcruise --config .dependency-cruiser.js -T dot src | dot -Tsvg > deps.svg'
73a70d00fb74 dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents: 126
diff changeset
74 )
126
9a57f8c556d2 add depgraph task
drewp@bigasterisk.com
parents: 108
diff changeset
75 print(f"browse to file://{os.path.abspath('deps.svg')}")