diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..2382d94 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,101 @@ +# Contributing to Mathy + +Thank you for considering contributing to **Mathy**! We welcome all contributions to make this project better. Here's how you can help: + +--- + +## Getting Started + +1. **Fork the Repository**: + + - Click the "Fork" button on the top-right corner of the repository page. + +2. **Clone Your Fork**: + + ```bash + git clone https://github.com/WebDevCaptain-Lab/oss-npm-package-workshop.git + cd oss-npm-package-workshop + ``` + +3. **Install Dependencies**: + + ```bash + npm install + ``` + +4. **Run Tests**: + ```bash + npm test + ``` + +--- + +## How to Contribute + +### Reporting Issues + + Found a bug or have a suggestion? Open an issue and use the appropriate template. + +### Feature Requests + + Check the [Roadmap](./ROADMAP.md) to see if your feature aligns with future plans. If not, create an issue to discuss. + +### Submitting Pull Requests + +- Create a new branch for your work: + `git checkout -b my-feature` + +- Make your changes. Write clear and concise code, and add comments if necessary. + +- Ensure tests pass: + `npm test` + +- Push your branch and open a pull request: + `git push origin my-feature` + +- Follow the Pull Request Template to include all required details. + +- Code Style + Prettier and ESLint are used to enforce code style. Run: + + - `npm run lint` + - `npm run format` + +- Join the Discussion + Feel free to ask questions or seek guidance by opening a discussion or issue. Happy coding! + +--- + +### **2. CODE_OF_CONDUCT.md** + +Defines behavior expectations for contributors. + +```markdown +# Contributor Code of Conduct + +## Our Pledge + +We as contributors and maintainers pledge to make participation in this project a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to a positive environment: + +- Being respectful of differing viewpoints. +- Providing constructive feedback. +- Showing empathy toward others. + +Examples of unacceptable behavior: + +- Use of sexualized language or unwelcome advances. +- Insulting or derogatory comments. +- Public or private harassment. + +## Enforcement + +Instances of unacceptable behavior can be reported by contacting the project team at **[hello@webdevcaptain.com](mailto:hello@webdevcaptain.com)**. All complaints will be reviewed and addressed confidentially. + +## Acknowledgments + +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org). +``` diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..830cca2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,54 @@ +name: "Bug Report" +description: "Report a bug in Mathy Lib." +title: "[Bug]: " +labels: [bug] +body: + - type: markdown + attributes: + value: | + Thank you for reporting a bug! Please fill out the form below so we can resolve the issue promptly. + + - type: input + id: summary + attributes: + label: "Bug Summary" + description: "Provide a concise summary of the bug." + placeholder: "e.g., add function returns wrong result for negative numbers." + + - type: textarea + id: steps + attributes: + label: "Steps to Reproduce" + description: "Provide the steps to reproduce the bug." + placeholder: | + 1. Call `add(-1, -1)` + 2. Check the output + 3. Observe the issue + + - type: textarea + id: expected + attributes: + label: "Expected Behavior" + description: "What should happen instead?" + placeholder: "The `add` function should return -2." + + - type: textarea + id: actual + attributes: + label: "Actual Behavior" + description: "What actually happened?" + placeholder: "The `add` function returned 0." + + - type: input + id: environment + attributes: + label: "Environment Details" + description: "Provide relevant details about your setup." + placeholder: "OS: macOS 13, Node.js: 18.12.0, Mathy Lib version: 1.0.1" + + - type: textarea + id: additional + attributes: + label: "Additional Context" + description: "Add any other relevant information or screenshots." + placeholder: "Include error logs, screenshots, or related details." diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..5c45766 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,44 @@ +name: "Feature Request" +description: "Suggest a new feature or enhancement for Mathy Lib." +title: "[Feature]: " +labels: [enhancement] +body: + - type: markdown + attributes: + value: | + We'd love to hear your ideas for improving Mathy Lib! Please fill out the form below. + + - type: input + id: feature_summary + attributes: + label: "Feature Summary" + description: "Briefly describe the new feature or enhancement." + placeholder: "e.g., Add a function for subtracting numbers." + + - type: textarea + id: description + attributes: + label: "Description" + description: "Provide a detailed explanation of the feature." + placeholder: "The subtract function should return the difference of two numbers." + + - type: textarea + id: use_cases + attributes: + label: "Use Cases" + description: "Describe how this feature would be used." + placeholder: "This function will be used to perform simple subtraction operations." + + - type: textarea + id: alternatives + attributes: + label: "Alternatives" + description: "List any alternative solutions or features you've considered." + placeholder: "Using external libraries for subtraction, but it's not ideal for our lightweight library." + + - type: textarea + id: additional + attributes: + label: "Additional Context" + description: "Add any other relevant information or screenshots." + placeholder: "Provide examples, links, or other supporting details." diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 0000000..4ce2cd4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,30 @@ +name: "Question or Support" +description: "Ask a question or request support for Mathy Lib." +title: "[Question]: " +labels: [question] +body: + - type: markdown + attributes: + value: | + Have a question or need help? Let us know by filling out the form below. + + - type: input + id: question_summary + attributes: + label: "Question Summary" + description: "What is your question?" + placeholder: "e.g., How do I use the multiply function?" + + - type: textarea + id: details + attributes: + label: "Details" + description: "Provide additional details about your question or problem." + placeholder: "Include code examples, error logs, or other details." + + - type: textarea + id: additional + attributes: + label: "Additional Context" + description: "Add any other relevant information." + placeholder: "Screenshots, links to documentation, etc." diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..c921d45 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,35 @@ + + +### Description + + + +### Related Issues + + + +Closes #123 + +### Type of change + +- [ ] Bug fix +- [ ] New feature +- [ ] Refactor +- [ ] Documentation update +- [ ] Other (please specify): + +### Checklist + +- [ ] My code follows the project's coding style. +- [ ] I have performed a self-review of my code. +- [ ] I have written or updated tests to cover my changes. +- [ ] I have updated documentation (if necessary). +- [ ] My changes generate no new warnings. + +### Screenshots (if applicable) + + + +### Additional context + + diff --git a/.github/ROADMAP.md b/.github/ROADMAP.md new file mode 100644 index 0000000..53d7822 --- /dev/null +++ b/.github/ROADMAP.md @@ -0,0 +1,39 @@ +# Mathy Roadmap + +Our goal is to make **Mathy** a comprehensive and lightweight library for performing basic mathematical operations. Here are our plans: + +--- + +## Current Features + +- **Addition**: Adds multiple numbers. + +--- + +## Future Features + +1. **Subtraction**: + + - Function to subtract one number from another. + - Example: `subtract(5, 3) // 2`. + +2. **Division**: + + - Function to divide one number by another. + - Example: `divide(6, 2) // 3`. + +3. **Advanced Operations**: + - Support for percentages. + - Modular arithmetic. + +--- + +## Long-Term Vision + +- Ensure compatibility with various JavaScript frameworks. +- Optimize performance for large datasets. +- Provide thorough documentation and examples. + +--- + +Want to contribute to this roadmap? See our [Contributing Guide](./CONTRIBUTING.md) for details! diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md new file mode 100644 index 0000000..9cb830b --- /dev/null +++ b/.github/SUPPORT.md @@ -0,0 +1,34 @@ +# Support Guide + +If you need help with **Mathy**, here’s how to get assistance: + +--- + +## Questions and Discussions + +- Open a [Discussion](https://github.com/WebDevCaptain-Lab/oss-npm-package-workshop.git/discussions) to ask a question or seek advice. + +## Reporting Bugs + +- Found a bug? [Open an Issue](https://github.com/WebDevCaptain-Lab/oss-npm-package-workshop.git/issues/new?template=bug_report.yml) using the Bug Report template. + +## Feature Requests + +- Have an idea for improving Math-Lib? Submit a [Feature Request](https://github.com/WebDevCaptain-Lab/oss-npm-package-workshop.git/issues/new?template=feature_request.yml). + +## Frequently Asked Questions (FAQ) + +1. **How do I install Mathy?** + + - Use npm: `npm install mathy`. + +2. **What versions of Node.js are supported?** + - We support Node.js versions >=20. + +--- + +## Contact Us + +If your query is not addressed above, email us at **[hello@webdevcaptain.com](mailto:hello@webdevcaptain.com)**. + +Please be patient as our team is small, but we’ll do our best to respond promptly. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e4a7955 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [2025] [Shreyash (WebDevcaptain)] + +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 index 11d464e..4e4405f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,54 @@ Workshop for developing Open Source NPM packages. +## Getting Started + +- This workshop is designed to be a hands-on experience for developers who want to learn how to develop and publish Open Source NPM packages. + +- The workshop is divided into multiple sections, each section will cover a specific topic. + +--- + +## Sections + +### 1. **Code and Test**: + +Focuses on writing a simple add function and testing it using Vitest. Also, we will learn how to use the collaborative development tool, Git and GitHub. We talk about a Github Repository, Branches, and Merging. Along the way, we also discuss the importance of writing good commit messages. Issues and Pull Requests are also discussed. + +### 2. **Git Hooks**: + +This section is focussed on Git Hooks using Husky. We will learn how to use Husky to run tests before committing code. Husky makes it easy to use Git Hooks in your project. + +### 3. **CI**: + +This section is focussed on Continuous Integration using GitHub Actions. We will learn how to use GitHub Actions to run tests on every push to the repository and also on every Pull Request. + +### 4. **Linter and Formatter**: + +This section is focussed on using ESLint and Prettier. We will learn how to use ESLint to enforce code quality and Prettier to format the code. We also learn how to use Husky to run ESLint and Prettier on every commit. We also discuss about lint-staged and how it can be used to run ESLint and Prettier on staged files. + +### 5. **Commit Messages**: + +This section is focussed on writing good commit messages. We will learn how to use Conventional Commits to write commit messages. We will also learn how to use Commitlint to enforce Conventional Commits. Finally we run commitlint in CI. + +### 6. **Bundler**: + +This section is focussed on using Rollup as a bundler. We will learn how to use Rollup to bundle our code. We will also learn how to use Terser to minify the code. Finally we hook Rollup and Terser to our CI. + +### 7. **Documentation**: + +This section is focussed on writing documentation for our package. We already wrote some code documentation (using JSdoc) in the previous sections. In this section, we will learn how to write a README.md file for our package. We will also learn how to use GitHub Pages to host our documentation. We also discuss about templates for Pull Requests and Issues. Finally we end this section with a brief discussion on CHANGELOG.md and licensing our code. + +--- + ## Prerequisites - Node.js - NPM + +--- + +- [Contributing Guide](./CONTRIBUTING.md) +- [Code of Conduct](./CODE_OF_CONDUCT.md) +- [Roadmap](./ROADMAP.md) +- [Support Guide](./SUPPORT.md) +- [License](./LICENSE)