Stop generating .template.config files dynamically. Convert them to plain files on disk.

This commit is contained in:
Steve Sanderson 2017-08-22 18:06:48 -07:00
Родитель 900e9ca835
Коммит 7c52be5e42
19 изменённых файлов: 750 добавлений и 136 удалений

Просмотреть файл

@ -0,0 +1,17 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"TargetFrameworkOverride": {
"isHidden": "true",
"longName": "target-framework-override",
"shortName": ""
},
"Framework": {
"longName": "framework"
},
"skipRestore": {
"longName": "no-restore",
"shortName": ""
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
{
"author": "Microsoft",
"classifications": [
"Web",
"MVC",
"SPA"
],
"groupIdentity": "Microsoft.DotNet.Web.Spa.ProjectTemplates.Angular",
"identity": "Microsoft.DotNet.Web.Spa.ProjectTemplates.Angular.CSharp",
"name": "ASP.NET Core with Angular",
"preferNameDirectory": true,
"primaryOutputs": [
{
"path": "WebApplicationBasic.csproj"
}
],
"shortName": "angular",
"sourceName": "WebApplicationBasic",
"sources": [
{
"source": "./",
"target": "./",
"exclude": [
".template.config/**"
]
}
],
"symbols": {
"TargetFrameworkOverride": {
"type": "parameter",
"description": "Overrides the target framework",
"replaces": "TargetFrameworkOverride",
"datatype": "string",
"defaultValue": ""
},
"Framework": {
"type": "parameter",
"description": "The target framework for the project.",
"datatype": "choice",
"choices": [
{
"choice": "netcoreapp2.0",
"description": "Target netcoreapp2.0"
}
],
"replaces": "netcoreapp2.0",
"defaultValue": "netcoreapp2.0"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
},
"skipRestore": {
"type": "parameter",
"datatype": "bool",
"description": "If specified, skips the automatic restore of the project on create.",
"defaultValue": "false"
}
},
"tags": {
"language": "C#",
"type": "project"
},
"postActions": [
{
"condition": "(!skipRestore)",
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{
"text": "Run 'dotnet restore'"
}
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\")",
"actionId": "AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C",
"description": "\n\n-------------------------------------------------------------------\nIMPORTANT: Before running this project on the command line,\n you must restore NPM packages by running \"npm install\"\n-------------------------------------------------------------------\n",
"manualInstructions": [
{
"text": "Run \"npm install\""
}
]
}
]
}

Просмотреть файл

@ -0,0 +1,20 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "Angular",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1100"
},
"description": {
"text": "A project template for creating an ASP.NET Core application with Angular",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1101"
},
"order": 301,
"icon": "icon.png",
"learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
"uiFilters": [
"oneaspnet"
],
"minFullFrameworkVersion": "4.6.1"
}

Просмотреть файл

@ -0,0 +1,17 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"TargetFrameworkOverride": {
"isHidden": "true",
"longName": "target-framework-override",
"shortName": ""
},
"Framework": {
"longName": "framework"
},
"skipRestore": {
"longName": "no-restore",
"shortName": ""
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
{
"author": "Microsoft",
"classifications": [
"Web",
"MVC",
"SPA"
],
"groupIdentity": "Microsoft.AspNetCore.SpaTemplates.Aurelia",
"identity": "Microsoft.AspNetCore.SpaTemplates.Aurelia.CSharp",
"name": "ASP.NET Core with Aurelia",
"preferNameDirectory": true,
"primaryOutputs": [
{
"path": "WebApplicationBasic.csproj"
}
],
"shortName": "aurelia",
"sourceName": "WebApplicationBasic",
"sources": [
{
"source": "./",
"target": "./",
"exclude": [
".template.config/**"
]
}
],
"symbols": {
"TargetFrameworkOverride": {
"type": "parameter",
"description": "Overrides the target framework",
"replaces": "TargetFrameworkOverride",
"datatype": "string",
"defaultValue": ""
},
"Framework": {
"type": "parameter",
"description": "The target framework for the project.",
"datatype": "choice",
"choices": [
{
"choice": "netcoreapp2.0",
"description": "Target netcoreapp2.0"
}
],
"replaces": "netcoreapp2.0",
"defaultValue": "netcoreapp2.0"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
},
"skipRestore": {
"type": "parameter",
"datatype": "bool",
"description": "If specified, skips the automatic restore of the project on create.",
"defaultValue": "false"
}
},
"tags": {
"language": "C#",
"type": "project"
},
"postActions": [
{
"condition": "(!skipRestore)",
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{
"text": "Run 'dotnet restore'"
}
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\")",
"actionId": "AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C",
"description": "\n\n-------------------------------------------------------------------\nIMPORTANT: Before running this project on the command line,\n you must restore NPM packages by running \"npm install\"\n-------------------------------------------------------------------\n",
"manualInstructions": [
{
"text": "Run \"npm install\""
}
]
}
]
}

Просмотреть файл

@ -0,0 +1,20 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "Aurelia",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1200"
},
"description": {
"text": "A project template for creating an ASP.NET Core application with Aurelia",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1201"
},
"order": 301,
"icon": "icon.png",
"learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
"uiFilters": [
"oneaspnet"
],
"minFullFrameworkVersion": "4.6.1"
}

Просмотреть файл

@ -0,0 +1,17 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"TargetFrameworkOverride": {
"isHidden": "true",
"longName": "target-framework-override",
"shortName": ""
},
"Framework": {
"longName": "framework"
},
"skipRestore": {
"longName": "no-restore",
"shortName": ""
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
{
"author": "Microsoft",
"classifications": [
"Web",
"MVC",
"SPA"
],
"groupIdentity": "Microsoft.AspNetCore.SpaTemplates.Knockout",
"identity": "Microsoft.AspNetCore.SpaTemplates.Knockout.CSharp",
"name": "ASP.NET Core with Knockout.js",
"preferNameDirectory": true,
"primaryOutputs": [
{
"path": "WebApplicationBasic.csproj"
}
],
"shortName": "knockout",
"sourceName": "WebApplicationBasic",
"sources": [
{
"source": "./",
"target": "./",
"exclude": [
".template.config/**"
]
}
],
"symbols": {
"TargetFrameworkOverride": {
"type": "parameter",
"description": "Overrides the target framework",
"replaces": "TargetFrameworkOverride",
"datatype": "string",
"defaultValue": ""
},
"Framework": {
"type": "parameter",
"description": "The target framework for the project.",
"datatype": "choice",
"choices": [
{
"choice": "netcoreapp2.0",
"description": "Target netcoreapp2.0"
}
],
"replaces": "netcoreapp2.0",
"defaultValue": "netcoreapp2.0"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
},
"skipRestore": {
"type": "parameter",
"datatype": "bool",
"description": "If specified, skips the automatic restore of the project on create.",
"defaultValue": "false"
}
},
"tags": {
"language": "C#",
"type": "project"
},
"postActions": [
{
"condition": "(!skipRestore)",
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{
"text": "Run 'dotnet restore'"
}
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\")",
"actionId": "AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C",
"description": "\n\n-------------------------------------------------------------------\nIMPORTANT: Before running this project on the command line,\n you must restore NPM packages by running \"npm install\"\n-------------------------------------------------------------------\n",
"manualInstructions": [
{
"text": "Run \"npm install\""
}
]
}
]
}

Просмотреть файл

@ -0,0 +1,20 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "Knockout.js",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1300"
},
"description": {
"text": "A project template for creating an ASP.NET Core application with Knockout.js",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1301"
},
"order": 301,
"icon": "icon.png",
"learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
"uiFilters": [
"oneaspnet"
],
"minFullFrameworkVersion": "4.6.1"
}

Просмотреть файл

@ -0,0 +1,17 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"TargetFrameworkOverride": {
"isHidden": "true",
"longName": "target-framework-override",
"shortName": ""
},
"Framework": {
"longName": "framework"
},
"skipRestore": {
"longName": "no-restore",
"shortName": ""
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
{
"author": "Microsoft",
"classifications": [
"Web",
"MVC",
"SPA"
],
"groupIdentity": "Microsoft.DotNet.Web.Spa.ProjectTemplates.ReactRedux",
"identity": "Microsoft.DotNet.Web.Spa.ProjectTemplates.ReactRedux.CSharp",
"name": "ASP.NET Core with React.js and Redux",
"preferNameDirectory": true,
"primaryOutputs": [
{
"path": "WebApplicationBasic.csproj"
}
],
"shortName": "reactredux",
"sourceName": "WebApplicationBasic",
"sources": [
{
"source": "./",
"target": "./",
"exclude": [
".template.config/**"
]
}
],
"symbols": {
"TargetFrameworkOverride": {
"type": "parameter",
"description": "Overrides the target framework",
"replaces": "TargetFrameworkOverride",
"datatype": "string",
"defaultValue": ""
},
"Framework": {
"type": "parameter",
"description": "The target framework for the project.",
"datatype": "choice",
"choices": [
{
"choice": "netcoreapp2.0",
"description": "Target netcoreapp2.0"
}
],
"replaces": "netcoreapp2.0",
"defaultValue": "netcoreapp2.0"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
},
"skipRestore": {
"type": "parameter",
"datatype": "bool",
"description": "If specified, skips the automatic restore of the project on create.",
"defaultValue": "false"
}
},
"tags": {
"language": "C#",
"type": "project"
},
"postActions": [
{
"condition": "(!skipRestore)",
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{
"text": "Run 'dotnet restore'"
}
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\")",
"actionId": "AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C",
"description": "\n\n-------------------------------------------------------------------\nIMPORTANT: Before running this project on the command line,\n you must restore NPM packages by running \"npm install\"\n-------------------------------------------------------------------\n",
"manualInstructions": [
{
"text": "Run \"npm install\""
}
]
}
]
}

Просмотреть файл

@ -0,0 +1,20 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "React.js and Redux",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1400"
},
"description": {
"text": "A project template for creating an ASP.NET Core application with React.js and Redux",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1401"
},
"order": 301,
"icon": "icon.png",
"learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
"uiFilters": [
"oneaspnet"
],
"minFullFrameworkVersion": "4.6.1"
}

Просмотреть файл

@ -0,0 +1,17 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"TargetFrameworkOverride": {
"isHidden": "true",
"longName": "target-framework-override",
"shortName": ""
},
"Framework": {
"longName": "framework"
},
"skipRestore": {
"longName": "no-restore",
"shortName": ""
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
{
"author": "Microsoft",
"classifications": [
"Web",
"MVC",
"SPA"
],
"groupIdentity": "Microsoft.DotNet.Web.Spa.ProjectTemplates.React",
"identity": "Microsoft.DotNet.Web.Spa.ProjectTemplates.React.CSharp",
"name": "ASP.NET Core with React.js",
"preferNameDirectory": true,
"primaryOutputs": [
{
"path": "WebApplicationBasic.csproj"
}
],
"shortName": "react",
"sourceName": "WebApplicationBasic",
"sources": [
{
"source": "./",
"target": "./",
"exclude": [
".template.config/**"
]
}
],
"symbols": {
"TargetFrameworkOverride": {
"type": "parameter",
"description": "Overrides the target framework",
"replaces": "TargetFrameworkOverride",
"datatype": "string",
"defaultValue": ""
},
"Framework": {
"type": "parameter",
"description": "The target framework for the project.",
"datatype": "choice",
"choices": [
{
"choice": "netcoreapp2.0",
"description": "Target netcoreapp2.0"
}
],
"replaces": "netcoreapp2.0",
"defaultValue": "netcoreapp2.0"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
},
"skipRestore": {
"type": "parameter",
"datatype": "bool",
"description": "If specified, skips the automatic restore of the project on create.",
"defaultValue": "false"
}
},
"tags": {
"language": "C#",
"type": "project"
},
"postActions": [
{
"condition": "(!skipRestore)",
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{
"text": "Run 'dotnet restore'"
}
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\")",
"actionId": "AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C",
"description": "\n\n-------------------------------------------------------------------\nIMPORTANT: Before running this project on the command line,\n you must restore NPM packages by running \"npm install\"\n-------------------------------------------------------------------\n",
"manualInstructions": [
{
"text": "Run \"npm install\""
}
]
}
]
}

Просмотреть файл

@ -0,0 +1,20 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "React.js",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1500"
},
"description": {
"text": "A project template for creating an ASP.NET Core application with React.js",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1501"
},
"order": 301,
"icon": "icon.png",
"learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
"uiFilters": [
"oneaspnet"
],
"minFullFrameworkVersion": "4.6.1"
}

Просмотреть файл

@ -0,0 +1,17 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"TargetFrameworkOverride": {
"isHidden": "true",
"longName": "target-framework-override",
"shortName": ""
},
"Framework": {
"longName": "framework"
},
"skipRestore": {
"longName": "no-restore",
"shortName": ""
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
{
"author": "Microsoft",
"classifications": [
"Web",
"MVC",
"SPA"
],
"groupIdentity": "Microsoft.AspNetCore.SpaTemplates.Vue",
"identity": "Microsoft.AspNetCore.SpaTemplates.Vue.CSharp",
"name": "ASP.NET Core with Vue.js",
"preferNameDirectory": true,
"primaryOutputs": [
{
"path": "WebApplicationBasic.csproj"
}
],
"shortName": "vue",
"sourceName": "WebApplicationBasic",
"sources": [
{
"source": "./",
"target": "./",
"exclude": [
".template.config/**"
]
}
],
"symbols": {
"TargetFrameworkOverride": {
"type": "parameter",
"description": "Overrides the target framework",
"replaces": "TargetFrameworkOverride",
"datatype": "string",
"defaultValue": ""
},
"Framework": {
"type": "parameter",
"description": "The target framework for the project.",
"datatype": "choice",
"choices": [
{
"choice": "netcoreapp2.0",
"description": "Target netcoreapp2.0"
}
],
"replaces": "netcoreapp2.0",
"defaultValue": "netcoreapp2.0"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
},
"skipRestore": {
"type": "parameter",
"datatype": "bool",
"description": "If specified, skips the automatic restore of the project on create.",
"defaultValue": "false"
}
},
"tags": {
"language": "C#",
"type": "project"
},
"postActions": [
{
"condition": "(!skipRestore)",
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{
"text": "Run 'dotnet restore'"
}
],
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"continueOnError": true
},
{
"condition": "(HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\")",
"actionId": "AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C",
"description": "\n\n-------------------------------------------------------------------\nIMPORTANT: Before running this project on the command line,\n you must restore NPM packages by running \"npm install\"\n-------------------------------------------------------------------\n",
"manualInstructions": [
{
"text": "Run \"npm install\""
}
]
}
]
}

Просмотреть файл

@ -0,0 +1,20 @@
{
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"name": {
"text": "Vue.js",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1600"
},
"description": {
"text": "A project template for creating an ASP.NET Core application with Vue.js",
"package": "{0CD94836-1526-4E85-87D3-FB5274C5AFC9}",
"id": "1601"
},
"order": 301,
"icon": "icon.png",
"learnMoreLink": "https://github.com/aspnet/JavaScriptServices",
"uiFilters": [
"oneaspnet"
],
"minFullFrameworkVersion": "4.6.1"
}

Просмотреть файл

@ -10,7 +10,6 @@ import * as targz from 'tar.gz';
const isWindows = /^win/.test(process.platform);
const textFileExtensions = ['.gitignore', 'template_gitignore', '.config', '.cs', '.cshtml', '.csproj', '.html', '.js', '.json', '.jsx', '.md', '.nuspec', '.ts', '.tsx'];
const webToolsVSPackageGuid = '{0CD94836-1526-4E85-87D3-FB5274C5AFC9}';
const dotNetPackages = {
builtIn: 'Microsoft.DotNet.Web.Spa.ProjectTemplates',
@ -19,19 +18,16 @@ const dotNetPackages = {
interface TemplateConfig {
dir: string;
dotNetNewId: string;
dotNetPackageId: string;
displayName: string;
localizationIdStart: number;
}
const templates: { [key: string]: TemplateConfig } = {
'angular': { dotNetPackageId: dotNetPackages.builtIn, dir: '../../templates/AngularSpa/', dotNetNewId: 'Angular', displayName: 'Angular', localizationIdStart: 1100 },
'aurelia': { dotNetPackageId: dotNetPackages.extra, dir: '../../templates/AureliaSpa/', dotNetNewId: 'Aurelia', displayName: 'Aurelia', localizationIdStart: 1200 },
'knockout': { dotNetPackageId: dotNetPackages.extra, dir: '../../templates/KnockoutSpa/', dotNetNewId: 'Knockout', displayName: 'Knockout.js', localizationIdStart: 1300 },
'react-redux': { dotNetPackageId: dotNetPackages.builtIn, dir: '../../templates/ReactReduxSpa/', dotNetNewId: 'ReactRedux', displayName: 'React.js and Redux', localizationIdStart: 1400 },
'react': { dotNetPackageId: dotNetPackages.builtIn, dir: '../../templates/ReactSpa/', dotNetNewId: 'React', displayName: 'React.js', localizationIdStart: 1500 },
'vue': { dotNetPackageId: dotNetPackages.extra, dir: '../../templates/VueSpa/', dotNetNewId: 'Vue', displayName: 'Vue.js', localizationIdStart: 1600 }
'angular': { dotNetPackageId: dotNetPackages.builtIn, dir: '../../templates/AngularSpa/' },
'aurelia': { dotNetPackageId: dotNetPackages.extra, dir: '../../templates/AureliaSpa/' },
'knockout': { dotNetPackageId: dotNetPackages.extra, dir: '../../templates/KnockoutSpa/' },
'react-redux': { dotNetPackageId: dotNetPackages.builtIn, dir: '../../templates/ReactReduxSpa/' },
'react': { dotNetPackageId: dotNetPackages.builtIn, dir: '../../templates/ReactSpa/' },
'vue': { dotNetPackageId: dotNetPackages.extra, dir: '../../templates/VueSpa/' }
};
function isTextFile(filename: string): boolean {
@ -129,123 +125,6 @@ function buildDotNetNewNuGetPackage(packageId: string) {
const templateOutputDir = path.join(outputRoot, 'Content', templateName);
writeTemplate(templateConfig.dir, templateOutputDir, contentReplacements, filenameReplacements);
// Add the .template.config dir and its contents
const templateConfigDir = path.join(templateOutputDir, '.template.config');
mkdirp.sync(templateConfigDir);
fs.writeFileSync(path.join(templateConfigDir, 'template.json'), JSON.stringify({
author: 'Microsoft',
classifications: ['Web', 'MVC', 'SPA'],
groupIdentity: `${packageId}.${templateConfig.dotNetNewId}`,
identity: `${packageId}.${templateConfig.dotNetNewId}.CSharp`,
name: `ASP.NET Core with ${templateConfig.displayName}`,
preferNameDirectory: true,
primaryOutputs: [{ path: `${sourceProjectName}.csproj` }],
shortName: `${templateConfig.dotNetNewId.toLowerCase()}`,
sourceName: sourceProjectName,
sources: [{
source: './',
target: './',
exclude: ['.template.config/**']
}],
symbols: {
TargetFrameworkOverride: {
type: 'parameter',
description: 'Overrides the target framework',
replaces: 'TargetFrameworkOverride',
datatype: 'string',
defaultValue: ''
},
Framework: {
type: 'parameter',
description: 'The target framework for the project.',
datatype: 'choice',
choices: [
{
choice: 'netcoreapp2.0',
description: 'Target netcoreapp2.0'
}
],
replaces: 'netcoreapp2.0',
defaultValue: 'netcoreapp2.0'
},
HostIdentifier: {
type: 'bind',
binding: 'HostIdentifier'
},
skipRestore: {
type: 'parameter',
datatype: 'bool',
description: 'If specified, skips the automatic restore of the project on create.',
defaultValue: 'false'
}
},
tags: { language: 'C#', type: 'project' },
postActions: [
{
condition: '(!skipRestore)',
description: 'Restore NuGet packages required by this project.',
manualInstructions: [{ text: 'Run \'dotnet restore\'' }],
actionId: '210D431B-A78B-4D2F-B762-4ED3E3EA9025',
continueOnError: true
},
/*
// Currently it doesn't appear to be possible to run `npm install` from a
// postAction, due to https://github.com/dotnet/templating/issues/849
// We will re-enable this when that bug is fixed.
{
condition: '(!skipRestore)',
description: 'Restores NPM packages required by this project.',
manualInstructions: [{ text: 'Run \'npm install\'' }],
actionId: '3A7C4B45-1F5D-4A30-959A-51B88E82B5D2',
args: { executable: 'npm', args: 'install' },
continueOnError: false
}
*/
{
// For the preview2 release, just display manual instructions instead.
// This is only applicable on the command line, because VS will restore
// NPM packages automatically by default.
condition: '(HostIdentifier == "dotnetcli" || HostIdentifier == "dotnetcli-preview")',
actionId: 'AC1156F7-BB77-4DB8-B28F-24EEBCCA1E5C',
description: '\n\n-------------------------------------------------------------------\nIMPORTANT: Before running this project on the command line,\n you must restore NPM packages by running "npm install"\n-------------------------------------------------------------------\n',
manualInstructions: [{ text: 'Run "npm install"' }]
}
],
}, null, 2));
fs.writeFileSync(path.join(templateConfigDir, 'dotnetcli.host.json'), JSON.stringify({
$schema: 'http://json.schemastore.org/dotnetcli.host',
symbolInfo: {
TargetFrameworkOverride: {
isHidden: 'true',
longName: 'target-framework-override',
shortName: ''
},
Framework: {
longName: 'framework'
},
skipRestore: {
longName: 'no-restore',
shortName: ''
},
}
}, null, 2));
const localisedNameId = templateConfig.localizationIdStart + 0;
const localisedDescId = templateConfig.localizationIdStart + 1;
fs.writeFileSync(path.join(templateConfigDir, 'vs-2017.3.host.json'), JSON.stringify({
$schema: 'http://json.schemastore.org/vs-2017.3.host',
name: { text: templateConfig.displayName, package: webToolsVSPackageGuid, id: localisedNameId.toString() },
description: { text: `A project template for creating an ASP.NET Core application with ${templateConfig.displayName}`, package: webToolsVSPackageGuid, id: localisedDescId.toString() },
order: 301,
icon: 'icon.png',
learnMoreLink: 'https://github.com/aspnet/JavaScriptServices',
uiFilters: [ 'oneaspnet' ],
minFullFrameworkVersion: '4.6.1'
}, null, 2));
});
// Create the .nuspec file
@ -274,15 +153,6 @@ function buildDotNetNewNuGetPackage(packageId: string) {
return glob.sync(path.join(outputRoot, './*.nupkg'))[0];
}
function runPrepublishScripts(rootDir: string, scripts: string[]) {
console.log(`[Prepublish] In directory: ${ rootDir }`);
scripts.forEach(script => {
console.log(`[Prepublish] Running: ${ script }`);
childProcess.execSync(script, { cwd: rootDir, stdio: 'inherit' });
});
console.log(`[Prepublish] Done`)
}
const distDir = './dist';
const artifactsDir = path.join(distDir, 'artifacts');