Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@axa-ch/alt-pod-havarie

Package Overview
Dependencies
Maintainers
48
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axa-ch/alt-pod-havarie

The havarie pod of axa.ch

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
48
Created
Source

Pod havarie

Migration of old Frontend lib to its own pod.

This is a pure migration from my side 😇!

Main issues in design

  • Incorrect use of redux. One connection for the whole application instead of multiple sub-store connects. It will trigger a react props comparison on every store change!
  • Overengineering: Redux totally not needed for such a small application
  • Logic very complex and abstract. To understand what something is meant to do you have to debug every line of code
  • Unnecessary API requests for getting the json. Is a hard coupled and bidirectional coupling between frontend and server as the server needs frontend and frontend needs sever in order to get countries data, which are static.
  • jQuery only used for DOM selection, not needed at all.
  • Superagent and superagentpromise ajax/fetch wrapper absolutly not needed.
  • Styling in completely different location

Refcatoring done so far:

  • Json loaded on buildtime and incoroporated as a bundle
  • From Frontendlib to POD architecture
  • PLIB v1 to PLIB v2
  • Correct usage of connect and redux
  • Add more debugging tools to the store
  • Externalise store
  • Styling per component
  • Get rid of jQuery
  • Get rid of superagent and superagentpromise
  • Self contained components (action, reducer and component in one place)

Keeping as technical depth:

  • Redux
  • Own implemented translating system
  • Helpers file
  • Semantic incorrect elements (<a> instead of <button> as example)
  • Hard coupling of the setAgents action between <HavarieFilter> and <HavarieList>
  • Agent component has no own data or store. <HavarieList> keeps state of <HavarieAgent> such as areDetailsVisible. -> Fixed

Other refactorings: From WTF code to normal code

WTF:

const dummy = Array.apply(null, { length: Math.max(comTypes.length, communications.length) })

return dummy.map((item, index) => {
  const comType = comTypes[index]

  return {
    type: comTypeMap[comType] || comType,
    communication: communications[index],
  }
})

Normalised:

  const dummy = [];

  for (let i = 0; i < Math.max(comTypes.length, communications.length); i++) {
    const comType = comTypes[i];

    dummy.push({
      type: comTypeMap[comType] || comType,
      communication: communications[i],
    });
  }

  return dummy;

how to release

  1. update package.json in the "version": "1.0.0" field. Please follow semver best practices
  2. run npm run release
  3. commit to develop, add git tag containg the same version as in step 1 and push
  4. Execute jenkins job promote with the version added in point 1

FAQs

Package last updated on 28 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc