Skip to content

Commit 484dcce

Browse files
committed
Merge branch 'main' of github.com:ionic-team/ionic-docs
# Conflicts: # docs/angular/lifecycle.md # docs/angular/navigation.md # docs/api/datetime.md # docs/api/input.md # docs/api/item-sliding.md # docs/api/menu.md # docs/api/modal.md # docs/api/range.md # docs/api/select.md # docs/api/spinner.md # docs/api/tab.md # docs/core-concepts/fundamentals.md # docs/deployment/app-store.md # docs/deployment/progressive-web-app.md # docs/developing/android.md # docs/layout/structure.md # docs/react/lifecycle.md # docs/reference/glossary.md # docs/reference/versioning.md # docs/theming/css-shadow-parts.md # docs/updating/6-0.md # docs/updating/7-0.md # docs/vue/lifecycle.md # docs/vue/quickstart.md # package-lock.json # package.json # versioned_docs/version-v6/intro/upgrading-to-ionic-6.md
2 parents 327ce7d + d57ab7e commit 484dcce

File tree

2,351 files changed

+50329
-47388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,351 files changed

+50329
-47388
lines changed

.github/workflows/CI.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# GitHub Actions docs
2+
# https://help.github.com/en/articles/about-github-actions
3+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
4+
5+
name: Install Dependencies, Lint
6+
7+
on: [pull_request]
8+
9+
jobs:
10+
test:
11+
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
node_version: [16]
16+
os: [windows-latest, macOS-latest]
17+
18+
steps:
19+
- uses: actions/checkout@v1
20+
- name: Use Node.js ${{ matrix.node_version }}
21+
uses: actions/setup-node@v1
22+
with:
23+
node-version: ${{ matrix.node_version }}
24+
- name: Install Dependencies
25+
run: npm ci --legacy-peer-deps
26+
- name: Lint
27+
run: npm run lint
28+
# Lint changes should be pushed
29+
# to the branch before the branch
30+
# is merge eligible.
31+
- name: Check Diff
32+
run: git diff --exit-code
33+
shell: bash

.prettierignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
src/theme/DocItem
22
src/theme/DocPage
33
legacy-stencil-components
4-
node_modules
54
scripts/bak
6-
src/styles.bak
7-
src/pages
5+
86
docs/api
97
docs/native
108
docs/cli/commands
119

10+
static/code/stackblitz
11+
1212
.docusaurus
13-
.github
13+
.github
14+
build
15+
node_modules

.prettierrc.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Ionic's documentation is built using [Docusaurus](https://docusaurus.io/). The c
5454
- `components/` - styles split out into the components they target
5555
- `static/`
5656
- `demos/` - self-contained demos, optionally presented by pages via `demoUrl` YAML frontmatter
57+
- `usage/` - playgrounds that can be created by running `npm run playground:new` [(docs)](_templates/README.md#new-playground-template)
5758
- `versioned_docs/` - versions of the docs created by the docusaurus versioning command
5859
- `versioned_sidebars/` - versions of the docs sidebars created by the docusaurus versioning command
5960

_templates/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Hygen templates
2+
3+
The templates in this directory are intended to be used with [hygen](https://www.hygen.io/) to generate boilerplate files. Check out [the root package.json](../package.json) to see if there are any custom commands to use them (e.g. `npm run playground:new`). You can also run e.g. `hygen playground new` to use a generator.
4+
5+
Some helpful docs links for updating/creating templates:
6+
7+
- [enquirer](https://github.com/enquirer/enquirer#toggle-prompt) for building command line prompts
8+
- [inflection](https://www.hygen.io/docs/templates#helpers-and-inflections) and [change case](https://www.hygen.io/docs/templates#change-case-helpers) for e.g. changing the case of variables submitted via the prompts
9+
10+
# New playground template
11+
12+
## Generation
13+
14+
To create a new playground, run `npm run playground:new`. This will walk you through some prompts to decide what files for the generator to create for the playground, and what their paths should be.
15+
16+
The path defaults to `basic`. If there is already a basic playground, you'll want to input a different path for the playground.
17+
18+
The CSS option will add extra files if you need to include custom CSS in your playground.
19+
20+
If you need a component for multiple versions of Ionic Framework, you (currently) need to run the generator once for each version.
21+
22+
## Usage
23+
24+
Once you've generated your playground, you need to add it to the main markdown file in the docs (e.g. [docs/api/button.md](../docs/api/button.md)) by doing something similar to the following example:
25+
26+
```
27+
## Feature
28+
29+
import Feature from '@site/static/usage/v7/button/feature/index.md';
30+
31+
<Feature />
32+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# this file's location depends on whether or not the css option or angular_ts option is selected via the prompt
3+
to: "<%= `static/usage/v${version}/${name.replace('ion-', '')}/${path}/${(css || angular_ts) ? 'angular/example_component_html.md' : 'angular.md'}` %>"
4+
---
5+
```html
6+
<<%= name %>></<%= name %>>
7+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
# this file only gets generated if `css` (from the command line prompt) is true
3+
to: "<%= css ? `static/usage/v${version}/${name.replace('ion-', '')}/${path}/angular/example_component_css.md` : null %>"
4+
---
5+
```css
6+
<%= name %> {
7+
/* styles go here */
8+
}
9+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
# this file only gets generated if `angular_ts` (from the command line prompt) is true
3+
to: "<%= angular_ts ? `static/usage/v${version}/${name.replace('ion-', '')}/${path}/angular/example_component_ts.md` : null %>"
4+
---
5+
```ts
6+
import { Component } from '@angular/core';
7+
8+
@Component({
9+
selector: 'app-example',
10+
templateUrl: 'example.component.html',
11+
<% if (css){ -%>
12+
styleUrls: ['./example.component.css'],
13+
<% } -%>
14+
})
15+
export class ExampleComponent {
16+
}
17+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
arbitrary: <% nameWithoutIon = name.replace('ion-', ''); numberOfAncestors = (path.match(/\//g) || []).length; directoryChanges = '../'.repeat(numberOfAncestors) %>
3+
to: "<%= `static/usage/v${version}/${nameWithoutIon}/${path}/demo.html` %>"
4+
---
5+
<!DOCTYPE html>
6+
<html lang="en">
7+
<head>
8+
<meta charset="UTF-8" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10+
<title><%= h.changeCase.titleCase(nameWithoutIon) %></title>
11+
<link rel="stylesheet" href="<%= directoryChanges %>../../../common.css" />
12+
<script src="<%= directoryChanges %>../../../common.js"></script>
13+
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@<%= version %>/dist/ionic/ionic.esm.js"></script>
14+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@<%= version %>/css/ionic.bundle.css" /><% if (css){ %>
15+
16+
<style>
17+
<%= name %> {
18+
/* styles go here */
19+
}
20+
</style><% } %>
21+
</head>
22+
23+
<body>
24+
<ion-app>
25+
<ion-content>
26+
<div class="container">
27+
<<%= name %>></<%= name %>>
28+
</div>
29+
</ion-content>
30+
</ion-app>
31+
</body>
32+
</html>

_templates/playground/new/index.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
const changeCase = require('change-case');
2+
3+
// see types of prompts:
4+
// https://github.com/enquirer/enquirer/tree/master/examples
5+
//
6+
module.exports = {
7+
prompt: ({ inquirer }) => {
8+
const questions = [
9+
{
10+
type: 'input',
11+
name: 'name',
12+
message: 'Which component is this playground for?',
13+
initial: 'ion-button',
14+
validate(value) {
15+
return value.match(/^ion-[a-z/-]*[a-z]+$/) ? true : "Component name must be kebab-case and begin with 'ion-'";
16+
},
17+
},
18+
{
19+
type: 'input',
20+
name: 'path',
21+
message: 'What should the playground path be?',
22+
hint: 'e.g. `basic` or `theming/colors`',
23+
validate(value) {
24+
return value.match(/^[a-z]+[a-z/-]*[a-z]+$/)
25+
? true
26+
: "Path should begin and end with a letter and only contain lowercase letters, '-', or '/'";
27+
},
28+
},
29+
{
30+
type: 'select',
31+
name: 'version',
32+
message: 'Select the Ionic Framework version for the playground',
33+
initial: '7',
34+
choices: ['6', '7'],
35+
},
36+
{
37+
type: 'toggle',
38+
name: 'css',
39+
message: 'Generate custom CSS files?',
40+
enabled: 'Yes',
41+
disabled: 'No',
42+
},
43+
{
44+
type: 'toggle',
45+
name: 'angular_ts',
46+
message: 'Generate an Angular TypeScript file?',
47+
enabled: 'Yes',
48+
disabled: 'No',
49+
},
50+
];
51+
52+
return inquirer.prompt(questions).then((answers) => {
53+
const componentName = changeCase.pascal(answers.path.split('/').pop());
54+
console.log(
55+
`\nTo use this component in a docs markdown file, include\nthe following:\n\n## ${componentName}\n\nimport ${componentName} from '@site/static/usage/v7/${answers.name.replace(
56+
'ion-',
57+
''
58+
)}/${answers.path}/index.md';\n\n<${componentName} />\n`
59+
);
60+
61+
return answers;
62+
});
63+
},
64+
};

0 commit comments

Comments
 (0)