Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow schematics to create file with permissions #11781

Copy link
Copy link
@bgotink

Description

@bgotink
Issue body actions

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions

any

Desired functionality

I'm writing schematics to help colleagues scaffold applications and libraries following our internal guidelines. One part of our set-up is the use of a file called Taskfile to contain scripts instead of cramming complicated one-liners in yarn run-scripts. This file should be executable, but a schematic cannot create executable files. The result is a broken package because ./Taskfile: Permission denied.

I've got a simple workaround:

The schematic in question is based on @schematics/angular:library. It runs the NodePackageInstallTask at the end. This allows me to create a selfdestructing preinstall script in the newly scaffolded package.json:

{
  "//": "...",
  "scripts": {
    "preinstall": "chmod +x Taskfile && ex +g/preinstall/d -cwq package.json",
    "prepublish": "./Taskfile build",
    "test": "./Taskfile test"
  }
}

This works, but it feels like a hack to me. It would be cleaner if either

  • file permissions were respected, as the source file for the scaffold has correct permissions; or
  • the schematic could modify permissions
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular-devkit/schematicsfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsLabel to add when the not a sufficient number of votes or comments from unique authors
    No fields configured for Enhancement.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.