From 6bc78de32be1a218a69e10a731072331ba94e7f9 Mon Sep 17 00:00:00 2001 From: "primer[bot]" <119360173+primer[bot]@users.noreply.github.com> Date: Tue, 19 Sep 2023 09:04:24 -0700 Subject: [PATCH 01/11] Version Packages (#987) Co-authored-by: github-actions[bot] --- .changeset/hip-fishes-rush.md | 5 ----- CHANGELOG.md | 6 ++++++ lib/octicons_gem/lib/octicons/version.rb | 2 +- lib/octicons_helper/Gemfile | 2 +- lib/octicons_helper/lib/octicons_helper/version.rb | 2 +- lib/octicons_helper/octicons_helper.gemspec | 2 +- lib/octicons_jekyll/Gemfile | 2 +- lib/octicons_jekyll/jekyll-octicons.gemspec | 2 +- lib/octicons_jekyll/lib/jekyll-octicons/version.rb | 2 +- lib/octicons_node/package.json | 2 +- lib/octicons_react/package.json | 2 +- package.json | 2 +- 12 files changed, 16 insertions(+), 15 deletions(-) delete mode 100644 .changeset/hip-fishes-rush.md diff --git a/.changeset/hip-fishes-rush.md b/.changeset/hip-fishes-rush.md deleted file mode 100644 index 237bb5486..000000000 --- a/.changeset/hip-fishes-rush.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@primer/octicons': minor ---- - -Adds filter remove octicon diff --git a/CHANGELOG.md b/CHANGELOG.md index ea6082525..276870faf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 19.8.0 + +### Minor Changes + +- [#976](https://github.com/primer/octicons/pull/976) [`15ea1e43`](https://github.com/primer/octicons/commit/15ea1e43510a55a5f77d4f4bc76f5033d6655997) Thanks [@UnicodeRogue](https://github.com/UnicodeRogue)! - Adds filter remove octicon + ## 19.7.0 ### Minor Changes diff --git a/lib/octicons_gem/lib/octicons/version.rb b/lib/octicons_gem/lib/octicons/version.rb index fd7a35e2d..e4d63fc33 100644 --- a/lib/octicons_gem/lib/octicons/version.rb +++ b/lib/octicons_gem/lib/octicons/version.rb @@ -1,3 +1,3 @@ module Octicons - VERSION = "19.7.0".freeze + VERSION = "19.8.0".freeze end diff --git a/lib/octicons_helper/Gemfile b/lib/octicons_helper/Gemfile index 31e1c58f7..319f26833 100644 --- a/lib/octicons_helper/Gemfile +++ b/lib/octicons_helper/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" gemspec -gem "octicons", "19.7.0" +gem "octicons", "19.8.0" gem "rails" group :development, :test do diff --git a/lib/octicons_helper/lib/octicons_helper/version.rb b/lib/octicons_helper/lib/octicons_helper/version.rb index 257812c73..10cbb57a7 100644 --- a/lib/octicons_helper/lib/octicons_helper/version.rb +++ b/lib/octicons_helper/lib/octicons_helper/version.rb @@ -1,3 +1,3 @@ module OcticonsHelper - VERSION = "19.7.0".freeze + VERSION = "19.8.0".freeze end diff --git a/lib/octicons_helper/octicons_helper.gemspec b/lib/octicons_helper/octicons_helper.gemspec index b7f81ba20..360d0a7e2 100644 --- a/lib/octicons_helper/octicons_helper.gemspec +++ b/lib/octicons_helper/octicons_helper.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] - s.add_dependency "octicons", "19.7.0" + s.add_dependency "octicons", "19.8.0" s.add_dependency "railties" s.add_dependency "actionview" end diff --git a/lib/octicons_jekyll/Gemfile b/lib/octicons_jekyll/Gemfile index c6037882a..67c8d8ce3 100644 --- a/lib/octicons_jekyll/Gemfile +++ b/lib/octicons_jekyll/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" gemspec -gem "octicons", "19.7.0" +gem "octicons", "19.8.0" group :development, :test do gem "minitest" diff --git a/lib/octicons_jekyll/jekyll-octicons.gemspec b/lib/octicons_jekyll/jekyll-octicons.gemspec index 7d74a6a4f..f8eef19b3 100644 --- a/lib/octicons_jekyll/jekyll-octicons.gemspec +++ b/lib/octicons_jekyll/jekyll-octicons.gemspec @@ -14,5 +14,5 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.add_dependency "jekyll", ">= 3.6", "< 5.0" - s.add_dependency "octicons", "19.7.0" + s.add_dependency "octicons", "19.8.0" end diff --git a/lib/octicons_jekyll/lib/jekyll-octicons/version.rb b/lib/octicons_jekyll/lib/jekyll-octicons/version.rb index f6c535c57..752463e6d 100644 --- a/lib/octicons_jekyll/lib/jekyll-octicons/version.rb +++ b/lib/octicons_jekyll/lib/jekyll-octicons/version.rb @@ -3,6 +3,6 @@ module Liquid; class Tag; end; end module Jekyll class Octicons < Liquid::Tag - VERSION = "19.7.0".freeze + VERSION = "19.8.0".freeze end end diff --git a/lib/octicons_node/package.json b/lib/octicons_node/package.json index 8dea328f2..f81bff517 100644 --- a/lib/octicons_node/package.json +++ b/lib/octicons_node/package.json @@ -1,6 +1,6 @@ { "name": "@primer/octicons", - "version": "19.7.0", + "version": "19.8.0", "description": "A scalable set of icons handcrafted with <3 by GitHub.", "homepage": "https://primer.style/octicons", "author": "GitHub Inc.", diff --git a/lib/octicons_react/package.json b/lib/octicons_react/package.json index 56f52eb33..a4a4218e0 100644 --- a/lib/octicons_react/package.json +++ b/lib/octicons_react/package.json @@ -1,6 +1,6 @@ { "name": "@primer/octicons-react", - "version": "19.7.0", + "version": "19.8.0", "description": "A scalable set of icons handcrafted with <3 by GitHub.", "homepage": "https://primer.style/octicons", "author": "GitHub, Inc.", diff --git a/package.json b/package.json index 6ad775cf2..823f5655a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@primer/octicons", - "version": "19.7.0", + "version": "19.8.0", "publishConfig": { "registry": "no registry, don't publish from this package.json." }, From 062778c4d48a563de0948f1eda44820074932f49 Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Tue, 12 Mar 2024 15:26:01 -0700 Subject: [PATCH 02/11] Avoid duplicate build folder in @primer/octicons (#1010) * Avoid duplicate build folder in @primer/octicons * Update year to 2024 in LICENSE files * Upgrade to newer artifact upload/download actions * Use newer ruby for linting * Upgrade rubocop version * Upgrade rubocop in more places * Disable checksum verification (since we're building the gem ourselves) * Fix bad class variable access pattern --------- Co-authored-by: Federico Brigante --- .github/workflows/ci.yml | 28 ++++++++++--------- .github/workflows/publish.yml | 18 ++++++------ .rubocop.yml | 3 ++ Gemfile | 5 ++-- LICENSE | 2 +- lib/octicons_gem/Gemfile | 5 ++-- lib/octicons_gem/LICENSE | 2 +- lib/octicons_gem/Rakefile | 2 ++ lib/octicons_gem/lib/octicons.rb | 2 ++ lib/octicons_gem/lib/octicons/octicon.rb | 2 ++ lib/octicons_gem/lib/octicons/version.rb | 2 ++ lib/octicons_gem/octicons.gemspec | 2 ++ lib/octicons_gem/test/helper.rb | 4 ++- lib/octicons_gem/test/octicon_test.rb | 4 ++- lib/octicons_gem/test/octicons_test.rb | 4 ++- lib/octicons_helper/Gemfile | 5 ++-- lib/octicons_helper/LICENSE | 2 +- lib/octicons_helper/Rakefile | 2 ++ lib/octicons_helper/lib/octicons_helper.rb | 2 ++ .../lib/octicons_helper/helper.rb | 2 ++ .../lib/octicons_helper/railtie.rb | 2 ++ .../lib/octicons_helper/version.rb | 2 ++ lib/octicons_helper/octicons_helper.gemspec | 2 ++ lib/octicons_helper/test/helper.rb | 2 ++ .../test/octicons_helper_test.rb | 10 ++++--- lib/octicons_jekyll/.rubocop.yml | 3 ++ lib/octicons_jekyll/Gemfile | 5 ++-- lib/octicons_jekyll/LICENSE | 2 +- lib/octicons_jekyll/Rakefile | 4 ++- lib/octicons_jekyll/jekyll-octicons.gemspec | 2 ++ lib/octicons_jekyll/lib/jekyll-octicons.rb | 2 ++ .../lib/jekyll-octicons/version.rb | 2 ++ lib/octicons_jekyll/test/helper.rb | 2 ++ lib/octicons_jekyll/test/octicon_tag_test.rb | 4 ++- lib/octicons_node/LICENSE | 2 +- lib/octicons_node/package.json | 2 +- lib/octicons_react/LICENSE | 2 +- lib/octicons_styled/LICENSE | 2 +- 38 files changed, 103 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05e738ae6..643c4148c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: Building run: yarn build - run: cp -r icons lib/build/svg - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: octicons-build path: ./lib/build @@ -31,7 +31,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: octicons-build path: ./lib/build @@ -53,7 +53,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: octicons-build path: ./lib/build @@ -77,7 +77,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: octicons-build path: ./lib/build @@ -101,8 +101,8 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 - - uses: actions/download-artifact@v3 + ruby-version: 3.3 + - uses: actions/download-artifact@v4 with: name: octicons-build path: ./lib/octicons_gem/lib/build @@ -113,7 +113,7 @@ jobs: run: bundle exec rake test - name: Build run: bundle exec rake build - - uses: actions/upload-artifact@master + - uses: actions/upload-artifact@v4 with: name: octicons-gem path: ./lib/octicons_gem/pkg @@ -130,12 +130,13 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 - - uses: actions/download-artifact@v3 + ruby-version: 3.3 + - uses: actions/download-artifact@v4 with: name: octicons-gem path: ./lib/octicons_helper/vendor/cache - - run: bundle install + - name: Run bundle install + run: bundle config set --local disable_checksum_validation true && bundle install - name: Linting run: bundle exec rake lint - name: Testing @@ -153,12 +154,13 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 - - uses: actions/download-artifact@v3 + ruby-version: 3.3 + - uses: actions/download-artifact@v4 with: name: octicons-gem path: ./lib/octicons_jekyll/vendor/cache - - run: bundle install + - name: Run bundle install + run: bundle config set --local disable_checksum_validation true && bundle install - name: Linting run: bundle exec rake lint - name: Testing diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 325517433..2053ebdfd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: - run: npm install - run: npm run build - run: cp -r icons lib/build/svg - - uses: actions/upload-artifact@master + - uses: actions/upload-artifact@v4 with: name: octicons path: ./lib/build @@ -23,7 +23,7 @@ jobs: needs: setup steps: - uses: actions/checkout@master - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: octicons path: ./lib/build @@ -33,7 +33,7 @@ jobs: with: args: octicons_gem - run: ls ./lib/octicons_gem/pkg - - uses: actions/upload-artifact@master + - uses: actions/upload-artifact@v4 with: name: octicons_gem path: ./lib/octicons_gem/pkg @@ -42,11 +42,11 @@ jobs: needs: gem steps: - uses: actions/checkout@master - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: octicons path: ./lib/build - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: octicons_gem path: ./lib/octicons_helper/vendor/cache @@ -60,11 +60,11 @@ jobs: needs: gem steps: - uses: actions/checkout@master - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: octicons path: ./lib/build - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: octicons_gem path: ./lib/octicons_jekyll/vendor/cache @@ -78,7 +78,7 @@ jobs: needs: setup steps: - uses: actions/checkout@master - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: octicons path: ./lib/build @@ -92,7 +92,7 @@ jobs: needs: setup steps: - uses: actions/checkout@master - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: octicons path: ./lib/build diff --git a/.rubocop.yml b/.rubocop.yml index 1be334345..2c4b6d408 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,3 +2,6 @@ inherit_gem: rubocop-github: - config/default.yml - config/rails.yml + +AllCops: + NewCops: enable diff --git a/Gemfile b/Gemfile index 2b9d64a82..5dd8f6f14 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,9 @@ +# frozen_string_literal: true + source "https://rubygems.org" group :development, :test do gem "minitest" gem "rake" - gem "rubocop", "0.59" - gem "rubocop-github", "0.12.0" + gem "rubocop-github", "0.20.0" end diff --git a/LICENSE b/LICENSE index 163074d5b..7533bc77a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 GitHub Inc. +Copyright (c) 2024 GitHub Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/octicons_gem/Gemfile b/lib/octicons_gem/Gemfile index 6df290a55..cc45e62c5 100644 --- a/lib/octicons_gem/Gemfile +++ b/lib/octicons_gem/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source "https://rubygems.org" gemspec @@ -5,6 +7,5 @@ gemspec group :development, :test do gem "minitest" gem "rake" - gem "rubocop", "0.59" - gem "rubocop-github", "0.12.0" + gem "rubocop-github", "0.20.0" end diff --git a/lib/octicons_gem/LICENSE b/lib/octicons_gem/LICENSE index 163074d5b..7533bc77a 100644 --- a/lib/octicons_gem/LICENSE +++ b/lib/octicons_gem/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 GitHub Inc. +Copyright (c) 2024 GitHub Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/octicons_gem/Rakefile b/lib/octicons_gem/Rakefile index fb7641f62..49d957c07 100644 --- a/lib/octicons_gem/Rakefile +++ b/lib/octicons_gem/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "rake/testtask" require "rubocop/rake_task" require "bundler/gem_tasks" diff --git a/lib/octicons_gem/lib/octicons.rb b/lib/octicons_gem/lib/octicons.rb index 063186888..744b91b84 100644 --- a/lib/octicons_gem/lib/octicons.rb +++ b/lib/octicons_gem/lib/octicons.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "octicons/version" require "octicons/octicon" require "json" diff --git a/lib/octicons_gem/lib/octicons/octicon.rb b/lib/octicons_gem/lib/octicons/octicon.rb index 7de596ec8..9deb422a0 100644 --- a/lib/octicons_gem/lib/octicons/octicon.rb +++ b/lib/octicons_gem/lib/octicons/octicon.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Octicons class Octicon DEFAULT_HEIGHT = 16 diff --git a/lib/octicons_gem/lib/octicons/version.rb b/lib/octicons_gem/lib/octicons/version.rb index e4d63fc33..3c9e05040 100644 --- a/lib/octicons_gem/lib/octicons/version.rb +++ b/lib/octicons_gem/lib/octicons/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Octicons VERSION = "19.8.0".freeze end diff --git a/lib/octicons_gem/octicons.gemspec b/lib/octicons_gem/octicons.gemspec index f22fe3c9e..81a3820ff 100644 --- a/lib/octicons_gem/octicons.gemspec +++ b/lib/octicons_gem/octicons.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require File.expand_path("../lib/octicons/version", __FILE__) Gem::Specification.new do |s| diff --git a/lib/octicons_gem/test/helper.rb b/lib/octicons_gem/test/helper.rb index 0377daa7d..96d3405ba 100644 --- a/lib/octicons_gem/test/helper.rb +++ b/lib/octicons_gem/test/helper.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + require "minitest/autorun" require "octicons" def octicon(symbol, options = {}) - ::Octicons::Octicon.new(symbol, options) + Octicons::Octicon.new(symbol, options) end diff --git a/lib/octicons_gem/test/octicon_test.rb b/lib/octicons_gem/test/octicon_test.rb index 80add615d..5d1d84732 100644 --- a/lib/octicons_gem/test/octicon_test.rb +++ b/lib/octicons_gem/test/octicon_test.rb @@ -1,4 +1,6 @@ -require_relative "./helper" +# frozen_string_literal: true + +require_relative "helper" describe Octicons::Octicon do it "fails when the octicon doesn't exist" do diff --git a/lib/octicons_gem/test/octicons_test.rb b/lib/octicons_gem/test/octicons_test.rb index 88e47b68e..8e128a80e 100644 --- a/lib/octicons_gem/test/octicons_test.rb +++ b/lib/octicons_gem/test/octicons_test.rb @@ -1,4 +1,6 @@ -require_relative "./helper" +# frozen_string_literal: true + +require_relative "helper" describe Octicons do it "loads all icons on initialization" do diff --git a/lib/octicons_helper/Gemfile b/lib/octicons_helper/Gemfile index 319f26833..fb6592e2d 100644 --- a/lib/octicons_helper/Gemfile +++ b/lib/octicons_helper/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source "https://rubygems.org" gemspec @@ -8,6 +10,5 @@ gem "rails" group :development, :test do gem "minitest" gem "rake" - gem "rubocop", "0.59" - gem "rubocop-github", "0.12.0" + gem "rubocop-github", "0.20.0" end diff --git a/lib/octicons_helper/LICENSE b/lib/octicons_helper/LICENSE index 163074d5b..7533bc77a 100644 --- a/lib/octicons_helper/LICENSE +++ b/lib/octicons_helper/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 GitHub Inc. +Copyright (c) 2024 GitHub Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/octicons_helper/Rakefile b/lib/octicons_helper/Rakefile index 918523a4d..861b647d8 100644 --- a/lib/octicons_helper/Rakefile +++ b/lib/octicons_helper/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "rake/testtask" require "rubocop/rake_task" require "bundler/gem_tasks" diff --git a/lib/octicons_helper/lib/octicons_helper.rb b/lib/octicons_helper/lib/octicons_helper.rb index cbe359dc0..e1f85d5ef 100644 --- a/lib/octicons_helper/lib/octicons_helper.rb +++ b/lib/octicons_helper/lib/octicons_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "octicons_helper/version" require "octicons_helper/helper" require "octicons_helper/railtie" if defined?(Rails) diff --git a/lib/octicons_helper/lib/octicons_helper/helper.rb b/lib/octicons_helper/lib/octicons_helper/helper.rb index c7030e6ad..a5e060e1e 100644 --- a/lib/octicons_helper/lib/octicons_helper/helper.rb +++ b/lib/octicons_helper/lib/octicons_helper/helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "octicons" require "action_view" diff --git a/lib/octicons_helper/lib/octicons_helper/railtie.rb b/lib/octicons_helper/lib/octicons_helper/railtie.rb index ff5606388..1d7ed029b 100644 --- a/lib/octicons_helper/lib/octicons_helper/railtie.rb +++ b/lib/octicons_helper/lib/octicons_helper/railtie.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "rails" module OcticonsHelper diff --git a/lib/octicons_helper/lib/octicons_helper/version.rb b/lib/octicons_helper/lib/octicons_helper/version.rb index 10cbb57a7..030215509 100644 --- a/lib/octicons_helper/lib/octicons_helper/version.rb +++ b/lib/octicons_helper/lib/octicons_helper/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module OcticonsHelper VERSION = "19.8.0".freeze end diff --git a/lib/octicons_helper/octicons_helper.gemspec b/lib/octicons_helper/octicons_helper.gemspec index 360d0a7e2..d1bed657e 100644 --- a/lib/octicons_helper/octicons_helper.gemspec +++ b/lib/octicons_helper/octicons_helper.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require File.expand_path("../lib/octicons_helper/version", __FILE__) Gem::Specification.new do |s| diff --git a/lib/octicons_helper/test/helper.rb b/lib/octicons_helper/test/helper.rb index e9664b2ae..2f17289a7 100644 --- a/lib/octicons_helper/test/helper.rb +++ b/lib/octicons_helper/test/helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "minitest/autorun" require "octicons_helper" diff --git a/lib/octicons_helper/test/octicons_helper_test.rb b/lib/octicons_helper/test/octicons_helper_test.rb index 3e2e54369..52de20c16 100644 --- a/lib/octicons_helper/test/octicons_helper_test.rb +++ b/lib/octicons_helper/test/octicons_helper_test.rb @@ -1,4 +1,6 @@ -require_relative "./helper" +# frozen_string_literal: true + +require_relative "helper" describe OcticonsHelper do describe "rendering" do @@ -23,10 +25,10 @@ mock = Minitest::Mock.new def mock.path - @@call_count ||= 0 - @@call_count += 1 + @call_count ||= 0 + @call_count += 1 - raise "Octicon library called twice" if @@call_count > 1 + raise "Octicon library called twice" if @call_count > 1 "foo" end diff --git a/lib/octicons_jekyll/.rubocop.yml b/lib/octicons_jekyll/.rubocop.yml index 448b745ff..2b4bc6dd7 100644 --- a/lib/octicons_jekyll/.rubocop.yml +++ b/lib/octicons_jekyll/.rubocop.yml @@ -4,3 +4,6 @@ inherit_gem: Naming/FileName: Enabled: false + +AllCops: + NewCops: enable diff --git a/lib/octicons_jekyll/Gemfile b/lib/octicons_jekyll/Gemfile index 67c8d8ce3..617553efb 100644 --- a/lib/octicons_jekyll/Gemfile +++ b/lib/octicons_jekyll/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source "https://rubygems.org" gemspec @@ -7,6 +9,5 @@ gem "octicons", "19.8.0" group :development, :test do gem "minitest" gem "rake" - gem "rubocop", "0.59" - gem "rubocop-github", "0.12.0" + gem "rubocop-github", "0.20.0" end diff --git a/lib/octicons_jekyll/LICENSE b/lib/octicons_jekyll/LICENSE index 163074d5b..7533bc77a 100644 --- a/lib/octicons_jekyll/LICENSE +++ b/lib/octicons_jekyll/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 GitHub Inc. +Copyright (c) 2024 GitHub Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/octicons_jekyll/Rakefile b/lib/octicons_jekyll/Rakefile index 773908aa4..ac387d6b3 100644 --- a/lib/octicons_jekyll/Rakefile +++ b/lib/octicons_jekyll/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "rake/testtask" require "rubocop/rake_task" require "bundler/gem_tasks" @@ -6,7 +8,7 @@ RuboCop::RakeTask.new(:lint) do |t| t.options = ["--display-cop-names"] end -task :version, [:v] do |t, args| +task :version, [:v] => :environment do |t, args| out = "# Prevent bundler errors\n"\ "module Liquid; class Tag; end; end\n\n"\ "module Jekyll\n"\ diff --git a/lib/octicons_jekyll/jekyll-octicons.gemspec b/lib/octicons_jekyll/jekyll-octicons.gemspec index f8eef19b3..15dc2d0e1 100644 --- a/lib/octicons_jekyll/jekyll-octicons.gemspec +++ b/lib/octicons_jekyll/jekyll-octicons.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require File.expand_path("../lib/jekyll-octicons/version", __FILE__) Gem::Specification.new do |s| diff --git a/lib/octicons_jekyll/lib/jekyll-octicons.rb b/lib/octicons_jekyll/lib/jekyll-octicons.rb index 55255cc6e..9364c2a6d 100644 --- a/lib/octicons_jekyll/lib/jekyll-octicons.rb +++ b/lib/octicons_jekyll/lib/jekyll-octicons.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "octicons" require "jekyll-octicons/version" require "liquid" diff --git a/lib/octicons_jekyll/lib/jekyll-octicons/version.rb b/lib/octicons_jekyll/lib/jekyll-octicons/version.rb index 752463e6d..3e95ecaaa 100644 --- a/lib/octicons_jekyll/lib/jekyll-octicons/version.rb +++ b/lib/octicons_jekyll/lib/jekyll-octicons/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Prevent bundler errors module Liquid; class Tag; end; end diff --git a/lib/octicons_jekyll/test/helper.rb b/lib/octicons_jekyll/test/helper.rb index 062e49110..2bb101bfe 100644 --- a/lib/octicons_jekyll/test/helper.rb +++ b/lib/octicons_jekyll/test/helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "minitest/autorun" require "jekyll-octicons" diff --git a/lib/octicons_jekyll/test/octicon_tag_test.rb b/lib/octicons_jekyll/test/octicon_tag_test.rb index 8ee217bd4..20b0700dd 100644 --- a/lib/octicons_jekyll/test/octicon_tag_test.rb +++ b/lib/octicons_jekyll/test/octicon_tag_test.rb @@ -1,4 +1,6 @@ -require_relative "./helper" +# frozen_string_literal: true + +require_relative "helper" describe Jekyll::Octicons do describe "parsing" do diff --git a/lib/octicons_node/LICENSE b/lib/octicons_node/LICENSE index 163074d5b..7533bc77a 100644 --- a/lib/octicons_node/LICENSE +++ b/lib/octicons_node/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 GitHub Inc. +Copyright (c) 2024 GitHub Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/octicons_node/package.json b/lib/octicons_node/package.json index f81bff517..369620bb8 100644 --- a/lib/octicons_node/package.json +++ b/lib/octicons_node/package.json @@ -17,7 +17,7 @@ "url": "https://github.com/primer/octicons/issues" }, "scripts": { - "build": "\\cp -r ../build/ ./build && \\cp index.scss ./build/build.css", + "build": "\\cp -r ../build/. ./build && \\cp index.scss ./build/build.css", "lint": "eslint index.js tests/*.js", "test": "ava --verbose 'tests/*.js'" }, diff --git a/lib/octicons_react/LICENSE b/lib/octicons_react/LICENSE index 163074d5b..7533bc77a 100644 --- a/lib/octicons_react/LICENSE +++ b/lib/octicons_react/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 GitHub Inc. +Copyright (c) 2024 GitHub Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/octicons_styled/LICENSE b/lib/octicons_styled/LICENSE index 163074d5b..7533bc77a 100644 --- a/lib/octicons_styled/LICENSE +++ b/lib/octicons_styled/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 GitHub Inc. +Copyright (c) 2024 GitHub Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 45f4fe9f69cd1e2afab6ff014aed5f729f1575a2 Mon Sep 17 00:00:00 2001 From: Josh Black Date: Tue, 12 Mar 2024 18:35:50 -0500 Subject: [PATCH 03/11] Update CODEOWNERS (#1011) Co-authored-by: Jon Rohan --- .github/CODEOWNERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b510cb491..7f340f558 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,2 @@ -* @primer/octicons-reviewers +* @primer/engineer-reviewers +icons @primer/octicons-reviewers From efe0ca3068b94dd31e0ad0486a4e9aedd51f4b76 Mon Sep 17 00:00:00 2001 From: Dominic Smith Date: Wed, 13 Mar 2024 21:45:27 +1100 Subject: [PATCH 04/11] Remove Octicon example from react README.md (#1012) Looks like 697bf97f1dcd6490dff1515e976b311460680b15 only deleted the section title, not the actual section in the README --- lib/octicons_react/README.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/octicons_react/README.md b/lib/octicons_react/README.md index 9ed7b548b..234c55f6f 100644 --- a/lib/octicons_react/README.md +++ b/lib/octicons_react/README.md @@ -158,20 +158,6 @@ export default () => ( ) ``` - -```diff -- -+ -``` - -The `Octicon` component is wrapper that passes props to its icon component. To render a specific icon, you -can pass it either via the `icon` prop, or as the only child: - -```jsx - - -``` - [octicons]: https://primer.style/octicons/ [primer]: https://github.com/primer/primer [docs]: http://primercss.io/ From 7225a81d3a293709383dcd74fe7fdb331166aa04 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Wed, 13 Mar 2024 15:19:31 +0000 Subject: [PATCH 05/11] update license to 2024 (#1004) * update license to 2024 * pin upload-artefact to 3 * v From dc333ccde54eb62244ea41b7dbca445cc859ba1f Mon Sep 17 00:00:00 2001 From: Josh Black Date: Wed, 13 Mar 2024 10:28:37 -0500 Subject: [PATCH 06/11] fix(octicons_react): remove build from npm package files (#1009) --- lib/octicons_react/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/octicons_react/package.json b/lib/octicons_react/package.json index a4a4218e0..90965470c 100644 --- a/lib/octicons_react/package.json +++ b/lib/octicons_react/package.json @@ -25,7 +25,6 @@ "posttest": "yarn ts-test" }, "files": [ - "build", "dist" ], "keywords": [ From 79b93954c6857e81a685066c1b1205893e7161c5 Mon Sep 17 00:00:00 2001 From: Josh Black Date: Wed, 13 Mar 2024 11:12:14 -0500 Subject: [PATCH 07/11] fix(octicons_react): remove role if aria-hidden (#1007) * chore(project): set yarn version * fix(octicons_react): remove role if aria-hidden * chore: add changeset * test: update snapshots --- .changeset/spicy-actors-act.md | 5 ++++ .../__tests__/tree-shaking.test.js | 2 +- .../__tests__/__snapshots__/octicon.js.snap | 1 - lib/octicons_react/src/__tests__/octicon.js | 24 +++++++++++++++++-- lib/octicons_react/src/createIconComponent.js | 6 +++-- package.json | 3 ++- 6 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 .changeset/spicy-actors-act.md diff --git a/.changeset/spicy-actors-act.md b/.changeset/spicy-actors-act.md new file mode 100644 index 000000000..32d0778c5 --- /dev/null +++ b/.changeset/spicy-actors-act.md @@ -0,0 +1,5 @@ +--- +'@primer/octicons-react': patch +--- + +Update octicons in React to no longer set role="img" if the icon is aria-hidden diff --git a/lib/octicons_react/__tests__/tree-shaking.test.js b/lib/octicons_react/__tests__/tree-shaking.test.js index 4dcd08f02..a490c44bf 100644 --- a/lib/octicons_react/__tests__/tree-shaking.test.js +++ b/lib/octicons_react/__tests__/tree-shaking.test.js @@ -50,5 +50,5 @@ test('tree shaking single export', async () => { }) const bundleSize = Buffer.byteLength(output[0].code.trim()) / 1000 - expect(`${bundleSize}kB`).toMatchInlineSnapshot(`"3.47kB"`) + expect(`${bundleSize}kB`).toMatchInlineSnapshot(`"3.563kB"`) }) diff --git a/lib/octicons_react/src/__tests__/__snapshots__/octicon.js.snap b/lib/octicons_react/src/__tests__/__snapshots__/octicon.js.snap index 6a702f6d2..2c1947a65 100644 --- a/lib/octicons_react/src/__tests__/__snapshots__/octicon.js.snap +++ b/lib/octicons_react/src/__tests__/__snapshots__/octicon.js.snap @@ -7,7 +7,6 @@ exports[`An icon component matches snapshot 1`] = ` fill="currentColor" focusable="false" height="16" - role="img" style="display: inline-block; user-select: none; vertical-align: text-bottom; overflow: visible;" viewBox="0 0 16 16" width="16" diff --git a/lib/octicons_react/src/__tests__/octicon.js b/lib/octicons_react/src/__tests__/octicon.js index 2364725e6..c4a9493a7 100644 --- a/lib/octicons_react/src/__tests__/octicon.js +++ b/lib/octicons_react/src/__tests__/octicon.js @@ -1,5 +1,5 @@ import '@testing-library/jest-dom' -import {render} from '@testing-library/react' +import {render, screen} from '@testing-library/react' import React from 'react' import {AlertIcon} from '../index' @@ -9,9 +9,29 @@ describe('An icon component', () => { expect(container.querySelector('svg')).toMatchSnapshot() }) + it('defaults to `aria-hidden="true"` if no label is present', () => { + const {container} = render() + expect(container.querySelector('svg')).toHaveAttribute('aria-hidden', 'true') + }) + + it('sets `role="img"` if `aria-label` is provided', () => { + render() + expect(screen.getByLabelText('Alert')).toHaveAttribute('role', 'img') + }) + + it('sets `role="img"` if `aria-labelledby` is provided', () => { + render( + <> + Alert + + + ) + expect(screen.getByLabelText('Alert')).toHaveAttribute('role', 'img') + }) + it('sets aria-hidden="false" if ariaLabel prop is present', () => { const {container} = render() - expect(container.querySelector('svg')).toHaveAttribute('aria-hidden', 'false') + expect(container.querySelector('svg')).not.toHaveAttribute('aria-hidden') expect(container.querySelector('svg')).toHaveAttribute('aria-label', 'icon') }) diff --git a/lib/octicons_react/src/createIconComponent.js b/lib/octicons_react/src/createIconComponent.js index 8b8a51df0..f895c43ec 100644 --- a/lib/octicons_react/src/createIconComponent.js +++ b/lib/octicons_react/src/createIconComponent.js @@ -30,17 +30,19 @@ export function createIconComponent(name, defaultClassName, getSVGData) { const naturalWidth = svgDataByHeight[naturalHeight].width const width = height * (naturalWidth / naturalHeight) const path = svgDataByHeight[naturalHeight].path + const labelled = ariaLabel || arialabelledby + const role = labelled ? 'img' : undefined return ( = 0 ? 'true' : 'false'} aria-label={ariaLabel} aria-labelledby={arialabelledby} - role="img" className={className} + role={role} viewBox={`0 0 ${naturalWidth} ${naturalHeight}`} width={width} height={height} diff --git a/package.json b/package.json index 823f5655a..751d625e0 100644 --- a/package.json +++ b/package.json @@ -49,5 +49,6 @@ "github/no-then": 0, "eslint-comments/no-use": 0 } - } + }, + "packageManager": "yarn@1.22.1" } From c5786ff2f3fb9ebca2405bb8d6cc53268b12674f Mon Sep 17 00:00:00 2001 From: Josh Black Date: Wed, 13 Mar 2024 12:20:36 -0500 Subject: [PATCH 08/11] feat(octicons_react): add support for ESM import (#1008) * feat(octicons_react): add support for ESM import * chore: add changeset --- .changeset/tasty-countries-grow.md | 5 ++++ lib/octicons_react/package.json | 10 ++++--- lib/octicons_react/rollup.config.js | 42 +++++++++++++++++++++++------ lib/octicons_react/script/types.js | 24 ++++++++--------- 4 files changed, 58 insertions(+), 23 deletions(-) create mode 100644 .changeset/tasty-countries-grow.md diff --git a/.changeset/tasty-countries-grow.md b/.changeset/tasty-countries-grow.md new file mode 100644 index 000000000..c426c4358 --- /dev/null +++ b/.changeset/tasty-countries-grow.md @@ -0,0 +1,5 @@ +--- +'@primer/octicons-react': minor +--- + +Update ESM import to use mjs extension when in parent CommonJS module diff --git a/lib/octicons_react/package.json b/lib/octicons_react/package.json index 90965470c..e63a16eea 100644 --- a/lib/octicons_react/package.json +++ b/lib/octicons_react/package.json @@ -5,11 +5,15 @@ "homepage": "https://primer.style/octicons", "author": "GitHub, Inc.", "license": "MIT", + "type": "commonjs", "main": "dist/index.umd.js", - "module": "dist/index.esm.js", + "module": "dist/index.esm.mjs", "exports": { - "types": "./dist/index.d.ts", - "import": "./dist/index.esm.js", + "types": { + "import": "./dist/index.d.mts", + "require": "./dist/index.d.ts" + }, + "import": "./dist/index.esm.mjs", "require": "./dist/index.umd.js" }, "sideEffects": false, diff --git a/lib/octicons_react/rollup.config.js b/lib/octicons_react/rollup.config.js index 1b04c208a..23cfa253a 100644 --- a/lib/octicons_react/rollup.config.js +++ b/lib/octicons_react/rollup.config.js @@ -1,10 +1,20 @@ import babel from '@rollup/plugin-babel' import commonjs from '@rollup/plugin-commonjs' +import packageJson from './package.json' -const formats = ['esm', 'umd'] // 'cjs' ? +const dependencies = [ + ...Object.keys(packageJson.peerDependencies ?? {}), + ...Object.keys(packageJson.dependencies ?? {}), + ...Object.keys(packageJson.devDependencies ?? {}) +] -export default { +function createPackageRegex(name) { + return new RegExp(`^${name}(/.*)?`) +} + +const baseConfig = { input: 'src/index.js', + external: dependencies.map(createPackageRegex), plugins: [ babel({ babelrc: false, @@ -20,10 +30,26 @@ export default { babelHelpers: 'bundled' }), commonjs() - ], - output: formats.map(format => ({ - file: `dist/index.${format}.js`, - format, - name: 'reocticons' - })) + ] } + +export default [ + { + ...baseConfig, + output: { + file: `dist/index.esm.mjs`, + format: 'esm' + } + }, + { + ...baseConfig, + output: { + file: `dist/index.umd.js`, + format: 'umd', + name: 'reocticons', + globals: { + react: 'React' + } + } + } +] diff --git a/lib/octicons_react/script/types.js b/lib/octicons_react/script/types.js index 99860a8ad..43cecec2a 100755 --- a/lib/octicons_react/script/types.js +++ b/lib/octicons_react/script/types.js @@ -10,17 +10,17 @@ const destDir = resolve(__dirname, '../dist') const iconsDest = join(destDir, 'icons.d.ts') const indexDest = join(destDir, 'index.d.ts') -fse - .copy(iconsSrc, iconsDest) - .then(() => { - return fse - .readFile(indexSrc, 'utf8') - .then(content => content.replace(/.\/__generated__\//g, './')) - .then(content => fse.writeFile(indexDest, content, 'utf8')) - }) - .catch(die) +async function main() { + await fse.copy(iconsSrc, iconsDest) -function die(err) { - console.error(err.stack) - process.exitCode = 1 + let contents = await fse.readFile(indexSrc, 'utf8') + contents = contents.replace(/.\/__generated__\//g, './') + + await fse.writeFile(indexDest, contents, 'utf8') + await fse.writeFile(join(destDir, 'index.d.mts'), contents, 'utf8') } + +main().catch(error => { + console.error(error) + process.exitCode = 1 +}) From ceb6c1c2321204ca95726e7b66801085d47828a5 Mon Sep 17 00:00:00 2001 From: Josh Black Date: Wed, 13 Mar 2024 12:49:12 -0500 Subject: [PATCH 09/11] chore: update changeset to reference octicons package (#1013) --- .changeset/spicy-actors-act.md | 2 +- .changeset/tasty-countries-grow.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/spicy-actors-act.md b/.changeset/spicy-actors-act.md index 32d0778c5..688fc578d 100644 --- a/.changeset/spicy-actors-act.md +++ b/.changeset/spicy-actors-act.md @@ -1,5 +1,5 @@ --- -'@primer/octicons-react': patch +'@primer/octicons': patch --- Update octicons in React to no longer set role="img" if the icon is aria-hidden diff --git a/.changeset/tasty-countries-grow.md b/.changeset/tasty-countries-grow.md index c426c4358..02ab84365 100644 --- a/.changeset/tasty-countries-grow.md +++ b/.changeset/tasty-countries-grow.md @@ -1,5 +1,5 @@ --- -'@primer/octicons-react': minor +'@primer/octicons': minor --- Update ESM import to use mjs extension when in parent CommonJS module From cce52ce0a94a7d8c6a44a2be26092585ab7a30b8 Mon Sep 17 00:00:00 2001 From: Jon Rohan Date: Thu, 14 Mar 2024 11:10:57 -0700 Subject: [PATCH 10/11] Update spicy-actors-act.md --- .changeset/spicy-actors-act.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/spicy-actors-act.md b/.changeset/spicy-actors-act.md index 688fc578d..44a2b3fab 100644 --- a/.changeset/spicy-actors-act.md +++ b/.changeset/spicy-actors-act.md @@ -2,4 +2,4 @@ '@primer/octicons': patch --- -Update octicons in React to no longer set role="img" if the icon is aria-hidden +Update octicons in React to no longer set `role="img"` if the icon is aria-hidden. From 428ee18af960ae6f2166d998475507f5f6c56d2b Mon Sep 17 00:00:00 2001 From: Jon Rohan Date: Thu, 14 Mar 2024 11:44:40 -0700 Subject: [PATCH 11/11] Fix versioning script that updates the version files (#1015) * Update Rakefile * Fix version script * Fix version script --- lib/octicons_gem/Rakefile | 2 +- lib/octicons_helper/Rakefile | 2 +- lib/octicons_jekyll/Rakefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/octicons_gem/Rakefile b/lib/octicons_gem/Rakefile index 49d957c07..2017abd9a 100644 --- a/lib/octicons_gem/Rakefile +++ b/lib/octicons_gem/Rakefile @@ -14,7 +14,7 @@ Rake::TestTask.new do |t| end task :version, [:v] do |t, args| - out = "module Octicons\n"\ + out = "# frozen_string_literal: true\n\nmodule Octicons\n"\ " VERSION = \"#{args[:v]}\".freeze\n"\ "end" File.open(File.expand_path("../lib/octicons/version.rb", __FILE__), "w") { |file| file.puts out } diff --git a/lib/octicons_helper/Rakefile b/lib/octicons_helper/Rakefile index 861b647d8..9590b1db1 100644 --- a/lib/octicons_helper/Rakefile +++ b/lib/octicons_helper/Rakefile @@ -9,7 +9,7 @@ RuboCop::RakeTask.new(:lint) do |t| end task :version, [:v] do |t, args| - out = "module OcticonsHelper\n"\ + out = "# frozen_string_literal: true\n\nmodule OcticonsHelper\n"\ " VERSION = \"#{args[:v]}\".freeze\n"\ "end" File.open(File.expand_path("../lib/octicons_helper/version.rb", __FILE__), "w") do |file| diff --git a/lib/octicons_jekyll/Rakefile b/lib/octicons_jekyll/Rakefile index ac387d6b3..1d5821720 100644 --- a/lib/octicons_jekyll/Rakefile +++ b/lib/octicons_jekyll/Rakefile @@ -9,7 +9,7 @@ RuboCop::RakeTask.new(:lint) do |t| end task :version, [:v] => :environment do |t, args| - out = "# Prevent bundler errors\n"\ + out = "# frozen_string_literal: true\n\n# Prevent bundler errors\n"\ "module Liquid; class Tag; end; end\n\n"\ "module Jekyll\n"\ " class Octicons < Liquid::Tag\n"\