diff --git a/template/config.public.mk.jinja b/template/config.public.mk.jinja index 741b0bf..96ae54a 100644 --- a/template/config.public.mk.jinja +++ b/template/config.public.mk.jinja @@ -21,6 +21,7 @@ LINKML_GENERATORS_DOC_ARGS= ## pass args to workaround genowl rdfs config bug (linkml#1453) ## (i.e. --no-type-objects --no-metaclasses --metadata-profile=rdfs) +# LINKML_GENERATORS_OWL_ARGS="--no-type-objects --no-metaclasses --metadata-profile=rdfs" LINKML_GENERATORS_OWL_ARGS= ## pass args to pydantic generator which isn't supported by gen-project diff --git a/template/justfile b/template/justfile index d0b1a11..e366ce3 100644 --- a/template/justfile +++ b/template/justfile @@ -38,7 +38,7 @@ dest := "project" pymodel := src / schema_name / "datamodel" source_schema_path := source_schema_dir / schema_name + ".yaml" docdir := "docs/elements" # Directory for generated documentation -merged_schema_path := "docs/schema" / schema_name + ".yaml" +distrib_schema_path := "docs/schema" # Directory for publishing schema artifacts # ============== Project recipes ============== @@ -92,9 +92,9 @@ test: _test-schema _test-python _test-examples lint: uv run linkml-lint {{source_schema_dir}} -# Generate md documentation for the schema +# Generate md documentation for the schema and add artifacts [group('model development')] -gen-doc: _gen-yaml +gen-doc: _gen-yaml && _add-artifacts uv run gen-doc {{gen_doc_args}} -d {{docdir}} {{source_schema_path}} # Build docs and run test server @@ -112,13 +112,19 @@ gen-project: uv run gen-project {{config_yaml}} -d {{dest}} {{source_schema_path}} mv {{dest}}/*.py {{pymodel}} uv run gen-pydantic {{gen_pydantic_args}} {{source_schema_path}} > {{pymodel}}/{{schema_name}}_pydantic.py + + @# Some generators ignore config_yaml or cannot create directories, so we run them separately. uv run gen-java {{gen_java_args}} --output-directory {{dest}}/java/ {{source_schema_path}} - @if [ {{gen_owl_args}} ]; then \ - echo "using gen-owl environment args (maybe for issue/1453)" && \ - uv run gen-owl {{gen_owl_args}} {{source_schema_path}} > {{dest}}/owl/{{schema_name}}.owl.ttl || true ; \ + + @if [ ! -d "{{dest}}/typescript" ]; then \ + mkdir -p {{dest}}/typescript ; \ + fi + uv run gen-typescript {{gen_ts_args}} {{source_schema_path}} > {{dest}}/typescript/{{schema_name}}.ts + + @if [ ! -d "{{dest}}/owl" ]; then \ + mkdir -p {{dest}}/owl ; \ fi - mkdir -p {{dest}}/typescript - uv run gen-typescript {{gen_ts_args}} {{source_schema_path}} > {{dest}}/typescript/{{schema_name}}.ts || true + uv run gen-owl {{gen_owl_args}} {{source_schema_path}} > "{{dest}}/owl/{{schema_name}}.owl.ttl" # ============== Migrations recipes for Copier ============== @@ -196,10 +202,13 @@ _test-examples: _ensure_examples_output --output-directory examples/output \ --schema {{source_schema_path}} > examples/output/README.md -# Generate merged model +# Add the merged model to docs/schema. _gen-yaml: - -mkdir -p docs/schema - uv run gen-yaml {{source_schema_path}} > {{merged_schema_path}} + -mkdir -p {{distrib_schema_path}} + uv run gen-yaml {{source_schema_path}} > {{distrib_schema_path}}/{{schema_name}}.yaml + +# Overridable recipe to add project-specific artifacts to the distribution schema path +_add-artifacts: # Run documentation server _serve: @@ -246,3 +255,12 @@ _ensure_examples_output: # Ensure a clean examples/output directory exists # ============== Include project-specific recipes ============== import "project.justfile" + +# ====== Override recipes from above with custom versions ======= + +# Uncomment the following line to allow duplicate recipe names +#set allow-duplicate-recipes + +# Overriding recipes from the root justfile by adding a recipe with the same +# name in an imported file is not possible until a known issue in just is fixed, +# https://github.com/casey/just/issues/2540 - So we need to override them here. diff --git a/template/project.justfile b/template/project.justfile index bf84fbc..6e7192f 100644 --- a/template/project.justfile +++ b/template/project.justfile @@ -1 +1,5 @@ ## Add your own just recipes here. This is imported by the main justfile. + +# Overriding recipes from the root justfile by adding a recipe with the same +# name in this file is not possible until a known issue in just is fixed, +# https://github.com/casey/just/issues/2540