1. Use plain Record instead of Map
2. Call fs.realpath inside the utility function Signed-off-by: Himanshu Mishra <himanshu@orkohunter.net>
This commit is contained in:
@@ -160,10 +160,10 @@ describe('CookieCutter Templater', () => {
|
||||
'--verbose',
|
||||
],
|
||||
envVars: ['HOME=/tmp'],
|
||||
mountDirs: new Map([
|
||||
[path.join('tempdir', 'template'), '/input'],
|
||||
[path.join('tempdir', 'intermediate'), '/output'],
|
||||
]),
|
||||
mountDirs: {
|
||||
[path.join('tempdir', 'template')]: '/input',
|
||||
[path.join('tempdir', 'intermediate')]: '/output',
|
||||
},
|
||||
workingDir: '/input',
|
||||
logStream: undefined,
|
||||
dockerClient: mockDocker,
|
||||
@@ -203,10 +203,10 @@ describe('CookieCutter Templater', () => {
|
||||
'--verbose',
|
||||
],
|
||||
envVars: ['HOME=/tmp'],
|
||||
mountDirs: new Map([
|
||||
[path.join('tempdir', 'template'), '/input'],
|
||||
[path.join('tempdir', 'intermediate'), '/output'],
|
||||
]),
|
||||
mountDirs: {
|
||||
[path.join('tempdir', 'template')]: '/input',
|
||||
[path.join('tempdir', 'intermediate')]: '/output',
|
||||
},
|
||||
workingDir: '/input',
|
||||
logStream: stream,
|
||||
dockerClient: mockDocker,
|
||||
|
||||
@@ -59,12 +59,10 @@ export class CookieCutter implements TemplaterBase {
|
||||
await fs.writeJSON(path.join(templateDir, 'cookiecutter.json'), cookieInfo);
|
||||
|
||||
// Directories to bind on container
|
||||
const mountDirs = new Map([
|
||||
// Need to use realpath here as Docker mounting does not like
|
||||
// symlinks for binding volumes
|
||||
[await fs.realpath(templateDir), '/input'],
|
||||
[await fs.realpath(intermediateDir), '/output'],
|
||||
]);
|
||||
const mountDirs = {
|
||||
[templateDir]: '/input',
|
||||
[intermediateDir]: '/output',
|
||||
};
|
||||
|
||||
const cookieCutterInstalled = await commandExists('cookiecutter');
|
||||
if (cookieCutterInstalled) {
|
||||
|
||||
@@ -40,10 +40,10 @@ export class CreateReactAppTemplater implements TemplaterBase {
|
||||
const intermediateDir = path.join(workspacePath, 'template');
|
||||
await fs.ensureDir(intermediateDir);
|
||||
|
||||
const mountDirs = new Map([
|
||||
[await fs.realpath(intermediateDir), '/template'],
|
||||
[await fs.realpath(intermediateDir), '/result'],
|
||||
]);
|
||||
const mountDirs = {
|
||||
[intermediateDir]: '/template',
|
||||
[intermediateDir]: '/result',
|
||||
};
|
||||
|
||||
await runDockerContainer({
|
||||
imageName: 'node:lts-alpine',
|
||||
|
||||
Reference in New Issue
Block a user