Repository: serverless/serverless-azure-functions (ts)

Issue:
Support individual packaging, or clearly reject if there's no intention to support it
Currently if `serverless.yml` is set with `package.individually`, deployment crahes with error as such:

```
 Error: Function app zip file 'XXX' does not exist
```

If for some reason there's no intention to support individual per-function packaging, then I believe it should be reported with clear message as:

```
Azure plugin does not support `pakcage.individually` option.
```




Pull request:
fix: Throw error if user tries to specify package.individually
Because Azure Functions does not support individually packaged functions, the plugin needs to throw an error when user tries to perform the operation.

Resolves #254 

Patch:
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..9bff114
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,34 @@
+---
+name: Bug report
+about: Create a report to help us improve
+---
+
+<!--
+1. Please check if an issue already exists. This bug may have already been documented
+2. Check out and follow our Guidelines: https://github.com/serverless/serverless-azure-functions/CONTRIBUTING.md
+3. Fill out the whole template so we have a good overview on the issue
+4. Do not remove any section of the template. If something is not applicable leave it empty but leave it in the Issue
+5. Please follow the template, otherwise we'll have to ask you to update it
+-->
+
+# This is a Bug Report
+
+## Description
+
+- What went wrong?
+- What did you expect should have happened?
+- What was the config you used?
+- What stacktrace or error message from your provider did you see?
+
+Similar or dependent issues:
+
+- #12345
+
+## Additional Data
+
+- **_Serverless Framework Version you're using_**:
+- **_Serverless CLI Version you're using_**:
+- **_Serverless Azure Plugin Version you're using_**:
+- **_Operating System_**:
+- **_Stack Trace_**:
+- **_Provider Error messages_**:
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..4e19c59
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,23 @@
+---
+name: Feature request
+about: Suggest an idea for serverless framework
+---
+
+<!--
+1. Please check if an issue already exists. This feature may have already been requested
+2. Check out and follow our Guidelines: https://github.com/serverless/serverless-azure-functions/CONTRIBUTING.md
+3. Fill out the whole template so we have a good overview on the issue
+4. Do not remove any section of the template. If something is not applicable leave it empty but leave it in the Issue
+5. Please follow the template, otherwise we'll have to ask you to update it
+-->
+
+# This is a Feature Proposal
+
+## Description
+
+- What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
+- If there is additional config how would it look
+
+Similar or dependent issues:
+
+- #12345
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..dc53426
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,51 @@
+<!--
+1. Please check out and follow our Contributing Guidelines: https://github.com/serverless/serverless-azure-functions/CONTRIBUTING.md
+2. Do not remove any section of the template. If something is not applicable leave it empty but leave it in the PR
+3. Please follow the template, otherwise we'll have to ask you to update it and it will take longer until your PR is merged
+-->
+
+## What did you implement:
+
+Closes #XXXXX
+
+<!--
+Briefly describe the feature if no issue exists for this PR
+-->
+
+## How did you implement it:
+
+<!--
+If this is a nontrivial change please briefly describe your implementation so its easy for us to understand and review your code.
+-->
+
+## How can we verify it:
+
+<!--
+Add any applicable config, commands, screenshots or other resources
+to make it easy for us to verify this works. The easier you make it for us
+to review a PR, the faster we can review and merge it.
+
+Examples:
+* serverless.yml - Fully functioning to easily deploy changes
+* Screenshots - Showing the difference between your output and the master
+* Cloud Configuration - List cloud resources and show that the correct configuration is in place (e.g. AWS CLI commands)
+* Other - Anything else that comes to mind to help us evaluate
+-->
+
+## Todos:
+
+_**Note: Run `npm run test:ci` to run all validation checks on proposed changes**_
+
+- [ ] Write tests and confirm existing functionality is not broken.  
+       **Validate via `npm test`**
+- [ ] Write documentation
+- [ ] Ensure there are no lint errors.  
+       **Validate via `npm run lint`**  
+       _Note: Some reported issues can be automatically fixed by running `npm run lint:fix`_
+- [ ] Make sure code coverage hasn't dropped
+- [ ] Provide verification config / commands / resources
+- [ ] Enable "Allow edits from maintainers" for this PR
+- [ ] Update the messages below
+
+**_Is this ready for review?:_** NO  
+**_Is it a breaking change?:_** NO
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..fffd923
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,134 @@
+# Contributing Guidelines
+
+Welcome, and thanks in advance for your help! Please follow these simple guidelines :+1:
+
+# How to contribute to the Serverless Azure Plugin
+
+## When you propose a new feature or bug fix
+
+**Note:** Please make sure to write an issue first and get enough feedback before jumping into a Pull Request!
+
+- Please make sure there is an open issue discussing your contribution
+- If there isn't, please open an issue so we can talk about it before you invest time into the implementation
+- When creating an issue or pull request, follow the template that GitHub shows so that we have enough information about your request
+
+## When you want to work on an existing issue
+
+**Note:** Please write a quick comment in the corresponding issue and ask if the feature is still relevant and that you want to jump into the implementation.
+
+We will do our best to respond/review/merge your PR according to priority. We hope that you stay engaged with us during this period to insure QA. Please note that the PR will be closed if there hasn't been any activity for a long time (~ 30 days) to keep us focused and keep the repo clean.
+
+## Reviewing Pull Requests
+
+Another really useful way to contribute to Serverless is to review other peoples Pull Requests. Having feedback from multiple people is really helpful and reduces the overall time to make a final decision about the Pull Request.
+
+## Writing / improving documentation
+
+Our documentation lives on GitHub in the [docs](docs) directory. Do you see a typo or other ways to improve it? Feel free to edit it and submit a Pull Request!
+
+## Providing support
+
+The easiest thing you can do to help us move forward and make an impact on our progress is to simply provide support to other people having difficulties with their Serverless projects.
+
+You can do that by replying to [issues on Github](https://github.com/serverless/serverless-azure-functions/issues), chatting with other community members in [our Chat](http://chat.serverless.com) or helping with questions in [our Forum](http://forum.serverless.com).
+
+### Commit Message Format
+
+Each commit message consists of a **header**, a **body** and a **footer**.
+
+```text
+<type>: <short description>
+<BLANK LINE>
+<body>
+<BLANK LINE>
+<footer>
+```
+
+### Header
+
+#### Type
+
+Must be one of the following:
+
+* **build**: Changes that affect the build system or external dependencies
+* **ci**: Changes to our CI configuration files and scripts
+* **docs**: Documentation only changes
+* **feat**: A new feature
+* **fix**: A bug fix
+* **perf**: A code change that improves performance
+* **refactor**: A code change that neither fixes a bug nor adds a feature
+* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
+* **test**: Adding missing tests or correcting existing tests
+* **chore**: Updating dependencies
+
+#### Short Description
+
+Contains a succinct description of the change:
+
+* use the imperative, present tense: "change" not "changed" nor "changes"
+* don't capitalize the first letter
+* no dot (.) at the end
+
+### Body
+
+Just as in the **short description**, use the imperative, present tense: "change" not "changed" nor "changes".
+The body should include the motivation for the change and contrast this with previous behavior.
+
+### Footer
+
+The footer should contain any information about **breaking changes** and is also the place to
+reference Azure DevOps user stories/tasks or GitHub issues that this commit **closes**.
+
+### Commit Message Example
+
+```text
+fix: add debouncing to asset scroller to correct browser scroll position
+
+There is no debouncing when we store the asset container's scroll position.
+This results in erratic, jumpy scrolling and a poor user experience. Improve
+stability and usability with debouncing.
+
+closes #123
+```
+
+---
+
+# Code Style
+
+We aim for clean, consistent code style. We're using ESlint to check for codestyle issues.
+
+## Verifying linting style
+
+```
+npm run lint
+```
+
+## Fixing lint issues
+
+```
+npm run lint:fix
+```
+
+To help reduce the effort of creating contributions with this style, an [.editorconfig file](http://editorconfig.org/) is provided that your editor may use to override any conflicting global defaults and automate a subset of the style settings.
+
+# Testing
+
+We aim for a (near) 75% test coverage, so make sure your tests cover as much of your code as possible.
+
+## Test coverage
+
+During development, you can easily check coverage by running `npm test`.
+
+Please follow these Testing guidelines when writing your unit tests:
+
+- Include a top-level `describe('ClassName')` block, with the name of the class you are testing
+- Inside that top-level `describe()` block, create another `describe('#methodOne()')` block for each class method you might create or modify
+- For each method, include an `it('should do something')` test case for each logical edge case in your changes
+- As you write tests, check the code coverage and make sure all lines of code are covered. If not, just add more test cases until everything is covered
+- For reference and inspiration, please check our `tests` directory
+
+---
+
+Thanks again for being a contributor to the Serverless Community :tada:!
+
+Thanks!
\ No newline at end of file
diff --git a/README.md b/README.md
index cd669a0..1e359c2 100644
--- a/README.md
+++ b/README.md
@@ -207,7 +207,7 @@ The getting started walkthrough illustrates the interactive login experience, wh
 
 Please create issues in this repo for any problems or questions you find. Before sending a PR for any major changes, please create an issue to discuss.
 
-We're still in the process of getting everying running 100%, but please refer to the [Serverless contributing guidlines](https://github.com/serverless/serverless/blob/master/CONTRIBUTING.md) for information on how to contribute and code of conduct.
+We're still in the process of getting everying running 100%, but please refer to the [Serverless contributing guidlines](CONTRIBUTING.md) for information on how to contribute and code of conduct.
 
 #### Local dev
 
diff --git a/package-lock.json b/package-lock.json
index 712b014..06f7c89 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-azure-functions",
-  "version": "1.0.0-18",
+  "version": "1.0.0-20",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
diff --git a/package.json b/package.json
index de0a35f..29078cb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-azure-functions",
-  "version": "1.0.0-18",
+  "version": "1.0.0-20",
   "description": "Provider plugin for the Serverless Framework v1.x which adds support for Azure Functions.",
   "license": "MIT",
   "main": "./lib/index.js",
diff --git a/src/models/serverless.ts b/src/models/serverless.ts
index db09448..030fc5e 100644
--- a/src/models/serverless.ts
+++ b/src/models/serverless.ts
@@ -50,7 +50,7 @@ export interface ServerlessAzureProvider {
   hostingEnvironment?: ResourceConfig;
   virtualNetwork?: ResourceConfig;
   armTemplate?: ArmTemplateConfig;
-  runtime: string; 
+  runtime: string;
 }
 
 export interface ServerlessAzureConfig {
@@ -58,6 +58,7 @@ export interface ServerlessAzureConfig {
   provider: ServerlessAzureProvider;
   plugins: string[];
   functions: any;
+  package: any;
 }
 
 export interface ServerlessAzureFunctionConfig {
diff --git a/src/plugins/azureBasePlugin.ts b/src/plugins/azureBasePlugin.ts
index 75b61be..d366814 100644
--- a/src/plugins/azureBasePlugin.ts
+++ b/src/plugins/azureBasePlugin.ts
@@ -1,11 +1,12 @@
 import { Guard } from "../shared/guard";
 import Serverless from "serverless";
 import { Utils } from "../shared/utils";
-import { ServerlessCommandMap, ServerlessHookMap } from "../models/serverless";
+import { ServerlessCommandMap, ServerlessHookMap, ServerlessAzureConfig } from "../models/serverless";
 
 export abstract class AzureBasePlugin<TOptions=Serverless.Options> {
 
   public hooks: ServerlessHookMap
+  protected config: ServerlessAzureConfig;
   protected commands: ServerlessCommandMap;
 
   public constructor(
@@ -13,6 +14,7 @@ export abstract class AzureBasePlugin<TOptions=Serverless.Options> {
     protected options: TOptions,
   ) {
     Guard.null(serverless);
+    this.config = serverless.service as any;
   }
 
   protected log(message: string) {
diff --git a/src/plugins/package/azurePackagePlugin.ts b/src/plugins/package/azurePackagePlugin.ts
index 39a67c3..77b8a64 100644
--- a/src/plugins/package/azurePackagePlugin.ts
+++ b/src/plugins/package/azurePackagePlugin.ts
@@ -25,6 +25,10 @@ export class AzurePackagePlugin extends AzureBasePlugin {
       this.log("No need to create bindings. Using pre-existing package");
       return Promise.resolve();
     }
+    if (this.config.package && this.config.package.individually) {
+      throw new Error("Cannot package Azure Functions individually. " +
+        "Remove `individually` attribute from the `package` section of the serverless config");
+    }
     await this.packageService.createBindings();
     this.bindingsCreated = true;
 
diff --git a/src/services/offlineService.ts b/src/services/offlineService.ts
index 7288c6c..48da80e 100644
--- a/src/services/offlineService.ts
+++ b/src/services/offlineService.ts
@@ -42,13 +42,6 @@ export class OfflineService extends BaseService {
   public async cleanup() {
     this.log("Cleaning up offline files")
     await this.packageService.cleanUp();
-    const filenames = Object.keys(this.localFiles);
-    for (const filename of filenames) {
-      if (fs.existsSync(filename)) {
-        this.log(`Removing file '${filename}'`);
-        fs.unlinkSync(filename)
-      }
-    }
     this.log("Finished cleaning up offline files");
   }
 


Test patch:
diff --git a/src/plugins/package/azurePackagePlugin.test.ts b/src/plugins/package/azurePackagePlugin.test.ts
index d3d3867..e789d44 100644
--- a/src/plugins/package/azurePackagePlugin.test.ts
+++ b/src/plugins/package/azurePackagePlugin.test.ts
@@ -41,6 +41,17 @@ describe("Azure Package Plugin", () => {
     expect(PackageService.prototype.cleanUp).toBeCalled();
   });
 
+  it("Throws an error of package.individually is specified", async () => {
+    const slsService = MockFactory.createTestService();
+    slsService["package"] = { individually: true };
+    sls = MockFactory.createTestServerless({ service: slsService });
+    plugin = new AzurePackagePlugin(sls, MockFactory.createTestServerlessOptions());
+    await expect(invokeHook(plugin, "before:package:setupProviderConfiguration")).rejects.toThrow(
+      "Cannot package Azure Functions individually. " +
+      "Remove `individually` attribute from the `package` section of the serverless config"
+    );
+  });
+
   describe("Package specified in options", () => {
 
     beforeEach(() => {
diff --git a/src/services/offlineService.test.ts b/src/services/offlineService.test.ts
index e9b1427..a26fb24 100644
--- a/src/services/offlineService.test.ts
+++ b/src/services/offlineService.test.ts
@@ -47,7 +47,6 @@ describe("Offline Service", () => {
         MockFactory.createTestBindingsObject(`..${path.sep}${name}.js`)
       );
     }
-    expect(calls[calls.length - 1][0]).toEqual("local.settings.json");
     writeFileSpy.mockRestore();
   });
 
@@ -80,9 +79,9 @@ describe("Offline Service", () => {
     const rmdirSpy = jest.spyOn(fs, "rmdirSync")
     await service.cleanup();
     const unlinkCalls = unlinkSpy.mock.calls;
+    expect(unlinkCalls).toHaveLength(2);
     expect(unlinkCalls[0][0]).toBe(`hello${path.sep}function.json`);
     expect(unlinkCalls[1][0]).toBe(`goodbye${path.sep}function.json`);
-    expect(unlinkCalls[2][0]).toBe("local.settings.json");
     const rmdirCalls = rmdirSpy.mock.calls;
     expect(rmdirCalls[0][0]).toBe("hello");
     expect(rmdirCalls[1][0]).toBe("goodbye");
@@ -193,10 +192,9 @@ describe("Offline Service", () => {
 
     const unlinkCalls = unlinkSpy.mock.calls;
 
-    expect(unlinkCalls).toHaveLength(3);
+    expect(unlinkCalls).toHaveLength(2);
     expect(unlinkCalls[0][0]).toBe(`hello${path.sep}function.json`);
     expect(unlinkCalls[1][0]).toBe(`goodbye${path.sep}function.json`);
-    expect(unlinkCalls[2][0]).toBe("local.settings.json");
 
     const rmdirCalls = rmdirSpy.mock.calls;