The ember-es6-class-codemod-dyfactor is a dyfactor plugin to extract the data about ember objects like Routes, Components, Controllers etc. It is written with ember es6 codemods as primary use case but can be extended to be used for multiple use cases.
It uses Dyfactor - a plugin runner system, which allows you to collect the runtime information about the code. See the documentation for more information about dyfactor
yarn add ember-es6-class-codemod-dyfactor --dev
or
ember install ember-es6-class-codemod-dyfactor
After installation, a little configuration is needed:
- In your
test-helper.js
import theextract
utility from theember-es6-class-codemod-dyfactor
import { extract } from "ember-es6-class-codemod-dyfactor/test-support/ember-object";
- Call the extract utility before your tests are run.
// ... Other imports
import { extract } from "ember-es6-class-codemod-dyfactor/test-support/ember-object";
import { start } from "ember-qunit";
// ..... Other test helper code, setting up application, preloading assets etc
extract();
start();
- Initialize the dyfactor using
yarn dyfactor init
, configure the navigation in.dyfactor.json
to visit the tests page - Run the plugin - using
yarn dyfactor run template ember-object path/to/files --level extract
The plugin extracts the runtime data and dumps into dyfactor-telemetry.json
indexed with absolute file path
. Following is the example runtime data:
{
"data": [
{
"/home/user/workspace/ember-app/app/components/list-filter.js": {
"computedProperties": ['computedProp1', ...],
"observedProperties": ['observedProp1', ...],
"observerProperties": {
"observerProp1": ["prop1", "prop2", ...]
},
"offProperties": {
"offProp": ["prop3", ...]
},
"overriddenActions": ["overriddenAction1", ...],
"overriddenProperties": ["overriddenProp1"],
"ownProperties": ["prop1", ...],
"type": "Component|Route|Controller|EmberObject",
"unobservedProperties": {
"unobservedProp1": ["prop1", ...]
}
}
}
]
}
git clone <repository-url>
cd ember-es6-class-codemod-dyfactor
yarn install
yarn lint:hbs
yarn lint:js
yarn lint:js --fix
ember test
– Runs the test suite on the current Ember versionember test --server
– Runs the test suite in "watch mode"ember try:each
– Runs the test suite against multiple Ember versions
ember serve
- Visit the dummy application at http://localhost:4200.
For more information on using ember-cli, visit https://ember-cli.com/.
This project is licensed under the MIT License.