Scaffolder: Update CRA templater with new runDockerContainer format
Signed-off-by: Himanshu Mishra <himanshu@orkohunter.net>
This commit is contained in:
@@ -40,7 +40,10 @@ export class CreateReactAppTemplater implements TemplaterBase {
|
||||
const intermediateDir = path.join(workspacePath, 'template');
|
||||
await fs.ensureDir(intermediateDir);
|
||||
|
||||
const resultDir = path.join(workspacePath, 'result');
|
||||
const mountDirs = new Map([
|
||||
[await fs.realpath(intermediateDir), '/template'],
|
||||
[await fs.realpath(intermediateDir), '/result'],
|
||||
]);
|
||||
|
||||
await runDockerContainer({
|
||||
imageName: 'node:lts-alpine',
|
||||
@@ -49,10 +52,12 @@ export class CreateReactAppTemplater implements TemplaterBase {
|
||||
componentName as string,
|
||||
withTypescript ? ' --template typescript' : '',
|
||||
],
|
||||
inputDir: intermediateDir,
|
||||
outputDir: intermediateDir,
|
||||
mountDirs,
|
||||
logStream: logStream,
|
||||
dockerClient: dockerClient,
|
||||
// Set the home directory inside the container as something that applications can
|
||||
// write to, otherwise they will just fail trying to write to /
|
||||
envVars: ['HOME=/tmp'],
|
||||
createOptions: {
|
||||
Entrypoint: ['npx'],
|
||||
WorkingDir: '/result',
|
||||
@@ -67,6 +72,7 @@ export class CreateReactAppTemplater implements TemplaterBase {
|
||||
throw new Error('No data generated by cookiecutter');
|
||||
}
|
||||
|
||||
const resultDir = path.join(workspacePath, 'result');
|
||||
await fs.move(path.join(intermediateDir, generated), resultDir);
|
||||
|
||||
const extraAnnotations: Record<string, string> = {};
|
||||
|
||||
Reference in New Issue
Block a user