Skip to content

Commit

Permalink
Add Azure static web app routes for old pages
Browse files Browse the repository at this point in the history
  • Loading branch information
georgekosmidis-slalom committed Aug 31, 2024
1 parent f08c4cc commit b497039
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 2 deletions.
7 changes: 5 additions & 2 deletions _src/Blog.Builder/Services/PageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ private PageBuilderResult GetBuilderResult<T>(string directory) where T : Layout
string? pageHtml = File.ReadAllText(Path.Combine(directory, Globals.ContentHtmlFilename));
ExceptionHelpers.ThrowIfNullOrWhiteSpace(pageHtml);

//add azure static web app routes
_staticAppConfigBuilder.Add(pageData.RelativeUrl, pageData.DatePublished);
//add azure static web app routes for old pages
if(pageData.DatePublished < DateTime.Parse("2022-01-01T00:00:00Z"))
{
_staticAppConfigBuilder.Add(pageData.RelativeUrl, pageData.DatePublished);
}

//add the GitHub repo
string? articleFolderName = Path.GetFileName(directory.Trim(Path.DirectorySeparatorChar));
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"RelativeUrl": "/customize-the-azure-sdk-for-js.html",
"Title": How to Build and Customize the Azure SDK for JavaScript",
"Description": "The Azure Document Intelligence API offers powerful capabilities for form recognition and document analysis. However, the client library for JavaScript that offers ease of usage might not always align with your needs, especially when it comes to using preview versions of the API. In this blog post, we'll explore how to override the default API version used by the Azure Document Intelligence SDK to leverage the latest preview features.",
"DatePublished": "2024-06-03T15:15:00+01:00",
"DateModified": "2024-06-03T15:51:00+01:00",
"RelativeImageUrl": "/media/100600-feature.png",
"Tags": [
"azure-sdk-for-js",
"typescript",
"azure-ai-document-intelligence"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
### How to Build and Customize the Azure SDK for JavaScript: A Step-by-Step Guide

As a developer working with Azure services, you might find yourself needing to build and customize the Azure SDK to test a preview version of an Azure API that is not yet available in SDK. And of course you could just use Postman but where is the fun there :). Anyway, whether you're looking to make enhancements or support a new version that hasn't been officially released yet, having a clear set of instructions can save you a lot of time and hassle. In this post, we'll walk you through the process, from setting up your environment to pushing your custom changes to a forked repository.

#### Prerequisites

Before we dive into the build process, you'll need to ensure you have the following tools installed:

1. **Visual Studio 2022**: Make sure to include the "Desktop development with C++" workload. You can continue using VS Code for developing, VS just needs to be there, lost somewhere in your drive.
2. **Python 3.9.13**: If you are already using Python in a different version **pyenv** is a handy tool.
3. **Node 18.20.3**: Similarly, if you want to support multiple node versions try **nvm**.

#### Step 1: Forking and Making Changes

If you need to fork the repository, make custom changes, and then build it, follow these steps:

1. **Clone the Repository**:
```sh
git clone https://github.com/Azure/azure-sdk-for-js.git
cd azure-sdk-for-js
```

2. **Check Out a Specific Tag** (Optional):
```sh
git checkout tags/@azure/ai-form-recognizer_5.0.0 -b ai-form-recognizer_5.0.0
```

3. **Make Your Changes**: Open the code in your favorite editor and make the necessary modifications.

4. **Push Changes to Your Fork** (Optional):
- Add a remote for your fork:
```sh
git remote add fork https://github.com/<your-username>/azure-sdk-for-js.git
```
- Push your changes:
```sh
git push fork ai-form-recognizer_5.0.0
```

#### Step 2: Setting Up Your Environment

First, install the necessary software:

- **Visual Studio 2022**: Download and install from [https://visualstudio.microsoft.com/vs/](https://visualstudio.microsoft.com/vs/), ensuring you select the "Desktop development with C++" workload during installation.
- **pyenv**: Follow the installation instructions from [pyenv's GitHub repository](https://github.com/pyenv/pyenv). Once installed, set it to use Python 3.9.13:
```sh
pyenv install 3.9.13
pyenv global 3.9.13
```
<blockquote>If it is the first time you are using pyenv, it is advised to unistall all previous python versions.</blockquote>
- **nvm**: Install nvm from the [nvm GitHub repository](https://github.com/nvm-sh/nvm). Then install Node.js 18.20.3:
```sh
nvm install 18.20.3
nvm use 18.20.3
```
#### Step 3: Installing and Using Rush
Next, you'll need to install Rush, a build orchestration tool used by Microsoft for managing large monorepos:

```sh
npm install -g @microsoft/rush
```

Once Rush is installed, navigate to your project directory and run the following commands to install dependencies and build the SDK:

```sh
rush install --purge
rush build
rush build -t @azure/ai-form-recognizer
```

This will build the specific package for the AI Form Recognizer.

#### Step 4: Building the AI Form Recognizer Package

Navigate to the AI Form Recognizer package directory and pack the module:

```sh
cd .\sdk\formrecognizer\ai-form-recognizer
npm pack
```

After running this command, you should have a file named `azure-ai-form-recognizer-5.0.0.tgz`. Copy this file to a location of your choice for later use.
`
#### That's it!
By following these steps, you'll be able to set up your development environment, build the SDK, make custom modifications, and push your changes to your forked repository. Happy coding!
Feel free to leave comments or ask questions if you run into any issues!
13 changes: 13 additions & 0 deletions workables/articles/100610-infinity-the-scientific-god/content.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"RelativeUrl": "/customize-the-azure-sdk-for-js.html",
"Title": How to Build and Customize the Azure SDK for JavaScript",
"Description": "The Azure Document Intelligence API offers powerful capabilities for form recognition and document analysis. However, the client library for JavaScript that offers ease of usage might not always align with your needs, especially when it comes to using preview versions of the API. In this blog post, we'll explore how to override the default API version used by the Azure Document Intelligence SDK to leverage the latest preview features.",
"DatePublished": "2024-06-03T15:15:00+01:00",
"DateModified": "2024-06-03T15:51:00+01:00",
"RelativeImageUrl": "/media/100600-feature.png",
"Tags": [
"azure-sdk-for-js",
"typescript",
"azure-ai-document-intelligence"
]
}
Loading

0 comments on commit b497039

Please sign in to comment.