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

chore(docs): consolidate the developer resource files into a docs/ directory #29266

Merged
merged 17 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Issue number: resolves #
If this introduces a breaking change:
1. Describe the impact and migration path for existing applications below.
2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer for more information.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information.
-->


Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<a href="https://github.com/ionic-team/ionic-framework/blob/main/LICENSE">
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Ionic Framework is released under the MIT license." />
</a>
<a href="https://github.com/ionic-team/ionic/blob/main/.github/CONTRIBUTING.md">
<a href="https://github.com/ionic-team/ionic/blob/main/docs/CONTRIBUTING.md">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
</a>
<a href="https://twitter.com/Ionicframework">
Expand All @@ -38,7 +38,7 @@
Documentation
</a>
<span> Β· </span>
<a href="https://github.com/ionic-team/ionic/blob/main/.github/CONTRIBUTING.md">Contribute</a>
<a href="https://github.com/ionic-team/ionic/blob/main/docs/CONTRIBUTING.md">Contribute</a>
<span> Β· </span>
<a href="https://blog.ionicframework.com/">Blog</a>
<br />
Expand Down Expand Up @@ -88,7 +88,7 @@ The Ionic Conference App is a full featured Ionic app. It is the perfect startin
### Contributing

Thanks for your interest in contributing! Read up on our guidelines for
[contributing](https://github.com/ionic-team/ionic/blob/main/.github/CONTRIBUTING.md)
[contributing](https://github.com/ionic-team/ionic/blob/main/docs/CONTRIBUTING.md)
and then look through our issues with a [help wanted](https://github.com/ionic-team/ionic/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)
label.

Expand Down
44 changes: 2 additions & 42 deletions core/scripts/readme.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,4 @@

## Build
# Core Scripts

### 1. Clone ionic

git@github.com:ionic-team/ionic.git
cd ionic

### 2. Run `npm install`

cd core
npm install


Notice that `@ionic/core` lives in `core`.

### 3. Run `npm start`

Make sure you are inside the `core` directory.

npm start

With the `dev` command, Ionic components will be built with [Stencil](https://stenciljs.com/), changes to source files are watched, a local http server will startup, and http://localhost:3333/ will open in a browser.

### 4. Preview

Navigate to http://localhost:3333/src/components/. Each component has small e2e apps found in the `test` directory, for example: http://localhost:3333/src/components/button/test/basic

As changes are made in an editor to source files, the e2e app will live-reload.

## How to contribute

1. `npm start` allows you to modify the components and have live reloading, just like another ionic app.

2. When everything looks good, run `npm run validate` to verify the tests linter and production build passes.


# Deploy

1. `npm run prepare.deploy`
2. Review/update changelog
3. Commit updates using the package name and version number as the commit message.
4. `npm run deploy`
5. :tada:
This file has been moved to [/docs/core/testing/preview-changes.md](/docs/core/testing/preview-changes.md).
10 changes: 1 addition & 9 deletions core/src/utils/test/playwright/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# Ionic E2E Tests Guide

This directory contains information on how to get the most out of Ionic's E2E test infrastructure when writing tests.

## Directory

| Directory | Description |
| - | - |
| [Usage Instructions](./usage-instructions.md) | How to run tests and update screenshots |
| [Best Practices](./best-practices.md) | Contains information on conventions to follow as well as pitfalls to avoid when writing tests |
| [API](./api.md) | Documents the custom functionality that has been built on top of Playwright |
Refer to the [Core Testing documentation](/docs/core/testing/README.md) in order to build and run the e2e tests.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md β†’ docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

Thanks for your interest in contributing to the Ionic Framework! :tada:
Thanks for your interest in contributing to the Ionic Framework! πŸŽ‰

- [Contributing Etiquette](#contributing-etiquette)
- [Creating an Issue](#creating-an-issue)
Expand Down
36 changes: 36 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<p align="center">
<img alt="Ionic Logo" src="https://github.com/ionic-team/ionic-framework/blob/main/.github/assets/logo.png?raw=true" width="60" />
</p>

<h1 align="center">
Ionic Framework Developer Resources
</h1>

<p align="center">
This documentation includes guidelines on contributing, coding conventions, best practices, testing steps, and more. It should serve as a collective resource for all documentation related to developing Ionic Framework.
</p>

## What is Ionic Framework?

Ionic Framework is an open source app development toolkit for building modern, fast, top-quality cross-platform native and Progressive Web Apps from a single codebase with JavaScript and the Web.

It is based on <a href="https://www.webcomponents.org/introduction">Web Components</a>, which enables significant performance, usability, and feature improvements alongside support for popular web frameworks like <a href="https://angular.io/">Angular</a>, <a href="https://reactjs.com/">React</a>, and <a href="https://vuejs.org/">Vue</a>.

## Guides

| Guide | Description |
| ----------------------------------------| ---------------------------------------------------------------------------------------- |
| [Contributing](./CONTRIBUTING.md) | How to contribute including creating pull requests, commit message guidelines, and more. |
| [Component Guide](./component-guide.md) | Guidelines for implementing component states, accessibility, and more. |
brandyscarney marked this conversation as resolved.
Show resolved Hide resolved
| [Sass Guidelines](./sass-guidelines.md) | Outlines scenarios where Sass members and comments should be used. |

## Packages

| Project | Package | Documentation | Guides |
thetaPC marked this conversation as resolved.
Show resolved Hide resolved
| ---------------- | -------------------------------------------------------------------------- | ---------------------------------| ----------------------------------------------------------------- |
| **Core** | [`@ionic/core`](https://www.npmjs.com/package/@ionic/core) | [Readme](core/README.md) | [Testing](core/testing/README.md) |
| **Angular** | [`@ionic/angular`](https://www.npmjs.com/package/@ionic/angular) | [Readme](angular/README.md) | [Testing](angular/testing.md) |
| **React** | [`@ionic/react`](https://www.npmjs.com/package/@ionic/react) | [Readme](react/README.md) | [Testing](react/testing.md) |
| **React Router** | [`@ionic/react-router`](https://www.npmjs.com/package/@ionic/react-router) | [Readme](react-router/README.md) | [Testing](react-router/testing.md) |
| **Vue** | [`@ionic/vue`](https://www.npmjs.com/package/@ionic/vue) | [Readme](vue/README.md) | [Testing](vue/testing.md) |
| **Vue Router** | [`@ionic/vue-router`](https://www.npmjs.com/package/@ionic/vue-router) | [Readme](vue-router/README.md) | [Testing](vue-router/testing.md) |
2 changes: 2 additions & 0 deletions docs/_config.yml
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is necessary for generating GitHub pages from the markdown files

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could remove this if we want since we aren't deploying GitHub pages yet but I want to make sure we don't forget about it needing to be here when we do

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: Ionic Framework
include: CONTRIBUTING.md
11 changes: 11 additions & 0 deletions docs/angular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ionic Angular

The [@ionic/angular](https://www.npmjs.com/package/@ionic/angular) package builds on top of [@ionic/core](https://www.npmjs.com/package/@ionic/core) components.

## Contributing

See our [Contributing Guide](/docs/CONTRIBUTING.md).

## Testing

Refer to the [Angular Testing documentation](./testing.md) for testing the Angular package.
118 changes: 118 additions & 0 deletions docs/angular/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Angular Testing

Ionic Framework supports multiple versions of Angular. As a result, we need to verify that Ionic works correctly with each of these Angular versions.

## Syncing Local Changes

The Angular test app supports syncing your locally built changes for validation.

1. Build the `core` and `packages/angular` directories using `npm run build`.
2. [Build the Angular test app](#test-app-build-structure).
3. Navigate to the built test app directory (e.g. `packages/angular/test/build/ng14`).
4. Install dependencies using `npm install`.
5. Sync your local changes using `npm run sync`.

From here you can either build the application or start a local dev server. When re-syncing changes, you will need to [wipe or disable the application cache](#application-cache).

## Application Cache

Angular CLI creates a cache of several files on disk by default in the `.angular` directory. This decreases the time taken to build the test application. However, the cache makes it difficult to quickly sync and check local changes of Ionic. As a result, the `.angular` cache is disabled by default in the test app projects.

See https://angular.io/cli/cache for more information.

### Disable Cache

```shell
ng cache disable
```

> [!NOTE]
> You may need to manually remove the `.angular` directory once after running this command.

### Enable Cache

```shell
ng cache enable
```

> [!NOTE]
> You will need to delete the `.angular` cache and restart the dev server every time you want to sync local changes of Ionic.

## Test App Build Structure

> [!NOTE]
> Please confirm your current directory as `packages/angular/test` before proceeding with any of the following commands.

Unlike other test applications, these test apps are broken up into multiple directories. These directories are then combined to create a single application. This allows us to share common application code, tests, etc so that each app is being tested the same way. Below details the different pieces that help create a single test application.

**apps** - This directory contains partial applications for each version of Angular we want to test. Typically these directories contain new `package.json` files, `angular.json` files, and more. If you have code that is specific to a particular version of Angular, put it in this directory.

**base** - This directory contains the base application that each test app will use. This is where tests, application logic, and more live. If you have code that needs to be run on every test app, put it in this directory.

**build** - When the `apps` and `base` directories are merged, the final result is put in this directory. The `build` directory should never be committed to git.

**build.sh** - This is the script that merges the `apps` and `base` directories and places the built application in the `build` directory.

Usage:

```shell
# Build a test app using apps/ng14 as a reference
./build.sh ng14
```

## How to modify test apps

To add new tests, components, or pages, modify the `base` project. This ensures that tests are run for every tested version.

If you want to add a version-specific change, add the change inside of the appropriate projects in `apps`. Be sure to replicate the directory structure. For example, if you are adding a new E2E test file called `test.spec.ts` in `apps/ng14`, make sure you place the file in `apps/ng14/e2e/src/test.spec.ts`.

### Version-specific tests

If you need to add E2E tests that are only run on a specific version of the JS Framework, replicate the `VersionTest` component on each partial application. This ensures that tests for framework version X do not get run for framework version Y.

### Testing Lazy Loaded Ionic Components

Tests for lazy loaded Ionic UI components should only be added under the `/lazy` route. This ensures the `IonicModule` is added.

### Testing Standalone Ionic Components

Tests for standalone Ionic UI components should only be added under the `/standalone` route. This allows for an isolated environment where the lazy loaded `IonicModule` is not initialized. The standalone components use Stencil's custom element bundle instead of the lazy loaded bundle. If `IonicModule` is initialized then the Stencil components will fall back to using the lazy loaded implementation instead of the custom elements bundle implementation.

## Adding New Test Apps

As we add support for new versions of Angular, we will also need to update this directory to test against new applications. The following steps can serve as a guide for adding new apps:

1. Navigate to the built app for the most recent version of Angular that Ionic tests.
2. Update the application by following the steps on https://update.angular.io/.
3. Make note of any files that changed during the upgrade (`package.json`, `package-lock.json`, `angular.json`, etc).
4. Copy the changed files to a new directory in `apps`.
5. Add a new entry to the matrix for `test-core-angular` in `./github/workflows/build.yml`. This will allow the new test app to run against all PRs.
6. Commit these changes and push.

Example:

In this example, we are going to add the Angular 14 test app.

1. Build the Angular 13 test app using `./build.sh ng13`.
2. Navigate to `build/ng13`.
3. Perform the upgrade steps on https://update.angular.io/. The "From" field should say "13.0" and the "To" field should say "14.0".

Note: You may encounter some other peer dependency issues not covered by the Angular Upgrade Guide. These peer dependency issues can be resolved manually by updating the installed version of each dependency.

4. Observe that the output of the Angular upgrade indicates that the following files were modified:

`angular.json`
`package-lock.json`
`package.json`
`tsconfig.json`
`src/app/form/form.component.ts`
`src/app/modal-example/modal-example.component.ts`

5. Create a directory in `apps` named `ng14`.
6. Copy the modified files to the `apps/ng14` directory.
7. Open `./github/workflows/build.yml` and find the `test-angular-e2e` job.
8. Find the `apps` field under `matrix`.
9. Add "ng14" to the `apps` field.
10. Open `./github/workflows/stencil-nightly.yml` and find the `test-angular-e2e` job.
11. Repeat steps 8 and 9.
12. Commit these changes and push.
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ To work around this, you should set an RTL class on the host of your component a
<Host
class={{
'my-cmp-rtl': document.dir === 'rtl'
})
}}
>
...
</Host>
Expand Down
11 changes: 11 additions & 0 deletions docs/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ionic Core

The [@ionic/core](https://www.npmjs.com/package/@ionic/core) package contains the Web Components that make up the reusable UI building blocks of Ionic Framework. These components are designed to be used in traditional frontend view libraries/frameworks (such as React, Angular, or Vue), or on their own through traditional JavaScript in the browser.

## Contributing

See our [Contributing Guide](/docs/CONTRIBUTING.md).

## Testing

Refer to the [Core Testing documentation](./testing/README.md) for testing the Core package.
13 changes: 13 additions & 0 deletions docs/core/testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Core Testing

## Directory

| Directory | Description |
| --------------------------------------------- | --------------------------------------------------------------------------------------------- |
| [Preview Changes](./preview-changes.md) | Steps on building core and previewing changes |
| [Usage Instructions](./usage-instructions.md) | How to run tests and update screenshots |
| [Best Practices](./best-practices.md) | Contains information on conventions to follow as well as pitfalls to avoid when writing tests |
| [API](./api.md) | Documents the custom functionality that has been built on top of Playwright |


29 changes: 29 additions & 0 deletions docs/core/testing/preview-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Preview Changes

## Build

### 1. Clone ionic

git clone https://github.com/ionic-team/ionic-framework.git
cd ionic-framework

### 2. Run `npm install`

cd core
npm install

Notice that `@ionic/core` lives in `core`.
thetaPC marked this conversation as resolved.
Show resolved Hide resolved

### 3. Run `npm start`

Make sure you are inside the `core` directory.

npm start

With the `start` command, Ionic components will be built with [Stencil](https://stenciljs.com/), changes to source files are watched, a local http server will startup, and [http://localhost:3333/](http://localhost:3333/) will open in a browser.

### 4. Preview

Navigate to [http://localhost:3333/src/components/](http://localhost:3333/src/components/). Each component has small e2e apps found in the `test` directory, for example: [http://localhost:3333/src/components/button/test/basic](http://localhost:3333/src/components/button/test/basic)
brandyscarney marked this conversation as resolved.
Show resolved Hide resolved

As changes are made in an editor to source files, the e2e app will live-reload.
11 changes: 11 additions & 0 deletions docs/react-router/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ionic React Router

The [@ionic/react-router](https://www.npmjs.com/package/@ionic/react-router) package is the routing integration for [@ionic/react](https://www.npmjs.com/package/@ionic/react). It uses the [React Router](https://github.com/remix-run/react-router) library beneath the surface.

## Contributing

See our [Contributing Guide](/docs/CONTRIBUTING.md).

## Testing

Refer to the [React Router Testing documentation](./testing.md) for testing the React Router package.