Skip to content

Commit

Permalink
move the files
Browse files Browse the repository at this point in the history
  • Loading branch information
mltejera committed Apr 25, 2024
1 parent 0d6760a commit 54eb707
Show file tree
Hide file tree
Showing 100 changed files with 8,990 additions and 1 deletion.
1 change: 0 additions & 1 deletion docs/archived-fluent-wiki
Submodule archived-fluent-wiki deleted from 8229cc
121 changes: 121 additions & 0 deletions docs/react-wiki-archive/@uifabric-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
The `migration` package provides code modifications and notes in order to ease upgrades between fabric versions. **This package is only applicable when upgrading from `office-ui-fabric-react` 6 to 7.**

Can be run with `npx` inside your project without being an explicit dependency.

# Usage

```
Usage:
migration [-w] VERSION
Options:
-h --help Display this message
-w --write Write changes directly to files
```

## Examples

**Run in notify-only mode:**

```
$ npx @uifabric/[email protected] 7
```

_outputs:_

```
Apply migration steps:
- warn ColorPicker-related onChanged props removed
- warn ComboBox.onChanged removed
src/tsx/combocontrol.tsx:13:11 - onChanged is removed; please use onChange instead (NOTE: the arguments have changed from onChanged to onChange; please update accordingly)
- remove use of deprecated ComboBox props
- createRef should come from React.createRef, not from office-ui-fabric-react
src/tsx/combocontrol.tsx
- rename componentWillReceiveProps with UNSAFE_componentWillReceiveProps
src/tsx/file1.tsx
- warn SearchBox.onChange args changed
- warn autobind decorator removed
- Deprecated DetailsRowCheck.isSelected has been removed. Use DetailsRowCheck.selected instead.
- warn Slider.ValuePosition removed
src/ts/file0.ts:4:9 - ValuePosition no longer available
src/ts/file0.ts:5:9 - ValuePosition no longer available
```

**Run in write mode:**

**Important: Before running with `-w`, ensure all files are backed up or checked in to version control.**

```
$ npx @uifabric/[email protected] -w 7
```

# Supported versions

The migration package currently supports migrations to the following versions:

## 7.0.0

### ColorPicker - onChanged props removed _(Notify only)_

`TODO`

### ComboBox - onChanged removed _(Notify only)_

`TODO`

### ComboBox - remove use of deprecated props

`TODO`

### DetailsRowCheck - isSelected has been removed. Use DetailsRowCheck.selected instead.

`TODO`

### React - createRef should come from React.createRef, not from office-ui-fabric-react

React's implementation of `createRef` has improved to the degree where the office-ui-fabric-react version does not provide additional value. As a result, Fabric 7 no longer provides `createRef`. This migration will import `createRef` from `react` while removing it from `office-ui-fabric-react`'s import statements.

### React - rename componentWillReceiveProps with UNSAFE_componentWillReceiveProps

React is removing support for `componentWillReceiveProps` and will only be supporting the method as `UNSAFE_componentWillReceiveProps` in future versions (before removing support entirely). See https://reactjs.org/docs/react-component.html#the-component-lifecycle for more information. This migration renames all instances of this function in a codebase.

### SearchBox - onChange args changed _(Notify only)_

`TODO`

### Slider - ValuePosition removed _(Notify only)_

`TODO`

### Util - autobind decorator removed _(Notify only)_

Fabric 6 and earlier versions shipped a decorator called `autobind`. Autobind takes a function definition and binds it to `this` on class instantiation, such that all calls to the method would have a predicable `this` value regardless of their invocation.

In practice, a const lambda function provides the same guarantees of binding `this` without the need for annotation support, which is not on by default.

In practice, these are the practical changes needed:

```ts
class Foo {
private _val = 0;

// using autobind - no longer supported directly by fabric
@autobind
bar(): void {
console.log(this._val); // this is always bound correctly
}

// recommended
bar = (): void => {
console.log(this._val); // this is always bound correctly
};
}
```

If stopping use of `@autobind` represents a large migration burden, consider implementing it in your own codebase or finding an implementation in a pre-existing package, as several exist.
136 changes: 136 additions & 0 deletions docs/react-wiki-archive/API-Documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Documenting Fluent UI

This content only applies to [documentation site](https://developer.microsoft.com/en-us/fluentui) for `@fluentui/react` version 7/8 (formerly `office-ui-fabric-react`) and Fluent UI Android/iOS/etc. (`@fluentui/react-northstar` and `@fluentui/web-components` currently have separate documentation sites.)

- [Documenting components](#documenting-components)
- [Writing Markdown documentation for the website](#writing-markdown-documentation-for-the-website)

## API documentation

`@fluentui/react` 7/8 uses [API Extractor](API-Extractor) and the custom [`@fluentui/api-docs` package](https://github.com/microsoft/fluentui/tree/master/packages/api-docs) (formerly `@uifabric/api-docs`) to generate documentation which shows up in the [Controls section](https://developer.microsoft.com/en-us/fluentui#/controls/web) of our website as well as in the legacy demo app at [aka.ms/fluentdemo](http://aka.ms/fluentdemo).

Note that all the API documentation features described below will only work on doc comments `/** like this */` (multiline is fine).

### Top-level doc comments

For types or components which should be included on the website, be sure to include a `{@docCategory PageName}` tag in the top-level doc comment for each type which should be documented.

If the type is related to a specific component, `PageName` should be the name of the component. Otherwise, you can use either the name of the type or a general category that it falls under, such as `MergeStyles`. If the `PageName` doesn't match any of the known component page names, it will be put under the References section in the website sidebar.

For example, if you wanted `ISliderProps` to show up on the 'Slider' page, it would look like the following ([see it live here](https://developer.microsoft.com/en-us/fabric#/controls/web/slider#ISliderProps)):

```tsx
/**
* {@docCategory Slider}
*/
export interface ISliderProps {
```
This should work automatically for `@fluentui/react` and the packages it consumes. If the API is in a newer package, you should check [this file](https://github.com/microsoft/fluentui/blob/master/packages/api-docs/config/api-docs.js) to verify that the package is included (and add it if not).
Note that top-level doc comments will be rendered as markdown on the website. If it's an especially long/detailed comment which includes headings, **headings must start at level 4** to appropriately nest within the website.
### Limitations
Documenting the following API types on the website is **supported**:
- Interfaces
- Type aliases
- Classes
- Enums
These API types are **not supported** currently:
- Functions (including function components)
- Constants
### Prop comments
Individual props in interfaces and types have limited support for markdown rendering, due to performance concerns. Currently just inline code blocks (backticks) are supported.
API Extractor has a particular format required for certain types of doc comments and will fail at build time if this format is not followed. There are also a few suggested best practices.
<table>
<tr>
<th></th>
<th>Good</th>
<th>Bad</th>
</tr>
<tr>
<td><code>@param</code> tags must include a dash and not contain type information</td>
<!-- KEEP EXAMPLES SHORT - otherwise it makes the page scroll horizontally -->
<!-- good -->
<td><pre lang="ts">
/**
* @param myParam - Description here
*/
</pre></td>
<!-- bad -->
<td><pre lang="ts">
/**
* @param myParam Description here
* @param {number} myParam Description here
*/
</pre></tr>
<tr>
<td>Special characters which have meaning in TSDoc (e.g. <code>@ > { }</code> etc.) must be escaped with backslashes or backticks</td>
<!-- KEEP EXAMPLES SHORT - otherwise it makes the page scroll horizontally -->
<!-- good -->
<td><pre lang="ts">
/**
* Comment about `>` and `{`.
* As of version \>= 1.0.0.
*/
</pre></td>
<!-- bad -->
<td><pre lang="ts">
/**
* Comment about '>' and '{'.
* As of version >= 1.0.0.
*/
</pre></td>
</tr>
<tr>
<td><code>@deprecated</code> tags must include a deprecation message</td>
<!-- KEEP EXAMPLES SHORT - otherwise it makes the page scroll horizontally -->
<!-- good -->
<td><pre lang="ts">
/**
* @deprecated Use `foo` instead.
*/
</pre></td>
<!-- bad -->
<td><pre lang="ts">
/**
* Deprecated. Use `foo` instead.
* @deprecated
*/
</pre></td>
</tr>
<tr>
<td>Default values should be indicated by <code>@defaultvalue</code> tags (<code>@default</code> and <code>@defaultValue</code> also work)</td>
<!-- KEEP EXAMPLES SHORT - otherwise it makes the page scroll horizontally -->
<!-- good -->
<td><pre lang="ts">
/**
* @defaultvalue 'hello world'
*/
</pre></td>
<!-- bad -->
<td><pre lang="ts">
/**
* Default is 'hello world'
*/
</pre></td>
</tr>
</table>
### More details about the `@fluentui/api-docs` package
The `@fluentui/api-docs` (previously `@uifabric/api-docs`) package takes the api.json files generated by [API Extractor](API-Extractor) and splits them up into individual page.json files to populate both component pages and (new) references pages. These page.json files live in `@fluentui/api-docs`.
Generally, this tool is used on `@fluentui/react` and its dependencies (`@fluentui/react-northstar` uses a different approach). You can see or update the full list of included packages in [this file](https://github.com/microsoft/fluentui/blob/master/packages/api-docs/config/api-docs.js).
## Writing Markdown documentation for the website
See the [Markdown documentation](Markdown-documentation) page for tips on authoring markdown files such as component overviews/best practices and other website content.
17 changes: 17 additions & 0 deletions docs/react-wiki-archive/API-Extractor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### What is API Extractor?

[API Extractor](https://api-extractor.com/) generates an api.md file containing the public API for a package. `@fluentui/react` and related packages as well as `@fluentui/web-components` use API Extractor to ensure that API changes must be reviewed before being merged into master. (`@fluentui/react-northstar` and related packages do not use API Extractor as of writing.)

### Build Tasks

As part of a package's build process, the api-extractor task checks the package's public API with the package's auto-generated .api.md file.

If building locally, the API file will be updated automatically (in `7.0` and `master`). Be sure to commit the updates with your other changes!

In PR builds, the task will fail if it detects missing API file updates.

(Previously it was necessary to run a separate command `yarn update-api` to update the API files, but we decided to streamline this and do the update automatically as part of the build instead.)

### API Extractor code requirements

See the [API Documentation page](API-Documentation#prop-comment-requirements).
58 changes: 58 additions & 0 deletions docs/react-wiki-archive/Advanced-auto-merge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
You can give the bot commands to customize how the bot assists you with merging your pull request when all merge policies pass.

To customize the auto-merge parameters, @ mention the bot **(e.g. `@msft-fluent-ui-bot`, `@msft-github-bot` or `@msftbot` depending on the bot identity providing auto-merge capabilities)** and provide your instruction in English. Note that for all scenarios below, pre-configured merge policies at the GitHub level must still be satisfied (i.e. the bot will never bypass merge policies for you). Note that you must be a contributor - the bot will ignore all commands given by non-contributors.

---

At this time, the bot supports the following scenarios:

### Requiring a specific, minimum number of approvals

Examples of what to say (illustrative, not prescriptive nor exhaustive):

- > Only merge this pull request if it has 2 approvals.
- > require 3 sign offs.
- > Please make sure there are at least two approving reviews.
### Requiring an approval from a specific person

Examples of what to say (illustrative, not prescriptive nor exhaustive):

- > make sure @cliffkoh has a chance to review before you merge
- > do not merge unless @cliffkoh approves.
### Requiring approvals from multiple people

Examples of what to say (illustrative, not prescriptive nor exhaustive):

- > require sign-offs from @kkjeer and @JasonGore
- > hold this pr until all of the following approve: @kkjeer, @JasonGore, @dzearing
### Requiring approvals from one of several people

Examples of what to say (illustrative, not prescriptive nor exhaustive):

- > make sure @kkjeer, @dzearing or @JasonGore gets to approve
- > require approvals from any one of the following: @kkjeer, @JasonGore, @dzearing
### Changing the time the pull-request is held open before the bot merges the pull request on your behalf

Examples of what to say (illustrative, not prescriptive nor exhaustive):

- > hold this pr for the next 2 hours
- > please wait 1 more day before merging this
- > delay merging this pull request for 2 hours 30 mins
---

Note that the examples above of what to say are only meant to be illustrative and not definitive.

Additionally, if the bot has misinterpreted you or you have changed your mind, you can express such an intent with a phrase like "nevermind" or "forget what I just told you".

### Enforcement of policies

on April 18th 2023 `auto-merge.config.enforce` started to block all PR's (it never ran/finish).

As we use github automerge funcionatity anyways we removed it from required status checks to unblock contributors and use github build-in features.

~Enforcement of auto-merge comments is handled by the `auto-merge.config.enforce` status check. It's intended to run for each PR and automatically succeed if no AutoMerge policies apply. If this stops working, contact the bot team (check internal wiki for contact info).~
Loading

0 comments on commit 54eb707

Please sign in to comment.