pkg icon indicating copy to clipboard operation
pkg copied to clipboard

Include .key, .pem, .sh extension file ?

Open uds214125 opened this issue 7 years ago • 4 comments

How to add file like extension with .pem or .key or .crt etc. into binary ?

Is it possible to add private/public key content into binary ?

Actually, .pem file start with content with ----------BEGIN PRIVATE KEY----- and it breaks.

Error:

Parsing error: Invalid left-hand side in prefix operation

{ "name": "server", "version": "0.0.0", "private": true, "bin": "./output/main.bundle.js", "main": "./app.js", "engines": { "node": ">=6" }, "scripts": { "build-prod": "pkg -t latest-linux-x64 -o ./app ./server.js", "build": "webpack --config build/webpack.config.js --progress true --display-error-details true" }, "dependencies": { "@babel/runtime": "^7.2.0", ... }, "devDependencies": { "webpack": "^4.20.2", ... }, "pkg": { "scripts": [ "node_modules/", "node_modules/sharp/build/Release/sharp.node", "output/main.bundle.js" ], "assets": [ "views/**/", "public/**/*", "private_key.pem" ], "targets": [ "node8" ] } }

How to avoid checking/parsing content of one file but include it ?

Please somebody help.

uds214125 avatar Dec 31 '18 13:12 uds214125

Please include your package.json file

I have included a basic template below that might solve your problem but it is hard to be sure if I don't know the specifics of your package

package.json

{
  "name": "myapp",
  "version": "1.0.0",
  "description": "This is your app description",
  ...
  "pkg": {
    "scripts": [] // JavaScript files you want to package into your app. Will be parsed and checked and all required files will also be parsed and checked
    "assets": [ // Misc files you want to package into your app. Will not be parsed. Certain file extensions will not be allowed (like .node)
      "/my_keys/private_key.pem"
    ]
  },
  "licence": "" // If you leave license as "ISC" as is default then your packaged files might be readable
}

If you want to copy the example into your code please take out the "..." and the comments as they are not valid JSON

Daniel-Olivier avatar Jan 04 '19 08:01 Daniel-Olivier

I have added one .env file to read environment data. while build is ok, no error.

but it is giving error while execution, my evn file. .env

PORT=8080 HOST=localhost CRYPTO_KEY=asdaadsa JWT_TTL=1d

Error : Uncaught Error Caught: ReferenceError: Invalid left-hand side in assignment

uds214125 avatar Jan 07 '19 09:01 uds214125

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

github-actions[bot] avatar Apr 07 '21 00:04 github-actions[bot]

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

github-actions[bot] avatar Apr 12 '21 00:04 github-actions[bot]