sverweij / state-machine-cat

write beautiful state charts :scream_cat:
https://state-machine-cat.js.org
MIT License
793 stars 45 forks source link

[Feature request] Package to anaconda #179

Closed tuanpham96 closed 9 months ago

tuanpham96 commented 1 year ago

Context

It'd be great if this can be packaged on anaconda.org so folks using conda environments can easily install in their environment in a reproducible way (i.e. so that smcat can be specified in an environment.yaml file). For example, the node package prettier is also available on conda-forge channel at https://anaconda.org/conda-forge/prettier.

Proposed Behavior

I think this is how prettier integrates into conda-forge: https://github.com/conda-forge/prettier-feedstock

Current Behavior

I followed some of their recipe folder and was able to build locally with some modification, and currently only for Unix systems and may not be appropriate for Windows.

Click to view content of relevant recipe files I only included 2 files: - `recipe/meta.yaml` file: ```yaml {% set name = "state-machine-cat" %} {% set version = "v10.1.10" %} package: name: {{ name|lower }} version: {{ version|replace("-", "_")|replace("v", "") }} source: url: https://github.com/sverweij/state-machine-cat/archive/refs/tags/{{ version }}.tar.gz sha256: 386d2578731f0899c540e5020b4627cc75af4e50fb61887505aac47bd5c9dea1 build: number: 0 requirements: build: - sysroot_linux-64 2.17 # [linux64] - nodejs # [not win] host: - nodejs - yarn run: - nodejs test: commands: - smcat --version - which smcat about: home: https://github.com/sverweij/state-machine-cat license: MIT license_family: MIT license_file: - LICENSE # - ThirdPartyLicenses.txt summary: smcat write beautiful state charts. ``` - `recipe/build.sh` file: ```bash #!/usr/bin/env bash set -euxo pipefail if [[ "${target_platform}" == "osx-arm64" ]]; then export npm_config_arch="arm64" fi rm $PREFIX/bin/node ln -s $BUILD_PREFIX/bin/node $PREFIX/bin/node yarn pack -o ${PKG_NAME}-v${PKG_VERSION}.tgz # yarn licenses generate-disclaimer > ThirdPartyLicenses.txt NPM_CONFIG_USERCONFIG=/tmp/nonexistentrc npm install -g ${PKG_NAME}-v${PKG_VERSION}.tgz ``` Then I built with (with `conda-build`, `boa` installed) ```bash conda-mambabuild -c conda-forge recipe ```

Considered alternatives

An alternative is to manually install smcat inside a conda environment with nodejs already installed.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

sverweij commented 1 year ago

Hi @tuanpham96 I hadn't heard of anaconda before, so thanks for that insight. I'm OK with having a package (declaration) for it, provided it's fully automated and hooked in as part of state-machine-cat's release process. From your example it looks like this is possible.

Not sure if I have the bandwidth to dive into it a.t.m., but a PR is welcome.

tuanpham96 commented 1 year ago

I finally got some time to get around this. Just briefly, anaconda contains many packages that usually are used for python projects, but also can contain other non-python packages like R, nodejs, C, ... And conda-forge is one of the popular channels.

I submitted a PR on https://github.com/conda-forge/staged-recipes/pull/22544 for version 10.1.10. If approved, this can be added to conda-forge and the repo https://github.com/conda-forge/state-machine-cat-feedstock would be created. Feel free to browse through the PR and see what you'd like to add/modify, I use a lot of the codes from prettier-feedstock recipes to do that.

it's fully automated and hooked in as part of state-machine-cat's release process.

The only thing that would need changing is the sha256sum and version tag in the meta.yaml file, whenever there's a new release.

I'm not quite sure yet how to hook this up automatically. But once https://github.com/conda-forge/state-machine-cat-feedstock, I'll try to assess how that's possible.

tuanpham96 commented 9 months ago

It seems like PRs on conda-forge for nodejs packages are not very popular. The PR for this was marked as stale. I will close this issue for now. Thanks for the help!

sverweij commented 9 months ago

Hi @tuanpham96 it's sad it went that way - but agree.

You do have my admiration for your patience and tenacity with the anaconda repo though!