question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reorganize internal dependencies

See original GitHub issue

The actual code base doesn’t import features but fully relies on Chart.* (e.g. Chart.helpers, Chart.defaults, etc…). Files are imported in chart.js in the order they are supposed to depend from each other. As far as I tried, this makes very complicated to safely and properly import a subset of the library.

We could reorganize the library to use require('path/to/features') instead of Chart.{feature} and so remove all function export and Chart.* references.

var helpers = require('../helpers');    // instead of = Chart.helpers
var defaults = require('../defaults');  // instead of = Chart.defaults
//...

The Chart namespace would be fully populated in chart.js:

// chart.js
var Chart = require('./core/core.controller');
Chart.defaults = require('./core/core.defaults');
Chart.helpers = require('./helpers/index');
Chart.controllers = require('./controllers/index');
// ...

Removing the “function export” impacts a lot of lines (remove one tab almost everywhere), so we could do that step by step to avoid huge and painful reviews and limit conflicts with open PRs. I would sequentially split the work as follows:

  • #4479 export Chart.helpers.*, import src/helpers/index
  • #4512 export Chart.defaults.*, import src/core/core.defaults
  • #5114, #5382, #5969 export Chart.* from core classes
  • #4540 export Chart.elements.*, import src/elements/index
  • #5871 export Chart.controllers.*, import src/controllers/index
  • #5953 export Chart.scales.*, import src/scales/index
  • #4509 export Chart.platform.*, import src/platform/platform
  • #5114 export Chart.plugins.*, import src/plugins/index
  • #5868 deprecate Chart.* (from `src/charts/*.js)

This is a preliminary work in order to migrate to ES6 modules (discussed in #2466, #4461, #4303, etc.). Awesome work as been done by @salzhrani but I believe that trying to do everything in one step (including ES6 new features) will take time, be hard or even impossible to review / handle conflicts with incoming contributions and finally takes forever to land in master.

Thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
yahya-uddincommented, Aug 8, 2019

Any progress on this?

2reactions
benmccanncommented, Jan 9, 2020

The code uses import everywhere now, so I’m going to consider this done. https://github.com/chartjs/Chart.js/pull/6935

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Steps to Include in the Company Reorganization Process
A company reorganization process requires sensitivity, strategy, and foresight. ... and interdependencies of your new structure is to create an org chart.
Read more >
Internal Dependencies – What They Are Plus Examples -
A quick guide to Project Internal Dependencies. What they are plus examples so that you can effectively manage them!
Read more >
Managing dependencies in your Agile communication project ...
1. Identify potential dependencies · 2. Organize and stack tasks · 3. Improve communication · Project team. · Major internal stakeholders.
Read more >
How to remove the dependencies within your scaled agile setup
If it isn't possible to make them internal, we can only really manage the dependencies by visualizing them, making really good commitments on ......
Read more >
Project Management Dependencies: Types, Examples, and ...
In project management, you have four activity dependencies: Mandatory Dependencies; Discretionary Dependencies; Internal Dependencies ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found