Skip to content

Commit

Permalink
refine readme files, add error checking in outer script
Browse files Browse the repository at this point in the history
  • Loading branch information
chunyu3 committed Apr 29, 2022
1 parent 0ebb050 commit 96df97d
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 55 deletions.
2 changes: 1 addition & 1 deletion eng/scripts/automation/GenerateAndBuildLib.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function Invoke-Generate() {
Push-Location $sdkfolder/src
dotnet build /t:GenerateCode
if ( !$? ) {
Write-Error "Failed to create generate sdk."
Write-Error "Failed to generate sdk."
Pop-Location
exit 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ Write-Host "projectFolder:$projectFolder"
Remove-Item $outputJsonFile
# Generate Code
Invoke-Generate -sdkfolder $projectFolder
if ( !$? ) {
Write-Error "Failed to generate sdk."
exit 1
}
# Build
Invoke-Build -sdkfolder $projectFolder

if ( !$? ) {
Write-Error "Failed to build sdk. exit code: $?"
exit 1
}
# Generate APIs
$repoRoot = (Join-Path $PSScriptRoot .. .. ..)
Set-Location $repoRoot
Expand Down
25 changes: 9 additions & 16 deletions sdk/template/Azure.Template/.content/packageResource/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
# README.md template

Use the guidelines in each section of this template to ensure consistency and readability of your README. The README resides in your package's GitHub repository at the root of its directory within the repo. It's also used as the package distribution page (NuGet, PyPi, npm, etc.) and as a Quickstart on docs.microsoft.com. See [Azure.Template/README.md](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/template/Azure.Template/README.md) for an example following this template.

**Title**: The H1 of your README should be in the format: `# [Product Name] client library for [Language]`

* All headings, including the H1, should use **sentence-style capitalization**. Refer to the [Microsoft Style Guide][style-guide-msft] and [Microsoft Cloud Style Guide][style-guide-cloud] for more information.
* Example: `# Azure Batch client library for .NET`

# Azure Template client library for .NET

**Introduction**: The introduction appears directly under the title (H1) of your README.
This section should give out brief introduction of the client library.

* **DO NOT** use an "Introduction" or "Overview" heading (H2) for this section.
* First sentence: **Describe the service** briefly. You can usually use the first line of the service's docs landing page for this (Example: [Cosmos DB docs landing page](https://docs.microsoft.com/azure/cosmos-db/)).
* Next, add a **bulleted list** of the **most common tasks** supported by the package or library, prefaced with "Use the client library for [Product Name] to:". Then, provide code snippets for these tasks in the [Examples](#examples) section later in the document. Keep the task list short but include those tasks most developers need to perform with your package.
* Include this single line of links targeting your product's content at the bottom of the introduction, making any adjustments as necessary (for example, NuGet instead of PyPi):

[Source code](https://github.com/Azure/azure-sdk-for-net/tree/bb0fbccfc33dd27d1ec6f0870022824d47181e61/sdk/template-dpg/Azure.ServiceTemplate.Template/src) | [Package (NuGet)](https://www.nuget.org/packages/Azure.AI.AnomalyDetector) | [API reference documentation](https://azure.github.io/azure-sdk-for-net/anomalydetector.html) | [Product documentation](https://docs.microsoft.com/azure/cognitive-services/anomaly-detector/)

> TIP: Your README should be as **brief** as possible but **no more brief** than necessary to get a developer new to Azure, the service, or the package up and running quickly. Keep it brief, but include everything a developer needs to make their first API call successfully.
[Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/template/Azure.Template/src) | [Package (NuGet)](https://www.nuget.org/packages/Azure.Template) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure)

## Getting started

Expand All @@ -28,6 +15,12 @@ This section should include everything a developer needs to do to install and cr

First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository.

Install the client library for .NET with [NuGet](https://www.nuget.org/ ):

```dotnetcli
dotnet add package Azure.Template --prerelease
```

### Prerequisites

Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB:
Expand Down Expand Up @@ -94,4 +87,4 @@ This is a template, but your SDK readme should include details on how to contrib
[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ftemplate%2FAzure.Template%2FREADME.png)
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/template/Azure.Template/README.png)
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Sample readme template
# <scenario_list>

Use the guidelines in each section of this template to write samples, for an example following this template.

This sample shows how to detect all the anomalies in the entire time series.

To get started, make sure you have satisfied all the prerequisites and got all the resources required by [README][README].
To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/template/Azure.Template/README.md#getting-started) for details.

## <scenario>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Sample readme template
# <scenario_list>

Use the guidelines in each section of this template to write samples, for an example following this template.

This sample shows how to detect all the anomalies in the entire time series.

To get started, make sure you have satisfied all the prerequisites and got all the resources required by [README][README].
To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/template/Azure.Template/README.md#getting-started) for details.

## <scenario> asynchronously

Expand Down
8 changes: 4 additions & 4 deletions sdk/template/Azure.Template/.content/testResource/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ trigger:
- release/*
paths:
include:
- sdk/ServiceNameLowercase/
- sdk/template/

pr:
branches:
Expand All @@ -19,13 +19,13 @@ pr:
- release/*
paths:
include:
- sdk/ServiceNameLowercase/
- sdk/template/

extends:
template: /eng/pipelines/templates/stages/archetype-sdk-client.yml
parameters:
ServiceDirectory: ServiceNameLowercase
ServiceDirectory: template
ArtifactName: packages
Artifacts:
- name: Azure.Template
safeName: PackageSafeName
safeName: AzureTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ trigger: none
extends:
template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
ServiceDirectory: ServiceNameLowercase
ServiceDirectory: template
SupportedClouds: 'Public'
46 changes: 43 additions & 3 deletions sdk/template/Azure.Template/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,29 @@
"datatype": "text",
"valueSource": "libraryName",
"valueTransform": "ServiceNameLowerForm",
"replaces": "ServiceNameLowercase"
"replaces": "template"
},
"ServiceDirectoryPath": {
"type": "generated",
"generator": "join",
"parameters": {
"symbols": [
{
"type": "const",
"value": "sdk/"
},
{
"type": "ref",
"value": "ServiceNameLowercase"
}
],
"separator": ""
},
"replaces": "sdk/template"
},
"PackageSafeName": {
"type": "generated",
"generator": "join",
"replaces": "PackageSafeName",
"parameters": {
"symbols": [
{
Expand All @@ -215,7 +232,30 @@
}
],
"separator": ""
}
},
"replaces": "AzureTemplate"
},
"PackageNameUnderscored": {
"type": "generated",
"generator": "join",
"parameters": {
"symbols": [
{
"type": "const",
"value": "Azure"
},
{
"type": "ref",
"value": "groupName"
},
{
"type": "ref",
"value": "libraryName"
}
],
"separator": "_"
},
"replaces": "Azure_Template"
},
"securityTypes": {
"type": "generated",
Expand Down
24 changes: 7 additions & 17 deletions sdk/template/Azure.Template/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
# README.md template

Use the guidelines in each section of this template to ensure consistency and readability of your README. The README resides in your package's GitHub repository at the root of its directory within the repo. It's also used as the package distribution page (NuGet, PyPi, npm, etc.) and as a Quickstart on docs.microsoft.com. See [Azure.Template/README.md](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/template/Azure.Template/README.md) for an example following this template.

**Title**: The H1 of your README should be in the format: `# [Product Name] client library for [Language]`

* All headings, including the H1, should use **sentence-style capitalization**. Refer to the [Microsoft Style Guide][style-guide-msft] and [Microsoft Cloud Style Guide][style-guide-cloud] for more information.
* Example: `# Azure Batch client library for .NET`

# Azure Template client library for .NET

**Introduction**: The introduction appears directly under the title (H1) of your README.
Azure Template is a managed service that helps developers get secret simply and securely.

Use the client library for to:

* **DO NOT** use an "Introduction" or "Overview" heading (H2) for this section.
* First sentence: **Describe the service** briefly. You can usually use the first line of the service's docs landing page for this (Example: [Cosmos DB docs landing page](https://docs.microsoft.com/azure/cosmos-db/)).
* Next, add a **bulleted list** of the **most common tasks** supported by the package or library, prefaced with "Use the client library for [Product Name] to:". Then, provide code snippets for these tasks in the [Examples](#examples) section later in the document. Keep the task list short but include those tasks most developers need to perform with your package.
* Include this single line of links targeting your product's content at the bottom of the introduction, making any adjustments as necessary (for example, NuGet instead of PyPi):
* [Get secret](https://docs.microsoft.com/azure)

[Source code](https://github.com/Azure/azure-sdk-for-net/tree/bb0fbccfc33dd27d1ec6f0870022824d47181e61/sdk/template-dpg/Azure.ServiceTemplate.Template/src) | [Package (NuGet)](https://www.nuget.org/packages/Azure.AI.AnomalyDetector) | [API reference documentation](https://azure.github.io/azure-sdk-for-net/anomalydetector.html) | [Product documentation](https://docs.microsoft.com/azure/cognitive-services/anomaly-detector/)
[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples]

> TIP: Your README should be as **brief** as possible but **no more brief** than necessary to get a developer new to Azure, the service, or the package up and running quickly. Keep it brief, but include everything a developer needs to make their first API call successfully.
[Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/template/Azure.Template/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure)

## Getting started

Expand Down Expand Up @@ -108,4 +98,4 @@ This is a template, but your SDK readme should include details on how to contrib
[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ftemplate%2FAzure.Template%2FREADME.png)
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/template/Azure.Template/README.png)

0 comments on commit 96df97d

Please sign in to comment.