Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed tutorials #139

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ npx @codemod-utils/cli <your-codemod-name>

## Tutorials

- [Main tutorial](./tutorials/ember-codemod-rename-test-modules/00-introduction.md)
- [Blueprints](./tutorials/blueprints-v2-addon/00-introduction.md)
- [`<template>` tag](./tutorials/template-tag/00-introduction.md)
- [Main tutorial](./tutorials/main-tutorial/00-introduction.md)
- [Create blueprints](./tutorials/create-blueprints/00-introduction.md)
- [Update `<template>` tags](./tutorials/update-template-tags/00-introduction.md)


## Codemods written with @codemod-utils
Expand Down
2 changes: 1 addition & 1 deletion packages/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test('Some method', function () {
}).only();
```

Note, test files must have the extension `.test.ts` or `.test.js`. Check the [main tutorial](../../tutorials/ember-codemod-rename-test-modules/02-understand-the-folder-structure.md#tests) for conventions around tests.
Note, test files must have the extension `.test.ts` or `.test.js`. Check the [main tutorial](../../tutorials/main-tutorial/02-understand-the-folder-structure.md#tests) for conventions around tests.


### assert
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Introduction

> [!IMPORTANT]
> Please complete the [main tutorial](../ember-codemod-rename-test-modules/00-introduction.md) first.
> Please complete the [main tutorial](../main-tutorial/00-introduction.md) first.

> [!NOTE]
> This tutorial covers **blueprints**, files that you can use like a "stamp" to create or update certain files in a project. You will also learn how to transform a user's CLI options in the `create-options` step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ pnpm install
```

> [!NOTE]
> Just like in [the main tutorial](../ember-codemod-rename-test-modules/04-step-1-update-acceptance-tests-part-1.md#remove-the-sample-step), remove the sample step, `add-end-of-line`.
> Just like in [the main tutorial](../main-tutorial/04-step-1-update-acceptance-tests-part-1.md#remove-the-sample-step), remove the sample step, `add-end-of-line`.


## Folder structure

Let's take a look at how `blueprints-v2-addon` is structured as a tree. For simplicity, the tree only shows what's new, compared to that from [the main tutorial](ember-codemod-rename-test-modules/02-understand-the-folder-structure.md#folder-structure).
Let's take a look at how `blueprints-v2-addon` is structured as a tree. For simplicity, the tree only shows what's new, compared to that from [the main tutorial](../main-tutorial/02-understand-the-folder-structure.md#folder-structure).

```sh
blueprints-v2-addon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Copy-paste the following starter code:
Then, scaffold a step called `create-files-from-blueprints`. Use `findFiles()` from `@codemod-utils/files` to find the blueprint files, then log the file paths.

> [!NOTE]
> Need a refresher on [`findFiles()`](../ember-codemod-rename-test-modules/04-step-1-update-acceptance-tests-part-1.md#find-files)? Don't forget to run tests to check your code.
> Need a refresher on [`findFiles()`](../main-tutorial/04-step-1-update-acceptance-tests-part-1.md#find-files)? Don't forget to run tests to check your code.
>
> ```sh
> ❯ pnpm test
Expand Down Expand Up @@ -129,7 +129,7 @@ export function runCodemod(codemodOptions: CodemodOptions): void {

## Read and write blueprint files

Unlike in [the main tutorial](../ember-codemod-rename-test-modules/04-step-1-update-acceptance-tests-part-1.md#read-and-write-files), we won't use `writeFileSync()` from Node.js to create files. The reason is, the folders where files will be created (i.e. folders named `__addonLocation__` and `__testAppLocation__`) don't exist on the user's machine.
Unlike in [the main tutorial](../main-tutorial/04-step-1-update-acceptance-tests-part-1.md#read-and-write-files), we won't use `writeFileSync()` from Node.js to create files. The reason is, the folders where files will be created (i.e. folders named `__addonLocation__` and `__testAppLocation__`) don't exist on the user's machine.

Luckily, `@codemod-utils/files` provides [`createFiles()`](../../packages/files/README.md#createfiles), which creates missing folders as needed. We just need to provide this function a `Map`, which maps a blueprint's file path to its file content.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Introduction

> [!IMPORTANT]
> Please complete the [main tutorial](../ember-codemod-rename-test-modules/00-introduction.md) first.
> Please complete the [main tutorial](../main-tutorial/00-introduction.md) first.

> [!NOTE]
> This tutorial shows how to use [`content-tag`](https://github.com/embroider-build/content-tag#readme) and [`@codemod-utils/ast-template`](../../packages/ast/template#readme) (i.e. `ember-template-recast`) to read and update `*.{gjs,gts}` files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pnpm install content-tag
```

> [!NOTE]
> Just like in [the main tutorial](../ember-codemod-rename-test-modules/04-step-1-update-acceptance-tests-part-1.md#remove-the-sample-step), remove the sample step, `add-end-of-line`.
> Just like in [the main tutorial](../main-tutorial/04-step-1-update-acceptance-tests-part-1.md#remove-the-sample-step), remove the sample step, `add-end-of-line`.


## Scaffold step
Expand Down