From 1e59523f7a148a2acd7e6900c290c9008f67cf98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Djk=C3=A1=C5=A5o?= Date: Tue, 27 Feb 2024 20:05:09 +0100 Subject: [PATCH] Prepare for publishing --- .github/rust.yml | 35 ++++++++++ FSL-1.1-MIT.md | 110 ++++++++++++++++++++++++++++++ FUNDING.yml | 1 + README.md | 41 +++++++++++ saleor-app-template/.dockerignore | 5 ++ saleor-app-template/Dockerfile | 19 ++++++ 6 files changed, 211 insertions(+) create mode 100644 .github/rust.yml create mode 100644 FSL-1.1-MIT.md create mode 100644 FUNDING.yml create mode 100644 README.md create mode 100644 saleor-app-template/.dockerignore create mode 100644 saleor-app-template/Dockerfile diff --git a/.github/rust.yml b/.github/rust.yml new file mode 100644 index 0000000..b76e204 --- /dev/null +++ b/.github/rust.yml @@ -0,0 +1,35 @@ +name: Rust + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + - name: Run Linter + run: cargo fmt -- --check && cargo clippy --all-targets --all-features -- -D warnings + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose diff --git a/FSL-1.1-MIT.md b/FSL-1.1-MIT.md new file mode 100644 index 0000000..a265a0d --- /dev/null +++ b/FSL-1.1-MIT.md @@ -0,0 +1,110 @@ +# Functional Source License, Version 1.1, MIT Future License + +## Abbreviation + +FSL-1.1-MIT + +## Notice + +Copyright 2024 Radovan Katrenčik + +## Terms and Conditions + +### Licensor ("We") + +The party offering the Software under these Terms and Conditions. + +### The Software + +The "Software" is each version of the software that we make available under +these Terms and Conditions, as indicated by our inclusion of these Terms and +Conditions with the Software. + +### License Grant + +Subject to your compliance with this License Grant and the Patents, +Redistribution and Trademark clauses below, we hereby grant you the right to +use, copy, modify, create derivative works, publicly perform, publicly display +and redistribute the Software for any Permitted Purpose identified below. + +### Permitted Purpose + +A Permitted Purpose is any purpose other than a Competing Use. A Competing Use +means making the Software available to others in a commercial product or +service that: + +1. substitutes for the Software; + +2. substitutes for any other product or service we offer using the Software + that exists as of the date we make the Software available; or + +3. offers the same or substantially similar functionality as the Software. + +Permitted Purposes specifically include using the Software: + +1. for your internal use and access; + +2. for non-commercial education; + +3. for non-commercial research; and + +4. in connection with professional services that you provide to a licensee + using the Software in accordance with these Terms and Conditions. + +### Patents + +To the extent your use for a Permitted Purpose would necessarily infringe our +patents, the license grant above includes a license under our patents. If you +make a claim against any party that the Software infringes or contributes to +the infringement of any patent, then your patent license to the Software ends +immediately. + +### Redistribution + +The Terms and Conditions apply to all copies, modifications and derivatives of +the Software. + +If you redistribute any copies, modifications or derivatives of the Software, +you must include a copy of or a link to these Terms and Conditions and not +remove any copyright notices provided in or with the Software. + +### Disclaimer + +THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR +PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT. + +IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE +SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, +EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE. + +### Trademarks + +Except for displaying the License Details and identifying us as the origin of +the Software, you have no right under these Terms and Conditions to use our +trademarks, trade names, service marks or product names. + +## Grant of Future License + +We hereby irrevocably grant you an additional license to use the Software under +the MIT license that is effective on the second anniversary of the date we make +the Software available. On or after that date, you may use the Software under +the MIT license, in which case the following will apply: + +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/FUNDING.yml b/FUNDING.yml new file mode 100644 index 0000000..6962ed9 --- /dev/null +++ b/FUNDING.yml @@ -0,0 +1 @@ +ko_fi: djkato diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e18d31 --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +Buy Me a Coffee at ko-fi.com + +This repo contains the following main components: + +| Crate | Description | +| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | +| [**saleor-app-sdk**](https://crates.io/crates/saleor-app-sdk) | Types and utilities for making Saleor Apps | +| [**saleor-app-template**](https://github.com/djkato/saleor-app-template-rs/tree/master/saleor-app-template) | Simple template for making Saleor apps using axum | +| [**saleor-app-sitemap**](https://crates.io/crates/saleor-app-sitemap) | Saleor App for keeping sitemap.xml uptodate | + +# Using this repo + +To use, you need to have [Rust environment prepared](https://rustup.rs/). +Every folder represents a different workspace. To add a new lib, do `cargo new --lib` or `cargo new ` for binary apps. It should appear as a new member under root `Cargo.toml` + +# Unofficial Saleor App SDK + +SDK for building [Saleor Apps](https://github.com/saleor/apps) +to use in your project outside this repo: `cargo add saleor-app-sdk` +to use in your project inside this repo, create a new workspace member and add `saleor-app-sdk.workspace = true` to the members `Cargo.toml` + +# Unofficial Saleor App Template + +## Creating a new Saleor App from template + +If using the `saleor-app-template`, create a new workspace member `cargo new `, then `cp saleor-app-template/* `. + +## Adding new dependencies + +Workspace dependencies need to be managed manually. If you wanna add a new dependency to a single member do `cargo add `. +If you want to use a shared dependency, add it to the root level `Cargo.toml`, +then inside your member `Cargo.toml`add it under depencency like: ` = { workspace = true, features = [ "..." ] }`. + +## License + +Each workspace member has it's licensed in it's own directory. + +### TL;DR: + +- saleor-app-sdk, saleor-app-template and the root structure fall under either MIT or Apache 2.0 at your convenience. +- Any other workspace members fall under `FSL-1.1-MIT.md`. If you want to use my apps in commercial environment, each app costs 10€ (or voluntarily more). Upon payment/donation you can automatically use the given app as if it had MIT-1 or Apache 2.0. diff --git a/saleor-app-template/.dockerignore b/saleor-app-template/.dockerignore new file mode 100644 index 0000000..3645101 --- /dev/null +++ b/saleor-app-template/.dockerignore @@ -0,0 +1,5 @@ +target +Dockerfile +.dockerignore +.git +.gitignore diff --git a/saleor-app-template/Dockerfile b/saleor-app-template/Dockerfile new file mode 100644 index 0000000..422a68f --- /dev/null +++ b/saleor-app-template/Dockerfile @@ -0,0 +1,19 @@ +FROM lukemathwalker/cargo-chef:latest as chef +WORKDIR /app + +FROM chef AS planner +COPY ./Cargo.toml ./Cargo.lock ./ +COPY ./src ./src +RUN cargo chef prepare + +FROM chef AS builder +COPY --from=planner /app/recipe.json . +RUN cargo chef cook --release +COPY . . +RUN cargo build --release +RUN mv ./target/release/saleor-app-template ./app + +FROM debian:stable-slim AS runtime +WORKDIR /app +COPY --from=builder /app/app /usr/local/bin/ +ENTRYPOINT ["/usr/local/bin/app"]