swatchkit 0.8.0 → 0.9.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 +7 -1
- package/build.js +41 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,10 @@ my-project/
|
|
|
38
38
|
│ └── ...
|
|
39
39
|
└── dist/
|
|
40
40
|
└── swatchkit/ # Built pattern library
|
|
41
|
-
|
|
41
|
+
├── index.html
|
|
42
|
+
├── js/
|
|
43
|
+
│ └── swatches.js # Bundled swatch scripts
|
|
44
|
+
└── preview/ # Full-screen preview pages
|
|
42
45
|
```
|
|
43
46
|
|
|
44
47
|
---
|
|
@@ -220,6 +223,7 @@ Compiles your documentation site into `dist/swatchkit/`.
|
|
|
220
223
|
2. **Generates CSS**: Creates `css/tokens.css`. **Do not edit this file**; it is overwritten every build.
|
|
221
224
|
3. **Copies Assets**: Copies your `css/` folder (including your manually edited `global-styles.css` and `main.css`) to the output folder.
|
|
222
225
|
4. **Scans Patterns**: Finds all HTML files in `swatchkit/` and stitches them into the documentation site.
|
|
226
|
+
5. **Bundles JavaScript**: Collects any `.js` files from swatch folders (e.g., `swatchkit/carousel/script.js`) and section directories into a single `js/swatches.js` bundle. The default token display script (`swatchkit/tokens/script.js`) is included here — it shows computed CSS values alongside token documentation.
|
|
223
227
|
|
|
224
228
|
### Global Styles & Variables
|
|
225
229
|
SwatchKit includes sensible defaults in `css/variables.css` and `css/global-styles.css`.
|
|
@@ -262,6 +266,8 @@ swatchkit [command] [options]
|
|
|
262
266
|
| `--outDir` | `-o` | Output directory (Default: `dist/swatchkit`). |
|
|
263
267
|
| `--force` | `-f` | Overwrite all init-managed files with latest blueprints. |
|
|
264
268
|
| `--dry-run` | | Show what init would create or change, without writing anything.|
|
|
269
|
+
| `--help` | `-h` | Show help message. |
|
|
270
|
+
| `--version` | `-v` | Show version number. |
|
|
265
271
|
|
|
266
272
|
## Configuration
|
|
267
273
|
|
package/build.js
CHANGED
|
@@ -28,6 +28,10 @@ function parseArgs(args) {
|
|
|
28
28
|
options.command = "init";
|
|
29
29
|
} else if (arg === "-w" || arg === "--watch") {
|
|
30
30
|
options.watch = true;
|
|
31
|
+
} else if (arg === "-h" || arg === "--help") {
|
|
32
|
+
options.command = "help";
|
|
33
|
+
} else if (arg === "-v" || arg === "--version") {
|
|
34
|
+
options.command = "version";
|
|
31
35
|
} else if (arg === "-f" || arg === "--force") {
|
|
32
36
|
options.force = true;
|
|
33
37
|
} else if (arg === "--dry-run") {
|
|
@@ -838,9 +842,46 @@ function watch(settings) {
|
|
|
838
842
|
}, 2000);
|
|
839
843
|
}
|
|
840
844
|
|
|
845
|
+
// --- 7. Help & Version ---
|
|
846
|
+
function printVersion() {
|
|
847
|
+
const pkg = require(path.join(__dirname, "package.json"));
|
|
848
|
+
console.log(pkg.version);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
function printHelp() {
|
|
852
|
+
const pkg = require(path.join(__dirname, "package.json"));
|
|
853
|
+
console.log(`SwatchKit v${pkg.version}
|
|
854
|
+
|
|
855
|
+
Usage: swatchkit [command] [options]
|
|
856
|
+
|
|
857
|
+
Commands:
|
|
858
|
+
(default) Build the pattern library
|
|
859
|
+
init Scaffold layout, tokens, and CSS blueprints
|
|
860
|
+
|
|
861
|
+
Options:
|
|
862
|
+
-w, --watch Watch files and rebuild on change
|
|
863
|
+
-c, --config Path to config file
|
|
864
|
+
-i, --input Pattern directory (default: swatchkit/)
|
|
865
|
+
-o, --outDir Output directory (default: dist/swatchkit)
|
|
866
|
+
-f, --force Overwrite all init-managed files with latest blueprints
|
|
867
|
+
--dry-run Show what init would create or change, without writing
|
|
868
|
+
-h, --help Show this help message
|
|
869
|
+
-v, --version Show version number`);
|
|
870
|
+
}
|
|
871
|
+
|
|
841
872
|
// --- Main Execution ---
|
|
842
873
|
try {
|
|
843
874
|
const cliOptions = parseArgs(process.argv);
|
|
875
|
+
|
|
876
|
+
if (cliOptions.command === "help") {
|
|
877
|
+
printHelp();
|
|
878
|
+
process.exit(0);
|
|
879
|
+
}
|
|
880
|
+
if (cliOptions.command === "version") {
|
|
881
|
+
printVersion();
|
|
882
|
+
process.exit(0);
|
|
883
|
+
}
|
|
884
|
+
|
|
844
885
|
const fileConfig = loadConfig(cliOptions.config);
|
|
845
886
|
const settings = resolveSettings(cliOptions, fileConfig);
|
|
846
887
|
|