Skip to content

Commit a7ff928

Browse files
committed
Fix spelling and reorder interface
Small fix to spelling and reordering to put private methods last based on review comments.
1 parent 81ba3db commit a7ff928

1 file changed

Lines changed: 58 additions & 58 deletions

File tree

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
//*********************************************************//
2-
// Copyright (c) Microsoft. All rights reserved.
3-
//
4-
// Apache 2.0 License
5-
//
6-
// You may obtain a copy of the License at
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12-
// implied. See the License for the specific language governing
13-
// permissions and limitations under the License.
14-
//
15-
//*********************************************************//
16-
17-
using System;
18-
using System.Collections.Generic;
19-
using System.Text.RegularExpressions;
20-
using EnvDTE;
21-
using Microsoft.VisualStudio.TemplateWizard;
1+
//*********************************************************//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
4+
// Apache 2.0 License
5+
//
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
// implied. See the License for the specific language governing
13+
// permissions and limitations under the License.
14+
//
15+
//*********************************************************//
16+
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Text.RegularExpressions;
20+
using EnvDTE;
21+
using Microsoft.VisualStudio.TemplateWizard;
22+
23+
namespace Microsoft.NodejsTools.ProjectWizard {
24+
class NodejsPackageParametersExtension : IWizard {
25+
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) {
26+
var projectName = replacementsDictionary["$projectname$"];
27+
replacementsDictionary.Add("$npmsafeprojectname$", NormalizeNpmPackageName(projectName));
28+
}
29+
30+
public void ProjectFinishedGenerating(EnvDTE.Project project) {
31+
return;
32+
}
33+
34+
public void ProjectItemFinishedGenerating(ProjectItem projectItem) {
35+
return;
36+
}
37+
38+
public bool ShouldAddProjectItem(string filePath) {
39+
return true;
40+
}
41+
42+
public void BeforeOpeningFile(ProjectItem projectItem) {
43+
return;
44+
}
45+
46+
public void RunFinished() {
47+
return;
48+
}
49+
50+
private const int NpmPackageNameMaxLength = 214;
2251

23-
namespace Microsoft.NodejsTools.ProjectWizard {
24-
class NodejsPackageParametersExtension : IWizard {
25-
private const int NpmPackageNameMaxLength = 214;
26-
2752
/// <summary>
28-
/// Normalize a project name to be a valid Npm package name.
53+
/// Normalize a project name to be a valid Npm package name: https://docs.npmjs.com/files/package.json#name
2954
/// </summary>
3055
/// <param name="projectName">Name of a VS project.</param>
3156
private static string NormalizeNpmPackageName(string projectName) {
3257
// Remove all leading url-invalid, underscore, and period characters
33-
var npmProjectNameTransform = Regex.Replace(projectName, "^[^a-zA-Z0-9-~]*", string.Empty);
34-
35-
// Replace all invalid characters with a dash
58+
var npmProjectNameTransform = Regex.Replace(projectName, "^[^a-zA-Z0-9-~]*", string.Empty);
59+
60+
// Replace all invalid characters with a dash
3661
npmProjectNameTransform = Regex.Replace(npmProjectNameTransform, "[^a-zA-Z0-9-_~.]", "-");
3762

38-
// insert hypens between camelcased sections.
63+
// Insert hyphens between camelcased sections.
3964
npmProjectNameTransform = Regex.Replace(npmProjectNameTransform, "([a-z0-9])([A-Z])", "$1-$2").ToLowerInvariant();
4065

4166
return npmProjectNameTransform.Substring(0, Math.Min(npmProjectNameTransform.Length, NpmPackageNameMaxLength));
42-
}
43-
44-
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) {
45-
var projectName = replacementsDictionary["$projectname$"];
46-
replacementsDictionary.Add("$npmsafeprojectname$", NormalizeNpmPackageName(projectName));
47-
}
48-
49-
public void ProjectFinishedGenerating(EnvDTE.Project project) {
50-
return;
51-
}
52-
53-
public void ProjectItemFinishedGenerating(ProjectItem projectItem) {
54-
return;
55-
}
56-
57-
public bool ShouldAddProjectItem(string filePath) {
58-
return true;
59-
}
60-
61-
public void BeforeOpeningFile(ProjectItem projectItem) {
62-
return;
63-
}
64-
65-
public void RunFinished() {
66-
return;
67-
}
68-
}
69-
}
67+
}
68+
}
69+
}

0 commit comments

Comments
 (0)