npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@chatopera/bless

v1.2.6

Published

Hide your source code.

Downloads

16

Readme

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