{"id":21553191,"url":"https://github.com/bbvaengineering/ember-component-analyzer","last_synced_at":"2025-03-18T02:34:45.221Z","repository":{"id":25525045,"uuid":"103959644","full_name":"BBVAEngineering/ember-component-analyzer","owner":"BBVAEngineering","description":"Extracts the \"possibles\" components that may exists in the different routes of an Ember application.","archived":false,"fork":false,"pushed_at":"2022-12-12T15:01:31.000Z","size":1293,"stargazers_count":2,"open_issues_count":26,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-26T05:36:39.310Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BBVAEngineering.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-18T15:49:53.000Z","updated_at":"2022-12-27T13:49:50.000Z","dependencies_parsed_at":"2023-01-14T02:53:29.976Z","dependency_job_id":null,"html_url":"https://github.com/BBVAEngineering/ember-component-analyzer","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-component-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-component-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-component-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-component-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BBVAEngineering","download_url":"https://codeload.github.com/BBVAEngineering/ember-component-analyzer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244144511,"owners_count":20405459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T07:09:46.627Z","updated_at":"2025-03-18T02:34:45.197Z","avatar_url":"https://github.com/BBVAEngineering.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ember-component-analyzer\n\n[![Build Status](https://travis-ci.org/BBVAEngineering/ember-component-analyzer.svg?branch=master)](https://travis-ci.org/BBVAEngineering/ember-component-analyzer)\n[![GitHub version](https://badge.fury.io/gh/BBVAEngineering%2Fember-component-analyzer.svg)](https://badge.fury.io/gh/BBVAEngineering%2Fember-component-analyzer)\n[![NPM version](https://badge.fury.io/js/ember-component-analyzer.svg)](https://badge.fury.io/js/ember-component-analyzer)\n[![Dependency Status](https://david-dm.org/BBVAEngineering/ember-component-analyzer.svg)](https://david-dm.org/BBVAEngineering/ember-component-analyzer)\n[![codecov](https://codecov.io/gh/BBVAEngineering/ember-component-analyzer/branch/master/graph/badge.svg)](https://codecov.io/gh/BBVAEngineering/ember-component-analyzer)\n[![Greenkeeper badge](https://badges.greenkeeper.io/BBVAEngineering/ember-component-analyzer.svg)](https://greenkeeper.io/)\n\n## Information\n\n[![NPM](https://nodei.co/npm/ember-component-analyzer.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/ember-component-analyzer/)\n\n### This project is an experimental dark thing O_O**\n\nThis library extracts the \"possibles\" components that may exists in the different routes\nof an Ember application. It uses Glimmer compiler to make \u0026 read the AST trees.\n\nThe lib reads all the handlebars files to find all the components (usually names that\ncontains `-` for components and `.` for contextual components).\nOnce the \"possible\" components are found, it replaces all the contextual components by\nits real name. This part is only possible for the application components (right now its unable to read the components\ninside the `ember-addons`).\n\n## Information\n\n[![NPM](https://nodei.co/npm/ember-component-analyzer.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/ember-component-analyzer/)\n\n## How to use\n\n1. Import the lib\n\n```js\nconst lib = require('ember-component-analyzer');\n```\n\n2. Process the application\n\n```js\n#!/usr/bin/env node\n\nconst { Analyzer, parse } = lib;\n\nconst analyzer = new Analyzer(process.argv.slice(2), {\n  // options...\n});\nconst result = analyzer.process(); // Hell JSON\nconst output = parse(result); // Friendly JSON with the application data\n```\n\n3. Save the results, process or do whatever you want\n\n## Options\n\nThe `Analyzer` class accepts an object as config. The possible attributes are:\n\n- **families**: An object containing the different typologies of the templates\n(components, helpers, routes, ...) and the `RegExp` used to recognize the type.\nThese families represents the attributes of the result object after parsing\nthe files.\n\nDefaults to:\n\n```javascript\n{\n  components: /components/, // the file path contains the word \"components\"\n  default: /^((?!components).)*$/ // the file path not contains the word \"components\"\n}\n```\n\n- **getNodeName**: This function receives an **AST node** as first argument and\nit should return the component name (if valid) or `null` if you don't want\nthe element to appear in the report (for example a blacklisted element).\n\n## Example\n\nGiven:\n\n- Component `my-wrapper.hbs`:\n\n```handlebars\n\u003cdiv\u003e\n  {{yield (hash header=(component 'my-header'))}}\n  {{my-footer}}\n\u003c/div\u003e\n```\n\n- Component `my-header.hbs`:\n\n```handlebars\n{{link-to}}\n```\n\n- Route `index.hbs`:\n\n```handlebars\n{{#my-wrapper as |wrapper|}}\n  {{wrapper.header}}\n{{/my-wrapper}}\n```\n\nThen it will generate an output (using the exported `parser`) similar to:\n\n```json\n{\n  \"default\": [{\n    \"moduleId\": \"index.hbs\",\n    \"components\": [\"my-wrapper\", \"header-main\", \"link-to\", \"my-footer\"]\n  },\n  \"components\": [{\n    \"moduleId\": \"my-wrapper\",\n    \"components\": [\"my-footer\"]\n  }, {\n    \"moduleId\": \"my-header\",\n    \"components\": [\"link-to\"]\n  }]\n}\n```\n\n## Readable report?\n\nWorking on it :)\n\n![report](https://cdn.pbrd.co/images/GKXhxwx.png)\n\n## Contributing\n\nWe're thankful to the community for contributing any improvements.\n\nDo not forget to follow our [eslint](https://github.com/BBVAEngineering/javascript/tree/master/eslint-config-bbva) rules and make test for the new functionalities/fixes.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/BBVAEngineering/ember-storages/tags).\n\n## Authors\n\nSee the list of [contributors](https://github.com/BBVAEngineering/ember-storages/graphs/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbvaengineering%2Fember-component-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbvaengineering%2Fember-component-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbvaengineering%2Fember-component-analyzer/lists"}