@chatopera/bless
Hide your source code.
Last updated a year ago by hain .
Private · Repository · Original npm · Tarball · package.json
$ cnpm install @chatopera/bless 
SYNC missed versions from official npm registry.

Chatopera Bless

Node.js packaging utility to hide your source code.

source: nodejs-binary

Usage

Install

via npmjs registry

https://www.npmjs.com/package/@chatopera/bless

npm install -g @chatopera/bless

Use below command to verifiy installation.

Usage: dist [options]

Options:
  -p, --projectdir <value>  Project Path, *required
  -l, --level [value]       Mangling Level [union|minify|binary], optional, default binary
  --clean [value]           Clean up build files after generation, optional, default true
  -h, --help                output usage information

Project Structure

To package your project's source code to binary, define bless.json under the project base dir, imagine the project has a structure like this.

purejs
├── main.js
├── bless.json
├── data
│   └── data.txt
├── lib
│   ├── a.js
│   ├── b.js
│   └── c.js
└── package.json

Note, purejs is basedir, main.js is main entry, bless.json is configuration for bless toolset.

Configure

A sample configuration file bless.json.

{
  "dist": {
    "sources": ["main.js", "lib/**/*.js"],
    "data": ["data/**/*", "data/**/.*"]
  }
}

dist is for target name, a target is a collection of source codes and assets, it has a main entry that is executable. Target name is used as directory name to store Release files under bless-gen.

sources is a bunch of java script sources, the first element is for main entry of this application/library.

data is the assets to copy into dist folder.

Build

bless dist -p ${project path}

After the generation is done, check out ${project path}/bless-gen/${target name} for the release file.

Note, during the generation, some build files are generated first for compiling and linking, then package the sources as binary, build files are deleted by default. In order to keep these files, --clean false should be present, use command like bless dist --clean false -p ${project path}.

There are three levels to hide the source codes, specify --level with union, minify or binary.

  • union, make all source code into a solitary javascript file, the names for variables are not changed.

  • minify, make all source code into a solitary javascript file, the codes are uglified and minified.

  • binary, make all source code into a binary file, the codes are uglified and minified.

Checkout sample script.

Run

cd ${project path}/bless-gen/${target name}
npm i
node app.js

Samples

To get details about usage, check out samples in https://github.com/chatopera/bless-samples.

Known Issues

conflict with bless command in Mac OSX

Mac OSX has a command as bless, to use bless within node_modules, set alias in environment variables, for example:

alias bless='/Users/hain/.nvm/versions/node/v8.10.0/bin/bless'

Find your bless command by where bless.

empty folder in data is not copyed

empty folder in data section would be omitted.

require.main is not assigned value in main entry

So, this piece of code does not work to check main entry .

// on main entry
if (require.main === module) {
  (async function() {
    await main();
  })();
}

Give credits to

License

Copyright 2019 北京华夏春松科技有限公司. All rights reserved.

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

chatoper banner

Current Tags

  • 1.2.5                                ...           latest (a year ago)

18 Versions

  • 1.2.5                                ...           a year ago
  • 1.2.3                                ...           a year ago
  • 1.2.2                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.9                                ...           a year ago
  • 1.1.8                                ...           a year ago
  • 1.1.7                                ...           a year ago
  • 1.1.6                                ...           a year ago
  • 1.1.5                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (2)
Downloads
Today 0
This Week 18
This Month 18
Last Day 0
Last Week 0
Last Month 18
Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |