volto icon indicating copy to clipboard operation
volto copied to clipboard

generator-volto does not run properly on NetBSD, modification needed on arguments passed to fs.copy()

Open dangomania opened this issue 8 months ago • 0 comments

Describe the bug generator-volto does not run properly on NetBSD.

To Reproduce Steps to reproduce the behavior:

  1. run yo @plone/volto frontend --description 'A new project using Plone 6.' --skip-install --volto=17.1.6 --defaultAddonName volto-myproject

This is the command run by "pipx run cookiecutter gh:collective/cookiecutter-plone-starter".

  1. See error

Expected behavior Finish install of frontend.

Software (please complete the following information):

  • OS:NetBSD 10.0
  • Volto Version [17.1.6]
  • @plone/generator-volto Version [8.1.4]

Additional context I found that writing() function in @plone/generator-volto/generators/app/index.js behaves differently on NetBSD from Linux. This is because this.fs.copy() function used in the line "this.fs.copy(this.templatePath(), this.destinationPath(base), [...])" handles the first argument, which is a directly, differently on these platforms.

I further found that this.fs.copy() is from mem-fs-editor package and it checks the first argument with actions.exists function, which returns null when the first argument is a directly on Linux but return a non-null string value when run on NetBSD.

This problem seems to be resolved by modifying the relevant lines in writing() function of @plone/generator-volto/generators/app/index.js as follows. Similar modification is necessary for generators/addon/index.js and generators/addonThemes/index.js.

@@ -258,10 +258,11 @@ -bu  npm_global/lib/node_modules/@plone/generator-volto/generators/app/index.js.orig                                                    
     );
     this.fs.write(this.destinationPath(base, 'yarn.lock'), this.voltoYarnLock);
 
-    this.fs.copy(this.templatePath(), this.destinationPath(base), {
+    this.fs.copy(this.templatePath()+"/**/*", this.destinationPath(base), {
       globOptions: {
         ignore: ['**/*.tpl', '**/*~', '**/.gitignorefile'],
         dot: true,
+       fromBasePath: this.templatePath(),
       },
     });
   }

dangomania avatar May 27 '24 22:05 dangomania