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

Remove unused / barely used dependencies? #524

Closed
acorncom opened this issue Dec 7, 2017 · 8 comments · Fixed by #807
Closed

Remove unused / barely used dependencies? #524

acorncom opened this issue Dec 7, 2017 · 8 comments · Fixed by #807

Comments

@acorncom
Copy link
Contributor

acorncom commented Dec 7, 2017

I'm planning on using this add-on in a client app (thanks very much for all the work, it's great! ❤️ ) While looking things over, I was struck by the number of dependencies that were going to get included in my app:

https://github.com/offirgolan/ember-light-table/blob/0d99b0f4655d6a02d0ee1d3c1801db822922269d/package.json#L25-L36

The ones that specifically caught my eye were the various helpers. Curious, I dug in to see where all those helpers were being used.

ember-composable-helpers

No longer used in add-on templates from what I can see, just used in the dummy app.

ember-cli-string-helpers

The html-safe helper is used in three places:

https://github.com/offirgolan/ember-light-table/blob/0d99b0f4655d6a02d0ee1d3c1801db822922269d/addon/templates/components/lt-head.hbs#L13-L15

https://github.com/offirgolan/ember-light-table/blob/0d99b0f4655d6a02d0ee1d3c1801db822922269d/addon/templates/components/lt-foot.hbs#L6-L8

https://github.com/offirgolan/ember-light-table/blob/0d99b0f4655d6a02d0ee1d3c1801db822922269d/addon/templates/components/lt-body.hbs#L21-L23

ember-truth-helpers

The or helper is used three times in one place:

https://github.com/offirgolan/ember-light-table/blob/0d99b0f4655d6a02d0ee1d3c1801db822922269d/addon/templates/components/lt-body.hbs#L2-L4

The and helper is used once:

https://github.com/offirgolan/ember-light-table/blob/0d99b0f4655d6a02d0ee1d3c1801db822922269d/addon/templates/components/columns/base.hbs#L5

Should we remove these dependencies that bleed into consuming apps?

I've steered clear of using these types of helpers in client apps, as I prefer cleaner templates. I realize that's not something everyone agrees with, but until tree-shaking hits, I'd prefer to keep my asset sizes down as much as I can.

Do we want to remove these dependencies to slightly reduce asset sizes for consuming apps? Doing so could be a breaking-change if other developers have begun to rely on the helpers without specifically adding them to their own app dependencies ...

If we do want to remove the dependencies, it looks like we might want to replicate the html-safe helper (as it's being used in some loops that might be easiest to leave alone). The other calls could easily move into computed properties though ...

Interested in your thoughts! 😀

@buschtoens
Copy link
Collaborator

Thank you so much for digging into this and keeping a watchful eye on asset size! I'm totally on your side here. 👍

I think we can safely do the following:

ember-composable-helpers

Move to devDependencies.

ember-cli-string-helpers

Remove from dependencies and recreate the {{html-safe}} helper.

ember-truth-helpers

Move to devDependencies.

{{or}}

Replace the (or someComponent (component 'defaultComponent')) construct by setting the default value in the JS class:

https://github.com/offirgolan/ember-light-table/blob/0d99b0f4655d6a02d0ee1d3c1801db822922269d/addon/components/lt-body.js#L266-L306

{{and}}

Luckily both branches of the if statement depend on sortIconProperty, which allows us to restructure the logic:

https://github.com/offirgolan/ember-light-table/blob/0d99b0f4655d6a02d0ee1d3c1801db822922269d/addon/templates/components/columns/base.hbs#L5-L9

{{#if sortIconProperty}}
  {{#if sortIcons.iconComponent}}
    {{component sortIcons.iconComponent sortIcons=sortIcons sortIconProperty=sortIconProperty}}
  {{else}}
    <i class="lt-sort-icon {{get sortIcons sortIconProperty}}"></i>
  {{/if}}
{{/if}}

@buschtoens
Copy link
Collaborator

Doing so could be a breaking-change if other developers have begun to rely on the helpers without specifically adding them to their own app dependencies ...

Valid point, but since we're not 'explicitly' exporting these helpers, I think we can risk this. Googling the error message should give you pretty clear instructions on what to do.

Error: Compile Error: or is not a helper

Or do you think this is too dangerous?

@alexander-alvarez
Copy link
Collaborator

I think as long as we document it in the release notes it would be ok

Imagine a:

With this release -- we've grately reduced the output size of ember-light-table. We realized thanks to @acorncom that we had some large dependencies that were either in dependencies instead of devDependencies (they were only used in our demo app) or could easily be replaced with our own implementation of small helpers. Note if you've depended on any of the helpers defined in ember-composable-helpers, ember-cli-string-helpers, or ember-truth-helpers but have not added them as dependencies to your host app this change is a breaking change because your host app had a "hidden dependency" that was provided by this addon

Side note: it looks like we can tree shake at build time ember-cli-string to only bring in 'html-safe'.
https://github.com/romulomachado/ember-cli-string-helpers#configuration

@acorncom
Copy link
Contributor Author

acorncom commented Dec 7, 2017

Side note: it looks like we can tree shake at build time ember-cli-string to only bring in 'html-safe'. https://github.com/romulomachado/ember-cli-string-helpers#configuration

I'm all for not duplicating work on that html-safe helper if we can avoid it. I won't have time until late next week at the earliest to implement these changes (have a crunch on a deadline at the moment), but yes, that message or something akin looks reasonable to me ...

Technically though, if we're sem-ver lawyering, we'd need to do a major version bump to indicate potential snags ... 🤔

@alexander-alvarez
Copy link
Collaborator

Technically though, if we're sem-ver lawyering, we'd need to do a major version bump to indicate potential snags ... 🤔

Fair enough.. @buschtoens are there other breaking changes we'd want to coordinate with this?

@buschtoens
Copy link
Collaborator

Hmmm... Probably. 😅

The first thing that comes to mind that is breaking and wouldn't require a lot of work is removing the light-table/cells and light-table/columns path prefixes, so you put your components where you like.

@ynnoj
Copy link
Contributor

ynnoj commented Jan 10, 2018

Any activity on this as of yet? I'm keen to start contributing 🚀

@buschtoens
Copy link
Collaborator

The only thing holding us back is the fact, that we might break apps, by removing these dependencies.

#524 (comment):

Technically though, if we're sem-ver lawyering, we'd need to do a major version bump to indicate potential snags ... 🤔

I would like to gather some more breaking changes, but your're PR would be a great start! 💪

fran-worley added a commit that referenced this issue May 26, 2019
…rs to devDependencies (#693)

* move ember composable helpers to dev dependencies and bump version  see #524

* bump ember wormhole

* add ember lts 3.8 to travis

* remove ember-native-dom-helpers testing add-on

* update multiple table test from 1-x branch to remove native-dom-helpers add-on

* [breaking] rename inViewport closure action to enterViewport

paving the way to update ember-in-viewport dependency

* fixes infinite loop on onScrolledToBottom

* remove unused rows property from lt-infinity

* bump ember-in-viewport version and refactor lt-infinity component not to use mixin

* make lt-body.inViewport event deprecated in favour of enterViewport and test
RobbieTheWagner added a commit that referenced this issue Feb 9, 2021
* replace `sendAction` with modern callable methods

* make easy jquery fixes

* Release v2.0.0-beta.0

* Release v2.0.0-beta.1

* removed jquery

* yarn upgrade

* Update ember-scrollable

* Assert and Test compatibility with LTS 3.4

* Officially drop support for node 4 in package.json

* bump vertical-collection to v1.0.0-beta.13

* Replace merge with assign (#673)

* bump vertical-collection to v1.0.0-beta.13

* replace merge with assign

* ensure ember-scrollable updates when rows are updated (#677)

* refactor: Remove sendAction() calls (#686)

* release 2.0.0-beta.3

* Replace propertyWillChange/propertyDidChange with notifyPropertyChange and add polyfill for < Ember 3.1 (#692)

Fixes #660

* update changelog for 2.x

* Update ember-in-viewport, ember-wormhole, move ember-composable-helpers to devDependencies (#693)

* move ember composable helpers to dev dependencies and bump version  see #524

* bump ember wormhole

* add ember lts 3.8 to travis

* remove ember-native-dom-helpers testing add-on

* update multiple table test from 1-x branch to remove native-dom-helpers add-on

* [breaking] rename inViewport closure action to enterViewport

paving the way to update ember-in-viewport dependency

* fixes infinite loop on onScrolledToBottom

* remove unused rows property from lt-infinity

* bump ember-in-viewport version and refactor lt-infinity component not to use mixin

* make lt-body.inViewport event deprecated in favour of enterViewport and test

* Drop node 6 support as end of line Apr 2019 (#698)

LGTM! Node 8 it latest Maintenance LTS and will be EOL in December

* Bump Ember CLI to 3.8 and update other dependencies (#696)

* bump ember cli to lts 3.8 update other dev dependencies

also apply some ember add-on blueprint changes

* fix handlebar lint errors

Note - unsure why 'no-inline-styles' config isn’t being applied. For now I’ve manually disabled the rule in applicable templates

* disable js no-observer rule

* update eslint-plugin-ember-suave and fix lint errors

* upgrade ember-mirage (used for dummy app)

* upgrade remaining addons

* set minimum supported ember version at 2.18 (#700)

see community survey results - https://emberjs.com/ember-community-survey-2019/

* migrate to using lerna-changelog (#697)

* update changelog [ci skip]

* BREAKING drop support for ember 2.18 (#713)

* [BREAKING] drop support for ember 2.18

* fix travis - ember release can fail

* as we use the compute helper we need to restore ember-composable-helpers as a dependency (#714)

* [BREAKING] fixes #444 #662 converts ES6 native classes to ember objects (#701)

This is a breaking change as it converts the new Class() syntax to Class.create().
In addition, the only way I could get these to work was to convert the positional arguments to named args in an options hashes:

`new Table(columns, rows)` => `Table.create(columns: columns, rows: rows)`
`new Row(content, options)` => `Row.create({ content: })`
`new Column(opts)` => `Column.create(opts)`

We’ve had to replace the native constructor methods with emberObject init methods as per the official docs which should also fix #699. As a result we’ve removed the Ember 2.12 ‘hacks’ which shouldn’t be an issue as we’ve bumped ember version minimum version to 2.18.

* Bump to ember cli 3.12 and update dependencies (#716)

* bump addons

* update ember cli to 3.12

* drop ember-release from allowed travis failures

* use yarn not npm and remove unused ember-cli-changelog

* update ember changelog

* [ci skip] fix dummy app port following update to ember cli 3.12

see ember-cli/ember-cli#8794

* release v2.0.0-beta.4

* [ci-skip] update changelog for beta 4 release

* replace volatile computed properties with native getters (#718)

* Add a guard to check if scaffolding cells exist

* Always render scaffolding row in table header

* Test lt-scaffolding-row

* Update ember-scrollable version to jquery-less

* bump ember-code-snippet for dummy app

* update travis to include recent LTS versions of ember

* fix lint issues

* bump ember cli to 3.16.1 and fix/ warn easy js lint errors disable other rules

* bump dependency addons

* [ci skip] bump changelog and yuidoc addons

* [ci-skip] update changelog

* fix deprecation warning for overridden rowspan cp

* remove unsafe style attribute warnings

* make compute own helper then drop ember-composable-helpers as dependency

* Remove debugging line in compute helper

* Drop support to Ember 3.4 and 3.5

Related #739

* add testing for ember 3.20

* bump addons

* drop ember-suave eslint to fix travis

# Conflicts:
#	package.json
#	yarn.lock

* [ci-skip] update ember version in readme

* v3.16.1...v3.20.0

* drop support for ember <3.12

* drop this.get

Co-authored-by: Donald Wasserman <djwasserman@gmail.com>
Co-authored-by: Alex Alvarez <dominalexican@gmail.com>
Co-authored-by: Gaurav Munjal <gaurav@peeriq.com>
Co-authored-by: Fran Worley <frances@safetytoolbox.co.uk>
Co-authored-by: Michal Bryxí <michal.bryxi@gmail.com>
Co-authored-by: mmadsen2 <mmadsen@foundationsource.com>
Co-authored-by: Tomasz Węgrzyn <twgrzyn1@gmail.com>
Co-authored-by: Richard Viney <richard@lightspeedgraphics.co.nz>
Co-authored-by: gorzas <joseda87@gmail.com>
RobbieTheWagner added a commit that referenced this issue Jul 8, 2022
* replace `sendAction` with modern callable methods

* make easy jquery fixes

* Release v2.0.0-beta.0

* Release v2.0.0-beta.1

* removed jquery

* yarn upgrade

* Update ember-scrollable

* Assert and Test compatibility with LTS 3.4

* Officially drop support for node 4 in package.json

* bump vertical-collection to v1.0.0-beta.13

* Replace merge with assign (#673)

* bump vertical-collection to v1.0.0-beta.13

* replace merge with assign

* ensure ember-scrollable updates when rows are updated (#677)

* refactor: Remove sendAction() calls (#686)

* release 2.0.0-beta.3

* Replace propertyWillChange/propertyDidChange with notifyPropertyChange and add polyfill for < Ember 3.1 (#692)

Fixes #660

* update changelog for 2.x

* Update ember-in-viewport, ember-wormhole, move ember-composable-helpers to devDependencies (#693)

* move ember composable helpers to dev dependencies and bump version  see #524

* bump ember wormhole

* add ember lts 3.8 to travis

* remove ember-native-dom-helpers testing add-on

* update multiple table test from 1-x branch to remove native-dom-helpers add-on

* [breaking] rename inViewport closure action to enterViewport

paving the way to update ember-in-viewport dependency

* fixes infinite loop on onScrolledToBottom

* remove unused rows property from lt-infinity

* bump ember-in-viewport version and refactor lt-infinity component not to use mixin

* make lt-body.inViewport event deprecated in favour of enterViewport and test

* Drop node 6 support as end of line Apr 2019 (#698)

LGTM! Node 8 it latest Maintenance LTS and will be EOL in December

* Bump Ember CLI to 3.8 and update other dependencies (#696)

* bump ember cli to lts 3.8 update other dev dependencies

also apply some ember add-on blueprint changes

* fix handlebar lint errors

Note - unsure why 'no-inline-styles' config isn’t being applied. For now I’ve manually disabled the rule in applicable templates

* disable js no-observer rule

* update eslint-plugin-ember-suave and fix lint errors

* upgrade ember-mirage (used for dummy app)

* upgrade remaining addons

* set minimum supported ember version at 2.18 (#700)

see community survey results - https://emberjs.com/ember-community-survey-2019/

* migrate to using lerna-changelog (#697)

* update changelog [ci skip]

* BREAKING drop support for ember 2.18 (#713)

* [BREAKING] drop support for ember 2.18

* fix travis - ember release can fail

* as we use the compute helper we need to restore ember-composable-helpers as a dependency (#714)

* [BREAKING] fixes #444 #662 converts ES6 native classes to ember objects (#701)

This is a breaking change as it converts the new Class() syntax to Class.create().
In addition, the only way I could get these to work was to convert the positional arguments to named args in an options hashes:

`new Table(columns, rows)` => `Table.create(columns: columns, rows: rows)`
`new Row(content, options)` => `Row.create({ content: })`
`new Column(opts)` => `Column.create(opts)`

We’ve had to replace the native constructor methods with emberObject init methods as per the official docs which should also fix #699. As a result we’ve removed the Ember 2.12 ‘hacks’ which shouldn’t be an issue as we’ve bumped ember version minimum version to 2.18.

* Bump to ember cli 3.12 and update dependencies (#716)

* bump addons

* update ember cli to 3.12

* drop ember-release from allowed travis failures

* use yarn not npm and remove unused ember-cli-changelog

* update ember changelog

* [ci skip] fix dummy app port following update to ember cli 3.12

see ember-cli/ember-cli#8794

* release v2.0.0-beta.4

* [ci-skip] update changelog for beta 4 release

* replace volatile computed properties with native getters (#718)

* Add a guard to check if scaffolding cells exist

* Always render scaffolding row in table header

* Test lt-scaffolding-row

* Update ember-scrollable version to jquery-less

* bump ember-code-snippet for dummy app

* update travis to include recent LTS versions of ember

* fix lint issues

* bump ember cli to 3.16.1 and fix/ warn easy js lint errors disable other rules

* bump dependency addons

* [ci skip] bump changelog and yuidoc addons

* [ci-skip] update changelog

* fix deprecation warning for overridden rowspan cp

* remove unsafe style attribute warnings

* make compute own helper then drop ember-composable-helpers as dependency

* Remove debugging line in compute helper

* Drop support to Ember 3.4 and 3.5

Related #739

* add testing for ember 3.20

* correct travis

* bump addons

* v3.16.1...v3.20.0

* bump ember version to 3.20

* fix travis.yml

* fix eslintrc

* replace one-way-controls with ember-power-select and ember input

* convert to angle bracket syntax

* fix ember data deprecations

* fix ember-power-select commit

* replace actions for fn/on non shared table

* replace table-shared mixin with base-table component

* convert action to fn for base-table actions

* replace remainder of action with on/fn

* bump dummy app addons

* Drop support to Ember 3.4 and 3.5

Related #739

* add testing for ember 3.20

* bump addons

* drop ember-suave eslint to fix travis

# Conflicts:
#	package.json
#	yarn.lock

* [ci-skip] update ember version in readme

* v3.16.1...v3.20.0

* drop support for ember <3.12

* drop this.get

* Released 3.0.0-beta.0

* ci: Add github actions with embroider test scenarios

* build: Drop Ember 3.12 support

BREAKING CHANGE: Dropped support for Ember 3.12

* Node 12

* fix: Fix linting errors

* ci: Allow embroider tests to fail

Tests pass locally but not in when running with GitHub actions

* docs: Remove Embroider safe and optimized from readme

CI fails in GitHub actions

* fix: Change to @faker/fakerjs to fix missing avatars

* Revert "fix: Change to @faker/fakerjs to fix missing avatars"

@faker/fakerjs requires Node 14. This reverts commit 81ba515.

Co-authored-by: Donald Wasserman <djwasserman@gmail.com>
Co-authored-by: Alex Alvarez <dominalexican@gmail.com>
Co-authored-by: Gaurav Munjal <gaurav@peeriq.com>
Co-authored-by: Fran Worley <frances@safetytoolbox.co.uk>
Co-authored-by: Michal Bryxí <michal.bryxi@gmail.com>
Co-authored-by: mmadsen2 <mmadsen@foundationsource.com>
Co-authored-by: Tomasz Węgrzyn <twgrzyn1@gmail.com>
Co-authored-by: Richard Viney <richard@lightspeedgraphics.co.nz>
Co-authored-by: gorzas <joseda87@gmail.com>
Co-authored-by: maxwondercorn <gmartell@pobox.com>
Co-authored-by: Robert Wagner <rwwagner90@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants