Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
6to5-library-boilerplate
Advanced tools
Author libraries in ES6 for Node and the browser.
Update the metadata about the project, including the name in the LICENSE
and the package.json
information.
Write your code in src
. The primary file is index.js
(although the filename
can be changed).
Run gulp build
to compile the source into a distributable format.
Put your unit tests in test/unit
. The gulp
command runs the tests.
gulp
- Lint the library and tests, then run the unit testsgulp build
- Lint then build the librarygulp watch
- Continuously run the unit tests as you make changes to the source
and test files themselvesgulp test-browser
- Build the library for use with the browser spec runner.
Changes to the source will cause the runner to automatically refresh.The browser spec runner
can be opened in a browser to run your tests. For it to work, you must first run gulp test-browser
. This
will set up a watch task that will automatically refresh the tests when your scripts, or the tests, change.
This library is set up to integrate with Code Climate. If you've never used Code Climate, then you might be wondering why it's useful. There are two reasons:
Either of these items on the list can simply be ignored if you're uninterested in them. Or you can pull Code Climate out entirely from the boilerplate and not worry about it. To do that, update the relevant Gulp tasks and the Travis build.
If you'd like to set up Code Climate for your project, follow the steps here.
This boilerplate uses JSHint
and JSCS to lint your source. To change the rules,
edit the .jshintrc
and .jscsrc
files in the root directory, respectively.
Given that your unit tests aren't your library code, it makes sense to
lint them against a separate JSHint configuration. For this reason, a
separate, unit-test specific .jshintrc
can be found in the test
directory. Unlike JSHint, the same JSCS rules are applied to both your code
and your tests.
You're authoring a library that exports a single file, and that one file exports a single variable.
You can always use this boilerplate as inspiration, but it works best for smaller libraries. If you're building a full-scale webapp, you will likely need many more changes to the build system.
As a rule of thumb, this transpiler works best in IE9+. You can support IE8 by limiting yourself to a subset of ES6 features. The 6to5 caveats page does an excellent job at explaining the nitty gritty details of supporting legacy browsers.
Quite a few! Check them out on the wiki.
This boilerplate is, to a certain extent, easily customizable. To make changes, find what you're looking to do below and follow the instructions.
The primary source file for the library is src/index.js
. Only the files that this
file imports will be included in the final build. To change the name of this entry file:
entryFileName
in package.json
under to5BoilerplateOptions
main
in package.json
main
in package.json
MyLibrary
is the name of the variable exported from this boilerplate. You can change this by following
these steps:
exportVarName
in package.json
under to5BoilerplateOptions
test/.jshintrc
fileexportVarName
in package.json
to be null
test/.jshintrc
In the simplest case, you just need to install the module and use it in your scripts.
If you want to access the module itself in your unit test files, you will need to set up the test environment to support the module. To do this:
.jshintrc
files to include any new global variable that you have addedmochaGlobals
array in package.json
under
to5BoilerplateOptions
main
field in package.json
gulp watch
to run headless tests as you make changes to the library and testsFAQs
Author libraries in ES6 for Node and the browser.
The npm package 6to5-library-boilerplate receives a total of 2 weekly downloads. As such, 6to5-library-boilerplate popularity was classified as not popular.
We found that 6to5-library-boilerplate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.