* Remove unused bot work
This removes the previous start of RNW bot work, targetting Azure Functions as a client for GitHub webhooks. GitHub Actions workflows can be triggered in response to many GH webhooks, with orchestration taken care of.
* Change files
* Update telemetry unittest timeouts
Some tests were checking for the presence of npm/yarn before checking
its version. Since we almost always have those installed, I rearranged
the tests to look for the version first, and only if it returns null do
I check to confirm the tool is indeed missing.
Closes#9183
* Change files
* Remove lookpath confirmation
We need a way to be able to specify different setup strings and proxy servers for the telemetry. We can do this in code, but that's not always an option, for example in the case of `react-native-windows-init` which is called by using npx.
Adding these environment variable overrides will help us test the telemetry system before (and after) we go live and turn it on.
Example:
```cmd
set RNW_TELEMETRY_SETUP=12345678-abcd-abcd-abcd-1234567890ab
set RNW_TELEMETRY_PROXY=http://localhost:8888
```
Closes#9166
This PR refactors our RNW CLI telemetry code to be easier to consume, align with our requirements, and add a suite of unit and E2E tests.
**Note:** This PR does not *enable* telemetry collection yet - we still need to (re)-setup the service side to actually receive data, test the E2E pipeline and fix any bugs.
Closes#7312Closes#7903
## Overview
All telemetry-related operations are driven by the `Telemetry` class, the `CodedError` type, and a small handful of helper functions exported from the `@react-native-windows/telemetry` package. Consumers of this package (`@react-native-windows/cli` and `react-native-windows-init`) are provided this abstraction layer and are therefore no longer expected to understand the intricacies of the underlying telemetry service (Application Insights).
CLI commands are now generally restructured to follow this pattern:
```ts
async function cliCommand(args) {
// Telemetry setup
Telemetry.setup();
Telemetry.startCommand(...);
let cliCommandError: Error | undefined;
try {
await cliCommandInternal(args);
} catch (error) {
// Report any error thrown
Telemetry.trackException(error);
cliCommandError= error;
}
// Telemetry cleanup
TelemetryTest.endCommand(...);
}
```
With this setup, none of the code within internal function (`cliCommandInternal` here) has any notion of or connection to the telemetry system, other than throwing `CodedError` whenever it hits a known error in our code that we wish to capture. (Note that none of the functionality of any of our commands were changed in this PR, as they were already throwing `CodedError` s with appropriate extra data, where appropriate). Any unknown errors are also caught and recorded by the Telemetry.
In the end, we expect up to two events from every CLI command: `RNWCLI.Command` and potentially one error event: `RNWCLI.CodedError`. The `RNWCLI.Command` event is fired in the call to `endCommand` and contains everything we want to know from a run of our commands, success or failure. If an error was thrown, then we'll also have fired an additional event with the call to `trackException`, including error codes, stack traces, etc. The two events can be correlated to one another via the `sessionId` property.
Every effort has been made to make sure that we can easily extend and update our CLI commands *without* having to update the telemetry code. For example, the work to gather the command line arguments/options passed, to gather project info and environment setup, are all set up in a standardized way and sanitize such data of PII.
* Ensure native animations fire completion callbacks
The AnimationDrivers were being stored as unique_ptrs, but internally
use a weak_ptr to handle completion callbacks. When attempting to
convert the weak_ptr to a shared_ptr, the conversion would always return
an empty pointer because the constructor was not called from a
shared_ptr.
This changes the NativeAnimatedNodeManager to hold shared_ptrs to
AnimationDrivers to ensure that callbacks fire when the composition
scoped batch completes for the animation.
Fixes#9157
* Change files
* # nice-fs
`nice-fs` is a minimal-dependency drop-in replacement to `fs` with changes for resiliency, promises, and convenience. It has several opinionated changes, targeted towards cross-platform CLI apps.
## Async Usage (Default)
`nice-fs` exposes a Promise-based API, mostly matching that of `fs.promises`, with several methods added [extra methods](#Extra-Methods).
```ts
// import {promises as fs} from 'fs'
import fs from 'nice-fs';
const fileContent = await fs.readFile('foo.txt');
```
## Sync Usage
`nice-fs` exports all `fs.*Sync` Where an async version has a graceful implementation, and the synchronous version does not, the method is marked as deprecated.
```ts
// import fs from 'fs'
import fs from 'nice-fs';
const fileContent = await fs.readFileSync('foo.txt');
```
## Extra Methods
### `exists`
NodeJS deprecated `fs.exists`, and removed `fs.promises.exists`. The recommendation is to instead acquire a lock to the file via `fs.open` for the duration of file-use. One-shot existence checks are still useful, and because `fs.existsSync` is not deprecated, more likely means usage of blocking synchronous APIs.
```ts
import fs from 'nice-fs';
const fooExists = await fs.exists('foo.txt');
```
### `readFile.asJson`
`nice-fs` provides convenience methods to handle JSON files. These are implemented as methods under `fs.ReadFile`. The following conversions are added:
| Method | Return type |
|-|-|
| `readFile.asJson<T>` | `Promise<T>` or `Promise<Record<string, unknown> \| Array<unknown>>` |
| `readFileSync.asJson<T>` | `T` or `Record<string, unknown> \| Array<unknown>` |
```ts
import fs from 'nice-fs';
// foo is type: Record<string, unknown>
const foo = await fs.readFile.asJsonObject('foo.json');
```
## Resiliency
`nice-fs` uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to gracefully handle transient filesystem conditions, at the cost of extra latency. This includes transient `EPERM`, `EACCESS`, `EMFILE`, `ENFILE`. This can be important when handling files that a subject to antivirus, which may temporarily lock mutation of files on Windows.
## eslint
We reccomend adding the following rules to your eslint config if you would like to use `nice-fs` everywhere:
```js
module.exports = {
rules: {
'no-restricted-imports': [
'error', {
name: 'fs',
message: 'Please us `nice-fs` instead of `fs`'
}
],
}
}
```
* yarn
* Remove 'readFileSync' from import list
* Update package directory in package.json
* Update packages/nice-fs/README.md
* Update packages/react-native-platform-override/src/PackageUtils.ts
* Rename to @react-native-windows/fs
* PR Feedback
* Refine JSON API
* Change files
* bad find/replace
* @react-native-windows/fs
* missing import
* Node 12 compat
* sort dependencies
* readme cleanup
* Ensure MSRN Debug Builds Use Debug WinMD
Validated script changes by running locally.
* Revert
* Remove redundant WindowsTargetPlatformVersion declarations
* Change files
* Centralize SDK setting in Microsoft.ReactNative.WindowsSdk.Default.props
* Also overrride SDKs when version is 10.0.0.0
* NuGet Caching Improvements
We are only caching the directory that packages.config style projects restore to. Cache the ProjectReference ones.
Enforces that lockfiles are updated in CI, so that we do not see lockfile changes during build interfering with cache. Updated related projects to look more like template, and fix non-deterministic lockfiles.
Adds logic to only cache the zipped nupkg files, since the nuget cache directory redundantly includes both them, and loose extracted files.
* fixes
* try diffferent glob
* fixes
* update directoeries
* typo
* try different glob
* No partial restore
* remove caching
* Removes unnecessary prop settings on VM base class
Removes the explicit setting of layout prop values on
FrameworkElementViewManager for:
- width
- height
- minWidth
- minHeight
- maxWidth
- maxHeight
Setting these values can cause the bug described in #9050 due to the
special treatment of numeric values for these props.
These props should not be needed at all. If a view is self-measuring,
Yoga hands the parameters of layout via the self-measuring callback, and
at any rate the width and height props are cleared before measuring:
8adef58a52/vnext/Microsoft.ReactNative/Views/ViewManagerBase.cpp (L70-L71)
And the `minWidth` / `maxWidth` props will be accounted for in the Yoga
layout calculation when setting the width/height bounds and measurement
modes.
Fixes#9050
* Change files
* Add MSRN Debug NuGet Packages
Paths to debug files are stripped from the MSRN nuspec before publishing. We have been able to generate NuGet packages with debug bits, but only used them for PR testing.
This change adds: `Microsoft.ReactNative.Debug`, `Microsoft.ReactNative.ProjectReunion.Debug`, `Microsoft.ReactNative.Managed.Debug`. These are drop-in replacements for the old NuGet package, just using debug bits.
It also switches PR's NuGet init tests to use release binaries, since those are what we'd use out of the box from the template.
* yaml
* yaml
* yaml
* indentation
* Change files
* x86
* Update .ado/templates/prep-and-pack-nuget.yml
* x64
* $
* Pass as JSON
* interp
* 😢
* fixes
* Install pwsh
* Use test pool
* Back to normal image
* Remove debug reunion
* Remove debug reunion from publish
* RnwNativeBuildReunion remove debug
Current logic attempts to waive PR validation from running for a subset of changes based on file extension. Includes Markdown-only changes.
We want to run PR on Markdown Changes though, because we have PR checks to lint Markdown.
Remove the shouldSkipPRBuild logic.