licensed 2.14.4 → 2.15.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 +4 -4
- data/.github/workflows/release.yml +9 -9
- data/.github/workflows/test.yml +42 -42
- data/.gitignore +1 -0
- data/CHANGELOG.md +13 -4
- data/README.md +1 -1
- data/docs/sources/npm.md +1 -1
- data/lib/licensed/sources/cabal.rb +17 -6
- data/lib/licensed/sources/manifest.rb +1 -1
- data/lib/licensed/sources/npm.rb +55 -7
- data/lib/licensed/version.rb +1 -1
- data/script/packages/build +4 -1
- data/script/packages/mac +3 -0
- data/script/source-setup/npm +18 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e90a33d845fe81078014cc53dd61cc5044fc908df4fe65e3c3ce05e11884e3f
|
|
4
|
+
data.tar.gz: b0c1f03b192d70ec84d27f6b614d7874f32238a98a606f44e777cd1ee2e436ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d57bca03f12516e4802c50f4ac5483966659debe879f43f54ddec8d17a6ea05e88048693288a67e73ee68992981d127205025a16eb7fec7ae165554c3ea52d79
|
|
7
|
+
data.tar.gz: 74d3df3dbdd3f52f7c22d2ca006cb0893f8ec32873bab9b7d56998ad4c1ade63080f608498561834273c23a0e8b8e29fbad0b39a5942951c75b0b04350b8532a
|
|
@@ -83,7 +83,7 @@ jobs:
|
|
|
83
83
|
|
|
84
84
|
package_linux:
|
|
85
85
|
needs: vars
|
|
86
|
-
runs-on: ubuntu-
|
|
86
|
+
runs-on: ubuntu-18.04
|
|
87
87
|
steps:
|
|
88
88
|
- uses: actions/checkout@v2
|
|
89
89
|
with:
|
|
@@ -93,9 +93,9 @@ jobs:
|
|
|
93
93
|
fetch-depth: 0
|
|
94
94
|
|
|
95
95
|
- name: Set up Ruby 2.6
|
|
96
|
-
uses:
|
|
96
|
+
uses: ruby/setup-ruby@v1
|
|
97
97
|
with:
|
|
98
|
-
ruby-version: 2.6
|
|
98
|
+
ruby-version: 2.6
|
|
99
99
|
|
|
100
100
|
- name: Build package
|
|
101
101
|
run: script/packages/linux
|
|
@@ -119,9 +119,9 @@ jobs:
|
|
|
119
119
|
fetch-depth: 0
|
|
120
120
|
|
|
121
121
|
- name: Set up Ruby 2.6
|
|
122
|
-
uses:
|
|
122
|
+
uses: ruby/setup-ruby@v1
|
|
123
123
|
with:
|
|
124
|
-
ruby-version: 2.6
|
|
124
|
+
ruby-version: 2.6
|
|
125
125
|
|
|
126
126
|
- name: Build package
|
|
127
127
|
run: script/packages/mac
|
|
@@ -143,9 +143,9 @@ jobs:
|
|
|
143
143
|
ref: ${{needs.vars.outputs.version}}
|
|
144
144
|
|
|
145
145
|
- name: Set up Ruby 2.6
|
|
146
|
-
uses:
|
|
146
|
+
uses: ruby/setup-ruby@v1
|
|
147
147
|
with:
|
|
148
|
-
ruby-version: 2.6
|
|
148
|
+
ruby-version: 2.6
|
|
149
149
|
|
|
150
150
|
- name: Build gem
|
|
151
151
|
run: gem build licensed.gemspec -o licensed-${{needs.vars.outputs.version}}.gem
|
|
@@ -162,9 +162,9 @@ jobs:
|
|
|
162
162
|
|
|
163
163
|
steps:
|
|
164
164
|
- name: Set up Ruby 2.6
|
|
165
|
-
uses:
|
|
165
|
+
uses: ruby/setup-ruby@v1
|
|
166
166
|
with:
|
|
167
|
-
ruby-version: 2.6
|
|
167
|
+
ruby-version: 2.6
|
|
168
168
|
|
|
169
169
|
- name: Download linux package
|
|
170
170
|
uses: actions/download-artifact@v2
|
data/.github/workflows/test.yml
CHANGED
|
@@ -8,15 +8,15 @@ jobs:
|
|
|
8
8
|
steps:
|
|
9
9
|
- uses: actions/checkout@v2
|
|
10
10
|
- name: Setup node
|
|
11
|
-
uses: actions/setup-node@
|
|
11
|
+
uses: actions/setup-node@v2
|
|
12
12
|
with:
|
|
13
13
|
node-version: 8
|
|
14
14
|
- name: Install Bower
|
|
15
15
|
run: npm install -g bower
|
|
16
16
|
- name: Set up Ruby
|
|
17
|
-
uses:
|
|
17
|
+
uses: ruby/setup-ruby@v1
|
|
18
18
|
with:
|
|
19
|
-
ruby-version: 2.6
|
|
19
|
+
ruby-version: 2.6
|
|
20
20
|
- run: bundle lock
|
|
21
21
|
- uses: actions/cache@v1
|
|
22
22
|
with:
|
|
@@ -37,9 +37,9 @@ jobs:
|
|
|
37
37
|
steps:
|
|
38
38
|
- uses: actions/checkout@v2
|
|
39
39
|
- name: Set up Ruby
|
|
40
|
-
uses:
|
|
40
|
+
uses: ruby/setup-ruby@v1
|
|
41
41
|
with:
|
|
42
|
-
ruby-version: 2.6
|
|
42
|
+
ruby-version: 2.6
|
|
43
43
|
- name: Set up Bundler
|
|
44
44
|
run: |
|
|
45
45
|
yes | gem uninstall bundler --all
|
|
@@ -60,16 +60,16 @@ jobs:
|
|
|
60
60
|
runs-on: ubuntu-latest
|
|
61
61
|
strategy:
|
|
62
62
|
matrix:
|
|
63
|
-
ghc: [ '8.2
|
|
64
|
-
cabal: [ '2.
|
|
63
|
+
ghc: [ '8.2', '8.6', '8.8', '8.10' ]
|
|
64
|
+
cabal: [ '2.4', '3.0', '3.2' ]
|
|
65
65
|
steps:
|
|
66
66
|
- uses: actions/checkout@v2
|
|
67
67
|
- name: Set up Ruby
|
|
68
|
-
uses:
|
|
68
|
+
uses: ruby/setup-ruby@v1
|
|
69
69
|
with:
|
|
70
|
-
ruby-version: 2.6
|
|
70
|
+
ruby-version: 2.6
|
|
71
71
|
- name: Setup Haskell
|
|
72
|
-
uses: actions/setup
|
|
72
|
+
uses: haskell/actions/setup@v1
|
|
73
73
|
with:
|
|
74
74
|
ghc-version: ${{ matrix.ghc }}
|
|
75
75
|
cabal-version: ${{ matrix.cabal }}
|
|
@@ -89,17 +89,17 @@ jobs:
|
|
|
89
89
|
runs-on: ubuntu-latest
|
|
90
90
|
strategy:
|
|
91
91
|
matrix:
|
|
92
|
-
php: [ '
|
|
92
|
+
php: [ '7.3', '7.4' ]
|
|
93
93
|
steps:
|
|
94
94
|
- uses: actions/checkout@v2
|
|
95
95
|
- name: Setup php
|
|
96
|
-
uses: nanasess/setup-php@v3.0.
|
|
96
|
+
uses: nanasess/setup-php@v3.0.6
|
|
97
97
|
with:
|
|
98
98
|
php-version: ${{ matrix.php }}
|
|
99
99
|
- name: Set up Ruby
|
|
100
|
-
uses:
|
|
100
|
+
uses: ruby/setup-ruby@v1
|
|
101
101
|
with:
|
|
102
|
-
ruby-version: 2.6
|
|
102
|
+
ruby-version: 2.6
|
|
103
103
|
- run: bundle lock
|
|
104
104
|
- uses: actions/cache@v1
|
|
105
105
|
with:
|
|
@@ -116,11 +116,11 @@ jobs:
|
|
|
116
116
|
runs-on: ubuntu-latest
|
|
117
117
|
strategy:
|
|
118
118
|
matrix:
|
|
119
|
-
ruby: [ 2.
|
|
119
|
+
ruby: [ 2.5, 2.6, 2.7 ]
|
|
120
120
|
steps:
|
|
121
121
|
- uses: actions/checkout@v2
|
|
122
122
|
- name: Set up Ruby
|
|
123
|
-
uses:
|
|
123
|
+
uses: ruby/setup-ruby@v1
|
|
124
124
|
with:
|
|
125
125
|
ruby-version: ${{matrix.ruby}}
|
|
126
126
|
- name: Set up Bundler
|
|
@@ -146,9 +146,9 @@ jobs:
|
|
|
146
146
|
with:
|
|
147
147
|
go-version: 1.10.x
|
|
148
148
|
- name: Set up Ruby
|
|
149
|
-
uses:
|
|
149
|
+
uses: ruby/setup-ruby@v1
|
|
150
150
|
with:
|
|
151
|
-
ruby-version: 2.6
|
|
151
|
+
ruby-version: 2.6
|
|
152
152
|
- run: bundle lock
|
|
153
153
|
- uses: actions/cache@v1
|
|
154
154
|
with:
|
|
@@ -173,9 +173,9 @@ jobs:
|
|
|
173
173
|
with:
|
|
174
174
|
go-version: ${{ matrix.go }}
|
|
175
175
|
- name: Set up Ruby
|
|
176
|
-
uses:
|
|
176
|
+
uses: ruby/setup-ruby@v1
|
|
177
177
|
with:
|
|
178
|
-
ruby-version: 2.6
|
|
178
|
+
ruby-version: 2.6
|
|
179
179
|
- run: bundle lock
|
|
180
180
|
- uses: actions/cache@v1
|
|
181
181
|
with:
|
|
@@ -193,9 +193,9 @@ jobs:
|
|
|
193
193
|
steps:
|
|
194
194
|
- uses: actions/checkout@v2
|
|
195
195
|
- name: Set up Ruby
|
|
196
|
-
uses:
|
|
196
|
+
uses: ruby/setup-ruby@v1
|
|
197
197
|
with:
|
|
198
|
-
ruby-version: 2.6
|
|
198
|
+
ruby-version: 2.6
|
|
199
199
|
- run: bundle lock
|
|
200
200
|
- uses: actions/cache@v1
|
|
201
201
|
with:
|
|
@@ -213,9 +213,9 @@ jobs:
|
|
|
213
213
|
steps:
|
|
214
214
|
- uses: actions/checkout@v2
|
|
215
215
|
- name: Set up Ruby
|
|
216
|
-
uses:
|
|
216
|
+
uses: ruby/setup-ruby@v1
|
|
217
217
|
with:
|
|
218
|
-
ruby-version: 2.6
|
|
218
|
+
ruby-version: 2.6
|
|
219
219
|
- run: bundle lock
|
|
220
220
|
- uses: actions/cache@v1
|
|
221
221
|
with:
|
|
@@ -230,18 +230,18 @@ jobs:
|
|
|
230
230
|
runs-on: ubuntu-latest
|
|
231
231
|
strategy:
|
|
232
232
|
matrix:
|
|
233
|
-
otp: [21.x, 22.x]
|
|
234
|
-
elixir: [1.
|
|
233
|
+
otp: [21.x, 22.x, 23.x]
|
|
234
|
+
elixir: [ 1.10.x, 1.11.x ]
|
|
235
235
|
steps:
|
|
236
236
|
- uses: actions/checkout@v2
|
|
237
|
-
- uses:
|
|
237
|
+
- uses: erlef/setup-elixir@v1.6.0
|
|
238
238
|
with:
|
|
239
239
|
otp-version: ${{matrix.otp}}
|
|
240
240
|
elixir-version: ${{matrix.elixir}}
|
|
241
241
|
- name: Set up Ruby
|
|
242
|
-
uses:
|
|
242
|
+
uses: ruby/setup-ruby@v1
|
|
243
243
|
with:
|
|
244
|
-
ruby-version: 2.6
|
|
244
|
+
ruby-version: 2.6
|
|
245
245
|
- run: bundle lock
|
|
246
246
|
- uses: actions/cache@v1
|
|
247
247
|
with:
|
|
@@ -258,17 +258,17 @@ jobs:
|
|
|
258
258
|
runs-on: ubuntu-latest
|
|
259
259
|
strategy:
|
|
260
260
|
matrix:
|
|
261
|
-
node_version: [
|
|
261
|
+
node_version: [ 10, 12, 14, 15 ]
|
|
262
262
|
steps:
|
|
263
263
|
- uses: actions/checkout@v2
|
|
264
264
|
- name: Setup node
|
|
265
|
-
uses: actions/setup-node@
|
|
265
|
+
uses: actions/setup-node@v2
|
|
266
266
|
with:
|
|
267
267
|
node-version: ${{ matrix.node_version }}
|
|
268
268
|
- name: Set up Ruby
|
|
269
|
-
uses:
|
|
269
|
+
uses: ruby/setup-ruby@v1
|
|
270
270
|
with:
|
|
271
|
-
ruby-version: 2.6
|
|
271
|
+
ruby-version: 2.6
|
|
272
272
|
- run: bundle lock
|
|
273
273
|
- uses: actions/cache@v1
|
|
274
274
|
with:
|
|
@@ -290,9 +290,9 @@ jobs:
|
|
|
290
290
|
with:
|
|
291
291
|
dotnet-version: 3.1.202
|
|
292
292
|
- name: Set up Ruby
|
|
293
|
-
uses:
|
|
293
|
+
uses: ruby/setup-ruby@v1
|
|
294
294
|
with:
|
|
295
|
-
ruby-version: 2.6
|
|
295
|
+
ruby-version: 2.6
|
|
296
296
|
- run: bundle lock
|
|
297
297
|
- uses: actions/cache@v1
|
|
298
298
|
with:
|
|
@@ -318,9 +318,9 @@ jobs:
|
|
|
318
318
|
python-version: ${{ matrix.python }}
|
|
319
319
|
architecture: x64
|
|
320
320
|
- name: Set up Ruby
|
|
321
|
-
uses:
|
|
321
|
+
uses: ruby/setup-ruby@v1
|
|
322
322
|
with:
|
|
323
|
-
ruby-version: 2.6
|
|
323
|
+
ruby-version: 2.6
|
|
324
324
|
- run: bundle lock
|
|
325
325
|
- uses: actions/cache@v1
|
|
326
326
|
with:
|
|
@@ -345,9 +345,9 @@ jobs:
|
|
|
345
345
|
python-version: '3.x'
|
|
346
346
|
architecture: x64
|
|
347
347
|
- name: Set up Ruby
|
|
348
|
-
uses:
|
|
348
|
+
uses: ruby/setup-ruby@v1
|
|
349
349
|
with:
|
|
350
|
-
ruby-version: 2.6
|
|
350
|
+
ruby-version: 2.6
|
|
351
351
|
- run: bundle lock
|
|
352
352
|
- uses: actions/cache@v1
|
|
353
353
|
with:
|
|
@@ -371,7 +371,7 @@ jobs:
|
|
|
371
371
|
steps:
|
|
372
372
|
- uses: actions/checkout@v2
|
|
373
373
|
- name: Setup node
|
|
374
|
-
uses: actions/setup-node@
|
|
374
|
+
uses: actions/setup-node@v2
|
|
375
375
|
with:
|
|
376
376
|
node-version: 12
|
|
377
377
|
- name: Install Yarn
|
|
@@ -379,9 +379,9 @@ jobs:
|
|
|
379
379
|
env:
|
|
380
380
|
YARN_VERSION: ${{ matrix.yarn_version }}
|
|
381
381
|
- name: Set up Ruby
|
|
382
|
-
uses:
|
|
382
|
+
uses: ruby/setup-ruby@v1
|
|
383
383
|
with:
|
|
384
|
-
ruby-version: 2.6
|
|
384
|
+
ruby-version: 2.6
|
|
385
385
|
- run: bundle lock
|
|
386
386
|
- uses: actions/cache@v1
|
|
387
387
|
with:
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -6,23 +6,32 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## 2.15.0
|
|
10
|
+
2021-03-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Support for npm 7 (https://github.com/github/licensed/pull/341)
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Files in the manifest source will be found correctly for apps that are not at the repository root (https://github.com/github/licensed/pull/345)
|
|
17
|
+
|
|
9
18
|
## 2.14.4
|
|
10
19
|
2021-02-09
|
|
11
20
|
|
|
12
|
-
|
|
21
|
+
### Added
|
|
13
22
|
- `list` and `cache` commands optionally print output in JSON or YML formats using the `--format/-f` flag (https://github.com/github/licensed/pull/334)
|
|
14
23
|
- `list` command will include detected license keys using the `--licenses/-l` flag (https://github.com/github/licensed/pull/334)
|
|
15
24
|
|
|
16
25
|
## 2.14.3
|
|
17
26
|
2020-12-11
|
|
18
27
|
|
|
19
|
-
|
|
28
|
+
### Fixed
|
|
20
29
|
- Auto-generating license text for a known license will no longer raise an error if the found license has no text (:tada: @Eun https://github.com/github/licensed/pull/328)
|
|
21
30
|
|
|
22
31
|
## 2.14.2
|
|
23
32
|
2020-11-20
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
### Fixed
|
|
26
35
|
- Yarn source correctly finds dependency paths on disk (https://github.com/github/licensed/pull/326)
|
|
27
36
|
- Go source better handles finding dependencies that have been vendored (https://github.com/github/licensed/pull/323)
|
|
28
37
|
|
|
@@ -386,4 +395,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
386
395
|
|
|
387
396
|
Initial release :tada:
|
|
388
397
|
|
|
389
|
-
[Unreleased]: https://github.com/github/licensed/compare/2.
|
|
398
|
+
[Unreleased]: https://github.com/github/licensed/compare/2.15.0...HEAD
|
data/README.md
CHANGED
|
@@ -110,7 +110,7 @@ Dependencies will be automatically detected for all of the following sources by
|
|
|
110
110
|
1. [Gradle](./docs/sources/gradle.md)
|
|
111
111
|
1. [Manifest lists (manifests)](./docs/sources/manifests.md)
|
|
112
112
|
1. [Mix](./docs/sources/mix.md)
|
|
113
|
-
1. [
|
|
113
|
+
1. [npm](./docs/sources/npm.md)
|
|
114
114
|
1. [NuGet](./docs/sources/nuget.md)
|
|
115
115
|
1. [Pip](./docs/sources/pip.md)
|
|
116
116
|
1. [Pipenv](./docs/sources/pipenv.md)
|
data/docs/sources/npm.md
CHANGED
|
@@ -222,14 +222,25 @@ module Licensed
|
|
|
222
222
|
|
|
223
223
|
# Returns a package info structure with an error set
|
|
224
224
|
def missing_package(id)
|
|
225
|
-
name,
|
|
226
|
-
id.rpartition("-") # e.g. to match the right-most dash from ipid fused-effects-1.0.0.0
|
|
227
|
-
else
|
|
228
|
-
id.partition(/\s/) # e.g. to match the left-most space from constraint fused-effects > 1.0.0.0
|
|
229
|
-
end
|
|
230
|
-
|
|
225
|
+
name, version = package_id_name_version(id)
|
|
231
226
|
{ "name" => name, "version" => version, "error" => "package not found" }
|
|
232
227
|
end
|
|
228
|
+
|
|
229
|
+
# Parses the name and version pieces from an id or package requirement string
|
|
230
|
+
def package_id_name_version(id)
|
|
231
|
+
name, version = id.split(" ", 2)
|
|
232
|
+
return [name, version] if version
|
|
233
|
+
|
|
234
|
+
# split by dashes, find the rightmost thing that looks like an
|
|
235
|
+
parts = id.split("-")
|
|
236
|
+
version_start_index = parts.rindex { |part| part.match?(/^[\d\.]+$/) }
|
|
237
|
+
return [id, nil] if version_start_index.nil?
|
|
238
|
+
|
|
239
|
+
[
|
|
240
|
+
parts[0...version_start_index].join("-"),
|
|
241
|
+
parts[version_start_index..-1].join("-")
|
|
242
|
+
]
|
|
243
|
+
end
|
|
233
244
|
end
|
|
234
245
|
end
|
|
235
246
|
end
|
|
@@ -170,7 +170,7 @@ module Licensed
|
|
|
170
170
|
def all_files
|
|
171
171
|
# remove files if they are tracked but don't exist on the file system
|
|
172
172
|
@all_files ||= Set.new(Licensed::Git.files || [])
|
|
173
|
-
.delete_if { |f| !File.exist?(f) }
|
|
173
|
+
.delete_if { |f| !File.exist?(File.join(Licensed::Git.repository_root, f)) }
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
class Dependency < Licensed::Dependency
|
data/lib/licensed/sources/npm.rb
CHANGED
|
@@ -4,6 +4,25 @@ require "json"
|
|
|
4
4
|
module Licensed
|
|
5
5
|
module Sources
|
|
6
6
|
class NPM < Source
|
|
7
|
+
class Dependency < ::Licensed::Dependency
|
|
8
|
+
# override license_metadata to pull homepage and summary information
|
|
9
|
+
# from a packages package.json file, if it exists
|
|
10
|
+
# this accounts for the lack of this information in npm 7's `npm list` output
|
|
11
|
+
def license_metadata
|
|
12
|
+
data = super
|
|
13
|
+
return data if !data["homepage"].to_s.empty? && !data["summary"].to_s.empty?
|
|
14
|
+
|
|
15
|
+
package_json_path = File.join(path, "package.json")
|
|
16
|
+
return data unless File.exist?(package_json_path)
|
|
17
|
+
|
|
18
|
+
package_json = JSON.parse(File.read(package_json_path))
|
|
19
|
+
data["homepage"] = package_json["homepage"]
|
|
20
|
+
data["summary"] = package_json["description"]
|
|
21
|
+
|
|
22
|
+
data
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
7
26
|
def self.type
|
|
8
27
|
"npm"
|
|
9
28
|
end
|
|
@@ -50,6 +69,7 @@ module Licensed
|
|
|
50
69
|
dependencies.each do |name, dependency|
|
|
51
70
|
next if dependency["peerMissing"]
|
|
52
71
|
next if yarn_lock_present && dependency["missing"]
|
|
72
|
+
dependency["name"] = name
|
|
53
73
|
(result[name] ||= []) << dependency
|
|
54
74
|
recursive_dependencies(dependency["dependencies"] || {}, result)
|
|
55
75
|
end
|
|
@@ -59,22 +79,50 @@ module Licensed
|
|
|
59
79
|
# Returns parsed package metadata returned from `npm list`
|
|
60
80
|
def package_metadata
|
|
61
81
|
return @package_metadata if defined?(@package_metadata)
|
|
82
|
+
@package_metadata = JSON.parse(package_metadata_command)
|
|
83
|
+
rescue JSON::ParserError => e
|
|
84
|
+
message = "Licensed was unable to parse the output from 'npm list'. JSON Error: #{e.message}"
|
|
85
|
+
npm_error = package_metadata_error
|
|
86
|
+
message = "#{message}. npm Error: #{npm_error}" if npm_error
|
|
87
|
+
raise Licensed::Sources::Source::Error, message
|
|
88
|
+
end
|
|
62
89
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
90
|
+
# Returns an error, if one exists, from running `npm list` to get package metadata
|
|
91
|
+
def package_metadata_error
|
|
92
|
+
Licensed::Shell.execute("npm", "list", *package_metadata_args)
|
|
93
|
+
return ""
|
|
94
|
+
rescue Licensed::Shell::Error => e
|
|
95
|
+
return e.message
|
|
69
96
|
end
|
|
70
97
|
|
|
71
98
|
# Returns the output from running `npm list` to get package metadata
|
|
72
99
|
def package_metadata_command
|
|
73
100
|
args = %w(--json --long)
|
|
74
|
-
args
|
|
101
|
+
args.concat(package_metadata_args)
|
|
102
|
+
|
|
75
103
|
Licensed::Shell.execute("npm", "list", *args, allow_failure: true)
|
|
76
104
|
end
|
|
77
105
|
|
|
106
|
+
# Returns an array of arguments that should be used for all `npm list`
|
|
107
|
+
# calls, regardless of how the output is formatted
|
|
108
|
+
def package_metadata_args
|
|
109
|
+
args = []
|
|
110
|
+
args << "--production" unless include_non_production?
|
|
111
|
+
|
|
112
|
+
# on npm 7+, the --all argument is necessary to evaluate the project's
|
|
113
|
+
# full dependency tree
|
|
114
|
+
args << "--all" if npm_version >= Gem::Version.new("7.0.0")
|
|
115
|
+
|
|
116
|
+
return args
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Returns the currently installed version of npm as a Gem::Version object
|
|
120
|
+
def npm_version
|
|
121
|
+
@npm_version ||= begin
|
|
122
|
+
Gem::Version.new(Licensed::Shell.execute("npm", "-v").strip)
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
78
126
|
# Returns true if a yarn.lock file exists in the current directory
|
|
79
127
|
def yarn_lock_present
|
|
80
128
|
@yarn_lock_present ||= File.exist?(config.pwd.join("yarn.lock"))
|
data/lib/licensed/version.rb
CHANGED
data/script/packages/build
CHANGED
|
@@ -51,8 +51,11 @@ cd $COPY_DIR
|
|
|
51
51
|
trap "git checkout $CURRENT_BRANCH" EXIT
|
|
52
52
|
fi
|
|
53
53
|
|
|
54
|
+
# get the openssl dir to use when building based on ruby's default ssl cert dir
|
|
55
|
+
OPENSSL_DIR="$(cd "$(ruby -e 'require "net/https"; puts OpenSSL::X509::DEFAULT_CERT_DIR')/.." && pwd)"
|
|
56
|
+
|
|
54
57
|
# build the licensed rubyc executable
|
|
55
|
-
"$RUBYC" --clean-tmpdir -o "$BUILD_DIR/licensed" "$COPY_DIR/exe/licensed"
|
|
58
|
+
"$RUBYC" --openssl-dir "$OPENSSL_DIR" --clean-tmpdir -o "$BUILD_DIR/licensed" "$COPY_DIR/exe/licensed"
|
|
56
59
|
chmod +x $BUILD_DIR/licensed
|
|
57
60
|
)
|
|
58
61
|
|
data/script/packages/mac
CHANGED
|
@@ -28,6 +28,9 @@ brew update
|
|
|
28
28
|
brew list "squashfs" &>/dev/null || brew install "squashfs"
|
|
29
29
|
brew list "pkg-config" &>/dev/null || brew install "pkg-config"
|
|
30
30
|
|
|
31
|
+
gem update --system
|
|
32
|
+
gem update bundler
|
|
33
|
+
|
|
31
34
|
if [ ! -f "$RUBYC" ]; then
|
|
32
35
|
mkdir -p "$(dirname "$RUBYC")"
|
|
33
36
|
curl -L https://github.com/kontena/ruby-packer/releases/download/2.6.0-0.6.0/rubyc-2.6.0-0.6.0-osx-amd64.gz | gunzip > "$RUBYC"
|
data/script/source-setup/npm
CHANGED
|
@@ -10,8 +10,25 @@ fi
|
|
|
10
10
|
BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
11
11
|
cd $BASE_PATH/test/fixtures/npm
|
|
12
12
|
|
|
13
|
+
FORCE=""
|
|
13
14
|
if [ "$1" == "-f" ]; then
|
|
14
|
-
|
|
15
|
+
FORCE=1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
NPM_MAJOR_VERSION="$(npm -v | cut -d'.' -f1)"
|
|
19
|
+
if [ "$NPM_MAJOR_VERSION" -ge "7" ]; then
|
|
20
|
+
PACKAGE_JSON_SRC="package.json.npm7"
|
|
21
|
+
else
|
|
22
|
+
PACKAGE_JSON_SRC="package.json.npm6"
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
if [ ! -f "package.json" ] || [ "$(cat package.json | md5sum )" != "$(cat "$PACKAGE_JSON_SRC" | md5sum)" ]; then
|
|
26
|
+
FORCE=1
|
|
27
|
+
cp -f "$PACKAGE_JSON_SRC" package.json
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if [ -n "$FORCE" ]; then
|
|
31
|
+
find . -not -regex "\.*" -and -not -name "package\.json*" -print0 | xargs -0 rm -rf
|
|
15
32
|
fi
|
|
16
33
|
|
|
17
34
|
npm install
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: licensed
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.15.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GitHub
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-03-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: licensee
|