squint

rafaeldelboni 2024-10-18T18:47:39.778359Z

Hey I would like to be able to express different configurations for my npx squint watch/build for tests vs the actual build.

rafaeldelboni 2024-10-18T18:48:45.472799Z

I'm using the react example and adding test folder to it with this structure:

rafaeldelboni 2024-10-18T18:49:02.692849Z

my bb.edn looks like this:

{:tasks
 {dev:squint (shell "npx squint watch")
  dev:vite (shell "npx vite --config=viteconfig.js public")
  -dev {:depends [dev:vite dev:squint]}
  dev (run '-dev {:parallel true})

  test:watch:squint (shell "npx squint watch")
  test:watch:vite (shell "npx vitest --config=viteconfig.js")
  -test:watch {:depends [test:watch:vite test:watch:squint]}
  test:watch (run '-test:watch {:parallel true})

  build:squint (shell "npx squint compile")
  build:vite (shell "npx vite --config viteconfig.js build public")
  -build {:depends [build:squint build:vite]}
  build (run '-build {:parallel false})}}

rafaeldelboni 2024-10-18T18:49:16.275409Z

my squint.edn:

{:paths ["src" "test"]
 :output-dir "public/js"
 :extension "jsx"}

rafaeldelboni 2024-10-18T18:49:35.745149Z

and the viteconfig.js:

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';

export default defineConfig({
  test: {
    include: ["test/*.mjs", "public/js/*test.jsx"],
  },
  plugins: [
    react(),
    visualizer({ open: false, filename: 'bundle-visualization.html' })
  ]
});

borkdude 2024-10-18T18:50:11.922179Z

I just published 0.8.119 where you can override --paths and --extension on the command line

rafaeldelboni 2024-10-18T18:50:23.038839Z

hahaha it's so fast

borkdude 2024-10-18T18:50:59.132629Z

perhaps you can try leaving out :extension in squint.edn since .jsx is automatically used when you use #jsx

borkdude 2024-10-18T18:51:07.435749Z

if that gets in the way

rafaeldelboni 2024-10-18T18:51:08.092149Z

I think would be enough, it's good to be able to not have the tests being compiled on build for example

borkdude 2024-10-18T18:51:19.597409Z

👍

rafaeldelboni 2024-10-18T18:51:37.641549Z

thanks

rafaeldelboni 2024-10-18T18:52:30.420909Z

to express using --paths it's like --paths ["src" "test"] ? or --paths src --paths test ?

borkdude 2024-10-18T18:53:02.330409Z

Both of these work:

--paths src --paths test
or --paths src test

rafaeldelboni 2024-10-18T18:53:21.690539Z

thanks again 🙂

rafaeldelboni 2024-10-18T18:58:55.853229Z

maybe you forgot something

rafaeldelboni 2024-10-18T19:02:52.248739Z

@borkdude sorry for the ping https://github.com/squint-cljs/squint/pull/565

borkdude 2024-10-18T19:03:21.551259Z

oops!

borkdude 2024-10-18T19:04:18.844779Z

published

❤️ 1
rafaeldelboni 2024-10-18T19:25:24.797779Z

I think it's not overriding what is in the squint.edn like the behavior of the --output-dir

rafaeldelboni 2024-10-18T19:25:35.087589Z

npx squint watch --paths src test --output-dir public/test
...
[squint] Watching paths: src

rafaeldelboni 2024-10-18T19:25:50.487179Z

npx squint watch --paths test --output-dir public/test
...
[squint] Watching paths: src

borkdude 2024-10-18T19:26:28.962239Z

hmm, bummer. I can take a look tomorrow or if you beat me, I'll merge your PR

rafaeldelboni 2024-10-18T19:26:52.736019Z

haha I will have a look as well

rafaeldelboni 2024-10-18T19:49:57.995589Z

reviewplease https://github.com/squint-cljs/squint/pull/566

borkdude 2024-10-18T19:55:14.855759Z

published thanks!

rafaeldelboni 2024-10-18T20:28:21.406229Z

reviewplease https://github.com/squint-cljs/squint/pull/567 sorry I think this is the last hahaha no need to rush btw you can check tomorrow

borkdude 2024-10-18T20:30:44.818139Z

sure made a comment

rafaeldelboni 2024-10-18T20:31:56.033039Z

I have to see all the fn call, the one I checked it had merged before

rafaeldelboni 2024-10-18T20:31:59.463469Z

let me debug

borkdude 2024-10-18T20:33:46.734849Z

I think you just need to merge @utils/cfg or so

borkdude 2024-10-18T20:33:55.087839Z

which is the read from the squint.edn file

borkdude 2024-10-18T20:34:09.991059Z

ok checking back tomorrow

rafaeldelboni 2024-10-19T11:16:38.339119Z

hey thanks for all your support I made this sample project with tests, if you have time could you check if it makes sense? https://github.com/rafaeldelboni/squint-vite-react

borkdude 2024-10-19T11:19:27.791229Z

@rafaeldelboni looks legit to me!

borkdude 2024-10-19T11:20:01.132039Z

PR welcome if you want to add this to the squint example

rafaeldelboni 2024-10-19T11:20:29.490139Z

sure, how should I call it there, since there is already an vite-react example

borkdude 2024-10-19T11:21:04.905679Z

you can just add it to that project?

rafaeldelboni 2024-10-19T11:21:11.317059Z

fair

rafaeldelboni 2024-10-19T11:36:48.258809Z

https://github.com/squint-cljs/squint/pull/569 My pr didn't check any boxes in the PR message template 😨 haha

borkdude 2024-10-19T11:37:52.187569Z

one comment added

rafaeldelboni 2024-10-19T11:38:20.292819Z

the :parallel false it's the default? I can remove?

borkdude 2024-10-19T11:39:18.286959Z

oh I see, false. let me just merge it and change it myself a little bit :)

rafaeldelboni 2024-10-19T11:39:29.037659Z

🙂

borkdude 2024-10-19T11:43:14.425749Z

pushed

borkdude 2024-10-19T11:43:16.149359Z

thanks!

rafaeldelboni 2024-10-19T12:16:48.628889Z

I was getting a deprecation warning on vite I solved renaming the viteconfig.js to vite.config.mjs

borkdude 2024-10-19T12:17:01.690949Z

oh really

borkdude 2024-10-19T12:17:07.112639Z

I thought that was the standard

borkdude 2024-10-19T12:17:23.929599Z

that's what they do here: https://vite.dev/config/

rafaeldelboni 2024-10-19T12:17:55.873679Z

> 1. The closest package.json file has "type": "module", or use the .mjs/`.mts` extension, e.g. vite.config.mjs or vite.config.mts.

borkdude 2024-10-19T12:19:16.186909Z

fixed by adding type module