From e9f099564a5c5d73041dfed3a0d2e1713e3f5670 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Mon, 7 Oct 2024 19:31:49 +1100 Subject: [PATCH] docs: update for JSR --- Cargo.lock | 2 +- Cargo.toml | 2 +- LICENSE | 2 +- README.md | 24 +++++++++++------------- deno.json | 2 +- lib/nocuous.generated.js | 2 +- lib/nocuous_bg.wasm | Bin 2756853 -> 2756853 bytes mod.ts | 6 ++---- 8 files changed, 18 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d7a617..40cc6a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -429,7 +429,7 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nocuous" -version = "1.0.3" +version = "1.1.0" dependencies = [ "anyhow", "deno_ast", diff --git a/Cargo.toml b/Cargo.toml index 7f92a76..3d22242 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nocuous" -version = "1.0.3" +version = "1.1.0" edition = "2021" description = "Wasm bindings to peform static analysis of JavaScript and TypeScript code" authors = ["Kitson P. Kelly"] diff --git a/LICENSE b/LICENSE index 40505fe..c7a4bdc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2019 - 2022 Kitson P. Kelly +Copyright 2019 - 2024 Kitson P. Kelly 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 diff --git a/README.md b/README.md index a2882a1..1f9a873 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,23 @@ # nocuous ![CI](https://github.com/h-o-t/nocuous/workflows/ci/badge.svg) -[![npm version](https://img.shields.io/npm/v/nocuous)](https://www.npmjs.com/package/nocuous) +[![jsr.io/@higher-order-testing/nocuous](https://jsr.io/badges/@higher-order-testing/nocuous)](https://jsr.io/@higher-order-testing/nocuous) +[![jsr.io/@higher-order-testing/nocuous score](https://jsr.io/badges/@higher-order-testing/nocuous/score)](https://jsr.io/@higher-order-testing/nocuous) A static code analysis tool for JavaScript and TypeScript. ## Installing the CLI If you want to install the CLI, you would need to have Deno -[installed first](https://deno.land/manual@v1.28.2/getting_started/installation) +[installed first](https://docs.deno.com/runtime/getting_started/installation/) and then on the command line, you would want to run the following command: ```shell -$ deno install --name nocuous --allow-read --allow-net --allow-hrtime --import-map https://deno.land/x/nocuous/import_map.json -f https://deno.land/x/nocuous/cli.ts +$ deno install --name nocuous --allow-read --allow-net -f jsr:@higher-order-testing/nocuous/cli ``` You can also "pin" to a specific version by using `nocuous@{version}` instead, -for example `https://deno.land/nocuous@1.0.0/import_map.json` and -`https://deno.land/nocuous@1.0.0/cli.ts`. +for example `jsr:@higher-order-testing/nocuous@1.1.0/cli`. The CLI comes with integrated help which can be accessed via the `--help` flag. @@ -28,21 +28,15 @@ into your code. For example the following will analyze the Deno std assertion library and its dependencies resolving with a map of statistics: ```ts -import { instantiate, stats } from "https://deno.land/x/nocuous/mod.ts"; +import { instantiate, stats } from "jsr:@higher-order-testing/nocuous"; await instantiate(); -const results = await stats( - new URL("https://deno.land/std/testing/asserts.ts"), -); +const results = await stats(new URL("https://jsr.io/@std/assert/1.0.6/mod.ts")); console.log(results); ``` -It is recommended though that you "pin" to a specific version of the library, -for example to import from version _1.0.0_ you would want to import from -`https://deno.land/x/nocuous@1.0.0/mod.ts`. - ## Architecture The tool uses [swc](https://swc.rs/) as a Rust library to parse code and then @@ -69,3 +63,7 @@ to TypeScript/JavaScript there are some adaptation that is required: | Cyclomatic Complexity | CC | The cyclomatic complexity for a function or method | 10 | | Binary Expression Complexity | BEC | How complex a binary expression is (e.g. how many `&&` and ` | | | Missing Switch Default | MSD | Any `switch` statements that are missing the `default` case. | 1 | + +--- + +Copyright 2019 - 2024 Kitson P. Kelly. MIT License. diff --git a/deno.json b/deno.json index c62c471..9fc77c1 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@higher-order-testing/nocuous", - "version": "1.1.0-alpha.1", + "version": "1.1.0", "exports": { ".": "./mod.ts", "./cli": "./cli.ts" diff --git a/lib/nocuous.generated.js b/lib/nocuous.generated.js index fc1aa93..91a36d2 100644 --- a/lib/nocuous.generated.js +++ b/lib/nocuous.generated.js @@ -4,7 +4,7 @@ // deno-fmt-ignore-file /// -// source-hash: 43cfda03f376967255010c5fde052a546c1224bb +// source-hash: 3c5dc89a98a1e2719fce7ed1ed5eeae612ebcfea let wasm; const heap = new Array(128).fill(undefined); diff --git a/lib/nocuous_bg.wasm b/lib/nocuous_bg.wasm index 3a39992466c5637913a1da63c94422d578e52bae..d065ccc720ab5a111def03425a353a7967dd3e8a 100644 GIT binary patch delta 4323 zcmaJ^d3Y36w$JVEY+aqCQ{B1M)z;Ek1(67XY*9&!AB6FtqreP^vb?7}K6D&Z9xyA5 zVi*O&njelRkcliwI^ATekc5ypK0n?_0yxgF3lf%ql9fC`(7aRKpfZ2F{=QT9?909P zRGseIzKit{1V^a0Ho45RVT^julFjk&#_!^9NA8eL$Nilzvlk`y^VQN@wyOzsw%LBq zCiel`QO5=OLusp2=v{5!=e{6s58*q-?`*BY1^F)_D(LA=yeJ<_*d~S7VrkE9PLb5g z5At2oMR%2_((@_bEuDAQcv|@1c!_kuom%bLl-TC^Kz>tb<7Yfqgi7&>t2D7uD0h~7 z+7sFnE+<@m;~O>q8d+a4A)dYn;%o@BL#HZv+elC@*U3sLh~yCJ<8 z^-v-U=1*K0MG#F8Ll8?~ClCl61aSoM1PKIAW8%WZ_qq!EG&gR|5qGk4DE?1z7S6}J zM&QExqSu%_S3J(xTgaS8>;k{2v2%uhp4gX)&AUYnO>4xrD1q?>BwZg6N8pnZG0k9W z#Ul*+_K0~nUQAk}){9Rddz+Yw-!>~Q>|HMk@cYFi4@C~oYg;^ehr zijh_-f?-`T`PZy^D0g)BXt5YrA41-3 z`|Ei&BCE-5Sqbgqw?Em(gSb>eAp+GD;=NLC$JPq|20jc>oY|EWhXpClptx}5x#ra$ zj7fe9K^Vu9dL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* zv0-6h9wHmjIHDiR;|FzZc4yeb#7`iaNM!Pph|C`wq{%^PP{!O2eO9#T`ctAwsP51o z3X0jLnA_W-6Zwb|iIR-oj^yXou@vK%%TgYgh6xvRXRf~?g=i>ID$y{aG{fI8eEyuj E0>1zW7ytkO diff --git a/mod.ts b/mod.ts index b8d6f81..9745c7f 100644 --- a/mod.ts +++ b/mod.ts @@ -4,7 +4,7 @@ * * ### Example * - * Fetches the `std/asserts` library for Deno and its dependencies and returns + * Fetches the `@std/assert` library for Deno and its dependencies and returns * a map of the code toxicity statistics. * * ```ts @@ -12,9 +12,7 @@ * * await instantiate(); * - * const results = await stats( - * new URL("https://jsr.io/@std/assert/1.0.6/equal.ts"), - * ); + * const results = await stats(new URL("https://jsr.io/@std/assert/1.0.6/mod.ts")); * * console.log(results); * ```