datalad / datalad-catalog

Create a user-friendly data catalog from structured metadata
https://datalad-catalog.netlify.app
MIT License
15 stars 12 forks source link

Consider a `catalog-update` command to update assets specifically #431

Closed jsheunis closed 3 months ago

jsheunis commented 7 months ago

Currently, running catalog-create --force on an existing catalog will overwrite a bunch of files:

https://github.com/datalad/datalad-catalog/blob/main/datalad_catalog/webcatalog.py#L78-L106

        # Create package-related paths/content
        if not (self.metadata_path.exists() and self.metadata_path.is_dir()):
            Path(self.metadata_path).mkdir(parents=True)
        content_paths = {
            "assets": cnst.catalog_path / "assets",
            "artwork": cnst.catalog_path / "artwork",
            "html": cnst.catalog_path / "index.html",
            "readme": cnst.catalog_path / "README.md",
            "schema": cnst.catalog_path / "schema",
            "templates": cnst.catalog_path / "templates",
        }
        out_dir_paths = {
            "assets": Path(self.location) / "assets",
            "artwork": Path(self.location) / "artwork",
            "html": Path(self.location) / "index.html",
            "readme": Path(self.location) / "README.md",
            "schema": Path(self.location) / "schema",
            "templates": Path(self.location) / "templates",
        }
        for key in content_paths:
            copy_overwrite_path(
                src=content_paths[key], dest=out_dir_paths[key], overwrite=force
            )
        # Copy / write config file
        self.write_config(force)
        # Reset STATE and SCHEMA
        self.is_valid_catalog = self.is_created()
        self.schema_store = self.get_schema_store()
        self.schema_validator = self.get_schema_validator()

But this is not always desired. Often, only updates related specifically to the javascript and html components are needed, and one would want to specify this.

A catalog-update command could form the basis of new functionality to specify updates more granularly. Or otherwise the existing -create can be amended to include such functionality.

@mslw it would be great if you can share your experience in terms of what you typically want to achieve when updating a catalog (not its metadata), and how the existing commands and complexities currently prevent you form achieving that.