squint 2024-10-18

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

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

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})}}

my squint.edn:

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

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' })
  ]
});

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

hahaha it's so fast

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

if that gets in the way

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

thanks

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

Both of these work:

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

thanks again 🙂

maybe you forgot something

published

❤️ 1

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

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

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

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

haha I will have a look as well

published thanks!

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

sure made a comment

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

let me debug

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

which is the read from the squint.edn file

ok checking back tomorrow

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

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

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

you can just add it to that project?

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

one comment added

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

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

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

I thought that was the standard

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

fixed by adding type module