use_packwerk 0.61.0 → 0.63.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c4a14c7a607d7c5778ec8dc79c199dbcb3dd5698db1e7d5f7c70e5b0deff5fa
4
- data.tar.gz: 73022ab6fa41370d82ab39610528ba393bc3559de7a764832c7107ec6048f408
3
+ metadata.gz: ebe18edb1b17a40a2ad1815cc4482d6dfcfac0817e8900ff775cbcacc5c1bcd5
4
+ data.tar.gz: edcba665142d63a40373126b85d5bbcb92ca98123bd599f8eff7ed56accc8014
5
5
  SHA512:
6
- metadata.gz: 98721b214ca79437c0dd5f4fa617df51cd2ea00d6373f01a28ee51a8799b281965d58aa68cc1c36100d79f639c30cb68e47acfbaebc3c8b57812a702c1ef798f
7
- data.tar.gz: 38e8aafc4cbd3b0e38bfda5f24087efbc33185f2e787568088e8afb98e67441eb62ebaf42c27b0e4d489637949316a6834989d2f8d99e5fd7ee8e002ab580e64
6
+ metadata.gz: 2421e5530d6534eb6592bc04278afb9a0276bd0446081483ff346f9d30864970edb13f7b2a01ee38682a183b1cb4d498f6fe726081a4783200d5c8aa38946e64
7
+ data.tar.gz: 8723efa393e952179f670818b99dacedcfd0be341d49447d01906a4c512150d819967cc4b2b2a28edf124eeb59d491347b688f0525a95a327c8b4341207712f8
@@ -11,12 +11,12 @@ module UsePackwerk
11
11
 
12
12
  sig { returns(ParsePackwerk::Package) }
13
13
  def origin_pack
14
- T.must(ParsePackwerk.package_from_path(origin_pathname))
14
+ ParsePackwerk.package_from_path(origin_pathname)
15
15
  end
16
16
 
17
17
  sig { params(origin_pathname: Pathname, new_package_root: Pathname).returns(Pathname) }
18
18
  def self.destination_pathname_for_package_move(origin_pathname, new_package_root)
19
- origin_pack = T.must(ParsePackwerk.package_from_path(origin_pathname))
19
+ origin_pack = ParsePackwerk.package_from_path(origin_pathname)
20
20
 
21
21
  if origin_pack.name == ParsePackwerk::ROOT_PACKAGE_NAME
22
22
  new_package_root.join(origin_pathname).cleanpath
@@ -27,7 +27,7 @@ module UsePackwerk
27
27
 
28
28
  sig { params(origin_pathname: Pathname).returns(Pathname) }
29
29
  def self.destination_pathname_for_new_public_api(origin_pathname)
30
- origin_pack = T.must(ParsePackwerk.package_from_path(origin_pathname))
30
+ origin_pack = ParsePackwerk.package_from_path(origin_pathname)
31
31
  if origin_pack.name == ParsePackwerk::ROOT_PACKAGE_NAME
32
32
  filepath_without_pack_name = origin_pathname.to_s
33
33
  else
@@ -35,7 +35,7 @@ module UsePackwerk
35
35
 
36
36
  # TODO: This is a copy of the implementation below. We may want to refactor out this implementation detail before making changes that apply to both.
37
37
  all_packages.each do |client_package|
38
- PackageProtections::ProtectedPackage.from(client_package).violations.select(&:privacy?).each do |violation|
38
+ client_package.violations.select(&:privacy?).each do |violation|
39
39
  next unless to_package_names.include?(violation.to_package_name)
40
40
 
41
41
  if pack_name.nil?
@@ -99,7 +99,7 @@ module UsePackwerk
99
99
 
100
100
  # TODO: This is a copy of the implementation above. We may want to refactor out this implementation detail before making changes that apply to both.
101
101
  all_packages.each do |client_package|
102
- PackageProtections::ProtectedPackage.from(client_package).violations.select(&:dependency?).each do |violation|
102
+ client_package.violations.select(&:dependency?).each do |violation|
103
103
  next unless to_package_names.include?(violation.to_package_name)
104
104
 
105
105
  if pack_name.nil?
@@ -64,7 +64,7 @@ module UsePackwerk
64
64
 
65
65
  sig { params(files: T::Array[String]).returns(T::Array[String]) }
66
66
  def self.package_names_for_files(files)
67
- files.map { |f| ParsePackwerk.package_from_path(f)&.name }.compact.uniq
67
+ files.map { |f| ParsePackwerk.package_from_path(f).name }.compact.uniq
68
68
  end
69
69
  end
70
70
  end
@@ -228,7 +228,7 @@ module UsePackwerk
228
228
  end
229
229
 
230
230
  file_move_operations = file_paths.map do |path|
231
- package = T.must(ParsePackwerk.package_from_path(path))
231
+ package = ParsePackwerk.package_from_path(path)
232
232
  origin_pathname = Pathname.new(path).cleanpath
233
233
 
234
234
  FileMoveOperation.new(
@@ -361,8 +361,7 @@ module UsePackwerk
361
361
  )
362
362
 
363
363
  ParsePackwerk.write_package_yml!(package)
364
- PackageProtections.set_defaults!([package], verbose: false)
365
- package = rewrite_package_with_original_packwerk_values(package)
364
+ RuboCop::Packs.set_default_rubocop_yml(packs: [package])
366
365
 
367
366
  current_contents = package.yml.read
368
367
  new_contents = current_contents.gsub('MyTeam', 'MyTeam # specify your team here, or delete this key if this package is not owned by one team')
@@ -373,23 +372,6 @@ module UsePackwerk
373
372
  existing_package
374
373
  end
375
374
 
376
- sig { params(original_package: ParsePackwerk::Package).returns(ParsePackwerk::Package) }
377
- def self.rewrite_package_with_original_packwerk_values(original_package)
378
- ParsePackwerk.bust_cache!
379
- package_with_protection_defaults = T.must(ParsePackwerk.all.find { |p| p.name == original_package.name })
380
- # PackageProtections also sets `enforce_privacy` and `enforce_dependency` to be true, so we set these back down to their original values
381
- package = ParsePackwerk::Package.new(
382
- enforce_dependencies: original_package.enforce_dependencies,
383
- enforce_privacy: original_package.enforce_privacy,
384
- dependencies: original_package.dependencies,
385
- metadata: package_with_protection_defaults.metadata,
386
- name: original_package.name
387
- )
388
-
389
- ParsePackwerk.write_package_yml!(package)
390
- package
391
- end
392
-
393
375
  sig { void }
394
376
  def self.load_client_configuration
395
377
  @loaded_client_configuration ||= T.let(false, T.nilable(T::Boolean))
@@ -122,7 +122,7 @@ module UsePackwerk
122
122
  Anything that is considered private should go in other folders.
123
123
 
124
124
  If another pack uses classes, constants, or modules that are not in your public folder, it will be considered a "privacy violation" by packwerk.
125
- You can prevent other packs from using private API by using package_protections.
125
+ You can prevent other packs from using private API by using packwerk.
126
126
 
127
127
  Want to find how your private API is being used today?
128
128
  Try running: `bin/use_packwerk list_top_privacy_violations #{pack_name}`
data/lib/use_packwerk.rb CHANGED
@@ -10,7 +10,7 @@ require 'colorized_string'
10
10
  require 'parse_packwerk'
11
11
  require 'code_teams'
12
12
  require 'code_ownership'
13
- require 'package_protections'
13
+ require 'rubocop-packs'
14
14
 
15
15
  # Private implementation requires
16
16
  require 'use_packwerk/private'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_packwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.61.0
4
+ version: 0.63.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-10 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_ownership
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: package_protections
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: packwerk
57
43
  requirement: !ruby/object:Gem::Requirement