Skip to content

Commit

Permalink
doc: add project info and contributing guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyamahunt committed Jun 21, 2023
1 parent 3c4ca84 commit 915d32c
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ Carthage/Checkouts
Carthage/Build/

# Add Xcode project related files required by Carthage
DynamicCodableKit.xcodeproj/*
!DynamicCodableKit.xcodeproj/*.pbxproj
!DynamicCodableKit.xcodeproj/*.plist
!DynamicCodableKit.xcodeproj/xcshareddata
MetaCodable.xcodeproj/*
!MetaCodable.xcodeproj/*.pbxproj
!MetaCodable.xcodeproj/*.plist
!MetaCodable.xcodeproj/xcshareddata

# Accio dependency management
Dependencies/
Expand Down
4 changes: 4 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 1
builder:
configs:
- documentation_targets: [CodableMacroPlugin, MetaCodable]
Empty file added CHANGELOG.md
Empty file.
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers 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, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at soumya.mahunt@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
50 changes: 50 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Contributing Guidelines

This document contains information and guidelines about contributing to this project.
Please read it before you start participating.

_See also: [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md)_

## Submitting Pull Requests

You can contribute by fixing bugs or adding new features. For larger code changes, we first recommend discussing them in our [Github issues](https://github.com/SwiftyLab/MetaCodable/issues). When submitting a pull request, please add relevant tests and ensure your changes don't break any existing tests (see [Automated Tests](#automated-tests) below).

### Things you will need

* Linux, Mac OS (preferred), or Windows.
* Git
* [Swift](https://www.swift.org/getting-started/#installing-swift)
* Optional
* Xcode and [CocoaPods], to test [CocoaPods] integration
* [Node], to use helper scripts in [package.json](package.json) folder.

### Automated Tests

GitHub action is already setup to run tests on pull requests targeting `main` branch. However, to reduce heavy usage of GitHub runners, run the following commands in your terminal to test:

| Test category | With [Node] | Manually |
| --- | --- | --- |
| SPM integration | Run `npm run test` | Run `swift test` |
| [CocoaPods] integration (Requires Xcode) | Run `npm run pod-lint` | Run `pod lib lint --no-clean --allow-warnings` |

## Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

<ol type='a'>
<li id='cert-a'>
The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
</li>
<li id='cert-b'>
The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
</li>
<li id='cert-c'>
The contribution was provided directly to me by some other person who certified <a href="#cert-a">(a)</a>, <a href="#cert-b">(b)</a> or <a href="#cert-c">(c)</a> and I have not modified it.
</li>
<li id='cert-d'>
I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
</li>
</ol>

[CocoaPods]: https://cocoapods.org/
[Node]: https://nodejs.org/
11 changes: 5 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import CompilerPluginSupport

let macroDeps: [Target.Dependency] = [
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftDiagnostics", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftOperators", package: "swift-syntax"),
.product(name: "SwiftParser", package: "swift-syntax"),
.product(name: "SwiftParserDiagnostics", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
.product(name: "OrderedCollections", package: "swift-collections"),
]
Expand All @@ -21,10 +20,10 @@ let testDeps: [Target.Dependency] = [
let package = Package(
name: "MetaCodable",
platforms: [
.iOS(.v8),
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v9),
.watchOS(.v2),
.tvOS(.v13),
.watchOS(.v6),
.macCatalyst(.v13),
],
products: [
Expand Down
67 changes: 66 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,67 @@
# MetaCodable
Supercharge Swift's Codable implementations with macros meta-programming.

[![API Docs](http://img.shields.io/badge/Read_the-docs-2196f3.svg)](https://swiftylab.github.io/MetaCodable/documentation/metacodable/)
[![Swift Package Manager Compatible](https://img.shields.io/github/v/tag/SwiftyLab/MetaCodable?label=SPM&color=orange)](https://badge.fury.io/gh/SwiftyLab%2FMetaCodable)
[![Swift](https://img.shields.io/badge/Swift-5.9+-orange)](https://img.shields.io/badge/Swift-5-DE5D43)
[![Platforms](https://img.shields.io/badge/Platforms-all-sucess)](https://img.shields.io/badge/Platforms-all-sucess)
[![CI/CD](https://github.com/SwiftyLab/MetaCodable/actions/workflows/main.yml/badge.svg?event=push)](https://github.com/SwiftyLab/MetaCodable/actions/workflows/main.yml)
[![CodeFactor](https://www.codefactor.io/repository/github/swiftylab/metacodable/badge)](https://www.codefactor.io/repository/github/swiftylab/metacodable)
[![codecov](https://codecov.io/gh/SwiftyLab/MetaCodable/branch/main/graph/badge.svg?token=jKxMv5oFeA)](https://codecov.io/gh/SwiftyLab/MetaCodable)
<!-- [![CodeQL](https://github.com/SwiftyLab/MetaCodable/actions/workflows/codeql-analysis.yml/badge.svg?event=schedule)](https://github.com/SwiftyLab/MetaCodable/actions/workflows/codeql-analysis.yml) -->

Supercharge `Swift`'s `Codable` implementations with macros.

## Overview

`MetaCodable` framework exposes custom macros which can be used to generate dynamic `Codable` implementations. The core of the framework is ``Codable()`` macro which generates the implementation aided by data provided with using other macros.


`MetaCodable` aims to supercharge your `Codable` implementations by providing these inbox features:

- Allows custom `CodingKey` value declaration per variable, instead of requiring you to write all the `CodingKey` values with ``CodablePath(_:)`` etc.
- Allows to create flattened model for nested `CodingKey` values with ``CodablePath(_:)`` etc.
- Allows to create composition of multiple `Codable` types with ``CodableCompose()`` etc.
- Allows to provide default value in case of decoding failures with ``CodablePath(default:_:)`` and ``CodableCompose(default:)`` etc.
- Generates member-wise initializer considering the above default value syntax as well.
- Allows to create custom decoding/encoding strategies with ``ExternalHelperCoder``. i.e. ``LossySequenceCoder`` etc.

## Requirements

| Platform | Minimum Swift Version | Installation | Status |
| --- | --- | --- | --- |
| iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+ | 5.9 | Swift Package Manager | Fully Tested |
| Linux | 5.9 | Swift Package Manager | Fully Tested |
| Windows | 5.9 | Swift Package Manager | Fully Tested |

## Installation

### Swift Package Manager

The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.

Once you have your Swift package set up, adding `MetaCodable` as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.

```swift
.package(url: "https://github.com/SwiftyLab/MetaCodable.git", from: "1.0.0"),
```

Then you can add the `MetaCodable` module product as dependency to the `target`s of your choosing, by adding it to the `dependencies` value of your `target`s.

```swift
.product(name: "MetaCodable", package: "MetaCodable"),
```

## Usage

See the full [documentation](https://swiftylab.github.io/MetaCodable/documentation/metacodable/) for API details and articles on sample scenarios.

## Contributing

If you wish to contribute a change, suggest any improvements,
please review our [contribution guide](CONTRIBUTING.md),
check for open [issues](https://github.com/SwiftyLab/MetaCodable/issues), if it is already being worked upon
or open a [pull request](https://github.com/SwiftyLab/MetaCodable/pulls).

## License

`MetaCodable` is released under the MIT license. [See LICENSE](LICENSE) for details.
2 changes: 1 addition & 1 deletion Sources/MetaCodable/MetaCodable.docc/MetaCodable.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Supercharge `Swift`'s `Codable` implementations with macros.

| Platform | Minimum Swift Version | Installation | Status |
| --- | --- | --- | --- |
| iOS 8.0+ / macOS 10.15+ / tvOS 9.0+ / watchOS 2.0+ | 5.9 | CocoaPods, Carthage, Swift Package Manager, Manual | Fully Tested |
| iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+ | 5.9 | Swift Package Manager | Fully Tested |
| Linux | 5.9 | Swift Package Manager | Fully Tested |
| Windows | 5.9 | Swift Package Manager | Fully Tested |

Expand Down
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "MetaCodable",
"version": "1.0.0-alpha.1",
"summary": "Supercharge Swift's Codable implementations with macros.",
"description": "MetaCodable exposes custom macros which can be used to generate dynamic Codable implementations.",
"homepage": "https://github.com/SwiftyLab/MetaCodable",
"license": "MIT",
"author": {
"name": "Soumya Ranjan Mahunt",
"email": "soumya.mahunt@gmail.com",
"url": "https://twitter.com/soumya_mahunt"
},
"repository": {
"type": "git",
"url": "https://github.com/SwiftyLab/MetaCodable.git"
},
"private": true,
"dependencies": {
"swiftylab-ci": "github:SwiftyLab/ci"
},
"scripts": {
"build": "npm exec --package=swiftylab-ci -- build.js",
"test": "npm exec --package=swiftylab-ci -- test.js",
"preview-doc": "npm exec --package=swiftylab-ci -- preview-doc.js MetaCodable",
"build-doc": "npm exec --package=swiftylab-ci -- build-doc.js MetaCodable",
"serve-doc": "npm exec --package=swiftylab-ci -- serve-doc.js MetaCodable"
}
}

0 comments on commit 915d32c

Please sign in to comment.