Skip to content

Commit b315b0c

Browse files
chore(docs): consolidate the developer resource files into a docs/ directory (ionic-team#29266)
Start your review here 👉 [docs/README.md](https://github.com/ionic-team/ionic-framework/blob/FW-6107/docs/README.md) ## What is the current behavior? Documentation files with information on how to contribute, component implementations, testing, etc. are scattered throughout various folders in this repository. ## What is the new behavior? Consolidates the documentation files into a root `docs/` directory for easier discovery and organization. `/docs` tree: ``` ├── _config.yml ├── component-guide.md ├── CONTRIBUTING.md ├── README.md ├── sass-guidelines.md ├── angular │   ├── README.md │   └── testing.md ├── core │   ├── README.md │   └── testing │   ├── README.md │   ├── api.md │   ├── best-practices.md │   ├── preview-changes.md │   └── usage-instructions.md ├── react │   ├── README.md │   └── testing.md ├── react-router │   ├── README.md │   └── testing.md ├── vue │   ├── README.md │   └── testing.md └── vue-router ├── README.md └── testing.md ``` **Migrates the following:** | Previous Location | New Location | | ----------------------------------------------------------- | ----------------------------------------- | | `.github/COMPONENT-GUIDE.md` | `docs/component-guide.md` | | `.github/CONTRIBUTING.md` | `docs/CONTRIBUTING.md` | | `core/scripts/README.md` | `docs/core/testing/preview-changes.md` | | `core/src/utils/test/playwright/docs/api.md` | `docs/core/testing/api.md` | | `core/src/utils/test/playwright/docs/best-practices.md` | `docs/core/testing/best-practices.md` | | `core/src/utils/test/playwright/docs/README.md` | `docs/core/testing/README.md` | | `core/src/utils/test/playwright/docs/usage-instructions.md` | `docs/core/testing/usage-instructions.md` | | `packages/angular/test/README.md` | `docs/angular/testing.md` | | `packages/react-router/test/README.md` | `docs/react-router/testing.md` | | `packages/react/test/README.md` | `docs/react/testing.md` | | `packages/react/test/base/README.md` | `docs/react/testing.md` | | `packages/vue/test/README.md` | `docs/vue/testing.md` | **Adds the following:** | File | Description | | ----------------------------- | ----------------------------------------------------------------------- | | `docs/sass-guidelines.md` | Sass Variable guidelines taken from `ionic-framework-design-documents` | | `docs/README.md` | Entry file that should link to all other files | | `docs/_config.yml` | Config file for use with GitHub pages | | `docs/core/README.md` | Description of core, links to contributing and testing | | `docs/angular/README.md` | Description of angular, links to contributing and testing | | `docs/react/README.md` | Description of react, links to contributing and testing | | `docs/react-router/README.md` | Description of react-router, links to contributing and testing | | `docs/vue/README.md` | Description of vue, links to contributing and testing | | `docs/vue-router/README.md` | Description of vue-router, links to contributing and testing | | `docs/vue-router/testing.md` | Testing file for vue-router, populated from vue-router's main README | **Does not** add any files for `angular-server`. This is because the README is essentially empty and there is no testing in that directory. I can add blank files if we want to have something to add to later. **Does not** migrate the content of the packages' root `README.md` files. These files are used for their npm package descriptions so we should not edit them. ## Hosting Documentation We can (and should) host these files using GitHub Pages. I have duplicated them in a personal repository to see how this would look: [docs-consolidation](https://brandyscarney.github.io/docs-consolidation/). Doing so will require some formatting fixes (see [Sass Guidelines](https://brandyscarney.github.io/docs-consolidation/sass-guidelines.html#-reusable-values)) so I did not publish them now but we can easily enable GitHub pages by toggling a setting in this repository. ## Other information - Verify that no documentation files were missed in the migration - You can use these commands to search for `*.md` files in a directory: - `find core/src -type f -name "*.md" -print` - `find packages/angular -type f -name "*.md" -not -path "**/node_modules/*" -print` - I did add some redirect links in some of the existing markdown files so they might still exist for that reason - We should probably break up the contributing + component guide documentation into smaller files, such as including best practices, but I wanted to get everything in the same place first - The contributing has sections on each of the packages that we could move to that package's docs folder: https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#core --------- Co-authored-by: Maria Hutt <[email protected]>
1 parent 7b6c330 commit b315b0c

32 files changed

+1140
-382
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Issue number: resolves #
2525
If this introduces a breaking change:
2626
1. Describe the impact and migration path for existing applications below.
2727
2. Update the BREAKING.md file with the breaking change.
28-
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.
28+
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.
2929
-->
3030

3131

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<a href="https://github.com/ionic-team/ionic-framework/blob/main/LICENSE">
2121
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Ionic Framework is released under the MIT license." />
2222
</a>
23-
<a href="https://github.com/ionic-team/ionic/blob/main/.github/CONTRIBUTING.md">
23+
<a href="https://github.com/ionic-team/ionic/blob/main/docs/CONTRIBUTING.md">
2424
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
2525
</a>
2626
<a href="https://twitter.com/Ionicframework">
@@ -38,7 +38,7 @@
3838
Documentation
3939
</a>
4040
<span> · </span>
41-
<a href="https://github.com/ionic-team/ionic/blob/main/.github/CONTRIBUTING.md">Contribute</a>
41+
<a href="https://github.com/ionic-team/ionic/blob/main/docs/CONTRIBUTING.md">Contribute</a>
4242
<span> · </span>
4343
<a href="https://blog.ionicframework.com/">Blog</a>
4444
<br />
@@ -88,7 +88,7 @@ The Ionic Conference App is a full featured Ionic app. It is the perfect startin
8888
### Contributing
8989

9090
Thanks for your interest in contributing! Read up on our guidelines for
91-
[contributing](https://github.com/ionic-team/ionic/blob/main/.github/CONTRIBUTING.md)
91+
[contributing](https://github.com/ionic-team/ionic/blob/main/docs/CONTRIBUTING.md)
9292
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)
9393
label.
9494

core/scripts/readme.md

+2-42
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,4 @@
11

2-
## Build
2+
# Core Scripts
33

4-
### 1. Clone ionic
5-
6-
[email protected]:ionic-team/ionic.git
7-
cd ionic
8-
9-
### 2. Run `npm install`
10-
11-
cd core
12-
npm install
13-
14-
15-
Notice that `@ionic/core` lives in `core`.
16-
17-
### 3. Run `npm start`
18-
19-
Make sure you are inside the `core` directory.
20-
21-
npm start
22-
23-
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.
24-
25-
### 4. Preview
26-
27-
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
28-
29-
As changes are made in an editor to source files, the e2e app will live-reload.
30-
31-
## How to contribute
32-
33-
1. `npm start` allows you to modify the components and have live reloading, just like another ionic app.
34-
35-
2. When everything looks good, run `npm run validate` to verify the tests linter and production build passes.
36-
37-
38-
# Deploy
39-
40-
1. `npm run prepare.deploy`
41-
2. Review/update changelog
42-
3. Commit updates using the package name and version number as the commit message.
43-
4. `npm run deploy`
44-
5. :tada:
4+
This file has been moved to [/docs/core/testing/preview-changes.md](/docs/core/testing/preview-changes.md).
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
# Ionic E2E Tests Guide
22

3-
This directory contains information on how to get the most out of Ionic's E2E test infrastructure when writing tests.
4-
5-
## Directory
6-
7-
| Directory | Description |
8-
| - | - |
9-
| [Usage Instructions](./usage-instructions.md) | How to run tests and update screenshots |
10-
| [Best Practices](./best-practices.md) | Contains information on conventions to follow as well as pitfalls to avoid when writing tests |
11-
| [API](./api.md) | Documents the custom functionality that has been built on top of Playwright |
3+
Refer to the [Core Testing documentation](/docs/core/testing/README.md) in order to build and run the e2e tests.

.github/CONTRIBUTING.md renamed to docs/CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing
22

3-
Thanks for your interest in contributing to the Ionic Framework! :tada:
3+
Thanks for your interest in contributing to the Ionic Framework! 🎉
44

55
- [Contributing Etiquette](#contributing-etiquette)
66
- [Creating an Issue](#creating-an-issue)

docs/README.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<p align="center">
2+
<img alt="Ionic Logo" src="https://github.com/ionic-team/ionic-framework/blob/main/.github/assets/logo.png?raw=true" width="60" />
3+
</p>
4+
5+
<h1 align="center">
6+
Ionic Framework Developer Resources
7+
</h1>
8+
9+
<p align="center">
10+
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.
11+
</p>
12+
13+
## What is Ionic Framework?
14+
15+
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.
16+
17+
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>.
18+
19+
## Guides
20+
21+
| Guide | Description |
22+
| ----------------------------------------| ---------------------------------------------------------------------------------------- |
23+
| [Contributing](./CONTRIBUTING.md) | How to contribute including creating pull requests, commit message guidelines, and more. |
24+
| [Component Guide](./component-guide.md) | Guidelines for implementing component states, accessibility, and more. |
25+
| [Sass Guidelines](./sass-guidelines.md) | Outlines scenarios where Sass members and comments should be used. |
26+
27+
## Packages
28+
29+
| Project | Package | Documentation | Guides |
30+
| ---------------- | -------------------------------------------------------------------------- | ---------------------------------| ----------------------------------------------------------------- |
31+
| **Core** | [`@ionic/core`](https://www.npmjs.com/package/@ionic/core) | [Readme](core/README.md) | [Testing](core/testing/README.md) |
32+
| **Angular** | [`@ionic/angular`](https://www.npmjs.com/package/@ionic/angular) | [Readme](angular/README.md) | [Testing](angular/testing.md) |
33+
| **React** | [`@ionic/react`](https://www.npmjs.com/package/@ionic/react) | [Readme](react/README.md) | [Testing](react/testing.md) |
34+
| **React Router** | [`@ionic/react-router`](https://www.npmjs.com/package/@ionic/react-router) | [Readme](react-router/README.md) | [Testing](react-router/testing.md) |
35+
| **Vue** | [`@ionic/vue`](https://www.npmjs.com/package/@ionic/vue) | [Readme](vue/README.md) | [Testing](vue/testing.md) |
36+
| **Vue Router** | [`@ionic/vue-router`](https://www.npmjs.com/package/@ionic/vue-router) | [Readme](vue-router/README.md) | [Testing](vue-router/testing.md) |

docs/_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
name: Ionic Framework
2+
include: [ CONTRIBUTING.md ]

docs/angular/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Ionic Angular
2+
3+
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.
4+
5+
## Contributing
6+
7+
See our [Contributing Guide](/docs/CONTRIBUTING.md).
8+
9+
## Testing
10+
11+
Refer to the [Angular Testing documentation](./testing.md) for testing the Angular package.

docs/angular/testing.md

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Angular Testing
2+
3+
Ionic Framework supports multiple versions of Angular. As a result, we need to verify that Ionic works correctly with each of these Angular versions.
4+
5+
## Syncing Local Changes
6+
7+
The Angular test app supports syncing your locally built changes for validation.
8+
9+
1. Build the `core` and `packages/angular` directories using `npm run build`.
10+
2. [Build the Angular test app](#test-app-build-structure).
11+
3. Navigate to the built test app directory (e.g. `packages/angular/test/build/ng14`).
12+
4. Install dependencies using `npm install`.
13+
5. Sync your local changes using `npm run sync`.
14+
15+
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).
16+
17+
## Application Cache
18+
19+
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.
20+
21+
See https://angular.io/cli/cache for more information.
22+
23+
### Disable Cache
24+
25+
```shell
26+
ng cache disable
27+
```
28+
29+
> [!NOTE]
30+
> You may need to manually remove the `.angular` directory once after running this command.
31+
32+
### Enable Cache
33+
34+
```shell
35+
ng cache enable
36+
```
37+
38+
> [!NOTE]
39+
> You will need to delete the `.angular` cache and restart the dev server every time you want to sync local changes of Ionic.
40+
41+
## Test App Build Structure
42+
43+
> [!NOTE]
44+
> Please confirm your current directory as `packages/angular/test` before proceeding with any of the following commands.
45+
46+
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.
47+
48+
**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.
49+
50+
**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.
51+
52+
**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.
53+
54+
**build.sh** - This is the script that merges the `apps` and `base` directories and places the built application in the `build` directory.
55+
56+
Usage:
57+
58+
```shell
59+
# Build a test app using apps/ng14 as a reference
60+
./build.sh ng14
61+
```
62+
63+
## How to modify test apps
64+
65+
To add new tests, components, or pages, modify the `base` project. This ensures that tests are run for every tested version.
66+
67+
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`.
68+
69+
### Version-specific tests
70+
71+
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.
72+
73+
### Testing Lazy Loaded Ionic Components
74+
75+
Tests for lazy loaded Ionic UI components should only be added under the `/lazy` route. This ensures the `IonicModule` is added.
76+
77+
### Testing Standalone Ionic Components
78+
79+
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.
80+
81+
## Adding New Test Apps
82+
83+
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:
84+
85+
1. Navigate to the built app for the most recent version of Angular that Ionic tests.
86+
2. Update the application by following the steps on https://update.angular.io/.
87+
3. Make note of any files that changed during the upgrade (`package.json`, `package-lock.json`, `angular.json`, etc).
88+
4. Copy the changed files to a new directory in `apps`.
89+
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.
90+
6. Commit these changes and push.
91+
92+
Example:
93+
94+
In this example, we are going to add the Angular 14 test app.
95+
96+
1. Build the Angular 13 test app using `./build.sh ng13`.
97+
2. Navigate to `build/ng13`.
98+
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".
99+
100+
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.
101+
102+
4. Observe that the output of the Angular upgrade indicates that the following files were modified:
103+
104+
`angular.json`
105+
`package-lock.json`
106+
`package.json`
107+
`tsconfig.json`
108+
`src/app/form/form.component.ts`
109+
`src/app/modal-example/modal-example.component.ts`
110+
111+
5. Create a directory in `apps` named `ng14`.
112+
6. Copy the modified files to the `apps/ng14` directory.
113+
7. Open `./github/workflows/build.yml` and find the `test-angular-e2e` job.
114+
8. Find the `apps` field under `matrix`.
115+
9. Add "ng14" to the `apps` field.
116+
10. Open `./github/workflows/stencil-nightly.yml` and find the `test-angular-e2e` job.
117+
11. Repeat steps 8 and 9.
118+
12. Commit these changes and push.

.github/COMPONENT-GUIDE.md renamed to docs/component-guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ To work around this, you should set an RTL class on the host of your component a
760760
<Host
761761
class={{
762762
'my-cmp-rtl': document.dir === 'rtl'
763-
})
763+
}}
764764
>
765765
...
766766
</Host>

docs/core/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Ionic Core
2+
3+
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.
4+
5+
## Contributing
6+
7+
See our [Contributing Guide](/docs/CONTRIBUTING.md).
8+
9+
## Testing
10+
11+
Refer to the [Core Testing documentation](./testing/README.md) for testing the Core package.

docs/core/testing/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# Core Testing
3+
4+
## Directory
5+
6+
| Directory | Description |
7+
| --------------------------------------------- | --------------------------------------------------------------------------------------------- |
8+
| [Preview Changes](./preview-changes.md) | Steps on building core and previewing changes |
9+
| [Usage Instructions](./usage-instructions.md) | How to run tests and update screenshots |
10+
| [Best Practices](./best-practices.md) | Contains information on conventions to follow as well as pitfalls to avoid when writing tests |
11+
| [API](./api.md) | Documents the custom functionality that has been built on top of Playwright |
12+
13+
File renamed without changes.

docs/core/testing/preview-changes.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Preview Changes
2+
3+
## Build
4+
5+
### 1. Clone ionic
6+
7+
git clone https://github.com/ionic-team/ionic-framework.git
8+
cd ionic-framework
9+
10+
### 2. Run `npm install`
11+
12+
cd core
13+
npm install
14+
15+
Notice that `@ionic/core` lives in `core`.
16+
17+
### 3. Run `npm start`
18+
19+
Make sure you are inside the `core` directory.
20+
21+
npm start
22+
23+
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.
24+
25+
### 4. Preview
26+
27+
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)
28+
29+
As changes are made in an editor to source files, the e2e app will live-reload.

docs/react-router/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Ionic React Router
2+
3+
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.
4+
5+
## Contributing
6+
7+
See our [Contributing Guide](/docs/CONTRIBUTING.md).
8+
9+
## Testing
10+
11+
Refer to the [React Router Testing documentation](./testing.md) for testing the React Router package.

0 commit comments

Comments
 (0)