From 3d83579417dec566596b6b03137cf178b9766697 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 14 May 2022 14:02:50 +0200 Subject: [PATCH] add example npm project --- Cargo.lock | 82 ++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 3 ++ src/main.rs | 4 ++- testing/.gitignore | 3 ++ testing/index.js | 6 ++++ testing/package.json | 15 ++++++++ 6 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 testing/.gitignore create mode 100644 testing/index.js create mode 100644 testing/package.json diff --git a/Cargo.lock b/Cargo.lock index 0d95e72..faa541c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -72,8 +72,15 @@ checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" dependencies = [ "autocfg", "hashbrown", + "serde", ] +[[package]] +name = "itoa" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + [[package]] name = "libc" version = "0.2.125" @@ -85,6 +92,9 @@ name = "node-package-manager" version = "0.1.0" dependencies = [ "clap", + "indexmap", + "serde", + "serde_json", ] [[package]] @@ -93,12 +103,78 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +[[package]] +name = "proc-macro2" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "ryu" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" + +[[package]] +name = "serde" +version = "1.0.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.137" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +dependencies = [ + "itoa", + "ryu", + "serde", +] + [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "syn" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a07e33e919ebcd69113d5be0e4d70c5707004ff45188910106854f38b960df4a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "termcolor" version = "1.1.3" @@ -114,6 +190,12 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +[[package]] +name = "unicode-xid" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 5df44d5..3c7568c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,6 @@ edition = "2021" [dependencies] clap = "3.1.18" +indexmap = { version = "1.8.1", features = ["serde"] } +serde = { version = "1.0.137", features = ["derive"] } +serde_json = "1.0.81" diff --git a/src/main.rs b/src/main.rs index e7a11a9..37f8994 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +mod manifest; + fn main() { - println!("Hello, world!"); + let manifest = "package.json"; } diff --git a/testing/.gitignore b/testing/.gitignore new file mode 100644 index 0000000..960be9a --- /dev/null +++ b/testing/.gitignore @@ -0,0 +1,3 @@ +node_modules +package-lock.json +yarn.lock \ No newline at end of file diff --git a/testing/index.js b/testing/index.js new file mode 100644 index 0000000..1ac871f --- /dev/null +++ b/testing/index.js @@ -0,0 +1,6 @@ +const isEven = require('is-even'); +const isOdd = require('is-odd'); + +const isEvenOrOdd = (x) => isEven(x) || isOdd(x); + +console.log(isEvenOrOdd(5)); \ No newline at end of file diff --git a/testing/package.json b/testing/package.json new file mode 100644 index 0000000..1559835 --- /dev/null +++ b/testing/package.json @@ -0,0 +1,15 @@ +{ + "name": "testing", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "is-even": "^1.0.0", + "is-odd": "^3.0.1" + } +}