Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

SourceCode is not execluded from Binary #190

Closed
haeferer opened this issue Aug 8, 2017 · 8 comments
Closed

SourceCode is not execluded from Binary #190

haeferer opened this issue Aug 8, 2017 · 8 comments

Comments

@haeferer
Copy link

haeferer commented Aug 8, 2017

Hi,

at first, very nice work. Wonderfull,

Ive tried a minimal test (i think so)

main.js:

console.log('Hello World pkg');

package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "bin":"main.js",
  "main": "main.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "pkg":{
    "scripts": "*.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

an compiled using

pkg .

If you open the executable the sourcecode is still included...

If tried different scenarios.

Bug/ or my Fault :(

@haeferer
Copy link
Author

haeferer commented Aug 8, 2017

I've tested a few more scenarios and it seems the sourcecode is included if you use a package.json or '.' as parameter. Sourcecode Exclude seems to work, if you start packaging with a .js file...

@igorklopov
Copy link
Contributor

What do you mean "If you open the executable the sourcecode is still included" ?

@haeferer
Copy link
Author

haeferer commented Aug 15, 2017

I pack the executable. To check, if the sourcecode is removed i open the .exe File using a NotePad Editor.

In case of package.json to compile, the sourcefiles are still visible.

If i compile specifying an .js file, everything is fine.

If you activate Debug mode you can read in the output the file is included WITH SOURCE in the first case (package.json) and WITHOUT SOURCE using a .js file

@igorklopov
Copy link
Contributor

So, what is the problem? Json does not have any algorithms/logic. So, i think it is ok to disclose json. Right?

@haeferer
Copy link
Author

Ok, i will make a sample.

Setup

You have a file (main.js) with the following content

console.log('Hello World pkg');

and a package.js with this content:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "bin":"main.js",
  "main": "main.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "pkg":{
    "scripts": "*.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

Inside the package.json there is a "pkg" "scripts": "*.js" witch means: dont include main.js into the executable... Correct?

Test

1. Using main.js as parameter

pkg main.js

Everything is fine, the Text console.log('Hello World pkg'); is not copied inside the executable (debug output says: copied WITHOUT SOURCE)

2. Using . as parameter (witch means, get config from package.json)

pkg .

Wrong: cause the text console.log('Hello World pkg'); can be found inside the executable (debug output says: copied WITH SOURCE)

Result

  • If you use package.json for configuration the default behaviour (WITHOUT SOURCE) is not used, also the GLOB Pattern parameter scripts under "pkg" has no effect
  • If you use package.json for your compilation the SOURCE is alway included! which is not correct

@igorklopov
Copy link
Contributor

igorklopov commented Aug 16, 2017

Oh, now i understand. Remove "license": "ISC" from package.json

@haeferer
Copy link
Author

Ok, this makes sences, cause the license does not allow remove of sourcecode.. Thx

@damartripamungkas
Copy link

Oh, sekarang aku mengerti. Hapus "license": "ISC"daripackage.json

is it necessary to remove variable license in package.json? I mean just want to change the value without deleting the key "license"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants