packwerk 3.0.0 → 3.0.1

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: 11206a06e6ac99c1fb8ef4cdefbe334133317d0599fce6480d4dfe10f694c747
4
- data.tar.gz: 606778530b8a872d331e5f331b9c6e14cb37ff6e0a5e13247bb0aebe1ca9e0cc
3
+ metadata.gz: 9af43a5e2d624ca5d6b38bfa3c9e65d1d12b1b9cc148a153563ebd55d3b6c82a
4
+ data.tar.gz: 6dee0dac16640632fb272c72ebe024a36c6a85ba23748b2ab5886279cccd863c
5
5
  SHA512:
6
- metadata.gz: 66166a9c683483fda99341adc79c807c40f8190c349c8650b8646810e06d11f9b4728e2e938ef0abf640967d0764d78b66e956aba3bdaef830c4a15253711542
7
- data.tar.gz: c1cce5df16246f1561cd0954abca4685e21adcaf52d3f6d164acd776f9466a0ad276a65b9a2f5cc9e358b058fcdc2cef265c2b3948043f9f3e35b1d4798ec5e9
6
+ metadata.gz: 197f933a60a46aba470ee66a2c04bbabcf1ff3c3386665551dbb7b8241b9357d73e7576de7edd7c322249b8d45cfc0b282616e0f9a5a665d4560964632a66806
7
+ data.tar.gz: ec903a206f47df277d6187afc5c17a9cfa1591446afb249f2ba62171f7c56ba8687ce403041db451eb8ea0dba842feb26cc7c32e9ff600b93e60e49eafb4584f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- packwerk (3.0.0)
4
+ packwerk (3.0.1)
5
5
  activesupport (>= 6.0)
6
6
  ast
7
7
  better_html
@@ -198,4 +198,4 @@ DEPENDENCIES
198
198
  zeitwerk
199
199
 
200
200
  BUNDLED WITH
201
- 2.4.7
201
+ 2.4.8
@@ -3,7 +3,7 @@
3
3
  Violations can be [recorded as a deprecation](#recording-violations) or (better!) [eliminated](#eliminating-violations).
4
4
 
5
5
  ## Recording Violations
6
- 💡 New privacy and dependency violations are never hard-blocked. There are many very valid reasons to run `bin/packwerk update-todo`, adding new violations to `package_todo.yml` files. Even if you feel your reason might not be "valid," if your judgement says adding the violation and shipping your change will produce positive impact, trust your gut.
6
+ 💡 New dependency violations are never hard-blocked. There are many very valid reasons to run `bin/packwerk update-todo`, adding new violations to `package_todo.yml` files. Even if you feel your reason might not be "valid," if your judgement says adding the violation and shipping your change will produce positive impact, trust your gut.
7
7
 
8
8
  ### Emergency Fixes
9
9
  ❔ Is it a revert or is there a lot of urgency because you are fixing a production bug impacting customers?
@@ -31,7 +31,7 @@ Violations can be [recorded as a deprecation](#recording-violations) or (better!
31
31
  ➡️ Stay strong. Eliminate the violation. It is important to build a sustainable business that optimizes for the long-term. Look for advocates such as from mentors or within your team who can help you justify improving system design.
32
32
 
33
33
  ## Eliminating Violations
34
- 💡 Dependency and privacy violations are Packwerk's signal that what we've stated about the desired system design (what
34
+ 💡 Dependency violations are Packwerk's signal that what we've stated about the desired system design (what
35
35
  packages exist and what lives in them, the dependencies in a package.yml, and the public interface in the package's public folder) doesn't match the reality of our system.
36
36
  If what we've stated about our system design doesn't feel right, then the violations won't make sense either! Make sure to think through system design before addressing a violation.
37
37
 
@@ -40,12 +40,7 @@ If what we've stated about our system design doesn't feel right, then the violat
40
40
 
41
41
  If not, find a better place for it to live.
42
42
 
43
- Otherwise, follow the guide for eliminating [Privacy Violations](#privacy-violations) or [Dependency Violations](#dependency-violations).
44
-
45
- ### Privacy Violations
46
- 💡 Packwerk thinks something is a privacy violation if you're referencing a constant, class, or module defined in the private implementation (i.e. not the public folder) of another package. We care about these because we want to make sure we only use parts of a package that have been exposed as public API.
47
-
48
- An explicit and implementation-hiding public API is a cornerstone of well-modularized code.
43
+ Otherwise, follow the guide for eliminating [Dependency Violations](#dependency-violations).
49
44
 
50
45
  #### Use Existing Public Interface
51
46
  ❔ Does the package you're using expose public API in its public folder that supports your use case?
data/TROUBLESHOOT.md CHANGED
@@ -14,9 +14,8 @@ You can specify folders or packages in Packwerk commands for a shorter run time:
14
14
 
15
15
  bin/packwerk check components/your_package
16
16
 
17
- bin/packwerk update-todo components/your_package
18
-
19
- _Note: You cannot specify folders or packages for `bin/packwerk validate` because the command runs for the entire application._
17
+ _Note: You cannot specify folders or packages for `bin/packwerk validate` and `bin/packwerk update-todo` because the
18
+ command runs for the entire application._
20
19
 
21
20
  ![](static/packwerk_check_violation.gif)
22
21
 
data/UPGRADING.md CHANGED
@@ -1,3 +1,15 @@
1
+ # Upgrading from 2.x to 3.0
2
+
3
+ In Packwerk 3.0, we've made two notable changes:
4
+
5
+ ## Renaming deprecated_references to package_todo
6
+
7
+ The `update-deprecations` subcommand has been renamed to `update-todo`. Old `deprecated_references.yml` files will be automatically deleted and replaced with `package_todo.yml` files when you run `update-todo`. This behaviour has been in Packwerk [since 2.3.0](https://github.com/Shopify/packwerk/releases/tag/v2.3.0), and automatic deletion will be removed in the next release.
8
+
9
+ ### Removal of privacy checking
10
+
11
+ Privacy checking via `enforce_privacy` has been removed. Developers are encouraged to focus on leveraging Packwerk for dependency checking. For those who still need privacy checks, please use [Gusto's extension gem](https://github.com/rubyatscale/packwerk-extensions).
12
+
1
13
  # Upgrading from 1.x to 2.0
2
14
 
3
15
  With Packwerk 2.0, we made a few changes to simplify the setup. Updating will require removing some previously necessary files and configuration.
data/USAGE.md CHANGED
@@ -144,7 +144,7 @@ Example:
144
144
 
145
145
  ## Types of boundary checks
146
146
 
147
- Packwerk ships with dependency boundary checking only. See [`packwerk-extensions`](https://github.com/rubyatscale/packwerk-extensions) to incorporate privacy checks into your use of `packwerk`.
147
+ Packwerk ships with dependency boundary checking only. Other checking support may be added by extension gems.
148
148
 
149
149
  #### Enforcing dependency boundary
150
150
 
@@ -198,7 +198,7 @@ See: [TROUBLESHOOT.md - Sample violations](TROUBLESHOOT.md#Sample-violations)
198
198
 
199
199
  ### Understanding how to respond to new violations
200
200
 
201
- When you have a new dependency or privacy violation, what do you do?
201
+ When you have a new dependency violation, what do you do?
202
202
 
203
203
  See: [RESOLVING_VIOLATIONS.md](RESOLVING_VIOLATIONS.md)
204
204
 
@@ -235,10 +235,10 @@ Above is an example of a constant violation entry in `package_todo.yml`.
235
235
 
236
236
  * `components/merchant` - package where the constant violation is found
237
237
  * `::Checkouts::Core::CheckoutId` - violated constant in question
238
- * `dependency` - type of violation, either dependency or privacy
238
+ * `dependency` - type of violation, typically dependency
239
239
  * `components/merchant/app/public/merchant/generate_order.rb` - path to the file containing the violated constant
240
240
 
241
- Violations exist within the package that makes a violating reference. This means privacy violations of your package can be found listed in `package_todo.yml` files in the packages with the reference to a private constant.
241
+ Violations exist within the package that makes a violating reference.
242
242
 
243
243
  # Loading Extensions
244
244
 
@@ -284,7 +284,7 @@ bin/packwerk check --offenses-formatter=my_offenses_formatter
284
284
 
285
285
  ### Custom Checkers
286
286
 
287
- Packwerk ships with a way to analyze dependencies and also supports custom checkers, such as the privacy checker listed below.
287
+ Packwerk ships with a way to analyze dependencies and also supports custom checkers from extension gems.
288
288
 
289
289
  Custom checkers will allow references to constants to be analyzed in new ways, and for those invalid references to show up as violations in `package_todo.yml`.
290
290
 
@@ -327,14 +327,6 @@ require:
327
327
  - ./path/to/file.rb
328
328
  ```
329
329
 
330
- #### Privacy Checker
331
-
332
- [`packwerk-extensions`](https://github.com/rubyatscale/packwerk-extensions) (originally extracted from `packwerk`) can be used to help define and enforce public API boundaries of a package. See the README.md for more details. To use this, add it to your `Gemfile` and then require it via `packwerk.yml`:
333
- ```yml
334
- require:
335
- - packwerk-extensions
336
- ```
337
-
338
330
  ### Custom Validators
339
331
 
340
332
  Similar to checkers, you can define your own validator to be executed when `bin/packwerk validate` is invoked. This can be used to support your custom checker (by specifying permitted keys) or to provide any other validations you want to impose on packages.
data/exe/packwerk CHANGED
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require "packwerk/disable_sorbet"
4
+ unless defined?(Spring)
5
+ require "packwerk/disable_sorbet"
6
+ end
7
+
5
8
  require "packwerk"
6
9
 
7
10
  # Needs to be run in test environment in order to have test helper paths available in the autoload paths
@@ -91,19 +91,18 @@ module Packwerk
91
91
 
92
92
  sig { void }
93
93
  def dump
94
- delete_old_deprecated_references
95
-
96
94
  if @new_entries.empty?
97
95
  delete_if_exists
98
96
  else
99
97
  prepare_entries_for_dump
100
98
  message = <<~MESSAGE
101
- # This file contains a list of dependencies that are not part of the long term plan for #{@package.name}.
102
- # We should generally work to reduce this list, but not at the expense of actually getting work done.
99
+ # This file contains a list of dependencies that are not part of the long term plan for the
100
+ # '#{@package.name}' package.
101
+ # We should generally work to reduce this list over time.
103
102
  #
104
103
  # You can regenerate this file using the following command:
105
104
  #
106
- # bin/packwerk update-todo #{@package.name}
105
+ # bin/packwerk update-todo
107
106
  MESSAGE
108
107
  File.open(@filepath, "w") do |f|
109
108
  f.write(message)
@@ -119,12 +118,6 @@ module Packwerk
119
118
 
120
119
  private
121
120
 
122
- sig { void }
123
- def delete_old_deprecated_references
124
- deprecated_references_filepath = File.join(File.dirname(@filepath), "deprecated_references.yml")
125
- File.delete(deprecated_references_filepath) if File.exist?(deprecated_references_filepath)
126
- end
127
-
128
121
  sig { returns(EntriesType) }
129
122
  def prepare_entries_for_dump
130
123
  @new_entries.each do |package_name, package_violations|
@@ -33,5 +33,3 @@ module Packwerk
33
33
 
34
34
  Spring.register_command("packwerk", SpringCommand.new)
35
35
  end
36
-
37
- require "packwerk/disable_sorbet"
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Packwerk
5
- VERSION = "3.0.0"
5
+ VERSION = "3.0.1"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport