swatchkit 0.8.1 → 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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/build.js +41 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -266,6 +266,8 @@ swatchkit [command] [options]
266
266
  | `--outDir` | `-o` | Output directory (Default: `dist/swatchkit`). |
267
267
  | `--force` | `-f` | Overwrite all init-managed files with latest blueprints. |
268
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. |
269
271
 
270
272
  ## Configuration
271
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swatchkit",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "A lightweight tool for creating HTML pattern libraries.",
5
5
  "main": "build.js",
6
6
  "bin": {