Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug au build - type leaflet draw #2744

Closed
TheoLechemia opened this issue Oct 9, 2023 · 2 comments
Closed

Bug au build - type leaflet draw #2744

TheoLechemia opened this issue Oct 9, 2023 · 2 comments
Labels

Comments

@TheoLechemia
Copy link
Member

TheoLechemia commented Oct 9, 2023

Les dépendance de type "leaflet draw" et autres sont dans les dépendances "dev", donc non installées en prod.
Cela provoque ce bug, par exemple avec le module ZH :

(venv) geonatureadmin@cen38:~$ geonature update-configuration
/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py:302: DeprecationWarning: '_app_ctx_stack' is deprecated and will be removed in Flask 2.3. Use 'g' to store data, or 'app_ctx' to access the current context.
  queries = _app_ctx_stack.top.sqlalchemy_queries
/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py:304: DeprecationWarning: '_app_ctx_stack' is deprecated and will be removed in Flask 2.3. Use 'g' to store data, or 'app_ctx' to access the current context.
  queries = _app_ctx_stack.top.sqlalchemy_queries = []
/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/sqlalchemy/orm/mapper.py:1841: SAWarning: Property TBaseVisits.dataset on mapped class TBaseVisits->t_base_visits being replaced with new property TBaseVisits.dataset; the old property will be discarded
  util.warn(
Génération de la configuration du frontend :
  GeoNature … OK
  Module ZONES_HUMIDES … OK
  Module IMPORT … OK
  Module EXPORTS … OK
  Module DASHBOARD … OK
  Module MONITORINGS … OK
  Module OCCTAX … OK
  Module VALIDATION … OK
  Module OCCHAB … OK
Rebuild du frontend …
Found '/home/geonatureadmin/geonature/frontend/.nvmrc' with version <lts/gallium>
Running node v16.20.2 (npm v8.19.4)

> geonature@0.0.0 build
> ng build

✔ Browser application bundle generation complete.

Warning: /home/geonatureadmin/geonature/frontend/external_modules/import/app/components/import_list/import-list.component.ts depends on 'file-saver'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/external_modules/import/app/components/import_process/fields-mapping-step/fields-mapping-step.component.ts depends on 'rxjs/observable/forkJoin'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/external_modules/import/app/components/import_report/import_report.component.ts depends on 'leaflet-image'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/external_modules/monitorings/app/components/monitoring-properties/monitoring-properties.component.ts depends on 'html2canvas'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/external_modules/occhab/app/components/occhab-map-list/occhab-map-list.component.ts depends on 'moment'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/external_modules/zones_humides/app/services/files.service.ts depends on 'file-saver'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/external_modules/zones_humides/app/zh-map-list/zh-map-list.component.ts depends on 'moment'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/external_modules/zones_humides/node_modules/angular2-multiselect-dropdown/__ivy_ngcc__/fesm2015/angular2-multiselect-dropdown.js depends on '@tweenjs/tween.js'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/src/app/GN2CommonModule/form/autocomplete/autocomplete.component.ts depends on 'rxjs/observable/of'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/src/app/GN2CommonModule/form/dynamic-form-generator/dynamic-form-generator.component.ts depends on 'fast-deep-equal/es6'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/src/app/GN2CommonModule/map/map.service.ts depends on 'leaflet.markercluster'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/src/app/GN2CommonModule/map/map.service.ts depends on 'lodash'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/src/app/app.module.ts depends on 'ng2-cookies'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/src/app/components/home-content/home-content.component.ts depends on 'leaflet'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/geonatureadmin/geonature/frontend/src/app/syntheseModule/synthese.component.ts depends on 'lodash/cloneDeep'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies



Error: external_modules/zones_humides/app/zh-forms/map/map.component.ts:41:19 - error TS2339: Property 'Draw' does not exist on type 'typeof import("/home/geonatureadmin/geonature/frontend/node_modules/@types/leaflet/index")'.

41     console.log(L.Draw);
                     ~~~~


Error: external_modules/zones_humides/app/zh-forms/map/map.component.ts:43:32 - error TS2339: Property 'Draw' does not exist on type 'typeof import("/home/geonatureadmin/geonature/frontend/node_modules/@types/leaflet/index")'.

43     this._mapService.map.off(L.Draw.Event.DRAWSTART);
                                  ~~~~


Error: external_modules/zones_humides/app/zh-forms/map/map.component.ts:44:31 - error TS2339: Property 'Draw' does not exist on type 'typeof import("/home/geonatureadmin/geonature/frontend/node_modules/@types/leaflet/index")'.

44     this._mapService.map.on(L.Draw.Event.CREATED, (e) => {
                                 ~~~~


Error: external_modules/zones_humides/app/zh-forms/map/map.component.ts:47:32 - error TS2339: Property 'Draw' does not exist on type 'typeof import("/home/geonatureadmin/geonature/frontend/node_modules/@types/leaflet/index")'.

47     this._mapService.map.off(L.Draw.Event.EDITED);
                                  ~~~~


Error: external_modules/zones_humides/app/zh-forms/map/map.component.ts:48:31 - error TS2339: Property 'Draw' does not exist on type 'typeof import("/home/geonatureadmin/geonature/frontend/node_modules/@types/leaflet/index")'.

48     this._mapService.map.on(L.Draw.Event.EDITSTART, (e) => {
                                 ~~~~


Error: external_modules/zones_humides/app/zh-forms/map/map.component.ts:51:31 - error TS2339: Property 'Draw' does not exist on type 'typeof import("/home/geonatureadmin/geonature/frontend/node_modules/@types/leaflet/index")'.

51     this._mapService.map.on(L.Draw.Event.EDITED, (e) => {
                                 ~~~~
Traceback (most recent call last):
  File "/home/geonatureadmin/geonature/backend/venv/bin/geonature", line 8, in <module>
    sys.exit(main())
  File "/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/flask/cli.py", line 357, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/home/geonatureadmin/geonature/backend/venv/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/geonatureadmin/geonature/backend/geonature/core/command/main.py", line 129, in update_configuration
    build_frontend()
  File "/home/geonatureadmin/geonature/backend/geonature/utils/command.py", line 76, in build_frontend
    run(cmd, check=True, cwd=str(FRONTEND_DIR))
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/env', 'bash', '-i', '-c', 'nvm exec npm run build']' returned non-zero exit status 1.
@TheoLechemia TheoLechemia changed the title Bug au build Bug au build - type leaflet draw Oct 9, 2023
@lpofredc
Copy link
Contributor

Dans l'absolu, cela pose la question de l'organisation des dépendances du frontend entre dependencies et devDependencies. On pourrait peut-être réorganiser ces dépendances. Selon moi, deux approches sont possibles.

  • Dans la mesure ou le frontend de GeoNature est un build et qu'on sert des fichiers statiques, tout pourrait possiblement être considéré comme des dépendances de dev > On passe tout dans devDependencies.
  • Mais vu qu'on doit refaire un build à chaque modif de config, on a donc bien besoin d'une partie de ces dépendances > On passe ce qui sert à compiler dans dependencies et ce qui sert aux tests et à la qualité du code dans devDependencies (prettier/cypress ?).

@TheoLechemia
Copy link
Member Author

@lpofredc effectivement, pas le choix de passer toutes les dépendances de typages dans les dependencies prod.
On laisse juste ce qui sert à faire des tests dans les devDependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants