azure-functions-cli 1.0.0-beta.93 → 5.0.0-preview.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +263 -156
- package/lib/copy-metadata.js +9 -0
- package/lib/install.js +151 -0
- package/lib/main.js +42 -26
- package/npm-shrinkwrap.json +97 -0
- package/package.json +40 -20
- package/assets/azure-functions-logo-color-raster.png +0 -0
- package/bin/ARMClient.Authentication.dll +0 -0
- package/bin/ARMClient.Library.dll +0 -0
- package/bin/Autofac.Integration.WebApi.dll +0 -0
- package/bin/Autofac.dll +0 -0
- package/bin/Colors.Net.dll +0 -0
- package/bin/DocumentDB.Spatial.Sql.dll +0 -0
- package/bin/EdgeJs.dll +0 -0
- package/bin/FSharp.Compiler.Service.MSBuild.v12.dll +0 -0
- package/bin/FSharp.Compiler.Service.dll +0 -0
- package/bin/FSharp.Core.dll +0 -0
- package/bin/FluentCommandLineParser.dll +0 -0
- package/bin/Humanizer.dll +0 -0
- package/bin/Ignite.SharpNetSH.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Common.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Azure.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Bitbucket.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Dropbox.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.DynamicsCRM.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Generic.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.GitHub.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Instagram.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.MailChimp.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Pusher.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Salesforce.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Slack.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Stripe.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.Trello.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.WordPress.dll +0 -0
- package/bin/Microsoft.AspNet.WebHooks.Receivers.dll +0 -0
- package/bin/Microsoft.AspNetCore.Cryptography.Internal.dll +0 -0
- package/bin/Microsoft.AspNetCore.DataProtection.Abstractions.dll +0 -0
- package/bin/Microsoft.AspNetCore.DataProtection.dll +0 -0
- package/bin/Microsoft.AspNetCore.Hosting.Abstractions.dll +0 -0
- package/bin/Microsoft.AspNetCore.Hosting.Server.Abstractions.dll +0 -0
- package/bin/Microsoft.AspNetCore.Http.Abstractions.dll +0 -0
- package/bin/Microsoft.AspNetCore.Http.Features.dll +0 -0
- package/bin/Microsoft.AspNetCore.WebUtilities.dll +0 -0
- package/bin/Microsoft.Azure.ApiHub.Sdk.dll +0 -0
- package/bin/Microsoft.Azure.Documents.Client.dll +0 -0
- package/bin/Microsoft.Azure.Documents.ServiceInterop.dll +0 -0
- package/bin/Microsoft.Azure.KeyVault.Core.dll +0 -0
- package/bin/Microsoft.Azure.NotificationHubs.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Extensions.ApiHub.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Extensions.BotFramework.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Extensions.DocumentDB.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Extensions.MobileApps.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Extensions.NotificationHubs.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Extensions.SendGrid.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Extensions.Twilio.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Extensions.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Host.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Logging.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Script.Extensibility.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Script.WebHost.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.Script.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.ServiceBus.dll +0 -0
- package/bin/Microsoft.Azure.WebJobs.dll +0 -0
- package/bin/Microsoft.Azure.WebSites.DataProtection.dll +0 -0
- package/bin/Microsoft.Bot.Connector.DirectLine.dll +0 -0
- package/bin/Microsoft.CodeAnalysis.CSharp.Scripting.dll +0 -0
- package/bin/Microsoft.CodeAnalysis.CSharp.dll +0 -0
- package/bin/Microsoft.CodeAnalysis.Scripting.dll +0 -0
- package/bin/Microsoft.CodeAnalysis.dll +0 -0
- package/bin/Microsoft.Data.Edm.dll +0 -0
- package/bin/Microsoft.Data.OData.dll +0 -0
- package/bin/Microsoft.Data.Services.Client.dll +0 -0
- package/bin/Microsoft.Extensions.Configuration.Abstractions.dll +0 -0
- package/bin/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
- package/bin/Microsoft.Extensions.DependencyInjection.dll +0 -0
- package/bin/Microsoft.Extensions.FileProviders.Abstractions.dll +0 -0
- package/bin/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
- package/bin/Microsoft.Extensions.Options.dll +0 -0
- package/bin/Microsoft.Extensions.Primitives.dll +0 -0
- package/bin/Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll +0 -0
- package/bin/Microsoft.IdentityModel.Clients.ActiveDirectory.dll +0 -0
- package/bin/Microsoft.Rest.ClientRuntime.dll +0 -0
- package/bin/Microsoft.ServiceBus.Messaging.EventProcessorHost.dll +0 -0
- package/bin/Microsoft.ServiceBus.dll +0 -0
- package/bin/Microsoft.WindowsAzure.Configuration.dll +0 -0
- package/bin/Microsoft.WindowsAzure.Mobile.Ext.dll +0 -0
- package/bin/Microsoft.WindowsAzure.Mobile.dll +0 -0
- package/bin/Microsoft.WindowsAzure.Storage.dll +0 -0
- package/bin/NCrontab.dll +0 -0
- package/bin/Newtonsoft.Json.dll +0 -0
- package/bin/NuGet.Frameworks.dll +0 -0
- package/bin/NuGet.LibraryModel.dll +0 -0
- package/bin/NuGet.Versioning.dll +0 -0
- package/bin/NuGet.exe +0 -0
- package/bin/RestSharp.dll +0 -0
- package/bin/SendGrid.CSharp.HTTP.Client.dll +0 -0
- package/bin/SendGrid.SmtpApi.dll +0 -0
- package/bin/SendGrid.dll +0 -0
- package/bin/System.AppContext.dll +0 -0
- package/bin/System.Buffers.dll +0 -0
- package/bin/System.Collections.Immutable.dll +0 -0
- package/bin/System.Console.dll +0 -0
- package/bin/System.Diagnostics.FileVersionInfo.dll +0 -0
- package/bin/System.Diagnostics.StackTrace.dll +0 -0
- package/bin/System.IO.Abstractions.dll +0 -0
- package/bin/System.IO.FileSystem.Primitives.dll +0 -0
- package/bin/System.IO.FileSystem.dll +0 -0
- package/bin/System.Net.Http.Extensions.dll +0 -0
- package/bin/System.Net.Http.Formatting.dll +0 -0
- package/bin/System.Net.Http.Primitives.dll +0 -0
- package/bin/System.Reflection.Metadata.dll +0 -0
- package/bin/System.Security.Cryptography.Algorithms.dll +0 -0
- package/bin/System.Security.Cryptography.Encoding.dll +0 -0
- package/bin/System.Security.Cryptography.Primitives.dll +0 -0
- package/bin/System.Security.Cryptography.X509Certificates.dll +0 -0
- package/bin/System.Spatial.dll +0 -0
- package/bin/System.Text.Encoding.CodePages.dll +0 -0
- package/bin/System.Text.Encodings.Web.dll +0 -0
- package/bin/System.Threading.Tasks.Dataflow.dll +0 -0
- package/bin/System.Threading.Thread.dll +0 -0
- package/bin/System.ValueTuple.dll +0 -0
- package/bin/System.Web.Cors.dll +0 -0
- package/bin/System.Web.Http.Cors.dll +0 -0
- package/bin/System.Web.Http.SelfHost.dll +0 -0
- package/bin/System.Web.Http.WebHost.dll +0 -0
- package/bin/System.Web.Http.dll +0 -0
- package/bin/System.Xml.XPath.XDocument.dll +0 -0
- package/bin/System.Xml.XPath.dll +0 -0
- package/bin/System.Xml.XmlDocument.dll +0 -0
- package/bin/Twilio.Api.dll +0 -0
- package/bin/azurefunctions/functions.js +0 -129
- package/bin/azurefunctions/http/request.js +0 -8
- package/bin/azurefunctions/http/response.js +0 -78
- package/bin/edge/double_edge.js +0 -49
- package/bin/edge/edge.js +0 -172
- package/bin/edge/x64/edge_nativeclr.node +0 -0
- package/bin/edge/x64/node.dll +0 -0
- package/bin/edge/x86/edge_nativeclr.node +0 -0
- package/bin/edge/x86/node.dll +0 -0
- package/bin/func.exe +0 -0
- package/bin/func.exe.config +0 -96
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) .NET Foundation. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,156 +1,263 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
func
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Actions
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
list
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
|Branch|Status|
|
|
4
|
+
|------|------|
|
|
5
|
+
|main|[](https://dev.azure.com/azfunc/public/_build/latest?definitionId=579&repoName=Azure%2Fazure-functions-core-tools&branchName=main) |
|
|
6
|
+
|vnext|[](https://dev.azure.com/azfunc/public/_build/latest?definitionId=579&repoName=Azure%2Fazure-functions-core-tools&branchName=vnext)|
|
|
7
|
+
|
|
8
|
+
# Azure Functions Core Tools
|
|
9
|
+
|
|
10
|
+
The Azure Functions Core Tools provide a local development experience for creating, developing, testing, running, and debugging Azure Functions.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### One-line install
|
|
15
|
+
|
|
16
|
+
**PowerShell** (Windows, macOS, Linux):
|
|
17
|
+
|
|
18
|
+
```powershell
|
|
19
|
+
irm https://aka.ms/func-cli/install.ps1 | iex
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Bash** (macOS, Linux):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
curl -sSL https://aka.ms/func-cli/install.sh | bash
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Both scripts auto-detect your OS and architecture, download the latest 5.x release from GitHub, and install to `~/.azure-functions`.
|
|
29
|
+
|
|
30
|
+
> v5 is currently pre-release only. Add `--prerelease` / `-Prerelease` (see below) until the first stable 5.x ships.
|
|
31
|
+
|
|
32
|
+
If a v4 `func` is already on PATH (e.g., from npm), the installer leaves it as the default and installs a `func5` wrapper alongside so you can run v5 side-by-side without breaking v4.
|
|
33
|
+
|
|
34
|
+
### Options
|
|
35
|
+
|
|
36
|
+
Pass flags to the installer using the patterns below. The PowerShell script also supports `-WhatIf` to preview changes without writing anything, plus the standard `-Verbose`, `-SkipPath`, and `-KeepArchive` switches; the Bash script exposes the same via `--dry-run`, `--verbose`, `--skip-path`, `--keep-archive`, and prints the full list with `--help`.
|
|
37
|
+
|
|
38
|
+
| Option | PowerShell | Bash |
|
|
39
|
+
|--------|-----------|------|
|
|
40
|
+
| Include pre-releases | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -Prerelease"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --prerelease` |
|
|
41
|
+
| Specific version | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -Version 5.0.0"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --version 5.0.0` |
|
|
42
|
+
| Custom install dir | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -InstallPath ~/my-tools"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --install-path ~/my-tools` |
|
|
43
|
+
| Preview without writing | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -WhatIf"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --dry-run` |
|
|
44
|
+
| Show help | `iex "& { $(irm https://aka.ms/func-cli/install.ps1) } -Help"` | `curl -sSL https://aka.ms/func-cli/install.sh \| bash -s -- --help` |
|
|
45
|
+
|
|
46
|
+
The Bash script also still honours the legacy environment variables (`VERSION`, `PRERELEASE=true`, `INSTALL_DIR`, `FORCE=true`, `SOURCE`) for back-compat. Flags take precedence.
|
|
47
|
+
|
|
48
|
+
### Unattended install
|
|
49
|
+
|
|
50
|
+
To chain commands after the installer (e.g., in CI pipelines or Dockerfiles), source the updated PATH and then run `func` directly:
|
|
51
|
+
|
|
52
|
+
**PowerShell:**
|
|
53
|
+
|
|
54
|
+
```powershell
|
|
55
|
+
iex "& { $(irm https://aka.ms/func-cli/install.ps1) }"
|
|
56
|
+
func workload install dotnet
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Bash:**
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
curl -sSL https://aka.ms/func-cli/install.sh | bash
|
|
63
|
+
source ~/.bashrc
|
|
64
|
+
func workload install node
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The install script adds `~/.azure-functions` to your PATH automatically. In PowerShell, the current session is updated immediately. In Bash, you need to `source` your shell profile to pick up the change before running `func`.
|
|
68
|
+
|
|
69
|
+
In GitHub Actions, the installer also appends the install dir to `$GITHUB_PATH`, so `func` is on PATH in subsequent steps without needing to source anything.
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
func <command> [path] [options]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
| Command | Description |
|
|
78
|
+
|---------|-------------|
|
|
79
|
+
| `func init [path]` | Initialize a new Azure Functions project |
|
|
80
|
+
| `func new [path]` | Create a new function from a template |
|
|
81
|
+
| `func run [path]` | Start the Functions host locally (alias: `func start`) |
|
|
82
|
+
| `func workload install <id>` | Install a language workload |
|
|
83
|
+
| `func workload list` | List installed workloads |
|
|
84
|
+
| `func version` | Display version information |
|
|
85
|
+
| `func help [command]` | Display help for a command |
|
|
86
|
+
|
|
87
|
+
## Architecture
|
|
88
|
+
|
|
89
|
+
The v5 CLI is a ground-up rebuild using:
|
|
90
|
+
|
|
91
|
+
- **System.CommandLine 2.0.6** — command parsing (following the dotnet CLI model)
|
|
92
|
+
- **Spectre.Console** — rich terminal output (tables, prompts, spinners)
|
|
93
|
+
- **Dependency Injection** — Microsoft.Extensions.DependencyInjection
|
|
94
|
+
- **.NET 10** — target framework
|
|
95
|
+
- **Workload model** — core CLI + optional language workloads (dotnet, node, python, etc.)
|
|
96
|
+
|
|
97
|
+
## Project Structure
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
src/
|
|
101
|
+
Func/ # CLI application
|
|
102
|
+
Commands/ # Command definitions (one file per command)
|
|
103
|
+
Console/ # Console output abstractions (Spectre wrappers)
|
|
104
|
+
Workloads/ # Workload engine (contracts, manager, manifest)
|
|
105
|
+
Program.cs # Entry point with DI wiring
|
|
106
|
+
Parser.cs # Command tree composition
|
|
107
|
+
Abstractions/ # Public abstractions
|
|
108
|
+
Workloads/
|
|
109
|
+
<kind>/<Name>/ # An individual grouped workload
|
|
110
|
+
<Name>/ # An individual ungrouped workload
|
|
111
|
+
test/
|
|
112
|
+
Func.Tests/ # Unit tests core cli (xUnit + NSubstitute)
|
|
113
|
+
Workloads/
|
|
114
|
+
<kind>/<Name>.Tests/ # Unit tests for a grouped workload
|
|
115
|
+
<Name>.Tests/ # Unit tests for an ungrouped workload
|
|
116
|
+
eng/
|
|
117
|
+
build/ # MSBuild props and targets
|
|
118
|
+
ci/ # CI pipeline definitions (Azure DevOps)
|
|
119
|
+
scripts/ # Build and validation scripts
|
|
120
|
+
res/ # Resources (icons, MSI assets)
|
|
121
|
+
docs/
|
|
122
|
+
vnext.md # v5 design document
|
|
123
|
+
modernization.md # Modernization design document
|
|
124
|
+
Azure.Functions.Cli.slnx # Solution file
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Development
|
|
128
|
+
|
|
129
|
+
**Prerequisites:** .NET 10 SDK (see `global.json` for the exact version)
|
|
130
|
+
|
|
131
|
+
### Build
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
dotnet restore
|
|
135
|
+
dotnet build
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Test
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
dotnet test
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Run Locally
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Option 1 — dotnet run
|
|
148
|
+
dotnet run --project src/Func -- <command> [args]
|
|
149
|
+
|
|
150
|
+
# Option 2 — add to PATH
|
|
151
|
+
export PATH="$PATH:$(pwd)/out/bin/Func/debug"
|
|
152
|
+
func <command>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Set Up Language Workloads
|
|
156
|
+
|
|
157
|
+
`func setup` installs the host and the selected language's stack and worker workloads,
|
|
158
|
+
plus templates and extension bundles where applicable. Supported stacks are `dotnet`,
|
|
159
|
+
`node`, `python`, `go`, `java`, and `powershell`. For example:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
func setup --features java --yes
|
|
163
|
+
func setup --features powershell --yes
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
In an existing project, setup uses its configured runtime when `--features` is omitted.
|
|
167
|
+
`func setup --check` checks the same dependencies without installing them and returns
|
|
168
|
+
a nonzero exit code when a required stack workload is missing.
|
|
169
|
+
|
|
170
|
+
### Run Locally with Workloads
|
|
171
|
+
|
|
172
|
+
One-time bootstrap (per workload you want to test, into ./.debug-workloads/):
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
dotnet build src/Func/Func.csproj
|
|
176
|
+
dotnet build src/Workloads/Stacks/Node/Workloads.Node.csproj \
|
|
177
|
+
-t:DeployForDebug -p:FuncCliEnsureWorkloadInstalled=true
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
That packs the workload, runs func workload install against `./.debug-workloads/`, and drops the freshly built DLL+PDB into the install dir.
|
|
181
|
+
|
|
182
|
+
Inner loop (after editing workload source, no re-install, no pack):
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
dotnet build src/Workloads/Stacks/Node/Workloads.Node.csproj -t:DeployForDebug
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
> Just copies the new DLL+PDB over the installed one.
|
|
189
|
+
|
|
190
|
+
Run the CLI against that home:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
export FUNC_CLI_WORKLOADS_HOME="$PWD/.debug-workloads"
|
|
194
|
+
./out/bin/Func/debug/func <args>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### One-shot script
|
|
198
|
+
|
|
199
|
+
`eng/scripts/debug-workloads.ps1` wraps the above for every workload in the repo, so you can bootstrap a full home in one command:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pwsh ./eng/scripts/debug-workloads.ps1 # all workloads
|
|
203
|
+
pwsh ./eng/scripts/debug-workloads.ps1 -Project Node # just one
|
|
204
|
+
pwsh ./eng/scripts/debug-workloads.ps1 -Feature node # everything `func setup --features node` installs
|
|
205
|
+
pwsh ./eng/scripts/debug-workloads.ps1 -Clean # wipe + reinstall
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
`-Feature` accepts `host`, `runtime`, `dotnet`, `node`, `python`, `go`, `java`, `powershell` (or any combination, deduped).
|
|
209
|
+
|
|
210
|
+
Inner loop with the script (sub-second, copy-only):
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
pwsh ./eng/scripts/debug-workloads.ps1 -Project Node -SkipFuncBuild
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Reach for the `build-workloads` skill instead when what you're testing is `func workload install` itself (feed resolution, manifest behaviour, etc.). Otherwise the script above is faster because it skips the NuGet feed.
|
|
217
|
+
|
|
218
|
+
### Publish a Self-Contained Build
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
dotnet publish src/Func/Func.csproj -c Release -r osx-arm64
|
|
222
|
+
./out/pub/Func/release_osx-arm64/func --version
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Common runtime identifiers: `osx-arm64`, `osx-x64`, `linux-x64`, `win-x64`
|
|
226
|
+
|
|
227
|
+
## Branches
|
|
228
|
+
|
|
229
|
+
| Branch | Description |
|
|
230
|
+
|--------|-------------|
|
|
231
|
+
| `main` | v4 — current stable release |
|
|
232
|
+
| `vnext` | v5 — next-generation CLI rebuild |
|
|
233
|
+
|
|
234
|
+
## Documentation
|
|
235
|
+
|
|
236
|
+
- [Code and test Azure Functions locally](https://docs.microsoft.com/azure/azure-functions/functions-run-local)
|
|
237
|
+
- [Contributing Guide](CONTRIBUTING.md)
|
|
238
|
+
- [Design proposals](proposed/)
|
|
239
|
+
|
|
240
|
+
Files under `proposed/` capture design intent while a design is being shaped and reviewed, so they may lag the current implementation. Submit new proposals against `vnext`; after a design is accepted and implemented, move it to `accepted/` in a follow-up change.
|
|
241
|
+
|
|
242
|
+
## Telemetry
|
|
243
|
+
|
|
244
|
+
The Azure Functions Core Tools collect usage data in order to help us improve your experience.
|
|
245
|
+
The data is anonymous and doesn't include any user specific or personal information. The data is collected by Microsoft.
|
|
246
|
+
|
|
247
|
+
You can opt-out of telemetry by setting the `FUNC_CLI_TELEMETRY_OPTOUT` environment variable to any value other than `no`, `n`, `0`, `false`, or `off`. The legacy `FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT` variable from Core Tools v4 is still honored.
|
|
248
|
+
|
|
249
|
+
[Microsoft privacy statement](https://privacy.microsoft.com/privacystatement)
|
|
250
|
+
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
This project is under the benevolent umbrella of the [.NET Foundation](http://www.dotnetfoundation.org/) and is licensed under [the MIT License](LICENSE).
|
|
254
|
+
|
|
255
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
256
|
+
|
|
257
|
+
## Contact Us
|
|
258
|
+
|
|
259
|
+
For questions on Azure Functions or the tools:
|
|
260
|
+
|
|
261
|
+
- [Azure Functions Q&A Forum](https://docs.microsoft.com/answers/topics/azure-functions.html)
|
|
262
|
+
- [Azure-Functions tag on StackOverflow](http://stackoverflow.com/questions/tagged/azure-functions)
|
|
263
|
+
- [File bugs on GitHub](https://github.com/Azure/azure-functions-core-tools/issues)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const repositoryRoot = path.resolve(__dirname, '..', '..', '..', '..', '..');
|
|
5
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
6
|
+
|
|
7
|
+
for (const fileName of ['LICENSE', 'README.md']) {
|
|
8
|
+
fs.copyFileSync(path.join(repositoryRoot, fileName), path.join(packageRoot, fileName));
|
|
9
|
+
}
|
package/lib/install.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const https = require('https');
|
|
5
|
+
const { HttpsProxyAgent } = require('https-proxy-agent');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const ProgressBar = require('progress');
|
|
9
|
+
const yauzl = require('yauzl');
|
|
10
|
+
const { version } = require('../package.json');
|
|
11
|
+
|
|
12
|
+
function getRuntimeIdentifier() {
|
|
13
|
+
const platforms = {
|
|
14
|
+
darwin: 'osx',
|
|
15
|
+
linux: 'linux',
|
|
16
|
+
win32: 'win'
|
|
17
|
+
};
|
|
18
|
+
const architectures = {
|
|
19
|
+
arm64: 'arm64',
|
|
20
|
+
x64: 'x64'
|
|
21
|
+
};
|
|
22
|
+
const platform = platforms[os.platform()];
|
|
23
|
+
const architecture = architectures[os.arch()];
|
|
24
|
+
|
|
25
|
+
if (!platform || !architecture) {
|
|
26
|
+
throw new Error(`Platform '${os.platform()}-${os.arch()}' is not supported.`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return `${platform}-${architecture}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getProxyAgent() {
|
|
33
|
+
const proxy = process.env.npm_config_https_proxy
|
|
34
|
+
|| process.env.npm_config_proxy
|
|
35
|
+
|| process.env.HTTPS_PROXY
|
|
36
|
+
|| process.env.https_proxy
|
|
37
|
+
|| process.env.HTTP_PROXY
|
|
38
|
+
|| process.env.http_proxy;
|
|
39
|
+
|
|
40
|
+
return proxy ? new HttpsProxyAgent(proxy) : undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function download(url, destination, redirectCount = 0) {
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
const request = https.get(url, { agent: getProxyAgent() }, response => {
|
|
46
|
+
if ([301, 302, 307, 308].includes(response.statusCode)) {
|
|
47
|
+
response.resume();
|
|
48
|
+
if (!response.headers.location || redirectCount >= 5) {
|
|
49
|
+
reject(new Error(`Unable to follow redirect while downloading '${url}'.`));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
resolve(download(new URL(response.headers.location, url), destination, redirectCount + 1));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (response.statusCode !== 200) {
|
|
58
|
+
response.resume();
|
|
59
|
+
reject(new Error(`Failed to download '${url}'. Expected HTTP 200, received ${response.statusCode}.`));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const total = Number(response.headers['content-length']) || 0;
|
|
64
|
+
const progress = total > 0
|
|
65
|
+
? new ProgressBar('[:bar] Downloading Azure Functions CLI', { total, width: 18 })
|
|
66
|
+
: undefined;
|
|
67
|
+
const file = fs.createWriteStream(destination);
|
|
68
|
+
|
|
69
|
+
response.on('data', data => progress?.tick(data.length));
|
|
70
|
+
response.on('error', reject);
|
|
71
|
+
file.on('error', reject);
|
|
72
|
+
file.on('finish', () => file.close(resolve));
|
|
73
|
+
response.pipe(file);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
request.on('error', reject);
|
|
77
|
+
request.setTimeout(300000, () => {
|
|
78
|
+
request.destroy(new Error(`Timed out downloading '${url}'.`));
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function extractExecutable(archivePath, destination) {
|
|
84
|
+
const expectedEntry = os.platform() === 'win32' ? 'func.exe' : 'func';
|
|
85
|
+
|
|
86
|
+
return new Promise((resolve, reject) => {
|
|
87
|
+
yauzl.open(archivePath, { lazyEntries: true }, (openError, archive) => {
|
|
88
|
+
if (openError) {
|
|
89
|
+
reject(openError);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
archive.on('error', reject);
|
|
94
|
+
archive.on('end', () => {
|
|
95
|
+
reject(new Error(`Archive does not contain '${expectedEntry}'.`));
|
|
96
|
+
});
|
|
97
|
+
archive.on('entry', entry => {
|
|
98
|
+
if (entry.fileName !== expectedEntry) {
|
|
99
|
+
archive.readEntry();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
archive.openReadStream(entry, (streamError, input) => {
|
|
104
|
+
if (streamError) {
|
|
105
|
+
archive.close();
|
|
106
|
+
reject(streamError);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const output = fs.createWriteStream(destination, { mode: 0o755 });
|
|
111
|
+
input.on('error', reject);
|
|
112
|
+
output.on('error', reject);
|
|
113
|
+
output.on('close', () => {
|
|
114
|
+
archive.close();
|
|
115
|
+
resolve();
|
|
116
|
+
});
|
|
117
|
+
input.pipe(output);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
archive.readEntry();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function install() {
|
|
126
|
+
const runtimeIdentifier = getRuntimeIdentifier();
|
|
127
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
128
|
+
const binDirectory = path.join(packageRoot, 'bin');
|
|
129
|
+
const archiveName = `Azure.Functions.Cli.${runtimeIdentifier}.${version}.zip`;
|
|
130
|
+
const archivePath = path.join(binDirectory, archiveName);
|
|
131
|
+
const executablePath = path.join(binDirectory, os.platform() === 'win32' ? 'func.exe' : 'func');
|
|
132
|
+
const endpoint = `https://cdn.functions.azure.com/public/cli/v5/${version}/${archiveName}`;
|
|
133
|
+
|
|
134
|
+
fs.rmSync(binDirectory, { recursive: true, force: true });
|
|
135
|
+
fs.mkdirSync(binDirectory, { recursive: true });
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
console.log(`Downloading Azure Functions CLI from '${endpoint}'.`);
|
|
139
|
+
await download(endpoint, archivePath);
|
|
140
|
+
await extractExecutable(archivePath, executablePath);
|
|
141
|
+
fs.rmSync(archivePath, { force: true });
|
|
142
|
+
} catch (error) {
|
|
143
|
+
fs.rmSync(binDirectory, { recursive: true, force: true });
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
install().catch(error => {
|
|
149
|
+
console.error(error.message);
|
|
150
|
+
process.exitCode = 1;
|
|
151
|
+
});
|