Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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
│ ...
```