Skip to content

Commit

Permalink
Initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Jul 23, 2024
0 parents commit 884eb71
Show file tree
Hide file tree
Showing 13 changed files with 1,110 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: ci

on: [push, pull_request]

jobs:
rust:
name: deno_package_json-${{ matrix.os }}
if: |
(github.event_name == 'push' || !startsWith(github.event.pull_request.head.label, 'denoland:'))
&& github.ref_name != 'deno_package_json'
&& !startsWith(github.ref, 'refs/tags/deno/')
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
os: [macOS-latest, ubuntu-latest, windows-2019]

env:
CARGO_INCREMENTAL: 0
GH_ACTIONS: 1
RUST_BACKTRACE: full
RUSTFLAGS: -D warnings

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install Rust
uses: dsherret/rust-toolchain-file@v1

- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Format
if: contains(matrix.os, 'ubuntu')
run: |
cargo fmt -- --check
- name: Cargo test
run: cargo test --locked --release --all-features --bins --tests --examples

- name: Lint
if: contains(matrix.os, 'ubuntu')
run: |
cargo clippy --locked --all-features --all-targets -- -D clippy::all
- name: Cargo publish
if: |
contains(matrix.os, 'ubuntu') &&
github.repository == 'denoland/deno_package_json' &&
startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: release

on:
workflow_dispatch:
inputs:
releaseKind:
description: "Kind of release"
default: "minor"
type: choice
options:
- patch
- minor
required: true

jobs:
rust:
name: release
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
token: ${{ secrets.DENOBOT_PAT }}

- uses: denoland/setup-deno@v1
- uses: dtolnay/rust-toolchain@stable

- name: Tag and release
env:
GITHUB_TOKEN: ${{ secrets.DENOBOT_PAT }}
GH_WORKFLOW_ACTOR: ${{ github.actor }}
run: |
git config user.email "denobot@users.noreply.github.com"
git config user.name "denobot"
deno run -A https://raw.githubusercontent.com/denoland/automation/0.15.0/tasks/publish_release.ts --${{github.event.inputs.releaseKind}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
.vscode
3 changes: 3 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
max_width = 80
tab_spaces = 2
edition = "2021"
250 changes: 250 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "deno_package_json"
description = "package.json implementation for the Deno CLI"
version = "0.0.1"
edition = "2021"
authors = ["the Deno authors"]
license = "MIT"
repository = "https://github.com/denoland/deno_package_json"

[features]
sync = []

[dependencies]
indexmap = { version = "2", features = ["serde"] }
serde = { version = "1.0.149", features = ["derive"] }
serde_json = "1.0.85"
url = { version = "2.3.1" }
thiserror = "1.0.61"
deno_semver = "0.5.6"

[dev-dependencies]
pretty_assertions = "1.4.0"
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright 2018-2024 the Deno authors

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.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `deno_package_json`

The package.json implementation used in the Deno CLI.
Loading

0 comments on commit 884eb71

Please sign in to comment.