Skip to content

Commit

Permalink
rename to ember-hbs-imports (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx authored Feb 26, 2021
1 parent 4acaa10 commit a2b62d4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ jobs:
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "tag exists";
else
curl -X POST -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/patricklx/ember-template-imports/git/refs -d "{ \"ref\": \"refs/tags/$TAG\", \"sha\": \"$GITHUB_COMMIT\" }"
curl -X POST -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/patricklx/ember-hbs-imports/git/refs -d "{ \"ref\": \"refs/tags/$TAG\", \"sha\": \"$GITHUB_COMMIT\" }"
fi
- name: Create a Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version=$(cat package.json | jq -r '.version')
TAG=v$version
url="https://api.github.com/repos/patricklx/ember-template-imports/releases"
url="https://api.github.com/repos/patricklx/ember-hbs-imports/releases"
exists=$(curl -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" $url | jq ".[] | select(.tag_name == \"$TAG\") | .id")
if [[ -z $exists ]]; then
npm i lerna-changelog || echo "its okay"
Expand Down
21 changes: 5 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ember-template-imports
ember-hbs-imports
==============================================================================

merged
Expand All @@ -15,11 +15,13 @@ a helper/component and import styles within a template file.
* Relative imports!


there is now an official addon for imports at https://github.com/ember-template-imports/ember-template-imports

Installation
------------------------------------------------------------------------------

```
ember install ember-template-imports
ember install ember-hbs-imports
```


Expand Down Expand Up @@ -61,7 +63,7 @@ Syntax:
The helper is looked up from the given string using a direct lookup
pattern. I set the `resolveHelper` in the resolver.
All this addon does is taking that `{{import ...}}` statement
and replacing all helper invocations with `{{ember-template-helper-import/helpers/invoke-helper 'myHelper' ...}}`.
and replacing all helper invocations with `{{ember-hbs-import/helpers/invoke-helper 'myHelper' ...}}`.

Our helper then looks up the actual helper and calls `compute` with the other arguments

Expand All @@ -73,19 +75,6 @@ already gives us import for components, but I really miss the helper imports.
So I went ahead and added this functionality :)


But what about Module Unification?
------------------------------------------------------------------------------

Once Module Unification lands fully, this addon will be largely obsolete. MU
provides all these benefits and more.

So on the one hand, your templates will start to look _something kinda like_
MU a little sooner, which is nice.

But be warned - any official tooling to codemod templates into a new MU world
likely won't support this addon. So weigh the pros and cons carefully before
widely adopting this addon.

License
------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion lib/import-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const importProcessors = {
}
// its a helper
imported.others.add(resolvedPath + '.js');
node.original = `ember-template-imports/helpers/invoke-helper this '${resolvedPath}'`;
node.original = `ember-hbs-imports/helpers/invoke-helper this '${resolvedPath}'`;
i.used = true;
}
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "ember-template-imports",
"version": "0.2.14",
"name": "ember-hbs-imports",
"version": "0.3.0",
"repository": {
"type": "git",
"url": "https://github.com/patricklx/ember-template-imports"
"url": "https://github.com/patricklx/ember-hbs-imports"
},
"description": "Adds template imports for ember hbs",
"keywords": [
Expand Down

0 comments on commit a2b62d4

Please sign in to comment.