Skip to content

Commit 4e7acaf

Browse files
author
Robert Jackson
authored
Converting htmlbars import declaration from 'htmlbars-inline-preco… (#1)
Converting htmlbars import declaration from 'htmlbars-inline-precompile' to 'ember-cli-htmlbars'
2 parents 56c67ec + a746c6e commit 4e7acaf

16 files changed

Lines changed: 5585 additions & 1 deletion

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!.*
2+
__testfixtures__

.eslintrc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
parserOptions: {
3+
ecmaVersion: 2018,
4+
},
5+
6+
plugins: ['prettier', 'node'],
7+
extends: ['eslint:recommended', 'plugin:prettier/recommended', 'plugin:node/recommended'],
8+
env: {
9+
node: true,
10+
},
11+
rules: {},
12+
overrides: [
13+
{
14+
files: ['__tests__/**/*.js'],
15+
env: {
16+
jest: true,
17+
},
18+
},
19+
],
20+
};

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "es5",
4+
"printWidth": 100
5+
}

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
language: node_js
3+
node_js:
4+
- "8"
5+
6+
sudo: false
7+
dist: trusty
8+
9+
cache:
10+
yarn: true
11+
12+
before_install:
13+
- curl -o- -L https://yarnpkg.com/install.sh | bash
14+
- export PATH=$HOME/.yarn/bin:$PATH
15+
16+
install:
17+
- yarn install
18+
19+
script:
20+
- yarn lint
21+
- yarn test:coverage
22+
23+
after_success:
24+
- yarn coveralls

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
11
# ember-cli-htmlbars-inline-precompile-codemod
2-
Codemod away from importing from htmlbars-inline-precompile to ember-cli-htmlbars.
2+
3+
[![Build Status](https://travis-ci.com/ember-codemods/ember-cli-htmlbars-inline-precompile-codemod.svg?branch=master)](https://travis-ci.com/ember-codemods/ember-cli-htmlbars-inline-precompile-codemod)
4+
[![npm version](https://badge.fury.io/js/ember-cli-htmlbars-inline-precompile-codemod.svg)](https://badge.fury.io/js/ember-cli-htmlbars-inline-precompile-codemod)
5+
6+
A collection of codemod's for ember-cli-htmlbars-inline-precompile-codemod.
7+
8+
## Usage
9+
10+
To run a specific codemod from this project, you would run the following:
11+
12+
```
13+
npx ember-cli-htmlbars-inline-precompile-codemod path/of/files/ or/some**/*glob.js
14+
15+
# or
16+
17+
yarn global add ember-cli-htmlbars-inline-precompile-codemod
18+
ember-cli-htmlbars-inline-precompile-codemod path/of/files/ or/some**/*
19+
```
20+
21+
## Transforms
22+
23+
<!--TRANSFORMS_START-->
24+
* [convert-htmlbars-import](transforms/convert-htmlbars-import/README.md)
25+
26+
## Contributing
27+
28+
### Installation
29+
30+
* clone the repo
31+
* change into the repo directory
32+
* `yarn`
33+
34+
### Running tests
35+
36+
* `yarn test`
37+
38+
### Update Documentation
39+
40+
* `yarn update-docs`

bin/cli.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
require('codemod-cli').runTransform(
5+
__dirname,
6+
'convert-htmlbars-import' /* transform name */,
7+
process.argv.slice(2) /* paths or globs */
8+
);

package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "ember-cli-htmlbars-inline-precompile-codemod",
3+
"version": "0.1.0",
4+
"scripts": {
5+
"lint": "eslint --cache .",
6+
"test": "codemod-cli test",
7+
"test:coverage": "codemod-cli test --coverage",
8+
"update-docs": "codemod-cli update-docs",
9+
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls"
10+
},
11+
"bin": "./bin/cli.js",
12+
"keywords": [
13+
"codemod-cli"
14+
],
15+
"dependencies": {
16+
"codemod-cli": "^2.1.0"
17+
},
18+
"devDependencies": {
19+
"coveralls": "^3.0.6",
20+
"eslint": "^6.4.0",
21+
"eslint-config-prettier": "^6.3.0",
22+
"eslint-plugin-node": "^10.0.0",
23+
"eslint-plugin-prettier": "^3.1.1",
24+
"jest": "^24.9.0",
25+
"prettier": "^1.18.2"
26+
},
27+
"engines": {
28+
"node": "8.* || 10.* || >= 12"
29+
},
30+
"jest": {
31+
"testEnvironment": "node"
32+
}
33+
}

transforms/.gitkeep

Whitespace-only changes.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# convert-htmlbars-import
2+
3+
4+
## Usage
5+
6+
```
7+
npx ember-cli-htmlbars-inline-precompile-codemod path/of/files/ or/some**/*glob.js
8+
9+
# or
10+
11+
yarn global add ember-cli-htmlbars-inline-precompile-codemod
12+
ember-cli-htmlbars-inline-precompile-codemod path/of/files/ or/some**/*
13+
```
14+
15+
## Input / Output
16+
17+
<!--FIXTURES_TOC_START-->
18+
* [convert-htmlbars-import](#convert-htmlbars-import)
19+
* [non-standard-imported-name](#non-standard-imported-name)
20+
<!--FIXTURES_TOC_END-->
21+
22+
<!--FIXTURES_CONTENT_START-->
23+
---
24+
<a id="convert-htmlbars-import">**convert-htmlbars-import**</a>
25+
26+
**Input** (<small>[convert-htmlbars-import.input.js](transforms/convert-htmlbars-import/__testfixtures__/convert-htmlbars-import.input.js)</small>):
27+
```js
28+
import hbs from 'htmlbars-inline-precompile';
29+
30+
```
31+
32+
**Output** (<small>[convert-htmlbars-import.output.js](transforms/convert-htmlbars-import/__testfixtures__/convert-htmlbars-import.output.js)</small>):
33+
```js
34+
import { hbs } from 'ember-cli-htmlbars';
35+
36+
```
37+
---
38+
<a id="non-standard-imported-name">**non-standard-imported-name**</a>
39+
40+
**Input** (<small>[non-standard-imported-name.input.js](transforms/convert-htmlbars-import/__testfixtures__/non-standard-imported-name.input.js)</small>):
41+
```js
42+
import h from 'htmlbars-inline-precompile';
43+
44+
```
45+
46+
**Output** (<small>[non-standard-imported-name.output.js](transforms/convert-htmlbars-import/__testfixtures__/non-standard-imported-name.output.js)</small>):
47+
```js
48+
import { hbs as h } from 'ember-cli-htmlbars';
49+
50+
```
51+
<!--FIXTURES_CONTENT_END-->
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import hbs from 'htmlbars-inline-precompile';

0 commit comments

Comments
 (0)