european-commission-empl / european-digital-credentials

European Union Public License 1.2
5 stars 3 forks source link

EDCI-Viewer does not compile out of the box: missing swagger files under edci-viewer-web #1

Open SeSodesa opened 3 years ago

SeSodesa commented 3 years ago

I have taken it upon myself to start adding credential visualizations to the Europass front-end, as a part of the Tampere University Erasmus+ WP7 research efforts. When compiling the front-end, I ran into issues related to a missing Swagger files, after installing the dependencies of

edci-viewer/edci-viewer-web/src/main/angular

with the commands

npm install
npm install --also=dev

The build logs and errors shown during a build went as follows:

santtu@~/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular
λ npm run build-test    

> eui-angular-app@1.0.0 build-test /home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular
> eui-scripts build-app --skipTest --configuration=test

▶ BUILDING APPLICATION : APP...
{ name: 'app',
  folder: '.',
  rootName: 'app',
  paths:
   { rootPath:
      '/home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular',
     angularPath:
      '/home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular',
     elementsPath:
      '/home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular/src/assets/elements' },
  devopsMetadataFile: 'app-app-build-metadata.json',
  devopsEnvsMetadataFile: 'app-app-envs-metadata.json',
  devopsVersionsMetadataFile: 'app-app-versions-metadata.json',
  devopsHistoryMetadataFile: 'app-app-history-metadata.json' }

▶ PRE-BUILD : PREPARING THE PROJECT...
❯❯❯ Registering angular project definition...
❯❯❯ Checking elements...
❯❯❯ elements not found for project...skipping
❯❯❯ TS Linting application...
❯❯❯ running tslint -c /home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular/tslint.json -p /home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular/src/tsconfig.app.json
❯❯❯❯❯❯ OK

❯❯❯ Styles Linting application...
❯❯❯❯❯❯ OK

❯❯❯ Launching application build...
❯❯❯ ng build for configuration : test
running Angular BUILD with args: /home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular/node_modules/@angular/cli/bin/ng,build,app,--aot,--configuration=test on
/home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular
 10% building 3/7 modules 4 active ...er-web/src/main/angular/src/styles.scssBrowserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating

Date: 2021-08-19T06:36:43.787Z
Hash: 0010fa84c7c01fba80c6
Time: 17559ms
chunk {0} runtime.80ab492fe3d778817936.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} main.202765e82fd65fa4f907.js (main) 128 bytes [initial] [rendered]
chunk {2} polyfills.cccb2ee14eb4f9d80fbd.js (polyfills) 130 bytes [initial] [rendered]
chunk {3} styles.61ba779f18b50f547fd9.css (styles) 988 kB [initial] [rendered]

ERROR in app/core/core.module.ts(80,5): Error during template compile of 'CoreModule'
  Could not resolve ../shared/swagger relative to [object Object]..
src/app/core/services/viewer.service.ts(5,33): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/guards/viewer.guard.ts(6,44): error TS2307: Cannot find module '../shared/swagger'.
src/app/app.component.ts(17,44): error TS2307: Cannot find module './shared/swagger'.
src/app/shared/model/entityModalInformation.ts(7,8): error TS2307: Cannot find module '../swagger'.
src/app/core/services/share-data.service.ts(10,8): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/core/services/entity-link.service.ts(9,8): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/shared/components/achievement-detail/achievement-detail.component.ts(8,8): error TS2307: Cannot find module '../../swagger'.
src/app/shared/components/activity-detail/activity-detail.component.ts(7,8): error TS2307: Cannot find module '../../swagger'.
src/app/shared/components/assessment-detail/assessment-detail.component.ts(2,56): error TS2307: Cannot find module '../../swagger'.
src/app/shared/components/diploma-toolbar/diploma-toolbar.component.ts(30,42): error TS2307: Cannot find module '../../swagger'.
src/app/shared/components/entitlement-detail/entitlement-detail.component.ts(2,57): error TS2307: Cannot find module '../../swagger'.
src/app/shared/components/identifiers/identifiers.component.ts(2,37): error TS2307: Cannot find module '../../swagger'.
src/app/shared/components/more-information/more-information.component.ts(2,31): error TS2307: Cannot find module '../../swagger'.
src/app/shared/components/organization-detail/organization-detail.component.ts(2,60): error TS2307: Cannot find module '../../swagger'.
src/app/shared/components/other-documents/other-documents.component.ts(2,31): error TS2307: Cannot find module '../../swagger'.
src/app/shared/pipes/join.pipe.address.ts(2,34): error TS2307: Cannot find module '../swagger'.
src/app/core/core.module.ts(26,27): error TS2307: Cannot find module '../shared/swagger'.
src/app/features/diploma/diploma.component.ts(18,48): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/features/diploma-details/diploma-details.component.ts(15,8): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/features/diploma-details/components/issuing-organization/issuing-organization.component.ts(3,37): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/features/diploma-details/components/credential-owner/credential-owner.component.ts(3,42): error TS2307: Cannot find module 'src/app/shared/swagger/model/credentialSubjectTabView'.
src/app/features/diploma-details/components/achievements/achievements.component.ts(5,36): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/features/diploma-details/components/activities/activities.component.ts(5,33): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/features/diploma-details/components/sub-credentials/sub-credentials.component.ts(4,56): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/features/diploma-details/components/verification/verification.component.ts(10,8): error TS2307: Cannot find module 'src/app/shared/swagger'.
src/app/features/diploma-details/components/entitlements/entitlements.component.ts(5,36): error TS2307: Cannot find module 'src/app/shared/swagger/model/entitlementTabView'.

{ Error: Command failed: node /home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular/node_modules/@angular/cli/bin/ng build app --aot --configuration=test
    at makeError (/home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular/node_modules/@eui/tools/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular/node_modules/@eui/tools/node_modules/execa/index.js:278:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  code: 1,
  stdout: null,
  stderr: null,
  failed: true,
  signal: null,
  cmd:
   'node /home/santtu/europass-digital-credentials/edci-viewer/edci-viewer-web/src/main/angular/node_modules/@angular/cli/bin/ng build app --aot --configuration=test',
  timedOut: false,
  killed: false }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! eui-angular-app@1.0.0 build-test: `eui-scripts build-app --skipTest --configuration=test`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the eui-angular-app@1.0.0 build-test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/santtu/.npm/_logs/2021-08-19T06_36_43_836Z-debug.log

The other build scripts provided produce the same results.

My question then is, are the Swagger files mentioned at the top of the log missing intentionally, meaning I should install them myself, or was this an accidental omission? If they are meant to be installed by the person building the project, I would not mind receiving a link to instructions on how the Swagger files are relevant to the build process and how to perform the installation.

-- Santtu Söderholm

SeSodesa commented 3 years ago

Apparently the files are supposed to be created automatically, as edci-viewer-web is built? Or maybe the other modules

edci-viewer-web-rest{, -swagger}

are supposed to be built first?

Esayos commented 2 years ago

Hello @SeSodesa , In fact, we are missing an explanation on how to generate the swagger files for the first build. The quickest way to do this, would be to create an empty "dist" folder inside edci-viewer-web/src/main/angular and run the backend compilation (even tho the resulting artifact is not a valid one, as it is still missing the frontend). This will generate the swagger files and allow you to continue with frontend compilation. Also, this information will be included in next's version Readme, thanks por pointing this out!