# HG changeset patch # User drewp@bigasterisk.com # Date 1683407455 25200 # Node ID 8a30f1c9a702fe15833306917caf4d9e86c7a9e8 # Parent 828a64e62e73cd76bcdbdfa12d3cde0006724b75 trying to build a runnable dist diff -r 828a64e62e73 -r 8a30f1c9a702 package.json --- a/package.json Sat May 06 14:10:22 2023 -0700 +++ b/package.json Sat May 06 14:10:55 2023 -0700 @@ -30,6 +30,8 @@ "sub-events": "^1.9.0" }, "devDependencies": { + "@rollup/plugin-commonjs": "^24.1.0", + "@rollup/plugin-node-resolve": "^15.0.2", "@rollup/plugin-terser": "^0.4.1", "@types/jest": "^29.5.1", "dependency-cruiser": "^12.12.0", diff -r 828a64e62e73 -r 8a30f1c9a702 tasks.py --- a/tasks.py Sat May 06 14:10:22 2023 -0700 +++ b/tasks.py Sat May 06 14:10:55 2023 -0700 @@ -43,19 +43,23 @@ v = ctx.run('pnpm version minor').stdout.strip() ctx.run(f'hg commit --message "release {v}"') build(ctx) + install_to_bigasterisk_lib(ctx, 'streamed-graph.js', + f'lib/streamed-graph/{v}/') + # this fails with ENEEDAUTH: + #ctx.run(f'pnpm publish --registry https://bigasterisk.com/js', pty=True) + + +def install_to_bigasterisk_lib(ctx, distFile, libPath): filesRoot = '/my/site/homepage/newsrc/files' - path = f'lib/streamed-graph/{v}/' - outdir = f'{filesRoot}/{path}' - name = 'streamed-graph.es.js' + outdir = f'{filesRoot}/{libPath}' ctx.run(f'mkdir -p {outdir}') - ctx.run(f'cp dist/{name} {outdir}') + ctx.run(f'cp dist/{distFile} {outdir}') + print('rebuild bigasterisk:') ctx.run('cd /my/site/homepage; inv build') ctx.run( "curl -s -o/dev/null -w '%{url_effective} %{http_code} bytes=%{size_download}\n' " - + "https://bigasterisk.com/" + path + name, + + "https://bigasterisk.com/" + libPath + distFile, pty=True) - # this fails with ENEEDAUTH: - #ctx.run(f'pnpm publish --registry https://bigasterisk.com/js', pty=True) @task diff -r 828a64e62e73 -r 8a30f1c9a702 vite.config.ts --- a/vite.config.ts Sat May 06 14:10:22 2023 -0700 +++ b/vite.config.ts Sat May 06 14:10:55 2023 -0700 @@ -1,5 +1,7 @@ import { defineConfig, Plugin, UserConfigExport } from "vite"; import terser from "@rollup/plugin-terser"; +import rollupResolve from "@rollup/plugin-node-resolve"; +import rollupCommonjs from "@rollup/plugin-commonjs"; const config: UserConfigExport = { base: "https://bigasterisk.com/reposyncDev/", @@ -15,14 +17,19 @@ target: "esnext", lib: { entry: "src/index.ts", - formats: ["es"], + formats: ["es", "cjs"], }, rollupOptions: { external: /^lit/, plugins: [ + rollupResolve({ + browser: true, + preferBuiltins: false, + }), + rollupCommonjs(), terser({ - mangle:false, - compress:false, + mangle: false, + compress: false, format: { semicolons: false, },