mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Use correct docker base image for csproj projects. Fixes #574.
This commit is contained in:
@@ -30,7 +30,8 @@ const templates: { [key: string]: { dir: string, dotNetNewId: string, displayNam
|
|||||||
};
|
};
|
||||||
|
|
||||||
function isTextFile(filename: string): boolean {
|
function isTextFile(filename: string): boolean {
|
||||||
return textFileExtensions.indexOf(path.extname(filename).toLowerCase()) >= 0;
|
return textFileExtensions.indexOf(path.extname(filename).toLowerCase()) >= 0
|
||||||
|
|| textFileExtensions.indexOf(path.basename(filename)) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeFileEnsuringDirExists(root: string, filename: string, contents: string | Buffer) {
|
function writeFileEnsuringDirExists(root: string, filename: string, contents: string | Buffer) {
|
||||||
@@ -92,6 +93,9 @@ function buildYeomanNpmPackage(outputRoot: string) {
|
|||||||
{ from: /.*\.csproj$/, to: 'tokenreplace-namePascalCase.csproj' }
|
{ from: /.*\.csproj$/, to: 'tokenreplace-namePascalCase.csproj' }
|
||||||
];
|
];
|
||||||
const contentReplacements = [
|
const contentReplacements = [
|
||||||
|
// Dockerfile items
|
||||||
|
{ from: /FROM microsoft\/dotnet:1.1.0-sdk-projectjson/g, to: 'FROM <%= dockerBaseImage %>' },
|
||||||
|
|
||||||
// .xproj items
|
// .xproj items
|
||||||
{ from: /\bWebApplicationBasic\b/g, to: '<%= namePascalCase %>' },
|
{ from: /\bWebApplicationBasic\b/g, to: '<%= namePascalCase %>' },
|
||||||
{ from: /<ProjectGuid>[0-9a-f\-]{36}<\/ProjectGuid>/g, to: '<ProjectGuid><%= projectGuid %></ProjectGuid>' },
|
{ from: /<ProjectGuid>[0-9a-f\-]{36}<\/ProjectGuid>/g, to: '<ProjectGuid><%= projectGuid %></ProjectGuid>' },
|
||||||
|
|||||||
@@ -50,11 +50,13 @@ const templates = [
|
|||||||
const sdkChoices = [{
|
const sdkChoices = [{
|
||||||
value: '1.0.0-preview2-1-003177', // Current released version
|
value: '1.0.0-preview2-1-003177', // Current released version
|
||||||
name: 'project.json' + chalk.gray(' (compatible with .NET Core tooling preview 2 and Visual Studio 2015)'),
|
name: 'project.json' + chalk.gray(' (compatible with .NET Core tooling preview 2 and Visual Studio 2015)'),
|
||||||
includeFiles: [/^project.json$/, /\.xproj$/, /_placeholder.txt$/, /\.deployment$/]
|
includeFiles: [/^project.json$/, /\.xproj$/, /_placeholder.txt$/, /\.deployment$/],
|
||||||
|
dockerBaseImage: 'microsoft/dotnet:1.1.0-sdk-projectjson'
|
||||||
}, {
|
}, {
|
||||||
value: '1.0.0-preview3-004056', // Version that ships with VS2017RC
|
value: '1.0.0-preview3-004056', // Version that ships with VS2017RC
|
||||||
name: '.csproj' + chalk.gray(' (compatible with .NET Core tooling preview 3 and Visual Studio 2017)'),
|
name: '.csproj' + chalk.gray(' (compatible with .NET Core tooling preview 3 and Visual Studio 2017)'),
|
||||||
includeFiles: [/\.csproj$/]
|
includeFiles: [/\.csproj$/],
|
||||||
|
dockerBaseImage: 'microsoft/dotnet:1.1.0-sdk-msbuild'
|
||||||
}];
|
}];
|
||||||
|
|
||||||
class MyGenerator extends yeoman.Base {
|
class MyGenerator extends yeoman.Base {
|
||||||
@@ -110,6 +112,10 @@ class MyGenerator extends yeoman.Base {
|
|||||||
this._answers.sdkVersion = firstAnswers.sdkVersion;
|
this._answers.sdkVersion = firstAnswers.sdkVersion;
|
||||||
this._answers.namePascalCase = toPascalCase(answers.name);
|
this._answers.namePascalCase = toPascalCase(answers.name);
|
||||||
this._answers.projectGuid = this.options['projectguid'] || uuid.v4();
|
this._answers.projectGuid = this.options['projectguid'] || uuid.v4();
|
||||||
|
|
||||||
|
const chosenSdk = sdkChoices.filter(sdk => sdk.value === this._answers.sdkVersion)[0];
|
||||||
|
this._answers.dockerBaseImage = chosenSdk.dockerBaseImage;
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "generator-aspnetcore-spa",
|
"name": "generator-aspnetcore-spa",
|
||||||
"version": "0.7.3",
|
"version": "0.7.4",
|
||||||
"description": "Single-Page App templates for ASP.NET Core",
|
"description": "Single-Page App templates for ASP.NET Core",
|
||||||
"author": "Microsoft",
|
"author": "Microsoft",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user