packwerk-extensions 0.1.3 → 0.1.5

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: 386976d614f05a729cca841349279d58275a040efc1ed557f986bde6e12ed121
4
- data.tar.gz: 5b185ef7ffd80fc5729be39de4ae42183ae0c327f28795731981b1cd4c85054c
3
+ metadata.gz: 4f96f84e834641849b005e20027231c6baf405ac64d5f1c0ac8ae1915aa33fb8
4
+ data.tar.gz: ccaa5606cb9b40bcab5954ebb1e61450f72b14b2c2a40d67fbdf0b5145b52a29
5
5
  SHA512:
6
- metadata.gz: 50b1c9dfeedb990ee1288e9cdcde59590e03dd92e94f57806ce9b81572a2eb74da0fb5bf397068e6ce511ed884b0fc64f0c2bc7d020a00c7c573079449ba5aa7
7
- data.tar.gz: 28380895e41326a78a159708ea3a79d98be283fdd5d35169746d522e3d88331d49fd88877badd4e67a72edf9c9db7311052c2a264c468f36b1874a1c620f284e
6
+ metadata.gz: d8918928b822a0d5e229f550dec48e18faf056c93b7626c63d85a132f4fa0dcf3dc122f5dfefebf60bc807db4f184f170ba1c89afd36194ab0987b487ae1b5c9
7
+ data.tar.gz: 7dc8f0bf1b44412934321db1e54fb802535f2257b59adccd7194ca750230e46bc0f2bf8752f727c13f0d262c67c3441370a62d40bd16cd161bcc64773586c264
data/README.md CHANGED
@@ -2,11 +2,6 @@
2
2
 
3
3
  `packwerk-extensions` is a home for checker extensions for [packwerk](https://github.com/Shopify/packwerk) 3.
4
4
 
5
- Note that packwerk has not yet released packwerk 3. If you'd like to use `packwerk-extensions`, you'll need to point your `Gemfile` at the `packwerk` `main` branch:
6
- ```ruby
7
- gem 'packwerk', github: 'Shopify/packwerk', branch: 'main'
8
- ```
9
-
10
5
  Currently, it ships the following checkers to help improve the boundaries between packages. These checkers are:
11
6
  - A `privacy` checker that ensures other packages are using your package's public API
12
7
  - A `visibility` checker that allows packages to be private except to an explicit group of other packages.
@@ -14,10 +9,13 @@ Currently, it ships the following checkers to help improve the boundaries betwee
14
9
 
15
10
  ## Installation
16
11
 
12
+ Add `packwerk-extensions` to your `Gemfile`.
13
+
17
14
  To register all checkers included in this gem, add the following to your `packwerk.yml`:
18
15
 
19
16
  ```yaml
20
- require: packwerk-extensions
17
+ require:
18
+ - packwerk-extensions
21
19
  ```
22
20
 
23
21
  Alternatively, you can require individual checkers:
@@ -60,7 +58,7 @@ public_path: my/custom/path/
60
58
  Sometimes it is desirable to only enforce privacy on a subset of constants in a package. You can do so by defining a `private_constants` list in your package.yml. Note that `enforce_privacy` must be set to `true` or `'strict'` for this to work.
61
59
 
62
60
  ### Package Privacy violation
63
- A constant that is private to its package has been referenced from outside of the package. Constants are declared private in their package’s `package.yml`.
61
+ 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.
64
62
 
65
63
  #### Interpreting Privacy violation
66
64
 
@@ -36,10 +36,12 @@ module Packwerk
36
36
 
37
37
  # This allows the layer to be inferred based on the package root
38
38
  package_root = package.name.split('/').first
39
- if package_root && layers.names.include?(package_root)
39
+ if config['layer']
40
+ layer = config['layer']
41
+ elsif package_root && layers.names.include?(package_root)
40
42
  layer = package_root
41
43
  else
42
- layer = config['layer']
44
+ layer = nil
43
45
  end
44
46
 
45
47
  Package.new(
@@ -42,7 +42,8 @@ module Packwerk
42
42
  results = T.let([], T::Array[Result])
43
43
  resolver = ConstantResolver.new(
44
44
  root_path: configuration.root_path,
45
- load_paths: configuration.load_paths
45
+ load_paths: configuration.load_paths,
46
+ inflector: ActiveSupport::Inflector
46
47
  )
47
48
 
48
49
  private_constants_setting.each do |config_file_path, setting|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packwerk-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-24 00:00:00.000000000 Z
11
+ date: 2023-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: packwerk