create-node-app icon indicating copy to clipboard operation
create-node-app copied to clipboard

Keep permissions from original files when doing the scaffolding

Open ulises-jeremias opened this issue 2 years ago • 0 comments

Describe the bug

When doing the scaffolding of the project the command is not keeping the original permissions from the files in the templates.

For example, when using the extensions to add husky, the generated .husky/pre-commit file won't be have execution permissions causing the pre-commit hook to be skipped

Expected Behavior

Keep the permissions from the original file from the templates and extensions

Current Behavior

The files are not keeping the expected permissions

Reproduction Steps

Create a new project with the tool using the following configuration:

  • Package manager: any
  • App type: Frontend Application
  • Template: React Vite Boilerplate
  • Extensions: Husky + Lint Staged

Then moved to the generated project and check the permissions for the files inside .husky/

image

Possible Solution

Seems to be a problem in the places where we are using this function here without passing the correct permissions.

We need to fix this behavior when writing files from templates or append files

Additional Information/Context

No response

Version used

0.4.20

Environment details (OS name and version, etc.)

Environment Info:

  System:
    OS: Linux 6.1 Arch Linux
    CPU: (8) x64 Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
    Memory: 24.52 GB / 31.12 GB
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 18.17.0 - /run/user/1000/fnm_multishells/403345_1696141910500/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.6.7 - /run/user/1000/fnm_multishells/403345_1696141910500/bin/npm
    pnpm: 8.7.6 - /run/user/1000/fnm_multishells/403345_1696141910500/bin/pnpm
    Watchman: Not Found
  Browsers:
    Chrome: Not Found

ulises-jeremias avatar Oct 01 '23 06:10 ulises-jeremias