-
Notifications
You must be signed in to change notification settings - Fork 6
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
Install TypeScript, add template registry #13
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
984ff87
Add template registry
charlesfries df35f5a
Type helpers
charlesfries 6689a0f
Cleanup
charlesfries f638e90
Install TypeScript
charlesfries 141fdfc
Add .ts extensions
charlesfries 6794680
Cleanup
charlesfries 4c0923d
Use built in types
charlesfries f43f371
Remove generic contraint
charlesfries d724526
Lint CI
charlesfries 6a4e191
Update package.json
NullVoxPopuli ae98b0c
Update package.json
NullVoxPopuli 797c65c
Update ci.yml
NullVoxPopuli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,18 @@ | |
"version": "5.1.1", | ||
"description": "Composable helpers for Ember", | ||
"scripts": { | ||
"build": "rollup --config", | ||
"build": "concurrently 'pnpm:build:*'", | ||
"build:js": "rollup --config", | ||
"build:types": "glint --declaration", | ||
"contributors": "npx contributor-faces -e \"(*-bot|*\\[bot\\]|*-tomster|homu|bors)\"", | ||
"lint:hbs": "ember-template-lint .", | ||
"lint:js": "eslint .", | ||
"lint:types": "glint", | ||
"node-test": "mocha test --recursive --reporter spec", | ||
"prepack": "rollup --config", | ||
"start": "rollup --config --watch", | ||
"prepack": "concurrently 'pnpm:build:*'", | ||
"start": "concurrently 'pnpm:start:*'", | ||
"start:js": "rollup --config --watch --no-watch.clearScreen", | ||
"start:types": "glint --declaration --watch", | ||
"test": "echo 'A v2 addon does not have tests, run tests in test-app'", | ||
"test:all": "ember try:each" | ||
}, | ||
|
@@ -21,12 +26,24 @@ | |
"@babel/core": "^7.0.0", | ||
"@babel/plugin-proposal-decorators": "^7.22.15", | ||
"@babel/plugin-transform-class-properties": "^7.22.5", | ||
"@babel/plugin-transform-typescript": "^7.23.6", | ||
"@babel/runtime": "^7.22.15", | ||
"@embroider/addon-dev": "^4.1.0", | ||
"@glint/core": "^1.2.1", | ||
"@glint/environment-ember-loose": "^1.2.1", | ||
"@glint/environment-ember-template-imports": "^1.2.1", | ||
"@glint/template": "^1.2.1", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@tsconfig/ember": "^3.0.2", | ||
"@types/rsvp": "^4.0.9", | ||
"@typescript-eslint/eslint-plugin": "^6.14.0", | ||
"@typescript-eslint/parser": "^6.14.0", | ||
"concurrently": "^8.2.1", | ||
"ember-source": "~5.8.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needed to install this + There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense |
||
"rollup": "^3.29.1", | ||
"rollup-plugin-copy": "^3.5.0" | ||
"rollup-plugin-copy": "^3.5.0", | ||
"typescript": "^5.3.3", | ||
"webpack": "^5.88.1" | ||
}, | ||
"keywords": [ | ||
"ember-addon", | ||
|
@@ -47,12 +64,25 @@ | |
"@embroider/addon-shim": "^1.8.8" | ||
}, | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./*": "./dist/*.js", | ||
".": { | ||
"types": "./declarations/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"./*": { | ||
"types": "./declarations/*.d.ts", | ||
"default": "./dist/*.js" | ||
}, | ||
"./addon-main.js": "./addon-main.cjs", | ||
"./addon-main.cjs": "./addon-main.cjs", | ||
"./addon-main": "./addon-main.cjs" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"declarations/*" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"addon-main.cjs", | ||
"dist", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...e-array-and-use-deep-equal-from-params.js → ...e-array-and-use-deep-equal-from-params.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...composable-helpers/src/helpers/compact.js → ...composable-helpers/src/helpers/compact.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...composable-helpers/src/helpers/compute.js → ...composable-helpers/src/helpers/compute.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ember-composable-helpers/src/helpers/dec.js → ember-composable-helpers/src/helpers/dec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
ember-composable-helpers/src/helpers/drop.js → ember-composable-helpers/src/helpers/drop.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...composable-helpers/src/helpers/entries.js → ...composable-helpers/src/helpers/entries.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...-composable-helpers/src/helpers/filter.js → ...-composable-helpers/src/helpers/filter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...composable-helpers/src/helpers/find-by.js → ...composable-helpers/src/helpers/find-by.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { helper } from '@ember/component/helper'; | ||
import { isArray as isEmberArray } from '@ember/array'; | ||
import asArray from '../utils/as-array.ts'; | ||
|
||
export function flatten<T>(array: T[]): T[] { | ||
if (!isEmberArray(array)) { | ||
return array; | ||
} | ||
|
||
return asArray(array).reduce<T[]>((flattened, el) => { | ||
return flattened.concat(flatten(el as T[])); | ||
}, []); | ||
} | ||
|
||
export default helper(function<T>([array]: [T[]]) { | ||
return flatten(array); | ||
}); |
2 changes: 1 addition & 1 deletion
2
...sable-helpers/src/helpers/from-entries.js → ...sable-helpers/src/helpers/from-entries.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...omposable-helpers/src/helpers/group-by.js → ...omposable-helpers/src/helpers/group-by.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
...omposable-helpers/src/helpers/has-next.js → ...omposable-helpers/src/helpers/has-next.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { helper } from '@ember/component/helper'; | ||
import { isPresent } from '@ember/utils'; | ||
import { next } from './next'; | ||
import isEqual from '../utils/is-equal'; | ||
import getValueArrayAndUseDeepEqualFromParams from '../-private/get-value-array-and-use-deep-equal-from-params'; | ||
import asArray from '../utils/as-array'; | ||
import { next } from './next.ts'; | ||
import isEqual from '../utils/is-equal.ts'; | ||
import getValueArrayAndUseDeepEqualFromParams from '../-private/get-value-array-and-use-deep-equal-from-params.ts'; | ||
import asArray from '../utils/as-array.ts'; | ||
|
||
export function hasNext(currentValue, maybeArray, useDeepEqual = false) { | ||
export function hasNext<T>(currentValue: T, maybeArray: T[], useDeepEqual = false) { | ||
let array = asArray(maybeArray); | ||
let nextValue = next(currentValue, array, useDeepEqual); | ||
let isNotSameValue = !isEqual(nextValue, currentValue, useDeepEqual); | ||
|
||
return isNotSameValue && isPresent(nextValue); | ||
} | ||
|
||
export default helper(function(params) { | ||
export default helper(function<T>(params: [T, boolean | T[], T[]?]) { | ||
let { currentValue, array, useDeepEqual } = getValueArrayAndUseDeepEqualFromParams(params); | ||
|
||
return hasNext(currentValue, array, useDeepEqual); | ||
return hasNext(currentValue, array as T[], useDeepEqual); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put this in its own job above test-default?
and then add the lint command to package.json? 😅
https://github.com/NullVoxPopuli/ember-composable-helpers/pull/13/files#diff-b03f4acb30e04ceb12a40763ef649759b3f632df2357bcec14fab6dd29ebbfb4L5