@adobe/design-data 0.1.2
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/README.md +52 -0
- package/bin/design-data.js +68 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# [**@adobe/design-data**](https://github.com/adobe/design-data)
|
|
2
|
+
|
|
3
|
+
CLI tool for working with [Adobe Spectrum](https://spectrum.adobe.com) design tokens and component schemas.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g @adobe/design-data
|
|
9
|
+
# or use without installing:
|
|
10
|
+
npx @adobe/design-data <command>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires Node.js ≥ 20.12. No Rust toolchain needed — the CLI binary is included via platform-specific optional dependencies.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
# Get a structural overview of the Spectrum dataset (great for AI agent sessions)
|
|
19
|
+
design-data primer --format json
|
|
20
|
+
|
|
21
|
+
# Query tokens by name or property
|
|
22
|
+
design-data query "property=color*"
|
|
23
|
+
|
|
24
|
+
# Get AI-powered token suggestions for a given intent
|
|
25
|
+
design-data suggest "primary background color"
|
|
26
|
+
|
|
27
|
+
# Resolve a token's value for a given mode-set context
|
|
28
|
+
design-data resolve color-background-layer-1 --color-scheme light
|
|
29
|
+
|
|
30
|
+
# Print a component schema
|
|
31
|
+
design-data component button
|
|
32
|
+
|
|
33
|
+
# Validate a design-data directory
|
|
34
|
+
design-data validate ./my-tokens
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
Drop a `.design-data.toml` in your project root to point at a specific dataset version:
|
|
40
|
+
|
|
41
|
+
```toml
|
|
42
|
+
[source]
|
|
43
|
+
type = "github"
|
|
44
|
+
repo = "adobe/spectrum-design-data"
|
|
45
|
+
tag = "@adobe/spectrum-tokens@14.11.0"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Without configuration, the embedded Spectrum snapshot is used automatically (offline, zero-setup).
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
Apache-2.0 — see the [project repository](https://github.com/adobe/spectrum-design-data) for details.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
// This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
// of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
//
|
|
7
|
+
// Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
// OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
// governing permissions and limitations under the License.
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* design-data launcher (esbuild/biome pattern).
|
|
14
|
+
*
|
|
15
|
+
* npm installs only the matching @adobe/design-data-{os}-{cpu} package via
|
|
16
|
+
* optionalDependencies + os/cpu fields. This script resolves the right binary
|
|
17
|
+
* path and execs it, forwarding all arguments and stdio transparently.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { execFileSync } from "child_process";
|
|
21
|
+
import { createRequire } from "module";
|
|
22
|
+
|
|
23
|
+
const require = createRequire(import.meta.url);
|
|
24
|
+
|
|
25
|
+
/** Map of `${process.platform}-${process.arch}` → platform package name. */
|
|
26
|
+
const PLATFORM_PACKAGES = {
|
|
27
|
+
"darwin-arm64": "@adobe/design-data-darwin-arm64",
|
|
28
|
+
"darwin-x64": "@adobe/design-data-darwin-x64",
|
|
29
|
+
"linux-x64": "@adobe/design-data-linux-x64",
|
|
30
|
+
"win32-x64": "@adobe/design-data-win32-x64",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
34
|
+
const platformPkg = PLATFORM_PACKAGES[platformKey];
|
|
35
|
+
|
|
36
|
+
if (!platformPkg) {
|
|
37
|
+
process.stderr.write(
|
|
38
|
+
`design-data: unsupported platform "${platformKey}".\n` +
|
|
39
|
+
`Supported platforms: ${Object.keys(PLATFORM_PACKAGES).join(", ")}\n`,
|
|
40
|
+
);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const binaryName = `design-data${process.platform === "win32" ? ".exe" : ""}`;
|
|
45
|
+
|
|
46
|
+
let binaryPath;
|
|
47
|
+
try {
|
|
48
|
+
binaryPath = require.resolve(`${platformPkg}/bin/${binaryName}`);
|
|
49
|
+
} catch {
|
|
50
|
+
process.stderr.write(
|
|
51
|
+
`design-data: platform package "${platformPkg}" is not installed.\n` +
|
|
52
|
+
`Try: npm install ${platformPkg}\n` +
|
|
53
|
+
`Or reinstall @adobe/design-data to let npm pick the right package automatically.\n`,
|
|
54
|
+
);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
execFileSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
|
60
|
+
} catch (/** @type {any} */ err) {
|
|
61
|
+
if (err?.code === "EACCES") {
|
|
62
|
+
process.stderr.write(
|
|
63
|
+
`design-data: permission denied executing "${binaryPath}".\n` +
|
|
64
|
+
`Try: chmod +x "${binaryPath}"\n`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
process.exit(err?.status ?? 1);
|
|
68
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adobe/design-data",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "design-data CLI — validate and inspect Spectrum design data",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"design-data": "bin/design-data.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/design-data.js",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@adobe/design-data-darwin-arm64": "workspace:*",
|
|
15
|
+
"@adobe/design-data-darwin-x64": "workspace:*",
|
|
16
|
+
"@adobe/design-data-linux-x64": "workspace:*",
|
|
17
|
+
"@adobe/design-data-win32-x64": "workspace:*"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20.12.0"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/adobe/spectrum-design-data.git",
|
|
25
|
+
"directory": "sdk/cli"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/adobe/spectrum-design-data/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/adobe/spectrum-design-data/tree/main/sdk/cli#readme",
|
|
31
|
+
"keywords": [
|
|
32
|
+
"spectrum",
|
|
33
|
+
"design-system",
|
|
34
|
+
"design-tokens",
|
|
35
|
+
"cli"
|
|
36
|
+
],
|
|
37
|
+
"author": "Adobe",
|
|
38
|
+
"license": "Apache-2.0",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"registry": "https://registry.npmjs.org/",
|
|
42
|
+
"provenance": true
|
|
43
|
+
}
|
|
44
|
+
}
|