{"id":16322247,"url":"https://github.com/p-x9/runscriptplugin","last_synced_at":"2025-03-16T14:31:01.452Z","repository":{"id":65697962,"uuid":"597323434","full_name":"p-x9/RunScriptPlugin","owner":"p-x9","description":"🏃SwiftPackage Plugin for executing arbitrary ShellScript.","archived":false,"fork":false,"pushed_at":"2024-10-25T05:26:02.000Z","size":54,"stargazers_count":35,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T03:03:53.530Z","etag":null,"topics":["shell-script","shellscript","swift","swiftpackage"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/p-x9.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":"2023-02-04T07:12:09.000Z","updated_at":"2025-02-28T22:27:03.000Z","dependencies_parsed_at":"2024-08-02T05:54:22.349Z","dependency_job_id":null,"html_url":"https://github.com/p-x9/RunScriptPlugin","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-x9%2FRunScriptPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-x9%2FRunScriptPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-x9%2FRunScriptPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-x9%2FRunScriptPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p-x9","download_url":"https://codeload.github.com/p-x9/RunScriptPlugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243882394,"owners_count":20363126,"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":["shell-script","shellscript","swift","swiftpackage"],"created_at":"2024-10-10T22:50:23.397Z","updated_at":"2025-03-16T14:31:01.130Z","avatar_url":"https://github.com/p-x9.png","language":"Swift","readme":"# RunScriptPlugin\n\nSwiftPackage Plugin for executing arbitrary ShellScript.\n\n## Feature\n- BuildToolPlugin: RunScriptPlugin\n- CommandPlugin: RunScriptCommandPlugin\n- XcodeBuildToolPlugin: RunScriptPlugin\n- XcodeCommandPlugin: RunScriptCommandPlugin\n\n## Usage\nPlace the file named `runscript.yml`(or `.runscript.yml`) in the root of the project.\nWrite the shell script you want to run in this file.\n\nThe format is as follows.\n\n```yaml\nprebuild: # prebuild Command\n  - name: \"Hello\"\n    script: \"echo Hello\" # Write scripts directly\n  - name: \"Show current path\"\n    script: \"pwd\"\n  - name: \"Write file\"\n    script: \"echo Hello \u003e\u003e test.txt\"\n\n  - name: \"SwiftLint\"\n    launchPath: \"/bin/bash\" # bash, zsh, etc. can be specified\n    script: \"swiftlint lint --fix\"\n\n  - name: \"SwiftLint\" # Another way to write ↑↑\n    launchPath: \"/usr/local/bin/swiftlint\"\n    arguments:\n      - \"lint\"\n      - \"--fix\"\n\n  - name: \"Update schema\"\n    file: \"update_schema.sh\" # Execute .sh file\n\nbuild: # build Command\n  - name: \"Hello\"\n    script: \"echo Hello\"\n  - name: \"Make Swift Code\"\n    script: |\n        echo \"public enum Hello { case a,b,c,d }\" \u003e $RUN_SCRIPT_PLUGIN_WORK_DIR/tmp.swift\"\n\ncommand: # Command Plugin\n  - name: \"Hello from Command\"\n    script: \"echo 'Hello from Command'\"\n\nall: # run in `prebuild`, `build`...\n   - name: \"Hello(all)\"\n     script: \"echo Hello(all)\"\n```\n\n\u003e [!NOTE]\n\u003e Due to a limitation of Xcode, you may get a permission error when trying to write a file.\n\u003e\n\u003e If CommandPlugin is run from the shell, it is possible to work around this by disabling the sandbox using the `--disable-sandbox` option.\n\u003e ```sh\n\u003e swift package plugin --allow-writing-to-package-directory --disable-sandbox run-script\n\u003e ```\n\u003e\n\u003e　If you want to avoid the use of the BuildToolPlugin/CommandPlugin via Xcode, you can disable the use of the sandbox by configuring the following settings.\n\u003e ```sh\n\u003e defaults write com.apple.dt.Xcode IDEPackageSupportDisablePluginExecutionSandbox -bool YES\n\u003e ```\n\n### Environment Valiables\n\nThe following environment variables are available in the script to refer to the Plugin context.\n\n- RUN_SCRIPT_TARGET_PACKAGE_DIR  \n    Path of the target package on which the plugin runs.\n    The path obtained by `PackagePlugin.PluginContext.package.directory`\n- RUN_SCRIPT_PLUGIN_WORK_DIR  \n    The path of a writable directory into which the plugin or the build commands it constructs can write anything it wants.\n    The path obtained by `PackagePlugin.PluginContext.pluginWorkDirectory`\n\n## Example\n- SwiftLint\nYou can run Lint in SPM without using the SwiftLint plugin.\n```yaml\n- name: \"SwiftLint\"\n  script: \"swiftlint lint\"\n```\n\n- Build Log\n```yaml\n- name: \"Build Log\"\n  script: \"echo \\\"[$(date)] Build \u003e\u003e build.log\\\"\"\n```\n\n- Theos(Orion) install\nYou can install the Tweak from the Build button in SPM.\n```yaml\n- name: \"Theos make package and install\"\n  script: \"make do\"\n```\n- SwiftFormat\n```yaml\n- name: \"SwiftFormat\"\n  script: \"swiftformat .\"\n```\n\n- SwiftGen\n```yaml\n- name: \"SwiftGen\"\n  script: \"swiftgen config run\"\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp-x9%2Frunscriptplugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp-x9%2Frunscriptplugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp-x9%2Frunscriptplugin/lists"}