{"id":28438391,"url":"https://github.com/marcisbee/utils","last_synced_at":"2025-06-28T15:30:31.849Z","repository":{"id":272929166,"uuid":"918202753","full_name":"Marcisbee/utils","owner":"Marcisbee","description":"This repo contains various tiny sh utilities.","archived":false,"fork":false,"pushed_at":"2025-04-19T18:48:33.000Z","size":34,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-24T07:21:35.965Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Marcisbee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-17T13:03:28.000Z","updated_at":"2025-04-19T18:48:36.000Z","dependencies_parsed_at":"2025-01-17T14:27:14.097Z","dependency_job_id":"5007cc0e-6899-4b32-9718-78074c8ec100","html_url":"https://github.com/Marcisbee/utils","commit_stats":null,"previous_names":["marcisbee/utils"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Marcisbee/utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcisbee%2Futils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcisbee%2Futils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcisbee%2Futils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcisbee%2Futils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Marcisbee","download_url":"https://codeload.github.com/Marcisbee/utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcisbee%2Futils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262452041,"owners_count":23313369,"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":"2025-06-06T01:06:56.207Z","updated_at":"2025-06-28T15:30:31.842Z","avatar_url":"https://github.com/Marcisbee.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Various utilities\n\nThis repository contains several shell utility scripts designed to facilitate various tasks in your development workflow.\n\n## dotenv.sh\n\nThe `dotenv.sh` script loads environment variables from a `.env` file. This can be particularly useful for setting up your application's configuration in different environments without hardcoding sensitive information into your source code.\n\n### Default Usage:\n\n```sh\n# .env:\n# PORT=4000\n\n# test.js:\n# console.log(process.env.PORT);\n\n./dotenv.sh -- node ./test.js\n```\n\nor\n\n```sh\ncurl -SsfL https://marcisbee.github.io/utils/dotenv.sh | bash -s -- -- node ./test.js\n```\n\nThe script loads the environment variables from `.env` by default and runs the specified command, in this case, `node ./test.js`.\n\n### Using a Custom Environment File:\n\nIf you need to load environment variables from a different file (e.g., for development or testing environments), specify it as follows:\n\n```sh\n./dotenv.sh .env.development -- node ./test.js\n```\n\nor\n\n```sh\ncurl -SsfL https://marcisbee.github.io/utils/dotenv.sh | bash -s -- .env.development -- node ./test.js\n```\n\n## lslint.sh\n\nThe `lslint.sh` script assists in linting the file paths within your project according to rules specified in a `.lslint` configuration file. This is helpful for maintaining consistency and ensuring that all necessary files adhere to the specified patterns.\n\n### Usage:\n\nCreate a `.lslint` configuration file in your project's root directory with the desired file patterns. Here’s an example of how to set it up:\n\n```sh\n# .lslint\n# /package.json\n# /node_modules/**/*\n# /src/\u003ckebabcase\u003e**/\u003ckebabcase\u003e.\u003c:tsx|ts\u003e\n# /src/\u003ckebabcase\u003e**/\u003ckebabcase\u003e.module.css\n# /test/**/\u003ckebabcase\u003e.test.ts\n\n./lslint.sh\n```\n\nBefore running the script, ensure that the `.lslint` configuration file exists in your project root directory. Here are some example syntax matches for typical linting patterns:\n\n| Pattern                         | Matched File Paths                                            |\n|---------------------------------|---------------------------------------------------------------|\n| `/file.ts`                      | `/file.ts`                                                    |\n| `/test/*`                       | `/test/file.ts`, `/test/any.css`                              |\n| `/test/**/*`                    | `/test/file.ts`, `/test/a/b/c/any.css`                        |\n| `/test/**/file.ts`              | `/test/file.ts`, `/test/a/file.ts`, `/test/a/b/c/file.ts`     |\n| `/test/**/*.ts`                 | `/test/file.ts`, `/test/a/any.ts`, `/test/a/b/c/any.ts`       |\n| `/test/start/**/end/*.ts`       | `/test/start/end/file.ts`, `/test/start/a/end/any.ts`, ...    |\n| `/test/**/\u003ckebabcase\u003e.ts`       | `/test/paper-bag.ts`, `/test/a/paper-bag.ts`, ...             |\n| `/test/\u003ckebabcase\u003e**/\u003ckebabcase\u003e.ts` | `/test/paper-bag.ts`, ...                                |\n| `/test/\u003c:[A-Z]+\u003e**/mod.\u003c:ts\\|tsx\\|css\u003e` | `/test/any.ts`, ...                                    |\n\n## tasks.sh\n\nThe `tasks.sh` script allows you to define and execute shell functions as tasks. These tasks are defined in a separate `task.sh` file within your project's root directory.\n\n### Usage:\n\n```sh\n./tasks.sh \u003ctask_name|task_group\u003e\n```\n\nor\n\n```sh\ncurl -SsfL https://marcisbee.github.io/utils/tasks.sh | bash -s -- \u003ctask_name|task_group\u003e\n```\n\n- **Single Task**: Execute the function by specifying its name, e.g., `./tasks.sh build`.\n\n- **Task Group**: Run multiple tasks concurrently by combining their names with a `+`, e.g., `./tasks.sh build+lint`.\n\n### Instructions:\n\n1. Ensure a `task.sh` file exists in your project's root directory.\n\n2. Define bash functions prefixed with `task_`. For example:\n\n   ```sh\n   #!/usr/bin/env bash\n\n   task_dev() {\n     start_task build\n     start_task db+server\n   }\n\n   task_server() {\n     echo \"Start server process\"\n   }\n\n   task_db() {\n     echo \"Start db process\"\n   }\n\n   task_build() {\n     echo \"This is build\"\n   }\n   ```\n\n3. Run the `tasks.sh` script with the desired task name or group of tasks.\n\nThe script includes error handling and cleanup procedures to manage running processes effectively. When combined task names (e.g., `build+lint`) are provided, each specified task runs concurrently; otherwise, they run sequentially.\n\n## Development\n\nFor linting shell scripts, use the following command:\n\n```sh\ncurl -SsfL https://marcisbee.github.io/gh/dl.sh | bash -s -- --repo koalaman/shellcheck\n./shellcheck lslint.sh\n```\n\n## License\n\n[MIT](LICENCE) \u0026copy; [Marcis Bergmanis](https://twitter.com/marcisbee)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcisbee%2Futils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcisbee%2Futils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcisbee%2Futils/lists"}