-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "revert(init-templates): csharp and fsharp app init fails when…
- Loading branch information
Showing
7 changed files
with
99 additions
and
137 deletions.
There are no files selected for viewing
32 changes: 6 additions & 26 deletions
32
packages/aws-cdk/lib/init-templates/app/csharp/add-project.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
import * as child_process from 'child_process'; | ||
import * as path from 'path'; | ||
import { InvokeHook } from '../../../init'; | ||
import { shell } from '../../../os'; | ||
|
||
export const invoke: InvokeHook = async (targetDirectory: string) => { | ||
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln'); | ||
const csprojPath = path.join(targetDirectory, 'src', '%name.PascalCased%', '%name.PascalCased%.csproj'); | ||
|
||
const child = child_process.spawn('dotnet', ['sln', slnPath, 'add', csprojPath], { | ||
// Need this for Windows where we want .cmd and .bat to be found as well. | ||
shell: true, | ||
stdio: ['ignore', 'pipe', 'inherit'], | ||
}); | ||
|
||
await new Promise<string>((resolve, reject) => { | ||
const stdout = new Array<any>(); | ||
|
||
child.stdout.on('data', chunk => { | ||
process.stdout.write(chunk); | ||
stdout.push(chunk); | ||
}); | ||
|
||
child.once('error', reject); | ||
|
||
child.once('exit', code => { | ||
if (code === 0) { | ||
resolve(Buffer.concat(stdout).toString('utf-8')); | ||
} else { | ||
reject(new Error(`Could not add project %name.PascalCased%.csproj to solution %name.PascalCased%.sln. Error code: ${code}`)); | ||
} | ||
}); | ||
}); | ||
try { | ||
await shell(['dotnet', 'sln', slnPath, 'add', csprojPath]); | ||
} catch (e) { | ||
throw new Error(`Could not add project %name.PascalCased%.csproj to solution %name.PascalCased%.sln. ${e.message}`); | ||
} | ||
}; |
32 changes: 6 additions & 26 deletions
32
packages/aws-cdk/lib/init-templates/app/fsharp/add-project.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
import * as child_process from 'child_process'; | ||
import * as path from 'path'; | ||
import { InvokeHook } from '../../../init'; | ||
import { shell } from '../../../os'; | ||
|
||
export const invoke: InvokeHook = async (targetDirectory: string) => { | ||
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln'); | ||
const fsprojPath = path.join(targetDirectory, 'src', '%name.PascalCased%', '%name.PascalCased%.fsproj'); | ||
|
||
const child = child_process.spawn('dotnet', ['sln', slnPath, 'add', fsprojPath], { | ||
// Need this for Windows where we want .cmd and .bat to be found as well. | ||
shell: true, | ||
stdio: ['ignore', 'pipe', 'inherit'], | ||
}); | ||
|
||
await new Promise<string>((resolve, reject) => { | ||
const stdout = new Array<any>(); | ||
|
||
child.stdout.on('data', chunk => { | ||
process.stdout.write(chunk); | ||
stdout.push(chunk); | ||
}); | ||
|
||
child.once('error', reject); | ||
|
||
child.once('exit', code => { | ||
if (code === 0) { | ||
resolve(Buffer.concat(stdout).toString('utf-8')); | ||
} else { | ||
reject(new Error(`Could not add project %name.PascalCased%.fsproj to solution %name.PascalCased%.sln. Error code: ${code}`)); | ||
} | ||
}); | ||
}); | ||
try { | ||
await shell(['dotnet', 'sln', slnPath, 'add', fsprojPath]); | ||
} catch (e) { | ||
throw new Error(`Could not add project %name.PascalCased%.fsproj to solution %name.PascalCased%.sln. ${e.message}`); | ||
} | ||
}; |
32 changes: 6 additions & 26 deletions
32
packages/aws-cdk/lib/init-templates/sample-app/csharp/add-project.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
import * as child_process from 'child_process'; | ||
import * as path from 'path'; | ||
import { InvokeHook } from '../../../init'; | ||
import { shell } from '../../../os'; | ||
|
||
export const invoke: InvokeHook = async (targetDirectory: string) => { | ||
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln'); | ||
const csprojPath = path.join(targetDirectory, 'src', '%name.PascalCased%', '%name.PascalCased%.csproj'); | ||
|
||
const child = child_process.spawn('dotnet', ['sln', slnPath, 'add', csprojPath], { | ||
// Need this for Windows where we want .cmd and .bat to be found as well. | ||
shell: true, | ||
stdio: ['ignore', 'pipe', 'inherit'], | ||
}); | ||
|
||
await new Promise<string>((resolve, reject) => { | ||
const stdout = new Array<any>(); | ||
|
||
child.stdout.on('data', chunk => { | ||
process.stdout.write(chunk); | ||
stdout.push(chunk); | ||
}); | ||
|
||
child.once('error', reject); | ||
|
||
child.once('exit', code => { | ||
if (code === 0) { | ||
resolve(Buffer.concat(stdout).toString('utf-8')); | ||
} else { | ||
reject(new Error(`Could not add project %name.PascalCased%.csproj to solution %name.PascalCased%.sln. Error code: ${code}`)); | ||
} | ||
}); | ||
}); | ||
try { | ||
await shell(['dotnet', 'sln', slnPath, 'add', csprojPath]); | ||
} catch (e) { | ||
throw new Error(`Could not add project %name.PascalCased%.csproj to solution %name.PascalCased%.sln. ${e.message}`); | ||
} | ||
}; |
32 changes: 6 additions & 26 deletions
32
packages/aws-cdk/lib/init-templates/sample-app/fsharp/add-project.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,13 @@ | ||
import * as child_process from 'child_process'; | ||
import * as path from 'path'; | ||
import { InvokeHook } from '../../../init'; | ||
import { shell } from '../../../os'; | ||
|
||
export const invoke: InvokeHook = async (targetDirectory: string) => { | ||
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln'); | ||
const fsprojPath = path.join(targetDirectory, 'src', '%name.PascalCased%', '%name.PascalCased%.fsproj'); | ||
|
||
const child = child_process.spawn('dotnet', ['sln', slnPath, 'add', fsprojPath], { | ||
// Need this for Windows where we want .cmd and .bat to be found as well. | ||
shell: true, | ||
stdio: ['ignore', 'pipe', 'inherit'], | ||
}); | ||
|
||
await new Promise<string>((resolve, reject) => { | ||
const stdout = new Array<any>(); | ||
|
||
child.stdout.on('data', chunk => { | ||
process.stdout.write(chunk); | ||
stdout.push(chunk); | ||
}); | ||
|
||
child.once('error', reject); | ||
|
||
child.once('exit', code => { | ||
if (code === 0) { | ||
resolve(Buffer.concat(stdout).toString('utf-8')); | ||
} else { | ||
reject(new Error(`Could not add project %name.PascalCased%.fsproj to solution %name.PascalCased%.sln. Error code: ${code}`)); | ||
} | ||
}); | ||
}); | ||
try { | ||
await shell(['dotnet', 'sln', slnPath, 'add', fsprojPath]); | ||
} catch (e) { | ||
throw new Error(`Could not add project %name.PascalCased%.fsproj to solution %name.PascalCased%.sln. ${e.message}`); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters