varabyte / kobweb-cli

The CLI binary that drives the interactive Kobweb experience. See varabyte/kobweb
Apache License 2.0
11 stars 5 forks source link

Allow querying a negative condition #8

Closed bitspittle closed 6 months ago

bitspittle commented 8 months ago

Currently in the empty template we're jumping through a lot of hoops because we can't query a negative:

 - !<Move>
    condition: "${useWorker}"
    from: "worker/src/worker/*"
    to: "worker/src/jsMain/kotlin/${packagePath}/worker"
    description: "Rearranging worker source to conform to the user's package"
  - !<Move>
    condition: "${useWorker}"
    from: "worker/*"
    to: "donotdeleteworker"
    description: "Moving worker files to a safe location before cleanup"
  - !<Delete>
    files: "worker/*"
    description: "Removing unused worker files (if any)"
  - !<Move>
    condition: "${useWorker}"
    from: "donotdeleteworker/*"
    to: "worker"
    description: "Finalizing worker files"

This should just be:

 - !<Move>
    condition: "${useWorker}"
    from: "worker/src/worker/*"
    to: "worker/src/jsMain/kotlin/${packagePath}/worker"
    description: "Rearranging worker source to conform to the user's package"
  - !<Delete>
    condition: "${!useWorker}"
    files: "worker/*"
    description: "Removing unused worker files (if any)"

but I remember earlier when trying to get that to work, it was failing.

bitspittle commented 6 months ago

Solved this by adding a not method. Maybe there's a vanilla freemarker way to do this but this seems easy enough for now.

So, we should change the code to

- !<Move>
    condition: "${useWorker}"
    from: "worker/src/worker/*"
    to: "worker/src/jsMain/kotlin/${packagePath}/worker"
    description: "Rearranging worker source to conform to the user's package"
  - !<Delete>
    condition: "${not(useWorker)}"
    files: "worker/*"
    description: "Removing unused worker files (if any)"

However, we should wait some amount of time (2-3 weeks?) after releasing 0.9.13 before updating the empty template, allowing people to update their Kobweb CLIs. We should ALSO add the minimum version of "0.9.13" to the empty template to prevent this change from crashing older CLIs that didn't update.