Skip to content

✨ 2.0#770

Open
johangirod wants to merge 90 commits intomasterfrom
2.0
Open

✨ 2.0#770
johangirod wants to merge 90 commits intomasterfrom
2.0

Conversation

@johangirod
Copy link
Copy Markdown
Member

@johangirod johangirod commented Sep 22, 2025

Soon...

👉 Voir l'avancement : Publicodes 2

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Sep 22, 2025

🦋 Changeset detected

Latest commit: 565274c

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link
Copy Markdown

netlify bot commented Sep 22, 2025

Deploy Preview for publicodes-website failed.

Name Link
🔨 Latest commit 565274c
🔍 Latest deploy log https://app.netlify.com/projects/publicodes-website/deploys/69ce61afbf7120000866a07a

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Sep 22, 2025

Open in StackBlitz

@publicodes/cli

npm i https://pkg.pr.new/publicodes/publicodes/@publicodes/cli@770

@publicodes/codemod

npm i https://pkg.pr.new/publicodes/publicodes/@publicodes/codemod@770

publicodes

npm i https://pkg.pr.new/publicodes/publicodes@770

@publicodes/forms

npm i https://pkg.pr.new/publicodes/publicodes/@publicodes/forms@770

@publicodes/react-ui

npm i https://pkg.pr.new/publicodes/publicodes/@publicodes/react-ui@770

@publicodes/rest-api

npm i https://pkg.pr.new/publicodes/publicodes/@publicodes/rest-api@770

@publicodes/runtime

npm i https://pkg.pr.new/publicodes/publicodes/@publicodes/runtime@770

@publicodes/tools

npm i https://pkg.pr.new/publicodes/publicodes/@publicodes/tools@770

commit: aa1c903

johangirod and others added 29 commits April 2, 2026 14:27
* feat(compiler): naive compilation to javascript

* feat(compiler): iterate on js compilation

* feat(compiler): generate .d.ts files

* feat(compiler): start to implement a runtime + add cache layer to the js engine

* feat(compiler): benchmark with first minimal runtime

* fix(compiler): correctly manage contexte and constants

* feat(compiler): allows to compile to js or json

+ start to debug the JS backend

* feat(runtime): allow to run tests with compiled to js code

* refactor(runtime): use public getters on outputs data

* fix(compiler): use the neq runtime and start to fix the ternary conditionnal

* fix(compiler): fix the js runtime semantic + add dune rule to embed js file in ocaml module

* fix(compiler): use default output file according the output type extension

* fix(compiler): fix the JS runtime round() function to have the correct precision

* fix(runtime): refactor tests

* fix(runtime): add the bun in dev deps

* fix(runtime): update auto-entrepreneur benchmark

- Everything is recompiled before running benchmark.
- Add support to the JS compiled engine.
- Check return values with assert in the benchmark to track regression
(note: the legacy engine doesn't return the same results as the new
ones, is it wanted?)

* refactor(runtime): remove unused benchmark file

* fix(compiler): start to fix parameters problem in JS compilation

And add dedicated test in the runtime specs to track regressions

* fix(compiler): remove artefacts

* feat(compiler): correctly handle needed/missing parameters with context in the JS compilation

* fix(compiler): correctly escape " from constant

* fix(compiler): correctly manage floor and ceiling tranformation

* fix(compiler): correctly manage lazy operators on null values

* feat(runtime): add more test for paramters

* feat(compiler): try a compilation to pure JS functions

* feat(runtime): improve the parameters handling -> better perfs

* fix(compiler): correctly manage ref in the JSON output

* fix(compiler): correctly parse emtpy string + add test for `par défaut` mechanism

* fix(compiler): correctly handle 'toutes ces conditions' with only one arguement

* fix(compiler): prefixes with $ runtime function to avoid name collision

* feat(compiler): expriment with js optim

* feat(compiler): export JS rules in a dedicated object

* feat(compiler): add cache for refs in the JS runtime

* feat(compiler): add missing JSDoc types in the javascript runtime

* refactor(compiler): add comment to the optim module

* feat(compiler): generates JSDoc types

* refactor(compiler): remove the JSON output as we only compile to JS now

* refactor(compiler): move To_hash as Tree.Hash + add some .mli files

* Add test and improve generated JS (#782)

* test: add test for context mechanism

* test: repare test for arrondi

* test: arrondi et applicable si

* test: applicable si / non applicable si / plafond / plancher

* test: par défaut

* test: add date

* feat: improve generated JS

1. Change rule signature to an object containing « evaluate » function
	This allows to add other meta (title, type, unit, description, etc) at the same place of the rule, and simplifies the API.
2. Improve generated JSDoc
	Use proper typing for param object
3. Add / update test
	Add some test, and update the previous ones

* fix: date equality comparison

* feat: fix js output

* fix: equality implementation

* test: add test for equality

* feat: add global cache and cleaning

* fix(compiler): avoid conflits with javascript identifiers

* refactor(compiler): use Pp instead of sprintf for the to_js module

* remove @publicodes/runtime package

- Move test and benchmark to compiler
- Create separate JS private package for each of theù

* fix JSDoc generation

* fix tests

---------

Co-authored-by: Emile Rolley <emile.rolley@tuta.io>
direnv is good and safe enough to use
The model has been renamed to missing_terme.publicodes, breaking this
test.
This one was just needing a promote?
Now I think the trailing "-" is the error. The stdout ends with
a stdin error, and the CI fails harder. Remove this.
Currently the tests are not re-run on binary change.

This dependency on the built binary was only used for this directory.
Using :whole_subtree make it recursive.
Odoc only build documentation for public libraries. We have to specify
public_name for odoc to consider them.
This add a -c command argument to pass a config file path. This allow
the user to specify multiple compilation targets. A default value
"publicodes.yaml" is used when absent. If both inputs files, and
config file are given by the user, the config file is ignored.

Currently the watch mode is not supported when building multiple
targets. An error message is displayed to the user for now.

The yaml format is simple, and specify the build targets:

	targets:
	  - output: test.js.local
	    inputs:
	      - test.publicodes.local
	    type: js
	    default_to_public: false

All fields are checked, and a corresponding error message is build to
the notice the user on invalid format. Ex:

Error: Parsing config: "targets" field error: "inputs" field error: Expected a string value

Co-authored-by: Emile Rolley <emile.rolley@tuta.io>
The init subcommand generate and write a default configuration file.

Co-authored-by: Emile Rolley <emile.rolley@tuta.io>
Remove a trailing whitespace, and missing EOL at EOF, remove empty line
on empty jsdoc_typedef.
Instead of using pretty printers, we use a templating system named
Jingo.

jingo: https://github.com/tategakibunko/jingoo

To achive this, we first build a dedicated model tree for Jingoo. This
tree is language agnostic, and represent primitives for the templating
system. This split the work between formattable preparation, and
language output structuring (hopefully simplifying both). The goal is
to make the second part, the languages templates, more easy to write
and alter.
This catch error branch match on SyntaxError, meaning after "compiled"
is generated. We can assert it is a string here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants