prismatic-io / spectral

Prismatic's typescript library for custom components
https://prismatic.io/docs/spectral/custom-component-library
35 stars 2 forks source link

Make Bin executables Cross Platform compatible #206

Closed jasoncomes closed 3 months ago

jasoncomes commented 3 months ago

Issue:

Our bin executables currently reference the tsc compiled cli.ts -> cli.js file. However, Typescript does not maintain the files' runtime permissions and resets them to the least amount of privileges.

The configuration for this is:

"bin": {
    "component-manifest": "./dist/generators/componentManifest/cli.js"
  },

To work around this, we introduced an npm script that runs after the build process to provide the generated cli.js file with its executable permission. However, the issue with this is it's not cross-platform compatible.

Solution:

Instead, we'll have a static bin directory as a sibling to the src and dist folders. This bin directory will need to be published along with Spectral. This bin folder will contain executable files that reference their corresponding CLI functionality.

Current Issue in Microsoft TypeScript Github repository: https://github.com/Microsoft/TypeScript/issues/26060.