figma-cli 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4174adfd2513d05fd36e0392d1bc2be14d6e495b26131682626cd9082046a7b
4
- data.tar.gz: dfb6f841bc0f27b7a1bf9603de28b059182ff9add04ef06cf99bf857b6928bb3
3
+ metadata.gz: 264bb31de4b3d3036daa7a20f03576254ebcf3384cc6ed468b319ae9fea96580
4
+ data.tar.gz: 6d7ebe134047f9a8a913d1a3aa6f3ee5e22d7004dfeae5ed6c5cbbc121955fb2
5
5
  SHA512:
6
- metadata.gz: 35e687e36c9398fffa59133b460944a4af0904d96b16a711a2f2f215c0e114d5e281e3572da1c61396b61ac4c8461e95dea918ac598052ec799ca643cd6676c8
7
- data.tar.gz: '028e35e28a4dbed03acc3a0ba39ddda5312c48210be085d2dcf50045a99c4f8dcf516d74e281d8d4176e207a6f8c22f0a0fb7796cac4d386f27114b391b60358'
6
+ metadata.gz: ad2372c9cdc0eedafffcb8b420d16ce2812dc44efa59d6b35bc9d4d9d09e296e2b0e99fd194d7a29bb856f553adf402bde2f9bd1e69a2bba739968012069398f
7
+ data.tar.gz: 2edf0ee22d7ec970aee8886e185397e037153827be46b0ed32a272bbfbc2c3d65e0996687accb72ead38f3de4f11a28a613e354bef20adf8e536802a13192400
data/CLAUDE.md CHANGED
@@ -44,7 +44,7 @@ lib/figma/cli/
44
44
  - `--node-id` scopes spacing extraction to a subtree
45
45
 
46
46
  ### Writer (`Figma::Cli::Writer`)
47
- - `Writer.write(data, output_dir: ".figma-cli")` → array of 5 written file paths
47
+ - `Writer.write(data, output_dir:)` → array of 5 written file paths
48
48
  - Writes `metadata.yml` (flat), `colors.yml`, `typography.yml`, `effects.yml`, `spacing.yml` (wrapped arrays)
49
49
  - YAML output: no `---` header, `line_width: -1`, empty categories → `colors: []`
50
50
  - Creates output directory if missing, overwrites silently (idempotent)
data/README.md CHANGED
@@ -42,10 +42,10 @@ figma-cli version
42
42
 
43
43
  ## Output
44
44
 
45
- Writes 5 YAML files to `.figma-cli/` (or custom directory via `-o`):
45
+ Writes 5 YAML files to a temp directory by default (`/tmp/figma-cli/<file-key>/`). Files are cleaned up automatically on reboot. Use `-o` to write to a persistent location instead.
46
46
 
47
47
  ```
48
- .figma-cli/
48
+ /tmp/figma-cli/<file-key>/
49
49
  metadata.yml
50
50
  colors.yml
51
51
  typography.yml
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "thor"
4
4
  require "yaml"
5
+ require "tmpdir"
5
6
 
6
7
  module Figma
7
8
  module Cli
@@ -13,25 +14,27 @@ module Figma
13
14
 
14
15
  desc "extract URL", "Extract design tokens from a Figma file"
15
16
  option :node_id, type: :string, desc: "Figma node ID to scope extraction"
16
- option :output, aliases: "-o", type: :string, default: ".figma-cli", desc: "Output directory"
17
+ option :output, aliases: "-o", type: :string, desc: "Output directory (default: temp directory)"
17
18
  def extract(url) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
18
19
  client = Client.new
19
20
  parser = Parser.new(client: client)
20
21
 
21
22
  # Check cache: skip if local version matches remote
22
23
  version_info = parser.file_version(url)
23
- metadata_path = File.join(options[:output], "metadata.yml")
24
+ output_dir = options[:output] || File.join(Dir.tmpdir, "figma-cli", version_info[:file_key])
25
+ metadata_path = File.join(output_dir, "metadata.yml")
24
26
  if File.exist?(metadata_path)
25
27
  local = YAML.safe_load_file(metadata_path)
26
28
  if local && local["version"] == version_info[:version]
27
29
  warn "Up to date (version #{version_info[:version]}), skipping."
30
+ warn "Files at #{output_dir}/"
28
31
  return
29
32
  end
30
33
  end
31
34
 
32
35
  data = parser.extract(url, node_id: options[:node_id])
33
- paths = Writer.write(data, output_dir: options[:output])
34
- warn "Wrote #{paths.size} files to #{options[:output]}/"
36
+ paths = Writer.write(data, output_dir: output_dir)
37
+ warn "Wrote #{paths.size} files to #{output_dir}/"
35
38
  paths.each { |p| warn " #{p}" }
36
39
  rescue Error => e
37
40
  warn "Error: #{e.message}"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Figma
4
4
  module Cli
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: figma-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom Meas