From a1910625f3bc6401ce2354b8a631b6edf7f8c498 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Sun, 23 Feb 2025 19:03:46 +0200 Subject: [PATCH] Initial commit --- .editorconfig | 19 ++++ .github/CODEOWNERS | 1 + .github/CODE_OF_CONDUCT.md | 129 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 41 +++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++ .github/renovate.json | 6 + .github/workflows/pr-lint.yml | 18 +++ .github/workflows/stale.yml | 19 ++++ .github/workflows/sync-labels.yml | 23 ++++ .gitignore | 24 ++++ LICENSE | 21 ++++ README.md | 31 ++++++ fishfile | 0 functions/nvm_auto_use.fish | 17 +++ functions/nvm_find_nvmrc.fish | 11 ++ 15 files changed, 380 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/CODEOWNERS create mode 100644 .github/CODE_OF_CONDUCT.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/renovate.json create mode 100644 .github/workflows/pr-lint.yml create mode 100644 .github/workflows/stale.yml create mode 100644 .github/workflows/sync-labels.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 fishfile create mode 100644 functions/nvm_auto_use.fish create mode 100644 functions/nvm_find_nvmrc.fish diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..869f880 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +max_line_length = 160 +tab_width = 2 +trim_trailing_whitespace = true + +[{*.json}] +indent_size = 4 +tab_width = 4 + +[{*.markdown,*.md}] +indent_size = 4 +tab_width = 4 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..a5ff83b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @ivuorinen diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..f2ce9f7 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,129 @@ +# Citizen Code of Conduct + +## 1. Purpose + +A primary goal of @ivuorinen's repositories is to be inclusive to the largest number +of contributors, with the most varied and diverse backgrounds possible. +As such, we are committed to providing a friendly, safe and welcoming environment +for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic +status, and religion (or lack thereof). + +This code of conduct outlines our expectations for all those who participate in our +community, as well as the consequences for unacceptable behavior. + +We invite all those who participate in @ivuorinen's repositories to help us +create safe and positive experiences for everyone. + +## 2. Open [Source/Culture/Tech] Citizenship + +A supplemental goal of this Code of Conduct is to increase open [source/culture/tech] +citizenship by encouraging participants to recognize and strengthen the relationships +between our actions and their effects on our community. + +Communities mirror the societies in which they exist and positive action is essential +to counteract the many forms of inequality and abuses of power that exist in society. + +If you see someone who is making an extra effort to ensure our community is welcoming, +friendly, and encourages all participants to contribute to the fullest extent, we want to know. + +## 3. Expected Behavior + +The following behaviors are expected and requested of all community members: + +* Participate in an authentic and active way. In doing so, you contribute to the health + and longevity of this community. +* Exercise consideration and respect in your speech and actions. +* Attempt collaboration before conflict. +* Refrain from demeaning, discriminatory, or harassing behavior and speech. +* Be mindful of your surroundings and of your fellow participants. Alert community leaders + if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential. +* Remember that community event venues may be shared with members of the public; + please be respectful to all patrons of these locations. + +## 4. Unacceptable Behavior + +The following behaviors are considered harassment and are unacceptable within our community: + +* Violence, threats of violence or violent language directed against another person. +* Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language. +* Posting or displaying sexually explicit or violent material. +* Posting or threatening to post other people's personally identifying information ("doxing"). +* Personal insults, particularly those related to gender, sexual orientation, race, + religion, or disability. +* Inappropriate photography or recording. +* Inappropriate physical contact. You should have someone's consent before touching them. +* Unwelcome sexual attention. This includes, sexualized comments or jokes; + inappropriate touching, groping, and unwelcomed sexual advances. +* Deliberate intimidation, stalking or following (online or in person). +* Advocating for, or encouraging, any of the above behavior. +* Sustained disruption of community events, including talks and presentations. + +## 5. Weapons Policy + +No weapons will be allowed at @ivuorinen's repositories events, community spaces, or in +other spaces covered by the scope of this Code of Conduct. Weapons include but are not +limited to guns, explosives (including fireworks), and large knives such as those used +for hunting or display, as well as any other item used for the purpose of causing injury +or harm to others. Anyone seen in possession of one of these items will be asked to leave +immediately, and will only be allowed to return without the weapon. Community members are +further expected to comply with all state and local laws on this matter. + +## 6. Consequences of Unacceptable Behavior + +Unacceptable behavior from any community member, including sponsors and those with +decision-making authority, will not be tolerated. + +Anyone asked to stop unacceptable behavior is expected to comply immediately. + +If a community member engages in unacceptable behavior, the community organizers may take +any action they deem appropriate, up to and including a temporary ban or permanent expulsion +from the community without warning (and without refund in the case of a paid event). + +## 7. Reporting Guidelines + +If you are subject to or witness unacceptable behavior, or have any other concerns, +please notify a community organizer as soon as possible. . + +Additionally, community organizers are available to help community members engage with local +law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. +In the context of in-person events, organizers will also provide escorts as desired +by the person experiencing distress. + +## 8. Addressing Grievances + +If you feel you have been falsely or unfairly accused of violating this Code of Conduct, +you should notify @ivuorinen with a concise description of your grievance. Your grievance +will be handled in accordance with our existing governing policies. + +## 9. Scope + +We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) +to abide by this Code of Conduct in all community venues--online and in-person--as well as +in all one-on-one communications pertaining to community business. + +This code of conduct and its related procedures also applies to unacceptable behavior +occurring outside the scope of community activities when such behavior has the potential +to adversely affect the safety and well-being of community members. + +## 10. Contact info + +@ivuorinen + + +## 11. License and attribution + +The Citizen Code of Conduct is distributed by [Stumptown Syndicate][st] under a +[Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/). + +Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) +and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy). + +_Revision 2.3. Posted 6 March 2017._ + +_Revision 2.2. Posted 4 February 2016._ + +_Revision 2.1. Posted 23 June 2014._ + +_Revision 2.0, adopted by the [Stumptown Syndicate][st] board on 10 January 2013. Posted 17 March 2013._ + +[st]: https://github.com/stumpsyn/ diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..d2190be --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,41 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: ivuorinen + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] + +**Smartphone (please complete the following information):** + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..abdc2e8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: ivuorinen + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..e46316f --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "github>ivuorinen/renovate-config" + ] +} diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 0000000..193995c --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,18 @@ +--- +name: PR Lint + +on: + push: + branches-ignore: [master, main] + # Remove the line above to run when pushing to master + pull_request: + branches: [master, main] + +permissions: + contents: read + packages: read + statuses: write + +jobs: + SuperLinter: + uses: ivuorinen/actions/pr-lint@main diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..2055b92 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,19 @@ +--- +name: Stale + +# yamllint disable-line rule:truthy +on: + schedule: + - cron: "0 8 * * *" + workflow_call: + workflow_dispatch: + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + contents: write # only for delete-branch option + issues: write + pull-requests: write + steps: + - uses: ivuorinen/actions/stale@main diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml new file mode 100644 index 0000000..e5e2001 --- /dev/null +++ b/.github/workflows/sync-labels.yml @@ -0,0 +1,23 @@ +--- +name: Sync labels + +# yamllint disable-line rule:truthy +on: + push: + branches: + - main + paths: + - .github/workflows/sync-labels.yml + - .github/labels.yml + schedule: + - cron: "34 5 * * *" + workflow_call: + workflow_dispatch: + +jobs: + SyncLabels: + permissions: + issues: write + runs-on: ubuntu-latest + steps: + - uses: ivuorinen/actions/sync-labels@main diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0e111a0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +.DS_Store +.idea/**/aws.xml +.idea/**/contentModel.xml +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/dataSources/ +.idea/**/dbnavigator.xml +.idea/**/dictionaries +.idea/**/dynamic.xml +.idea/**/gradle.xml +.idea/**/libraries +.idea/**/shelf +.idea/**/sqlDataSources.xml +.idea/**/tasks.xml +.idea/**/uiDesigner.xml +.idea/**/usage.statistics.xml +.idea/**/workspace.xml +.idea/caches/build_file_checksums.ser +.idea/httpRequests +.idea/replstate.xml +.idea/sonarlint/ +*~ +Session.vim +Sessionx.vim diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bffa737 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Ismo Vuorinen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..0d1ff99 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# nvm-auto-use.fish + +Automates loading the correct Node.js version from `.nvmrc` in Fish shell. + +## Installation + +Ensure you have [fisher](https://github.com/jorgebucaran/fisher) installed, then run: + +```fish +fisher install ivuorinen/nvm-auto-use.fish +``` + +## Usage + +This script automatically detects the `.nvmrc` file in your current or +parent directories and loads the specified Node.js version. + +If the specified version is not installed, it will be installed +automatically using `nvm install`. + +## Uninstall + +To remove the plugin, run: + +```fish +fisher remove ivuorinen/nvm-auto-use.fish +``` + +## License + +MIT License. See [LICENSE](LICENSE) for details. diff --git a/fishfile b/fishfile new file mode 100644 index 0000000..e69de29 diff --git a/functions/nvm_auto_use.fish b/functions/nvm_auto_use.fish new file mode 100644 index 0000000..d52dc4d --- /dev/null +++ b/functions/nvm_auto_use.fish @@ -0,0 +1,17 @@ +function nvm_auto_use --on-variable PWD + set -l nvmrc_file (nvm_find_nvmrc) + if test -n "$nvmrc_file" + set -l node_version (cat "$nvmrc_file") + + # Check the current version + set -l current_version (node -v 2>/dev/null | sed 's/v//') + + if test "$node_version" != "$current_version" + if not nvm use $node_version 2>/dev/null + echo "Node.js version $node_version not found, installing..." + nvm install $node_version && nvm use $node_version + end + end + end +end + diff --git a/functions/nvm_find_nvmrc.fish b/functions/nvm_find_nvmrc.fish new file mode 100644 index 0000000..2af1b52 --- /dev/null +++ b/functions/nvm_find_nvmrc.fish @@ -0,0 +1,11 @@ +function nvm_find_nvmrc + set -l dir (pwd) + while test "$dir" != "/" + if test -f "$dir/.nvmrc" + echo "$dir/.nvmrc" + return + end + set dir (dirname "$dir") + end +end +