Skip to content

Commit

Permalink
Merge pull request #4 from NullVoxPopuli/updates-to-work-with-codemod…
Browse files Browse the repository at this point in the history
…-clis-extension-support

Updates to support custom extensions in codemod-cli
  • Loading branch information
rwjblue authored Jul 14, 2019
2 parents 92ce435 + a28968c commit b06dccd
Show file tree
Hide file tree
Showing 20 changed files with 538 additions and 152 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
tmp
*.log
*.log
test/**/yarn.lock
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A collection of codemod's for ember-no-implicit-this-codemod.
To run a specific codemod from this project, you would run the following:

```
npx ember-no-implicit-this-codemod <TRANSFORM NAME> path/of/files/ or/some**/*glob.js
npx ember-no-implicit-this-codemod no-implicit-this path/of/files/ or/some**/*glob.hbs
# or
Expand Down
4 changes: 1 addition & 3 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
const transformName = process.argv[2];
const args = process.argv.slice(3);

console.log(transformName, args);

require('codemod-cli').runTransform(__dirname, transformName, args);
require('codemod-cli').runTransform(__dirname, transformName, args, 'hbs');
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,26 @@
"codemod-cli"
],
"dependencies": {
"codemod-cli": "^1.0.0",
"ember-template-recast": "^2.0.0",
"codemod-cli": "^1.1.0",
"ember-template-recast": "^3.1.1",
"fs-extra": "^8.1.0",
"git-repo-info": "^2.1.0",
"minimatch": "^3.0.4",
"puppeteer": "^1.18.1",
"sync-disk-cache": "^1.3.3",
"walk-sync": "^2.0.1",
"walk-sync": "^2.0.2",
"winston": "^3.2.1"
},
"devDependencies": {
"babel-plugin-htmlbars-inline-precompile": "^1.0.0",
"coveralls": "^3.0.4",
"coveralls": "^3.0.5",
"eslint": "^6.0.1",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-prettier": "^3.1.0",
"execa": "^2.0.1",
"execa": "^2.0.3",
"jest": "^24.8.0",
"prettier": "^1.18.2",
"release-it": "^12.3.0",
"release-it": "^12.3.3",
"release-it-lerna-changelog": "^1.0.3"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/input/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# input
# app

This README outlines the details of collaborating on this Ember application.
A short introduction of this app could easily go here.
Expand All @@ -15,7 +15,7 @@ You will need the following things properly installed on your computer.
## Installation

* `git clone <repository-url>` this repository
* `cd input`
* `cd app`
* `npm install`

## Running / Development
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/input/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Input</title>
<title>App</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/input.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/app.css">

{{content-for "head-footer"}}
</head>
<body>
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/input.js"></script>
<script src="{{rootURL}}assets/app.js"></script>

{{content-for "body-footer"}}
</body>
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/input/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = function(environment) {
let ENV = {
modulePrefix: 'input',
modulePrefix: 'app',
environment,
rootURL: '/',
locationType: 'auto',
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/input/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "input",
"name": "app",
"version": "0.0.0",
"private": true,
"description": "Small description for input goes here",
"description": "Small description for app goes here",
"repository": "",
"license": "MIT",
"author": "",
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/input/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Input Tests</title>
<title>App Tests</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}
{{content-for "test-head"}}

<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link rel="stylesheet" href="{{rootURL}}assets/input.css">
<link rel="stylesheet" href="{{rootURL}}assets/app.css">
<link rel="stylesheet" href="{{rootURL}}assets/test-support.css">

{{content-for "head-footer"}}
Expand All @@ -24,7 +24,7 @@
<script src="/testem.js" integrity=""></script>
<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/test-support.js"></script>
<script src="{{rootURL}}assets/input.js"></script>
<script src="{{rootURL}}assets/app.js"></script>
<script src="{{rootURL}}assets/tests.js"></script>

{{content-for "body-footer"}}
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/blueprints/*/files/
/vendor/

# compiled output
# compiled app
/dist/
/tmp/

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
# compiled app
/dist/
/tmp/

Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/output/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# output
# app

This README outlines the details of collaborating on this Ember application.
A short introduction of this app could easily go here.
Expand All @@ -15,7 +15,7 @@ You will need the following things properly installed on your computer.
## Installation

* `git clone <repository-url>` this repository
* `cd output`
* `cd app`
* `npm install`

## Running / Development
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/output/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Output</title>
<title>App</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/output.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/app.css">

{{content-for "head-footer"}}
</head>
<body>
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/output.js"></script>
<script src="{{rootURL}}assets/app.js"></script>

{{content-for "body-footer"}}
</body>
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/output/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = function(environment) {
let ENV = {
modulePrefix: 'output',
modulePrefix: 'app',
environment,
rootURL: '/',
locationType: 'auto',
Expand Down Expand Up @@ -35,7 +35,7 @@ module.exports = function(environment) {
// Testem prefers this...
ENV.locationType = 'none';

// keep test console output quieter
// keep test console app quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function(defaults) {
});

// Use `app.import` to add additional libraries to the generated
// output files.
// app files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/output/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/fixtures/output/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "output",
"name": "app",
"version": "0.0.0",
"private": true,
"description": "Small description for output goes here",
"description": "Small description for app goes here",
"repository": "",
"license": "MIT",
"author": "",
Expand Down
6 changes: 3 additions & 3 deletions test/fixtures/output/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Output Tests</title>
<title>App Tests</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}
{{content-for "test-head"}}

<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link rel="stylesheet" href="{{rootURL}}assets/output.css">
<link rel="stylesheet" href="{{rootURL}}assets/app.css">
<link rel="stylesheet" href="{{rootURL}}assets/test-support.css">

{{content-for "head-footer"}}
Expand All @@ -24,7 +24,7 @@
<script src="/testem.js" integrity=""></script>
<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/test-support.js"></script>
<script src="{{rootURL}}assets/output.js"></script>
<script src="{{rootURL}}assets/app.js"></script>
<script src="{{rootURL}}assets/tests.js"></script>

{{content-for "body-footer"}}
Expand Down
2 changes: 1 addition & 1 deletion test/run-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const execOpts = { cwd: inputDir, stderr: 'inherit' };

console.log('running codemod');

await execa('../../../bin/cli.js', ['http://localhost:4200', 'app'], execOpts);
await execa('../../../bin/cli.js', ['no-implicit-this', 'app'], execOpts);

console.log('codemod complete, ending serve');

Expand Down
Loading

0 comments on commit b06dccd

Please sign in to comment.