Skip to content

Commit e22e94f

Browse files
committed
feat: Snyk CLI is bundled with Webpack
1 parent dd46c19 commit e22e94f

File tree

38 files changed

+69573
-130
lines changed

38 files changed

+69573
-130
lines changed

.circleci/config.yml

Lines changed: 103 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ commands:
3838
steps:
3939
- run:
4040
name: Install dependencies
41-
command: npm install
41+
command: npm ci
4242
update_local_npmrc_linux:
4343
description: Update local .npmrc file (Linux)
4444
steps:
@@ -50,11 +50,13 @@ commands:
5050
steps:
5151
- run:
5252
name: Build
53-
command: npm run build
53+
command: npm run build:prod
5454
- persist_to_workspace:
5555
root: .
5656
paths:
5757
- dist/
58+
- packages/*/dist
59+
- pysrc
5860
install_gradle_windows:
5961
description: Install gradle
6062
steps:
@@ -144,44 +146,51 @@ commands:
144146
gh --version
145147
146148
jobs:
147-
regression-test:
149+
build:
148150
<<: *defaults
149151
docker:
150152
- image: circleci/node:<< parameters.node_version >>
151153
resource_class: large
152154
steps:
153155
- checkout
154-
- install_shellspec
155156
- run: sudo npm install -g npm@7
156157
- show_node_version
157-
- update_local_npmrc_linux
158158
- install_deps
159159
- build_ts
160-
- run:
161-
name: Run auth
162-
command: npm run snyk-auth
160+
regression-test:
161+
<<: *defaults
162+
docker:
163+
- image: circleci/node:<< parameters.node_version >>
164+
steps:
165+
- checkout
166+
- install_shellspec
167+
- run: sudo npm install -g npm@7
168+
- install_sdkman_linux
169+
- install_jdk_linux
170+
- install_gradle_linux
171+
- install_maven_linux
172+
- install_deps
173+
- run: sudo apt-get install python-pip
174+
- attach_workspace:
175+
at: ~/snyk
163176
- run:
164177
name: Run tests
165178
command: npm run test:common
166-
- run:
167-
name: Clear Snyk config
168-
command: rm ~/.config/configstore/snyk.json
169-
- run:
170-
name: Clear node_modules
171-
command: rm -rf node_modules/
172-
- run:
173-
name: Install only production dependencies
174-
command: npx npm@6 install # kludge because npm@7 will invoke the lifecycle scripts (thus running prepare -> tsc) even if we use --ignore-scripts
175-
environment:
176-
NODE_ENV: production
177179
- run:
178180
name: npm install for fixture project
179181
working_directory: ~/snyk/test/fixtures/basic-npm
180182
command: npm install
181183
- run:
182-
name: Setup alias for snyk
183-
working_directory: ~/snyk/
184-
command: sudo ./test/smoke/setup-alias-for-snyk.sh
184+
name: prune dependencies
185+
command: node ./release-scripts/prune-dependencies-in-packagejson.js
186+
- run: mkdir ./dist-pack
187+
- run:
188+
name: pack
189+
command: npm pack ..
190+
path: ./dist-pack
191+
- run:
192+
name: Install packed Snyk globally
193+
command: find . -name '*.tgz' | xargs sudo npm install -g
185194
- run:
186195
name: Run shellspec
187196
working_directory: ~/snyk/test/smoke
@@ -203,20 +212,14 @@ jobs:
203212
node_version: << parameters.node_version >>
204213
- show_node_version
205214
- checkout
215+
- run: npm install -g npm@7
216+
- install_deps
206217
- attach_workspace:
207218
at: ~/snyk
208-
- run: npm install -g npm@7
209219
- show_node_version
210220
- run:
211221
name: Update local .npmrc file (Windows)
212222
command: echo "//registry.npmjs.org/:_authToken=$env:NPM_TOKEN" >> .npmrc
213-
- run:
214-
name: Install dependencies (Windows)
215-
command: npm install --ignore-scripts # ignore-scripts required because of postinstall script in snyk-resolve-deps package
216-
- build_ts
217-
- run:
218-
name: npm version
219-
command: npm --version
220223
- run:
221224
name: Run auth
222225
shell: bash.exe
@@ -279,16 +282,12 @@ jobs:
279282
- install_sbt_linux
280283
- show_node_version
281284
- checkout
285+
- run: sudo npm install -g npm@7
282286
- attach_workspace:
283287
at: ~/snyk
284-
- run: sudo npm install -g npm@7
285288
- show_node_version
286289
- update_local_npmrc_linux
287290
- install_deps
288-
- build_ts
289-
- run:
290-
name: npm version
291-
command: npm --version
292291
- run:
293292
name: Run auth
294293
command: npm run snyk-auth
@@ -348,17 +347,23 @@ jobs:
348347
name: Install npm@7
349348
command: |
350349
sudo npm install -g npm@7
351-
- show_node_version
352350
- install_deps
351+
- attach_workspace:
352+
at: ~/snyk
353+
- show_node_version
353354
- run:
354355
name: Update package versions
355-
command: ./release-scripts/update-versions.sh
356+
command: ./release-scripts/update-dev-versions.sh
356357
- run:
357358
name: Install osslsigncode
358359
command: sudo apt-get install -y osslsigncode
360+
- run:
361+
name: prune dependencies
362+
command: node ./release-scripts/prune-dependencies-in-packagejson.js
359363
- run:
360364
name: Create Binaries
361365
command: |
366+
cat package.json
362367
./release-scripts/make-binaries.sh
363368
ls -la ./binary-releases
364369
- store_artifacts:
@@ -368,7 +373,13 @@ jobs:
368373
working_directory: ~/snyk/binary-releases
369374
command: |
370375
../release-scripts/validate-checksums.sh
371-
376+
- run: mkdir ./dist-pack
377+
- run:
378+
name: pack
379+
command: npm pack ..
380+
path: ./dist-pack
381+
- store_artifacts:
382+
path: ./dist-pack
372383
release:
373384
<<: *defaults
374385
docker:
@@ -385,9 +396,17 @@ jobs:
385396
name: Install npm@7
386397
command: |
387398
sudo npm install -g npm@7
399+
- run:
400+
name: Install osslsigncode
401+
command: sudo apt-get install -y osslsigncode
388402
- show_node_version
389403
- update_local_npmrc_linux
390404
- install_deps
405+
- attach_workspace:
406+
at: ~/snyk
407+
- run:
408+
name: prune dependencies
409+
command: node ./release-scripts/prune-dependencies-in-packagejson.js
391410
- run:
392411
name: Update package versions
393412
command: ./release-scripts/update-versions.sh
@@ -402,9 +421,6 @@ jobs:
402421
name: Lerna Publish
403422
command: |
404423
npx lerna publish minor --yes --no-push --no-git-tag-version --exact
405-
- run:
406-
name: Install osslsigncode
407-
command: sudo apt-get install -y osslsigncode
408424
- run:
409425
name: Create Binaries
410426
command: |
@@ -434,17 +450,25 @@ workflows:
434450
version: 2
435451
test_and_release:
436452
jobs:
453+
- build:
454+
name: Build
455+
context: nodejs-install
456+
node_version: '12.16.2'
437457
- regression-test:
438458
name: Regression Test
439459
context: nodejs-install
440460
node_version: '12.16.2'
461+
requires:
462+
- Build
441463
filters:
442464
branches:
443465
ignore:
444466
- master
445467
- dev-release:
446468
name: Dev Release
447469
node_version: '14'
470+
requires:
471+
- Build
448472
filters:
449473
branches:
450474
ignore:
@@ -457,6 +481,8 @@ workflows:
457481
jest_tests: true
458482
system_tests: true
459483
package_tests: true
484+
requires:
485+
- Build
460486
filters:
461487
branches:
462488
ignore:
@@ -466,6 +492,8 @@ workflows:
466492
context: nodejs-install
467493
node_version: '14.15.4'
468494
acceptance_tests: true
495+
requires:
496+
- Build
469497
filters:
470498
branches:
471499
ignore:
@@ -475,6 +503,8 @@ workflows:
475503
context: nodejs-install
476504
node_version: '14.15.4'
477505
root_tap_tests: true
506+
requires:
507+
- Build
478508
filters:
479509
branches:
480510
ignore:
@@ -487,6 +517,8 @@ workflows:
487517
jest_tests: true
488518
system_tests: true
489519
package_tests: true
520+
requires:
521+
- Build
490522
filters:
491523
branches:
492524
ignore:
@@ -496,6 +528,8 @@ workflows:
496528
context: nodejs-install
497529
node_version: '12.21.0'
498530
acceptance_tests: true
531+
requires:
532+
- Build
499533
filters:
500534
branches:
501535
ignore:
@@ -505,6 +539,8 @@ workflows:
505539
context: nodejs-install
506540
node_version: '12.21.0'
507541
root_tap_tests: true
542+
requires:
543+
- Build
508544
filters:
509545
branches:
510546
ignore:
@@ -517,6 +553,8 @@ workflows:
517553
jest_tests: true
518554
system_tests: true
519555
package_tests: true
556+
requires:
557+
- Build
520558
filters:
521559
branches:
522560
ignore:
@@ -526,6 +564,8 @@ workflows:
526564
context: nodejs-install
527565
node_version: '10.23.1'
528566
acceptance_tests: true
567+
requires:
568+
- Build
529569
filters:
530570
branches:
531571
ignore:
@@ -535,6 +575,8 @@ workflows:
535575
context: nodejs-install
536576
node_version: '10.23.1'
537577
root_tap_tests: true
578+
requires:
579+
- Build
538580
filters:
539581
branches:
540582
ignore:
@@ -547,6 +589,8 @@ workflows:
547589
jest_tests: true
548590
system_tests: true
549591
package_tests: true
592+
requires:
593+
- Build
550594
filters:
551595
branches:
552596
ignore:
@@ -556,6 +600,8 @@ workflows:
556600
context: nodejs-install
557601
node_version: '14.15.4'
558602
acceptance_tests: true
603+
requires:
604+
- Build
559605
filters:
560606
branches:
561607
ignore:
@@ -565,6 +611,8 @@ workflows:
565611
context: nodejs-install
566612
node_version: '14.15.4'
567613
root_tap_tests: true
614+
requires:
615+
- Build
568616
filters:
569617
branches:
570618
ignore:
@@ -577,6 +625,8 @@ workflows:
577625
jest_tests: true
578626
system_tests: true
579627
package_tests: true
628+
requires:
629+
- Build
580630
filters:
581631
branches:
582632
ignore:
@@ -586,6 +636,8 @@ workflows:
586636
context: nodejs-install
587637
node_version: '12.21.0'
588638
acceptance_tests: true
639+
requires:
640+
- Build
589641
filters:
590642
branches:
591643
ignore:
@@ -595,6 +647,8 @@ workflows:
595647
context: nodejs-install
596648
node_version: '12.21.0'
597649
root_tap_tests: true
650+
requires:
651+
- Build
598652
filters:
599653
branches:
600654
ignore:
@@ -607,6 +661,8 @@ workflows:
607661
jest_tests: true
608662
system_tests: true
609663
package_tests: true
664+
requires:
665+
- Build
610666
filters:
611667
branches:
612668
ignore:
@@ -616,6 +672,8 @@ workflows:
616672
context: nodejs-install
617673
node_version: '10.23.1'
618674
acceptance_tests: true
675+
requires:
676+
- Build
619677
filters:
620678
branches:
621679
ignore:
@@ -625,6 +683,8 @@ workflows:
625683
context: nodejs-install
626684
node_version: '10.23.1'
627685
root_tap_tests: true
686+
requires:
687+
- Build
628688
filters:
629689
branches:
630690
ignore:
@@ -638,3 +698,5 @@ workflows:
638698
branches:
639699
only:
640700
- master
701+
requires:
702+
- Build

0 commit comments

Comments
 (0)