dslinter 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.0.11
4
+
5
+ [compare changes](https://github.com/jrmybtlr/DSLinter/compare/v0.0.10...v0.0.11)
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - Update repository references from DSLint to DSLinter ([2dbae8d](https://github.com/jrmybtlr/DSLinter/commit/2dbae8d))
10
+
11
+ ### ❤️ Contributors
12
+
13
+ - Jeremy Butler <jeremy.butler@laravel.com>
14
+
3
15
  ## v0.0.10
4
16
 
5
17
  [compare changes](https://github.com/jrmybtlr/DSLint/compare/v0.0.9...v0.0.10)
package/README.md CHANGED
@@ -25,7 +25,7 @@ The **`dslinter` binary** runs the **`dslint`** scanner with the same flags as t
25
25
 
26
26
  On **`npm install dslinter`**, a **`postinstall`** script tries to download a **prebuilt `dslint`** for your OS/arch from this repo’s **GitHub Releases**, using the **same tag as the npm version** (for example npm `dslinter@0.0.6` → release **`v0.0.6`** and assets like `dslint-x86_64-unknown-linux-gnu`). The binary is stored under `node_modules/dslinter/vendor/` and `dslinter` / `npx dslinter` prefer it over `PATH`.
27
27
 
28
- **Release workflow:** push git tag `v*` (after bumping the npm version) so [.github/workflows/release-dslint-binaries.yml](https://github.com/jrmybtlr/DSLint/blob/main/.github/workflows/release-dslint-binaries.yml) uploads the platform binaries, **then** publish `dslinter` to npm (or publish after the workflow finishes so installs resolve the assets).
28
+ **Release workflow:** push git tag `v*` (after bumping the npm version) so [.github/workflows/release-dslint-binaries.yml](https://github.com/jrmybtlr/DSLinter/blob/main/.github/workflows/release-dslint-binaries.yml) uploads the platform binaries, **then** publish `dslinter` to npm (or publish after the workflow finishes so installs resolve the assets).
29
29
 
30
30
  Environment variables:
31
31
 
@@ -33,7 +33,7 @@ Environment variables:
33
33
  |----------|---------|
34
34
  | `DSLINT_SKIP_DOWNLOAD=1` | Skip postinstall download (air-gapped / you only use `PATH`). |
35
35
  | `DSLINT_RELEASE_TAG` | Override release tag (default `v` + `dslinter` version from `package.json`). |
36
- | `DSLINT_GITHUB_REPO` | Override `owner/repo` for downloads (default `jrmybtlr/DSLint`). |
36
+ | `DSLINT_GITHUB_REPO` | Override `owner/repo` for downloads (default `jrmybtlr/DSLinter`). |
37
37
 
38
38
  ### How this differs from `oxlint`
39
39
 
@@ -45,7 +45,7 @@ Environment variables:
45
45
 
46
46
  The crates.io crate **`dslint`** (v0.0.x) is a **different project** (design-file linting). It is **not** this design-system scanner. Installing it will break `npx dslinter` if it ends up on your `PATH`.
47
47
 
48
- Use **`cargo install --git https://github.com/jrmybtlr/DSLint dslinter --locked`** or set **`DSLINT_BIN`** to a local `target/release/dslinter` build.
48
+ Use **`cargo install --git https://github.com/jrmybtlr/DSLinter dslinter --locked`** or set **`DSLINT_BIN`** to a local `target/release/dslinter` build.
49
49
 
50
50
  ### If there is no matching release asset yet
51
51
 
@@ -59,7 +59,7 @@ npx dslinter /path/to/repo --json -o dslint-report.json
59
59
  |--------------|-------------------------|
60
60
  | **npm + GitHub Releases** | Default: download when release `vX.Y.Z` includes your platform asset. |
61
61
  | **GitHub Releases** | Manual download of `dslinter-*` from the release; run directly or set `DSLINT_BIN`. |
62
- | **From source** | `cargo install --git https://github.com/jrmybtlr/DSLint dslinter --locked` (not `cargo install dslint`). |
62
+ | **From source** | `cargo install --git https://github.com/jrmybtlr/DSLinter dslinter --locked` (not `cargo install dslint`). |
63
63
 
64
64
  Typical usage:
65
65
 
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "dslinter",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "DSLinter dashboard UI: playground shell, token wall, and governance panels (consumes dslint-report.json).",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/jrmybtlr/DSLint.git",
9
+ "url": "https://github.com/jrmybtlr/DSLinter.git",
10
10
  "directory": "packages/dashboard"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/jrmybtlr/DSLint/issues"
13
+ "url": "https://github.com/jrmybtlr/DSLinter/issues"
14
14
  },
15
- "homepage": "https://github.com/jrmybtlr/DSLint#readme",
15
+ "homepage": "https://github.com/jrmybtlr/DSLinter#readme",
16
16
  "keywords": [
17
17
  "dslinter",
18
18
  "design-system",
@@ -7,6 +7,7 @@ import { chmod, mkdir, stat } from "node:fs/promises";
7
7
  import { dirname, join } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import {
10
+ githubRepoFromPackage,
10
11
  releaseAssetBaseName,
11
12
  vendorBinaryPath,
12
13
  } from "./resolve-dslint-binary.mjs";
@@ -36,12 +37,14 @@ function releaseTag(version) {
36
37
  return `v${version}`;
37
38
  }
38
39
 
39
- function releaseRepo() {
40
- return process.env.DSLINT_GITHUB_REPO?.trim() || "jrmybtlr/DSLint";
40
+ function releaseRepo(packageRoot) {
41
+ const override = process.env.DSLINT_GITHUB_REPO?.trim();
42
+ if (override) return override;
43
+ return githubRepoFromPackage(packageRoot);
41
44
  }
42
45
 
43
- function assetUrl(tag, asset) {
44
- return `https://github.com/${releaseRepo()}/releases/download/${tag}/${asset}`;
46
+ function assetUrl(packageRoot, tag, asset) {
47
+ return `https://github.com/${releaseRepo(packageRoot)}/releases/download/${tag}/${asset}`;
45
48
  }
46
49
 
47
50
  /**
@@ -79,7 +82,7 @@ export async function ensureDslintBinary(packageRoot = defaultPackageRoot, opts
79
82
  const tmp = `${dest}.part`;
80
83
 
81
84
  for (const tag of tagsToTry) {
82
- const url = assetUrl(tag, asset);
85
+ const url = assetUrl(packageRoot, tag, asset);
83
86
  try {
84
87
  const res = await fetch(url, { redirect: "follow" });
85
88
  if (res.status === 404) continue;
@@ -16,10 +16,10 @@ To run the design-system scanner:
16
16
 
17
17
  1. Re-run after a GitHub release exists for v${version} (prebuilt download), or
18
18
  2. Build from this repo and point at it:
19
- cargo install --git https://github.com/jrmybtlr/DSLint dslinter --locked
19
+ cargo install --git https://github.com/jrmybtlr/DSLinter dslinter --locked
20
20
  export DSLINT_BIN="$(command -v dslinter)"
21
21
  npx dslinter ...
22
22
  3. Or set DSLINT_BIN to your local target/release/dslinter
23
23
 
24
- Releases: https://github.com/jrmybtlr/DSLint/releases
24
+ Releases: https://github.com/jrmybtlr/DSLinter/releases
25
25
  `);
@@ -1,8 +1,38 @@
1
+ import { readFileSync } from "node:fs";
1
2
  import { join } from "node:path";
2
3
 
3
4
  /** CLI binary name (avoids collision with unrelated `dslint` on crates.io). */
4
5
  export const CLI_BINARY_NAME = "dslinter";
5
6
 
7
+ /** Fallback when package.json has no parseable `repository` field. */
8
+ export const DEFAULT_GITHUB_REPO = "jrmybtlr/DSLinter";
9
+
10
+ /**
11
+ * @param {string | { type?: string; url?: string } | undefined} repository
12
+ * @returns {string | null} `owner/repo`
13
+ */
14
+ export function parseGitHubRepo(repository) {
15
+ if (!repository) return null;
16
+ const url = typeof repository === "string" ? repository : repository.url;
17
+ if (!url) return null;
18
+ const m = String(url).match(/github\.com[/:]([^/]+)\/([^/.]+?)(?:\.git)?\/?$/i);
19
+ return m ? `${m[1]}/${m[2]}` : null;
20
+ }
21
+
22
+ /**
23
+ * @param {string} packageRoot
24
+ */
25
+ export function githubRepoFromPackage(packageRoot) {
26
+ try {
27
+ const pkg = JSON.parse(
28
+ readFileSync(join(packageRoot, "package.json"), "utf8"),
29
+ );
30
+ return parseGitHubRepo(pkg.repository) ?? DEFAULT_GITHUB_REPO;
31
+ } catch {
32
+ return DEFAULT_GITHUB_REPO;
33
+ }
34
+ }
35
+
6
36
  /**
7
37
  * Maps the current OS/arch to the GitHub release asset basename (must match CI upload names).
8
38
  * @param {NodeJS.Process} [proc]
@@ -2,6 +2,8 @@ import { join } from "node:path";
2
2
  import { describe, expect, it } from "vitest";
3
3
  import {
4
4
  CLI_BINARY_NAME,
5
+ DEFAULT_GITHUB_REPO,
6
+ parseGitHubRepo,
5
7
  releaseAssetBaseName,
6
8
  vendorBinaryPath,
7
9
  } from "../scripts/resolve-dslint-binary.mjs";
@@ -10,6 +12,27 @@ function proc(platform: string, arch: string): NodeJS.Process {
10
12
  return { platform, arch } as NodeJS.Process;
11
13
  }
12
14
 
15
+ describe("parseGitHubRepo", () => {
16
+ it("parses https repository url", () => {
17
+ expect(
18
+ parseGitHubRepo("https://github.com/jrmybtlr/DSLinter.git"),
19
+ ).toBe("jrmybtlr/DSLinter");
20
+ });
21
+
22
+ it("parses repository object", () => {
23
+ expect(
24
+ parseGitHubRepo({
25
+ type: "git",
26
+ url: "git+https://github.com/jrmybtlr/DSLinter.git",
27
+ }),
28
+ ).toBe("jrmybtlr/DSLinter");
29
+ });
30
+
31
+ it("defaults constant points at DSLinter", () => {
32
+ expect(DEFAULT_GITHUB_REPO).toBe("jrmybtlr/DSLinter");
33
+ });
34
+ });
35
+
13
36
  describe("releaseAssetBaseName", () => {
14
37
  it("maps darwin arm64", () => {
15
38
  expect(releaseAssetBaseName(proc("darwin", "arm64"))).toBe(