Skip to content

Commit

Permalink
project -> app
Browse files Browse the repository at this point in the history
  • Loading branch information
bertdeblock committed Sep 12, 2023
1 parent fd520e7 commit a1f1057
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 47 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Transforms a **flat colocated** component structure to a **nested colocated** component structure.

- Works for projects and addons (v1, v2 and in-repo addons)
- 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))
Expand All @@ -20,14 +20,14 @@ Transforms a **flat colocated** component structure to a **nested colocated** co
### Flat to Nested

```shell
cd your/project-or-addon/path
cd your/app-or-addon/path
npx github:bertdeblock/ember-flat-to-nested
```

#### Before

```
your-project-name
your-app-name
├── app
│ └── components
│ ├── foo
Expand All @@ -41,7 +41,7 @@ your-project-name
#### After

```
your-project-name
your-app-name
├── app
│ └── components
│ └── foo
Expand All @@ -56,14 +56,14 @@ your-project-name
### Nested to Flat

```shell
cd your/project-or-addon/path
cd your/app-or-addon/path
npx github:bertdeblock/ember-flat-to-nested --revert
```

#### Before

```
your-project-name
your-app-name
├── app
│ └── components
│ └── foo
Expand All @@ -78,7 +78,7 @@ your-project-name
#### After

```
your-project-name
your-app-name
├── app
│ └── components
│ ├── foo
Expand Down
80 changes: 40 additions & 40 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,53 @@ import test from "ava";
import { flatToNested } from "../lib/index.js";
import { copyBlueprint, testFileExists, testPath } from "./helpers.js";

test("flat to nested inside a project", async function (t) {
await copyBlueprint("project-flat");
await flatToNested(testPath("output/project-flat"));

t.false(await testFileExists("project-flat/app/components/foo.css"));
t.false(await testFileExists("project-flat/app/components/foo.hbs"));
t.false(await testFileExists("project-flat/app/components/foo.js"));
t.false(await testFileExists("project-flat/app/components/foo/bar.css"));
t.false(await testFileExists("project-flat/app/components/foo/bar.hbs"));
t.false(await testFileExists("project-flat/app/components/foo/bar.js"));

t.true(await testFileExists("project-flat/app/components/foo/index.css"));
t.true(await testFileExists("project-flat/app/components/foo/index.hbs"));
t.true(await testFileExists("project-flat/app/components/foo/index.js"));
t.true(await testFileExists("project-flat/app/components/foo/bar/index.css"));
t.true(await testFileExists("project-flat/app/components/foo/bar/index.hbs"));
t.true(await testFileExists("project-flat/app/components/foo/bar/index.js"));
t.true(await testFileExists("project-flat/app/components/baz/index.css"));
t.true(await testFileExists("project-flat/app/components/baz/index.hbs"));
t.true(await testFileExists("project-flat/app/components/baz/index.js"));
test("flat to nested inside an app", async function (t) {
await copyBlueprint("app-flat");
await flatToNested(testPath("output/app-flat"));

t.false(await testFileExists("app-flat/app/components/foo.css"));
t.false(await testFileExists("app-flat/app/components/foo.hbs"));
t.false(await testFileExists("app-flat/app/components/foo.js"));
t.false(await testFileExists("app-flat/app/components/foo/bar.css"));
t.false(await testFileExists("app-flat/app/components/foo/bar.hbs"));
t.false(await testFileExists("app-flat/app/components/foo/bar.js"));

t.true(await testFileExists("app-flat/app/components/foo/index.css"));
t.true(await testFileExists("app-flat/app/components/foo/index.hbs"));
t.true(await testFileExists("app-flat/app/components/foo/index.js"));
t.true(await testFileExists("app-flat/app/components/foo/bar/index.css"));
t.true(await testFileExists("app-flat/app/components/foo/bar/index.hbs"));
t.true(await testFileExists("app-flat/app/components/foo/bar/index.js"));
t.true(await testFileExists("app-flat/app/components/baz/index.css"));
t.true(await testFileExists("app-flat/app/components/baz/index.hbs"));
t.true(await testFileExists("app-flat/app/components/baz/index.js"));
});

test("nested to flat inside a project", async function (t) {
await copyBlueprint("project-nested");
await flatToNested(testPath("output/project-nested"), { revert: true });

t.true(await testFileExists("project-nested/app/components/foo.css"));
t.true(await testFileExists("project-nested/app/components/foo.hbs"));
t.true(await testFileExists("project-nested/app/components/foo.js"));
t.true(await testFileExists("project-nested/app/components/foo/bar.css"));
t.true(await testFileExists("project-nested/app/components/foo/bar.hbs"));
t.true(await testFileExists("project-nested/app/components/foo/bar.js"));
t.true(await testFileExists("project-nested/app/components/baz.css"));
t.true(await testFileExists("project-nested/app/components/baz.hbs"));
t.true(await testFileExists("project-nested/app/components/baz.js"));

t.false(await testFileExists("project-nested/app/components/foo/index.css"));
t.false(await testFileExists("project-nested/app/components/foo/index.hbs"));
t.false(await testFileExists("project-nested/app/components/foo/index.js"));
test("nested to flat inside an app", async function (t) {
await copyBlueprint("app-nested");
await flatToNested(testPath("output/app-nested"), { revert: true });

t.true(await testFileExists("app-nested/app/components/foo.css"));
t.true(await testFileExists("app-nested/app/components/foo.hbs"));
t.true(await testFileExists("app-nested/app/components/foo.js"));
t.true(await testFileExists("app-nested/app/components/foo/bar.css"));
t.true(await testFileExists("app-nested/app/components/foo/bar.hbs"));
t.true(await testFileExists("app-nested/app/components/foo/bar.js"));
t.true(await testFileExists("app-nested/app/components/baz.css"));
t.true(await testFileExists("app-nested/app/components/baz.hbs"));
t.true(await testFileExists("app-nested/app/components/baz.js"));

t.false(await testFileExists("app-nested/app/components/foo/index.css"));
t.false(await testFileExists("app-nested/app/components/foo/index.hbs"));
t.false(await testFileExists("app-nested/app/components/foo/index.js"));
t.false(
await testFileExists("project-nested/app/components/foo/bar/index.css"),
await testFileExists("app-nested/app/components/foo/bar/index.css"),
);
t.false(
await testFileExists("project-nested/app/components/foo/bar/index.hbs"),
await testFileExists("app-nested/app/components/foo/bar/index.hbs"),
);
t.false(
await testFileExists("project-nested/app/components/foo/bar/index.js"),
await testFileExists("app-nested/app/components/foo/bar/index.js"),
);
});

Expand Down

0 comments on commit a1f1057

Please sign in to comment.