@stratixlabs/core 1.7.2 → 1.8.0
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 +2 -2
- package/bin/stratix.js +9 -5
- package/package.json +6 -3
- package/scripts/figma-sync.js +22 -0
- package/scripts/generate-tokens.js +3 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Stratix is a framework-agnostic **design infrastructure** for tokens, schemas, a
|
|
|
4
4
|
|
|
5
5
|
Unlike a UI library that couples design to components, Stratix provides the low-level *definitions* (design tokens and their canonical graph) that drive the UI, ensuring design intent is preserved from design tools to production code—even as frameworks change.
|
|
6
6
|
|
|
7
|
-
**[Documentation](https://github.
|
|
7
|
+
**[Documentation](https://mikaelcarrara.github.io/stratix)**
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -187,7 +187,7 @@ Stratix's architecture is defined by a few key artifacts that enable its semanti
|
|
|
187
187
|
- **JSON Schema**: A strict schema for `tokens.json` that enables validation, IDE autocompletion, and automated CI checks.
|
|
188
188
|
- **`stratix.d.ts`**: TypeScript declarations for type-safe token consumption in modern development workflows.
|
|
189
189
|
|
|
190
|
-
See the [**
|
|
190
|
+
See the [**SPECIFICATION.md**](./SPECIFICATION.md) and [**ARCHITECTURE.md**](./ARCHITECTURE.md) for more details on our architectural evolution.
|
|
191
191
|
|
|
192
192
|
---
|
|
193
193
|
|
package/bin/stratix.js
CHANGED
|
@@ -495,27 +495,31 @@ if (command === 'generate') {
|
|
|
495
495
|
|
|
496
496
|
if (command === 'figma') {
|
|
497
497
|
const subcommand = args[1];
|
|
498
|
+
const scriptPath = path.join(__dirname, '../scripts/figma-sync.js');
|
|
498
499
|
|
|
499
|
-
if (!subcommand || subcommand !== 'apply-preview') {
|
|
500
|
+
if (!subcommand || (subcommand !== 'apply-preview' && subcommand !== 'push-preview')) {
|
|
500
501
|
console.log('Usage: stratix figma <subcommand>');
|
|
501
502
|
console.log('Subcommands:');
|
|
503
|
+
console.log(' push-preview Generate figma-push-preview.json from tokens.json');
|
|
502
504
|
console.log(' apply-preview Apply figma-push-preview.json to Figma via Variables REST API');
|
|
503
505
|
process.exit(1);
|
|
504
506
|
}
|
|
505
507
|
|
|
506
|
-
const scriptPath = path.join(__dirname, '../scripts/figma-sync.js');
|
|
507
|
-
|
|
508
508
|
if (!fs.existsSync(scriptPath)) {
|
|
509
509
|
console.error('❌ Could not find Figma script at:', scriptPath);
|
|
510
510
|
process.exit(1);
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
-
process.env.FIGMA_SYNC_DIRECTION = 'apply';
|
|
513
|
+
process.env.FIGMA_SYNC_DIRECTION = subcommand === 'push-preview' ? 'push' : 'apply';
|
|
514
514
|
|
|
515
515
|
try {
|
|
516
516
|
require(scriptPath);
|
|
517
517
|
} catch (error) {
|
|
518
|
-
|
|
518
|
+
if (subcommand === 'push-preview') {
|
|
519
|
+
console.error('❌ Error generating Figma push preview:', error);
|
|
520
|
+
} else {
|
|
521
|
+
console.error('❌ Error applying Figma push preview:', error);
|
|
522
|
+
}
|
|
519
523
|
process.exit(1);
|
|
520
524
|
}
|
|
521
525
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stratixlabs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "...",
|
|
5
5
|
"bin": {
|
|
6
6
|
"stratix": "bin/stratix.js"
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"lint:tokens": "node scripts/lint-hardcoded.js",
|
|
16
16
|
"lint:code": "node scripts/lint-code.js",
|
|
17
17
|
"detect:breaking": "node scripts/detect-breaking-changes.js",
|
|
18
|
-
"sync:figma": "node scripts/figma-sync.js"
|
|
18
|
+
"sync:figma": "node scripts/figma-sync.js",
|
|
19
|
+
"figma:push-preview": "node bin/stratix.js figma push-preview",
|
|
20
|
+
"figma:apply-preview": "node bin/stratix.js figma apply-preview",
|
|
21
|
+
"figma:apply-all": "npm run figma:push-preview && npm run figma:apply-preview"
|
|
19
22
|
},
|
|
20
23
|
"keywords": [
|
|
21
24
|
"stratix",
|
|
@@ -26,7 +29,7 @@
|
|
|
26
29
|
],
|
|
27
30
|
"repository": {
|
|
28
31
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/mikaelcarrara/stratix"
|
|
32
|
+
"url": "git+https://github.com/mikaelcarrara/stratix.git"
|
|
30
33
|
},
|
|
31
34
|
"author": "Mikael Carrara",
|
|
32
35
|
"license": "MIT",
|
package/scripts/figma-sync.js
CHANGED
|
@@ -2,6 +2,25 @@ const https = require('https');
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
|
|
5
|
+
try {
|
|
6
|
+
const envPath = path.join(process.cwd(), '.env');
|
|
7
|
+
if (fs.existsSync(envPath)) {
|
|
8
|
+
const content = fs.readFileSync(envPath, 'utf8');
|
|
9
|
+
const lines = content.split(/\r?\n/);
|
|
10
|
+
for (const line of lines) {
|
|
11
|
+
const trimmed = line.trim();
|
|
12
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
13
|
+
const idx = trimmed.indexOf('=');
|
|
14
|
+
if (idx === -1) continue;
|
|
15
|
+
const key = trimmed.slice(0, idx).trim();
|
|
16
|
+
const value = trimmed.slice(idx + 1).trim();
|
|
17
|
+
if (key && !process.env[key]) {
|
|
18
|
+
process.env[key] = value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
} catch (e) {}
|
|
23
|
+
|
|
5
24
|
function ensurePathWithinRoot(resolvedPath, rootDir) {
|
|
6
25
|
const resolved = path.resolve(resolvedPath);
|
|
7
26
|
const root = path.resolve(rootDir);
|
|
@@ -101,6 +120,9 @@ function getDeep(obj, pathParts) {
|
|
|
101
120
|
|
|
102
121
|
function deepMerge(target, source) {
|
|
103
122
|
for (const key of Object.keys(source)) {
|
|
123
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
104
126
|
const srcVal = source[key];
|
|
105
127
|
const tgtVal = target[key];
|
|
106
128
|
if (srcVal && typeof srcVal === 'object' && !Array.isArray(srcVal)) {
|
|
@@ -63,6 +63,9 @@ function parseCssVariables(cssContent, fileType) {
|
|
|
63
63
|
|
|
64
64
|
function deepMerge(target, source) {
|
|
65
65
|
for (const key of Object.keys(source)) {
|
|
66
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
66
69
|
const srcVal = source[key];
|
|
67
70
|
const tgtVal = target[key];
|
|
68
71
|
if (srcVal && typeof srcVal === 'object' && !Array.isArray(srcVal)) {
|