Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bertdeblock/ember-flat-to-nested
Transforms a flat colocated component structure to a nested colocated component structure.
https://github.com/bertdeblock/ember-flat-to-nested
codemod ember
Last synced: 3 months ago
JSON representation
Transforms a flat colocated component structure to a nested colocated component structure.
- Host: GitHub
- URL: https://github.com/bertdeblock/ember-flat-to-nested
- Owner: bertdeblock
- License: mit
- Created: 2020-10-08T09:25:17.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-12T19:30:40.000Z (over 1 year ago)
- Last Synced: 2024-10-02T11:50:45.889Z (4 months ago)
- Topics: codemod, ember
- Language: JavaScript
- Homepage:
- Size: 350 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Ember Flat to Nested
[![CI](https://github.com/bertdeblock/ember-flat-to-nested/workflows/CI/badge.svg)](https://github.com/bertdeblock/ember-flat-to-nested/actions?query=workflow%3ACI)
Transforms a **flat colocated** component structure to a **nested colocated** component structure.
- Works for apps and addons (v1, v2 and in-repo addons)
- Supports reverting to a flat colocated component structure
- Ignores component files that already comply to the desired component structure
- Takes into account CSS module files (in case you are using [ember-css-modules](https://github.com/salsify/ember-css-modules))> **NOTE:** Use [ember-component-template-colocation-migrator](https://github.com/ember-codemods/ember-component-template-colocation-migrator) if you want to transform a **classic** component structure to a **flat or nested colocated** component structure.
## ✅ Compatibility
- Node.js v18 or above
## 👨💻 Usage
### Flat to Nested
```shell
cd your/app-or-addon/path
npx github:bertdeblock/ember-flat-to-nested
```#### Before
```
your-app-name
├── app
│ └── components
│ ├── foo
│ │ ├── bar.hbs
│ │ └── bar.js
│ ├── foo.hbs
│ └── foo.js
│ ...
```#### After
```
your-app-name
├── app
│ └── components
│ └── foo
│ ├── bar
│ │ ├── index.hbs
│ │ └── index.js
│ ├── index.hbs
│ └── index.js
│ ...
```### Nested to Flat
```shell
cd your/app-or-addon/path
npx github:bertdeblock/ember-flat-to-nested --revert
```#### Before
```
your-app-name
├── app
│ └── components
│ └── foo
│ ├── bar
│ │ ├── index.hbs
│ │ └── index.js
│ ├── index.hbs
│ └── index.js
│ ...
```#### After
```
your-app-name
├── app
│ └── components
│ ├── foo
│ │ ├── bar.hbs
│ │ └── bar.js
│ ├── foo.hbs
│ └── foo.js
│ ...
```