diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ad83f41 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,84 @@ +* text=auto + +*.anim text eol=lf +*.asset text eol=lf +*.bash text eol=lf +*.bat text eol=crlf +*.cdxml text eol=crlf +*.cmd text eol=crlf +*.controller text eol=lf +*.csproj text eol=crlf +*.dbproj text eol=crlf +*.dist text eol=lf +*.engine text eol=lf +*.filters text eol=crlf +*.fish text eol=lf +*.fsproj text eol=crlf +*.inc text eol=lf +*.install text eol=lf +*.ipynb text eol=lf +*.ksh text eol=lf +*.lsproj text eol=crlf +*.map text eol=lf +*.mat text eol=lf +*.mcf text eol=crlf +*.meta text eol=lf +*.modelproj text eol=crlf +*.module text eol=lf +*.msh text eol=crlf +*.msh1 text eol=crlf +*.msh1xml text eol=crlf +*.msh2 text eol=crlf +*.msh2xml text eol=crlf +*.mshxml text eol=crlf +*.php text eol=lf +*.phpt text eol=lf +*.phtml text eol=lf +*.physicmaterial text eol=lf +*.physicmaterial2d text eol=lf +*.physicsmaterial text eol=lf +*.physicsmaterial2d text eol=lf +*.po text eol=lf +*.prefab text eol=lf +*.profile text eol=lf +*.props text eol=crlf +*.props.tmpl text eol=crlf +*.ps1 text eol=crlf +*.ps1x text eol=crlf +*.ps1xml text eol=crlf +*.psd1 text eol=crlf +*.psm1 text eol=crlf +*.psrc text eol=crlf +*.pssc text eol=crlf +*.rc text eol=crlf +*.sh text eol=lf +*.sln text eol=crlf +*.sln.tmpl text eol=crlf +*.sql text eol=lf +*.sqlproj text eol=crlf +*.theme text eol=lf +*.twig text eol=lf +*.unity text eol=lf +*.vbproj text eol=crlf +*.vcproj text eol=crlf +*.vcxitems text eol=crlf +*.vcxproj text eol=crlf +*.vcxproj.filters text eol=crlf +*.vcxproj.tmpl text eol=crlf +*.vim text eol=lf +*.wixproj text eol=crlf +*.wmaproj text eol=crlf +*.wwaproj text eol=crlf +*.xproj text eol=crlf +*.zsh text eol=lf + +.husky/* text eol=lf + +.gvimrc text eol=lf +.vimrc text eol=lf +gradlew text eol=lf +mvnw text eol=lf +phpcs.xml text eol=lf +phpstan.neon text eol=lf +phpunit.xml text eol=lf +psalm.xml text eol=lf diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..8513ba5 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @hugoalh-studio/develop diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..4f9c154 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,64 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, colo(u)r, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our community include: + +- Demonstrating empathy and kindness toward other people. +- Being respectful of differing opinions, viewpoints, and experiences. +- Giving and gracefully accepting constructive feedback. +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience. +- Focusing on what is best not just for us as individuals, but for the overall community. + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of any kind. +- Trolling, insulting or derogatory comments, and personal or political attacks. +- Public or private harassment. +- Publishing others' private information, such as a physical or email address, without their explicit permission. +- Other conduct which could reasonably be considered inappropriate in a professional setting. + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior maybe report to the community leaders responsible for enforcement via [fill this form](https://forms.gle/AXq9hWq2DsJrDNjP7). + +All new requests may need `~96 hours (~4 days)` to begin the process. + +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +| | **Community Impact** | **Consequence** | +|:-:|:--|:--| +| **Correction** | Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. | A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. | +| **Warning** | A violation through a single incident or series of actions. | A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. | +| **Temporary Ban** | A serious violation of community standards, including sustained inappropriate behavior. | A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. | +| **Permanent Ban** | Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. | A permanent ban from any sort of public interaction within the community. | + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..8cd119c --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,7 @@ +# Contributing Guide + +This Contributing Guide is depend on ["hxhS (hugoalh & hugoalh Studio) Universal Contributing Guide"](https://github.com/hugoalh/hugoalh/blob/main/universal-guide/contributing.md), along with revise and take precedence over it. + +## Revise + +*N/A* diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..bcdc084 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,102 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-issue-forms.json +name: "Bug Report" +description: "Report a bug." +labels: + - "Status/Pending đŸ”ĩ" + - "Type/Bug 🐛" +body: + - type: "textarea" + id: "describe" + attributes: + label: "Describe" + description: |- + What the bug is? Add images and/or videos to help for explain this bug if needed. + + > [!NOTE] + > - Should not blur anything in the images and/or videos, except personal secrets. + > - For external images and/or videos, please ensure we are able to view those. + placeholder: |- + It cannot XXXXXXXX. + validations: + required: true + - type: "textarea" + id: "reproduce" + attributes: + label: "To Reproduce" + description: |- + Is this bug reproducible? If reproducible, please show the required steps by list, images, and/or videos! + + > [!NOTE] + > - Should not blur anything in the images and/or videos, except personal secrets. + > - For external images and/or videos, please ensure we are able to view those. + placeholder: |- + 1. Go to XXXXXXXX. + 2. Click on XXXXXXXX. + 3. Scroll to XXXXXXXX. + 4. Encounter this error. + validations: + required: false + - type: "textarea" + id: "expected-behaviour" + attributes: + label: "Expected Behaviour" + description: |- + What things should expected to happen? + placeholder: |- + It should XXXXXXXX. + validations: + required: false + - type: "textarea" + id: "version" + attributes: + label: "Version" + description: |- + Which versions are affected by this bug? + + > [!NOTE] + > - Accept versions range. + > - Versions must be listed as supported in the Security Policy (file `SECURITY.md`). + placeholder: |- + 1.2.3 + validations: + required: false + - type: "textarea" + id: "execution-environment" + attributes: + label: "Execution Environment" + description: |- + How is the execution environment? + + - **Type:** Device type. + > Computer / Phone / Server / ... + - **Hardware:** Hardware specifications. + - **Platforms:** Operate system and softwares, with architecture and version. + > Windows 11 22H2 X64 / Android 14 ARM64 / Alpine 3.18.0 X64 / NodeJS 20.6.0 X64 / Deno 1.36.0 X64 / Git 2.42.0 X64 / Python 3.11.0 X64 / ... + - **IsSubSystem:** Whether the execution environment in the sub system? + > False / True + - **Variables:** Environment variables. + > NO_COLOR=1 / ... + + > [!NOTE] + > - Accept multiple execution environments. + > - All of the properties are optional. + > - It is recommended to provide this information for reproducible steps. + + **\[🖌ī¸ YAML\]** + placeholder: |- + - Type: Server + Platforms: + - Ubuntu 23.04 X64 + - NodeJS 20.6.0 X64 + IsSubSystem: false + render: "yml" + validations: + required: false + - type: "textarea" + id: "additional-information" + attributes: + label: "Additional Information" + description: |- + If there have information that related to this bug but not suitable at other fields, please list those at here. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..6551e0f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-issue-config.json +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/documentation-issue.yml b/.github/ISSUE_TEMPLATE/documentation-issue.yml new file mode 100644 index 0000000..be93a16 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation-issue.yml @@ -0,0 +1,43 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-issue-forms.json +name: "Documentation Issue" +description: "Report a documentation issue." +labels: + - "Status/Pending đŸ”ĩ" + - "Type/Documentation 📓" +body: + - type: "textarea" + id: "page" + attributes: + label: "Page" + description: |- + List of the related pages. + validations: + required: true + - type: "textarea" + id: "describe" + attributes: + label: "Describe" + description: |- + What the issue is? Add images and/or videos to help for explain this issue if needed. + + > [!NOTE] + > - Should not blur anything in the images and/or videos, except personal secrets. + > - For external images and/or videos, please ensure we are able to view those. + validations: + required: true + - type: "textarea" + id: "expected-content" + attributes: + label: "Expected Content" + description: |- + What contents should expected? + validations: + required: false + - type: "textarea" + id: "additional-information" + attributes: + label: "Additional Information" + description: |- + If there have information that related to this issue but not suitable at other fields, please list those at here. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..03da292 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,31 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-issue-forms.json +name: "Feature Request" +description: "Suggest an idea." +labels: + - "Status/Pending đŸ”ĩ" + - "Type/Enhancement 💡" +body: + - type: "textarea" + id: "describe" + attributes: + label: "Describe" + description: |- + What feature do you want? Is your feature request related to a problem? + validations: + required: true + - type: "textarea" + id: "expected-behaviour" + attributes: + label: "Expected Behaviour" + description: |- + What things should expected to happen? + validations: + required: true + - type: "textarea" + id: "additional-information" + attributes: + label: "Additional Information" + description: |- + If there have information that related to this issue but not suitable at other fields, please list those at here. + validations: + required: false diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5afc553 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "sunday" + time: "00:00" + timezone: "Etc/UTC" + labels: + - "Platform/GitHubActions" + - "Status/Pending đŸ”ĩ" + - "Type/Dependency đŸ“Ļ" + open-pull-requests-limit: 100 + pull-request-branch-name: + separator: "/" diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..178bdd2 --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,220 @@ +# yaml-language-server: $schema=https://hugoalh.github.io/schema/json/github-labels.json +- name: "Platform/Android" + color: "#3DDC84" + description: "Related to Android." +- name: "Platform/Bluesky" + color: "#0285FF" + description: "Related to Bluesky." +- name: "Platform/Bun" + color: "#F9F1E1" + description: "Related to Bun." +- name: "Platform/ClamAV" + color: "#B83033" + description: "Related to ClamAV." +- name: "Platform/CloudflareWorkers" + color: "#F38020" + description: "Related to Cloudflare Workers." +- name: "Platform/CodeQL" + color: "#FFFFFF" + description: "Related to CodeQL." +- name: "Platform/Crowdin" + color: "#2E3340" + description: "Related to Crowdin." +- name: "Platform/Deno" + color: "#000000" + description: "Related to Deno." +- name: "Platform/DenoNetwork" + color: "#000000" + description: "Related to Deno Deploy, Deno KV, Deno Land, or Deno Module Registry." +- name: "Platform/Dependabot" + color: "#025E8C" + description: "Related to Dependabot." +- name: "Platform/Discord" + color: "#5865F2" + description: "Related to Discord." +- name: "Platform/Docker" + color: "#2496ED" + description: "Related to Docker." +- name: "Platform/DotNet" + color: "#512BD4" + description: "Related to .NET." +- name: "Platform/Git" + color: "#F05032" + description: "Related to Git." +- name: "Platform/GitHub" + color: "#181717" + description: "Related to GitHub." +- name: "Platform/GitHubActions" + color: "#2088FF" + description: "Related to GitHub Actions." +- name: "Platform/GitHubPackages" + color: "#181717" + description: "Related to GitHub Packages." +- name: "Platform/GitHubPages" + color: "#222222" + description: "Related to GitHub Pages." +- name: "Platform/GitLFS" + color: "#F64935" + description: "Related to Git LFS." +- name: "Platform/Godot" + color: "#478CBF" + description: "Related to Godot." +- name: "Platform/GoogleChrome" + color: "#4285F4" + description: "Related to Google Chrome." +- name: "Platform/Guilded" + color: "#F5C400" + description: "Related to Guilded." +- name: "Platform/JavaScript" + color: "#F7DF1E" + description: "Related to JavaScript." +- name: "Platform/JSR" + color: "#F7DF1E" + description: "Related to JSR (JavaScript Registry)." +- name: "Platform/Linux" + color: "#FCC624" + description: "Related to Linux." +- name: "Platform/LinuxAlpine" + color: "#0D597F" + description: "Related to Linux Alpine." +- name: "Platform/LinuxDebian" + color: "#A81D33" + description: "Related to Linux Debian." +- name: "Platform/LinuxUbuntu" + color: "#E95420" + description: "Related to Linux Ubuntu." +- name: "Platform/MacOS" + color: "#000000" + description: "Related to MacOS." + aliases: + - "Platform/AppleOS" +- name: "Platform/Mastodon" + color: "#6364FF" + description: "Related to Mastodon." +- name: "Platform/MicrosoftAzure" + color: "#0078D4" + description: "Related to Microsoft Azure." +- name: "Platform/MicrosoftEdge" + color: "#0078D7" + description: "Related to Microsoft Edge." +- name: "Platform/Minecraft" + color: "#62B47A" + description: "Related to Minecraft (Bedrock)." +- name: "Platform/MinecraftJava" + color: "#62B47A" + description: "Related to Minecraft Java." +- name: "Platform/NodeJS" + color: "#339933" + description: "Related to NodeJS." +- name: "Platform/NPM" + color: "#CB3837" + description: "Related to NPM." +- name: "Platform/POEditor" + color: "#00BCC9" + description: "Related to POEditor." +- name: "Platform/PowerShell" + color: "#5391FE" + description: "Related to PowerShell." +- name: "Platform/PowerShellGallery" + color: "#5391FE" + description: "Related to PowerShell Gallery." +- name: "Platform/Python" + color: "#3776AB" + description: "Related to Python." +- name: "Platform/RevoltChat" + color: "#FF4655" + description: "Related to Revolt Chat." +- name: "Platform/Roblox" + color: "#000000" + description: "Related to Roblox." +- name: "Platform/RobloxStudio" + color: "#00A2FF" + description: "Related to Roblox Studio." +- name: "Platform/Rust" + color: "#000000" + description: "Related to Rust." +- name: "Platform/Telegram" + color: "#26A5E4" + description: "Related to Telegram." +- name: "Platform/TypeScript" + color: "#3178C6" + description: "Related to TypeScript." +- name: "Platform/VisualStudio" + color: "#5C2D91" + description: "Related to Visual Studio." +- name: "Platform/VisualStudioCode" + color: "#007ACC" + description: "Related to Visual Studio Code." +- name: "Platform/Windows" + color: "#0078D4" + description: "Related to Windows." +- name: "Priority/Critical 🚨" + color: "#D50000" + description: "Critical priority." +- name: "Priority/High 🔴" + color: "#F44336" + description: "High priority." +- name: "Priority/Low đŸŸĸ" + color: "#4CAF50" + description: "Low priority." +- name: "Priority/Medium 🟡" + color: "#FFEB3B" + description: "Medium priority." +- name: "Status/Duplicated 🔁" + color: "#CFD3D7" # GitHub Default Label Color + description: "This already exists." + aliases: + - "duplicate" # GitHub Default Label +- name: "Status/HelpWanted ⛑ī¸" + color: "#008672" # GitHub Default Label Color + description: "This needs extra help." + aliases: + - "help wanted" # GitHub Default Label +- name: "Status/Invalid ⚠ī¸" + color: "#E4E669" # GitHub Default Label Color + description: "This does not seem right." + aliases: + - "invalid" # GitHub Default Label +- name: "Status/Investigating 🔍" + color: "#03A9F4" + description: "This is in investigating." +- name: "Status/NoSolution 🤷" + color: "#FFFFFF" + description: "This cannot be worked on due to no possible solution." +- name: "Status/Pending đŸ”ĩ" + color: "#2196F3" + description: "This is new." +- name: "Status/Question ❓" + color: "#D876E3" # GitHub Default Label Color + description: "This needs further information." + aliases: + - "question" # GitHub Default Label +- name: "Status/Rejected ❌" + color: "#B71C1C" + description: "This is rejected." +- name: "Status/Transfer ↗ī¸" + color: "#607D8B" + description: "This is transferred to a more relevant place." +- name: "Status/WillNotFix 🙅" + color: "#FFFFFF" # GitHub Default Label Color + description: "This will not be worked on." + aliases: + - "wontfix" # GitHub Default Label +- name: "Type/Bug 🐛" + color: "#D73A4A" # GitHub Default Label Color + description: "Something is not working as expected or intended." + aliases: + - "bug" # GitHub Default Label +- name: "Type/Dependency đŸ“Ļ" + color: "#6D4C41" + description: "Related to dependency." +- name: "Type/Documentation 📓" + color: "#0075CA" # GitHub Default Label Color + description: "Additions or improvements to the documentation." + aliases: + - "documentation" # GitHub Default Label +- name: "Type/Enhancement 💡" + color: "#A2EEEF" # GitHub Default Label Color + description: "New feature or request." + aliases: + - "enhancement" # GitHub Default Label diff --git a/.github/workflows/announce-new-release.yml b/.github/workflows/announce-new-release.yml new file mode 100644 index 0000000..3ed64bf --- /dev/null +++ b/.github/workflows/announce-new-release.yml @@ -0,0 +1,38 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: "Announce New Release" +on: + release: + types: + - "published" +jobs: + discord: + name: "Discord" + permissions: {} + runs-on: "ubuntu-latest" + steps: + - name: "Send Discord Webhook" + uses: "hugoalh/send-discord-webhook-ghaction@v6.0.2" + with: + key: "${{secrets.DISCORD_HXHS_PROJECTNEWRELEASEANNOUNCER_WEBHOOK}}" + embeds: | + - title: "Is String Single Line (TypeScript)" + description: | + > ${{github.event.repository.description}} + + Version ${{github.event.release.name}} (`${{github.event.release.tag_name}}`) just released! + timestamp: "${{github.event.release.published_at}}" + color: "#3178C6" + author: + name: "${{github.event.release.author.login}}" + url: "${{github.event.release.author.html_url}}" + icon_url: "${{github.event.release.author.avatar_url}}" + fields: + - name: "📋 Changelog" + value: "${{github.event.release.html_url}}" + inline: false + - name: "GitHub" + value: "${{github.event.repository.html_url}}" + inline: false + - name: "JSR" + value: "https://jsr.io/@hugoalh/is-string-singleline" + inline: false diff --git a/.github/workflows/invoke-codeql-analysis.yml b/.github/workflows/invoke-codeql-analysis.yml new file mode 100644 index 0000000..3b5df60 --- /dev/null +++ b/.github/workflows/invoke-codeql-analysis.yml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: "Invoke CodeQL Analysis" +on: + push: + branches: + - "**" + pull_request: + branches: + - "**" + types: + - "edited" + - "opened" + - "reopened" + - "synchronize" + schedule: + - cron: "0 0 * * SUN" + workflow_dispatch: +jobs: + main: + name: "Main" + permissions: + actions: "read" + contents: "read" + security-events: "write" + uses: "hugoalh/hugoalh/.github/workflows/call-invoke-codeql-analysis-0.yml@main" diff --git a/.github/workflows/publish-deno-package.yml b/.github/workflows/publish-deno-package.yml new file mode 100644 index 0000000..9b27cb4 --- /dev/null +++ b/.github/workflows/publish-deno-package.yml @@ -0,0 +1,13 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: "Publish Deno Package" +on: + release: + types: + - "published" +jobs: + main: + name: "Main" + permissions: + contents: "read" + id-token: "write" + uses: "hugoalh/hugoalh/.github/workflows/call-publish-deno-package-0.yml@main" diff --git a/.github/workflows/review-deno-code.yml b/.github/workflows/review-deno-code.yml new file mode 100644 index 0000000..282258f --- /dev/null +++ b/.github/workflows/review-deno-code.yml @@ -0,0 +1,30 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: "Review Deno Code" +on: + push: + branches: + - "**" + pull_request: + branches: + - "**" + types: + - "edited" + - "opened" + - "reopened" + - "synchronize" + schedule: + - cron: "0 0 * * SUN" + workflow_dispatch: +jobs: + main: + name: "${{matrix.runon}}" + permissions: + contents: "read" + strategy: + matrix: + runon: + - "ubuntu-latest" + fail-fast: false + uses: "hugoalh/hugoalh/.github/workflows/call-review-deno-code-1.yml@main" + with: + runon: "${{matrix.runon}}" diff --git a/.github/workflows/scan-virus.yml b/.github/workflows/scan-virus.yml new file mode 100644 index 0000000..2b2c176 --- /dev/null +++ b/.github/workflows/scan-virus.yml @@ -0,0 +1,52 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: "Scan Virus" +on: + push: + branches: + - "**" + pull_request: + branches: + - "**" + types: + - "edited" + - "opened" + - "reopened" + - "synchronize" + workflow_dispatch: + inputs: + git_integrate: + type: "choice" + description: "{Boolean} Whether to integrate with Git to perform scan by every commits." + required: false + default: "False" + options: + - "False" + - "True" + git_limit: + type: "string" + description: "{UInt64} Limit on how many Git commits will scan." + required: false + default: "0" + git_reverse: + type: "choice" + description: "{Boolean} Whether to reverse the scan order of the Git commits." + required: false + default: "False" + options: + - "False" + - "True" +jobs: + main: + name: "Main" + permissions: + contents: "read" + uses: "hugoalh/hugoalh/.github/workflows/call-scan-virus-0.yml@main" + with: + git_integrate: "${{github.event.inputs.git_integrate || 'False'}}" + git_limit: "${{github.event.inputs.git_limit || '0'}}" + git_reverse: "${{github.event.inputs.git_reverse || 'False'}}" + ignores_post: |- + Param($ElementPostMeta) + Return ( + $ElementPostMeta.Path -imatch '^node_modules[\\/]' + ) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml new file mode 100644 index 0000000..52ea791 --- /dev/null +++ b/.github/workflows/sync-labels.yml @@ -0,0 +1,17 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: "Sync Labels" +on: + push: + branches: + - "main" + paths: + - ".github/labels.yml" + workflow_dispatch: +jobs: + main: + name: "Main" + permissions: + contents: "read" + issues: "write" + pull-requests: "write" + uses: "hugoalh/hugoalh/.github/workflows/call-sync-labels-0.yml@main" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f013107 --- /dev/null +++ b/.gitignore @@ -0,0 +1,249 @@ +__history/ +__Previews +__pycache__/ +__recovery/ +_compareTemp +_thumbs/ +_UpgradeReport_Files/ +._* +.[Cc]ache +.[Cc]ache/ +.~lock.*# +.alcache/ +.apdisk +.AppleDB +.AppleDesktop +.AppleDouble +.byebug_history +.cache-main +.com.apple.timemachine.donotpresent +.coverage.* +.cpcache/ +.csdp.cache +.data/ +.directory +.DocumentRevisions-V100 +.docusaurus +.dropbox +.dropbox.attr +.dropbox.cache +.DS_Store +.dynamodb/ +.ensime_cache/ +.env +.env.development.local +.env.local +.env.production.local +.env.test.local +.eslintcache +.fseventsd +.fuse_hidden* +.fusebox/ +.git/ +.gradle/ +.gradletasknamecache +.grunt +.history +.history/ +.idea/caches/ +.idea/httpRequests +.jekyll-cache/ +.lein-repl-history +.lia.cache +.lib/ +.libs/ +.lock-waf_*_build +.lock-wscript +.LSOverride +.next +.nfs* +.nia.cache +.nlia.cache +.node_history +.node_repl_history +.npm +.nra.cache +.nuxt +.nyc_output +.parcel-cache +.php_cs.cache +.phpunit.result.cache +.pl-history +.pnp.* +.pnpm-debug.log* +.Rapp.history +.RData +.RDataTmp +.repl_history +.Rhistory +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ +.sass-cache/ +.scala_dependencies +.serverless/ +.snapshots/ +.Spotlight-V100 +.stversions +.stylelintcache +.svn/ +.temp +.temp/ +.TemporaryItems +.tern-port +.Trash-* +.Trashes +.VolumeIcon.icns +.vs/ +.vscode-test +.vscode/ +.vshistory/ +.vuepress/dist +.yarn-integrity +.yarn/ +[Dd]esktop.ini +[Tt]emp/ +[Tt]humbs.db +[Tt]humbs.db:encryptable +*_cache/ +*_qmlcache.qrc +*.~* +*.~vsd* +*.autosave +*.bak +*.cab +*.cache +*.cachefile +*.errors +*.hprof +*.identcache +*.lcov +*.lnk +*.log +*.msi +*.msix +*.msm +*.msp +*.pid +*.pid.lock +*.seed +*.slxc +*.stackdump +*.stTheme.cache +*.tgz +*.tmlanguage.cache +*.tmp +*.tmPreferences.cache +*.tsbuildinfo +*.userosscache +*.vsix +*.xlk +*~ +/_yardoc/ +/.qmake.cache +/.yardoc/ +/administrator/cache/ +/app/bootstrap.php.cache +/app/cache/ +/app/logs/ +/autoscan.log +/cache/ +/config.cache +/config.guess +/custom/history/ +/fuel/app/cache/ +/fuel/app/logs/ +/github-cache +/package-cache +/play-cache +/tmp/cache/models/ +/tmp/cache/persistent/ +/tmp/cache/views/ +/typo3conf/temp_CACHED* +/var/bootstrap.php.cache +/var/cache/ +/web/sites/*/cache +/web/sites/*/tmp +/web/sites/*/translations +/website/var/backup/ +/website/var/cache/ +/website/var/config/cache.xml +~$*.doc* +~$*.ppt* +~$*.xls* +$RECYCLE.BIN/ +App_Data/cache/ +application/cache/ +application/logs/ +autom4te.cache +Backup of *.doc* +BenchmarkDotNet.Artifacts/ +bh_unicode_properties.cache +Binaries/ +bower_components +build/Release +BundleArtifacts/ +cache +cache-downloads +cache/ +Cache/ +CMakeCache.txt +CMS/App_Data/AzureCache +CMS/App_Data/AzureTemp +coverage +crash.log +csdp.cache +cwallet.sso.lck +data/cache/ +data/DoctrineORMModule/cache/ +data/logs/ +data/sessions/ +DerivedDataCache/ +ehthumbs_vista.db +ehthumbs.db +expressionengine/cache/ +files/cache/ +files/tmp/ +fp-info-cache +Icon +image/cache/ +install-log.txt +jspm_packages/ +lerna-debug.log* +lia.cache +lib-cov +logs +Logs/ +manifest/cache/ +manifest/logs/ +manifest/tmp/ +Network Trash Folder +nia.cache +nimblecache/ +nimcache/ +nlia.cache +node_modules/ +npm-debug.log* +nra.cache +Package Control.cache/ +packer_cache/ +pids +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json +resources/sass/.sass-cache/ +source_gen +source_gen.caches +system/cache/ +system/logs/ +Temporary Items +test_gen +test_gen.caches +test-result +thumbs/ +tmp/ +vqmod/checked.cache +vqmod/mods.cache +vqmod/vqcache/ +web_modules/ +yarn-debug.log* +yarn-error.log* diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..54aca8f --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,63 @@ +# yaml-language-server: $schema=https://json.schemastore.org/yamllint.json +rules: + braces: + forbid: "non-empty" + max-spaces-inside-empty: 0 + max-spaces-inside: 1 + min-spaces-inside-empty: 0 + min-spaces-inside: 1 + brackets: + forbid: "non-empty" + max-spaces-inside-empty: 0 + max-spaces-inside: 1 + min-spaces-inside-empty: 0 + min-spaces-inside: 1 + colons: + max-spaces-after: 1 + max-spaces-before: 0 + commas: + max-spaces-after: 1 + max-spaces-before: 0 + min-spaces-after: 1 + comments: + ignore-shebangs: true + min-spaces-from-content: 0 + require-starting-space: false + comments-indentation: true + document-end: + present: false + document-start: false + empty-lines: + max-end: 1 + max-start: 0 + max: 0 + empty-values: + forbid-in-block-mappings: true + forbid-in-flow-mappings: true + float-values: + forbid-inf: false + forbid-nan: true + forbid-scientific-notation: false + require-numeral-before-decimal: true + hyphens: + max-spaces-after: 1 + indentation: + check-multi-line-strings: false + indent-sequences: true + spaces: 2 + key-duplicates: true + key-ordering: false + line-length: false + new-line-at-end-of-file: true + new-lines: false + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true + quoted-strings: + quote-type: "double" + required: true + trailing-spaces: true + truthy: true +yaml-files: + - "**/*.yaml" + - "**/*.yml" diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..4cff961 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,17 @@ +# yaml-language-server: $schema=https://citation-file-format.github.io/1.2.0/schema.json +cff-version: "1.2.0" +title: "Is String Single Line (TypeScript)" +message: "If you use this software, please cite it using the metadata from this file." +type: "software" +authors: + - name: "hugoalh Studio" +repository-code: "https://github.com/hugoalh-studio/is-string-singleline-ts" +keywords: + - "is" + - "line" + - "single" + - "singleline" + - "string" + - "ts" + - "typescript" +license: "MIT" diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..42fcbd0 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,35 @@ +# MIT License + +Copyright Š 2024 hugoalh Studio + +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. + +--- + +## TLDR + +This is a short and simple list that mostly concluded this license about the permissions, conditions, and limitations, this license content section shall prevail. + +### Permissions + +- **Commercial Use:** The licensed material and derivatives may be used for commercial purposes. +- **Distribution:** The licensed material may be distributed. +- **Modification:** The licensed material may be modified. +- **Private Use:** The licensed material may be used and modified in private. + +### Conditions + +- **License & Copyright Notice:** A copy of the license and copyright notice must be included with the licensed material. + +### Limitations + +- **Liability:** This license includes a limitation of liability. +- **Warranty:** This license explicitly states that it does not provide any warranty. + +## Attribution + +This license is adopted from [Choose A License](https://choosealicense.com/), available at [here](https://choosealicense.com/licenses/mit). diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ccb51c --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +# Is String Single Line (TypeScript) + +[**⚖ī¸** MIT](./LICENSE.md) + +**🗂ī¸** +[![GitHub: hugoalh-studio/is-string-singleline-ts](https://img.shields.io/badge/hugoalh--studio/is--string--singleline--ts-181717?logo=github&logoColor=ffffff&style=flat "GitHub: hugoalh-studio/is-string-singleline-ts")](https://github.com/hugoalh-studio/is-string-singleline-ts) +[![JSR: @hugoalh/is-string-singleline](https://img.shields.io/badge/JSR-@hugoalh/is--string--singleline-F7DF1E?labelColor=F7DF1E&logoColor=000000&style=flat "JSR: @hugoalh/is-string-singleline")](https://jsr.io/@hugoalh/is-string-singleline) + +**🆙** ![Latest Release Version](https://img.shields.io/github/release/hugoalh-studio/is-string-singleline-ts?sort=semver&color=2187C0&label=&style=flat "Latest Release Version") (![Latest Release Date](https://img.shields.io/github/release-date/hugoalh-studio/is-string-singleline-ts?color=2187C0&label=&style=flat "Latest Release Date")) + +A TypeScript module to determine whether the string is single line. + +## đŸŽ¯ Target + +- Bun ^ v1.0.0 +- Cloudflare Workers +- Deno >= v1.34.0 / >= v1.41.1 *(Via JSR)* + > **🛡ī¸ Require Permission** + > + > *N/A* +- NodeJS >= v16.13.0 + +## 🔰 Usage + +### Via HTTPS + +> **đŸŽ¯ Supported Target** +> +> - Deno + +1. Import at the script (`.ts`): + - Via DenoPKG + ```ts + import ... from "https://denopkg.com/hugoalh-studio/is-string-singleline-ts[@]/mod.ts"; + ``` + - Via GitHub Raw (Require Tag) + ```ts + import ... from "https://raw.githubusercontent.com/hugoalh-studio/is-string-singleline-ts//mod.ts"; + ``` + - Via Pax + ```ts + import ... from "https://pax.deno.dev/hugoalh-studio/is-string-singleline-ts[@]/mod.ts"; + ``` + > **ℹī¸ Note** + > + > Although it is recommended to import the entire module with the main path `mod.ts`, it is also able to import part of the module with sub path if available, but do not import if: + > + > - it's file path has an underscore prefix (e.g.: `_foo.ts`, `_util/bar.ts`), or + > - it is a benchmark or test file (e.g.: `foo.bench.ts`, `foo.test.ts`), or + > - it's symbol has an underscore prefix (e.g.: `export function _baz() {}`). + > + > These elements are not considered part of the public API, thus no stability is guaranteed for them. + +### Via JSR With Native Support + +> **đŸŽ¯ Supported Target** +> +> - Deno + +1. Import at the script (`.ts`): + ```ts + import ... from "jsr:@hugoalh/is-string-singleline[@]"; + ``` + > **ℹī¸ Note** + > + > Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit [file `jsr.jsonc`](./jsr.jsonc) property `exports` for available sub paths. + +### Via JSR With NPM Compatibility Layer Support + +> **đŸŽ¯ Supported Target** +> +> - Bun +> - Cloudflare Workers +> - NodeJS + +1. Install via console/shell/terminal: + - Via Bun + ```sh + bunx jsr add @hugoalh/is-string-singleline[@] + ``` + - Via NPM + ```sh + npx jsr add @hugoalh/is-string-singleline[@] + ``` + - Via PNPM + ```sh + pnpm dlx jsr add @hugoalh/is-string-singleline[@] + ``` + - Via Yarn + ```sh + yarn dlx jsr add @hugoalh/is-string-singleline[@] + ``` +2. Import at the script (`.ts`): + ```ts + import ... from "@hugoalh/is-string-singleline"; + ``` + > **ℹī¸ Note** + > + > Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit [file `jsr.jsonc`](./jsr.jsonc) property `exports` for available sub paths. + +## 🧩 API + +- ```ts + function isStringSingleLine(item: string): boolean; + ``` + +> **ℹī¸ Note** +> +> For the prettier documentation, can visit via: +> +> - [Deno CLI `deno doc`](https://deno.land/manual/tools/documentation_generator) +> - [JSR](https://jsr.io/@hugoalh/is-string-singleline) + +## ✍ī¸ Example + +- ```ts + isStringSingleLine("Wisi sed et at vero eos nostrud volutpat sed stet dignissim sit sanctus in eros.\nEt laoreet odio sanctus ea.\nSea in dolores diam tincidunt labore sea stet vero dolor ut est.\nAt aliquyam diam facilisis lorem et takimata et volutpat eros erat ipsum velit labore sed ea illum.\nDolor lorem sed et volutpat exerci gubergren gubergren tempor quis ea eirmod eos ut dolor autem ipsum accumsan."); + //=> false + ``` +- ```ts + isStringSingleLine("Hello, world!"); + //=> true + ``` diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..58c58dd --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,38 @@ +# Security Policy + +## Supported Versions + +> ```mermaid +> --- +> title: Versions Status Flow +> --- +> flowchart LR +> Unstable("Unstable") +> Pre("Pre Release") +> Release("Release") +> LTS("Long Term Support") +> Maintenance("Maintenance") +> EOL("End Of Life") +> Unstable --> Pre +> Pre --> Release +> subgraph Support +> Release -- Major = 0 --> Maintenance +> Release -- Major > 0 --> LTS +> LTS --> Maintenance +> end +> Maintenance --> EOL +> ``` + +| **Versions** | **Release Date** | **Long Term Support Date** | **End Of Life Date** | +|:-:|:-:|:-:|:-:| +| v1.X.X | 2024-03-13 | 2024-03-13 | *Unknown* | + +> **ℹī¸ Note** +> +> - The date format is according to ISO 8601 standard. +> - Values in italic format are subject to change. +> - Versions which not in the list are also end of life. + +## Report A Vulnerability + +You can report a security vulnerability by [create a security vulnerability report](https://github.com/hugoalh/hugoalh/blob/main/universal-guide/contributing.md#create-a-security-vulnerability-report). diff --git a/deno.jsonc b/deno.jsonc new file mode 100644 index 0000000..0e67dcb --- /dev/null +++ b/deno.jsonc @@ -0,0 +1,40 @@ +{ + "$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json", + "fmt": { + "indentWidth": 4, + "lineWidth": 800, + "proseWrap": "preserve", + "semiColons": true, + "singleQuote": false, + "useTabs": true + }, + "imports": { + // Only remap development dependencies! For more information, please visit https://docs.deno.com/runtime/manual/basics/import_maps. + "TEST/": "https://deno.land/std@0.219.1/assert/" + }, + "lint": { + "rules": { + "tags": [ + "recommended" + ], + "include": [ + "default-param-last", + "eqeqeq", + "guard-for-in", + "no-const-assign", + "no-eval", + "no-non-null-asserted-optional-chain", + "no-self-compare", + "no-sparse-arrays", + "no-sync-fn-in-async-fn", + "no-undef", + "triple-slash-reference" + ] + } + }, + "lock": false, + "tasks": { + // `deno publish` have weird behaviours, always check via the task `jsr-check` before release! For more information, please visit https://github.com/denoland/deno/issues/22648. + "jsr-check": "deno publish --config jsr.jsonc --dry-run --no-provenance" + } +} diff --git a/jsr.jsonc b/jsr.jsonc new file mode 100644 index 0000000..3914126 --- /dev/null +++ b/jsr.jsonc @@ -0,0 +1,32 @@ +// This file is only for JSR related, non-JSR related must set in the file `deno.jsonc`! +{ + "name": "@hugoalh/is-string-singleline", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "imports": { }, + "publish": { + "exclude": [ + "**/*_bench.ts", + "**/*_bench.tsx", + "**/*_test.ts", + "**/*_test.tsx", + "**/*.bench.ts", + "**/*.bench.tsx", + "**/*.test.ts", + "**/*.test.tsx", + "**/bench.ts", + "**/bench.tsx", + "**/test.ts", + "**/test.tsx" + ], + "include": [ + "**/*.ts", + "**/*.tsx", + "jsr.jsonc", + "LICENSE*.md", + "README*.md" + ] + } +} diff --git a/mod.bench.ts b/mod.bench.ts new file mode 100644 index 0000000..9c18037 --- /dev/null +++ b/mod.bench.ts @@ -0,0 +1,12 @@ +import { isStringSingleLine } from "./mod.ts"; +const sample1 = `Wisi sed et at vero eos nostrud volutpat sed stet dignissim sit sanctus in eros. +Et laoreet odio sanctus ea. +Sea in dolores diam tincidunt labore sea stet vero dolor ut est. +At aliquyam diam facilisis lorem et takimata et volutpat eros erat ipsum velit labore sed ea illum. +Dolor lorem sed et volutpat exerci gubergren gubergren tempor quis ea eirmod eos ut dolor autem ipsum accumsan.`; +Deno.bench("False 1", { permissions: "none" }, () => { + isStringSingleLine(sample1); +}); +Deno.bench("True 1", { permissions: "none" }, () => { + isStringSingleLine("Hello, world!"); +}); diff --git a/mod.test.ts b/mod.test.ts new file mode 100644 index 0000000..56f52e3 --- /dev/null +++ b/mod.test.ts @@ -0,0 +1,13 @@ +import { assertEquals } from "TEST/assert_equals.ts"; +import { isStringSingleLine } from "./mod.ts"; +const sample1 = `Wisi sed et at vero eos nostrud volutpat sed stet dignissim sit sanctus in eros. +Et laoreet odio sanctus ea. +Sea in dolores diam tincidunt labore sea stet vero dolor ut est. +At aliquyam diam facilisis lorem et takimata et volutpat eros erat ipsum velit labore sed ea illum. +Dolor lorem sed et volutpat exerci gubergren gubergren tempor quis ea eirmod eos ut dolor autem ipsum accumsan.`; +Deno.test("False 1", { permissions: "none" }, () => { + assertEquals(isStringSingleLine(sample1), false); +}); +Deno.test("True 1", { permissions: "none" }, () => { + assertEquals(isStringSingleLine("Hello, world!"), true); +}); diff --git a/mod.ts b/mod.ts new file mode 100644 index 0000000..e353eca --- /dev/null +++ b/mod.ts @@ -0,0 +1,10 @@ +const regexpSingleLine = /^.*$/; +/** + * Determine whether the string is single line. + * @param {string} item Item that need to determine. + * @returns {boolean} Determine result. + */ +export function isStringSingleLine(item: string): boolean { + return regexpSingleLine.test(item); +} +export default isStringSingleLine;