{"id":16223110,"url":"https://github.com/zerebos/trilium-pack","last_synced_at":"2025-03-19T11:31:57.298Z","repository":{"id":195664520,"uuid":"686873934","full_name":"zerebos/trilium-pack","owner":"zerebos","description":"A simple way to pack addons as zip files for Trilium Notes.","archived":false,"fork":false,"pushed_at":"2023-09-19T05:09:40.000Z","size":22,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-10T11:08:31.137Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerebos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-04T06:11:01.000Z","updated_at":"2025-01-05T20:56:38.000Z","dependencies_parsed_at":"2023-09-19T05:35:58.657Z","dependency_job_id":null,"html_url":"https://github.com/zerebos/trilium-pack","commit_stats":null,"previous_names":["rauenzi/trilium-pack","zerebos/trilium-pack"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerebos%2Ftrilium-pack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerebos%2Ftrilium-pack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerebos%2Ftrilium-pack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerebos%2Ftrilium-pack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerebos","download_url":"https://codeload.github.com/zerebos/trilium-pack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690163,"owners_count":20331729,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T12:17:24.282Z","updated_at":"2025-03-19T11:31:57.045Z","avatar_url":"https://github.com/zerebos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trilium-pack\n\nA simple way to pack addons as `zip` files for [Trilium Notes](https://github.com/zadam/trilium).\n\nNote: This is still early in development and things may change rapidly. Use at your own discretion.\n\n## Install\n\n```sh\nnpm install trilium-pack\n```\n\n## Usage\n\n### CLI\n\nTo use this via cli (or npm `scripts`) you'll have to setup your config in either a `tpack.json` or `tpack.config.json`. In either case, trilium-pack will find the config and pack your addon.\n\n#### Global\n\nIf you installed the package globally, just run `tpack`!\n\n#### Local\n\nJust add `tpack` to your npm `scripts`!\n\n```json\n{\n    \"scripts\": {\n        \"dist\": \"tpack\"\n    }\n}\n```\n\n### Node\n\n```js\nconst packAddon = require(\"trilium-pack\");\n\n// Replace with your config\nconst config = {};\n\n// __dirname is the default so this is optional\nconst opts = {basePath: __dirname};\n\npackAddon(config, opts);\n```\n\n## Configuration\n\nCurrently, the configuration only has 2 top-level properties, `output` and `notes`, both are required.\n\n| Name | Type | Description |\n|:----:|:----:|:------------|\n|`output`|`string`|A path to the desired output relative to the configuration file.|\n|`notes`|`object`|A tree of notes to be created with the root being a singular note.|\n\n### Notes\n\nEach note can have several different properties, some of them optional, and some of them have defaults.\n\n| Name | Type | Optional | Default | Description |\n|:----:|:----:|:--------:|:-------:|:------------|\n|`file`|`string`|❌*||Relative path string to the file to be included. *This may be omitted only for `\"render\"` notes.|\n|`title`|`string`|✅|filename|Title to be displayed in Trilium (affects pseudo-import name for scripts).|\n|`type`|`string`|✅|`\"code\"`|Type of note to be created. Only `\"code\"`, `\"file\"` and `\"render\"` are currently supported due to the scope of this project.|\n|`mime`|`string`|✅|`auto`|Mime type to set for the note, this will be automatically determined from the file extension where possible.|\n|`env`|`string`|✅|`\"frontend\"`|Script environment for `js` notes. Should be either `\"frontend\"` or `\"backend\"`.|\n|`attributes`|`object`|✅|`{}`|Attributes to be set on the imported note.|\n|`children`|`Array\u003cNote\u003e`|✅|filename|Title to be displayed in Trilium (affects pseudo-import name for scripts).|\n\n#### Attributes\n\nDue to the scope of the project, this does not support the full set of attribute features from Trilium such as inheritence. This only accepts a simple `Record\u003cstring, string\u003e` set of attributes, where the `key` is the name of the attribute and the `value` is the value of the attribute. Every `key` can start with `#` or `~` to indicate `label` or `relation` type respectively. For `relation` notes, the value should be set to the target `note.file` string, abd it will be resolved automatically. For simple labels like `#widget` you can simply use an empty string `\"\"` as the value.\n\n```js\n{\n    \"#widget\": \"\",\n    \"#run\": \"frontendStartup\",\n    \"~renderNote\": \"static/page.html\",\n}\n```\n\n### Example\n\nThis example was tested with [Trilium Heatmap](https://github.com/dvai/Trilium-Heatmap).\n\n`tpack.config.js`\n```js\nmodule.exports = {\n    output: \"dist/Trilium-Heatmap.zip\",\n    notes: {\n        title: \"Trilium Heatmap\",\n        type: \"render\",\n        attributes: {\n            \"~renderNote\": \"static/main.html\"\n        },\n        children: [\n            {\n                file: \"static/main.html\",\n                title: \"HTML\",\n                children: [\n                    {\n                        file: \"src/main.js\",\n                        env: \"frontend\",\n                        children: [\n                            {\n                                title: \"getDatas\", // ensures import name\n                                file: \"scripts/getDatas.js\",\n                                attributes: {\"#heatmapDatas\": \"\"}\n                            },\n                            {\n                                title: \"setHistoryCount\", // ensures import name\n                                file: \"scripts/setHistoryCount.js\",\n                                attributes: {\"#run\": \"frontendStartup\"}\n                            },\n                            {\n                                file: \"lib/d3.js\",\n                                title: \"d3\", // ensures import name\n                                type: \"file\"\n                            }\n                        ]\n                    }\n                ]\n            }\n        ]\n    }\n};\n```\n\n## More Info\n\n### Plans\n\n- Add more MIME types as needed\n- Add more options (e.g. enable/disable logging)\n\n### Known Limitations\n\n- Attributes don't support all attributes\n- Only 3 note types supported\n- Only a subset of MIME types supported","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerebos%2Ftrilium-pack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerebos%2Ftrilium-pack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerebos%2Ftrilium-pack/lists"}