Socket
Socket
Sign inDemoInstall

es2049package

Package Overview
Dependencies
29
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    es2049package

ECMAScript 2049 package: zero-configuration libraries and command-line utilies by Harald Rudell


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
31.0 MB
Created
Weekly downloads
 

Readme

Source

ECMAScript 2049 Package

ECMAScript 2049

ERASE THE PAST

© Harald Rudell created ECMAScript 2049 in December 2017. ISC License

This is the es2049package package

Repository links:
ECMAScript 2049 the monolithic repository
es2049scripts providing build-scripts written in ES.Next
allspawn async/promise command execution

Benefits

es2049package allows a library or command-line utility to be compiled with only one installed dependency and no configuration files.

Usage

  1. Add es2049package to your project

    yarn add es2049package --dev
  2. Add build to the scripts entry of package.json:

    "scripts": {
     "build": "rollup --config node:es2049package"
  3. Build:

    yarn build

ADVICE

  • If building a Node.js library, consider newer than default rollup.targets: 6.10, like "targets": {"node": 8}. Ensure proper main, module are set in package.json
  • If writing a command-line executable set rollup.shebang: true and if self-contained "dependencies": false. Possibly use "targets": "mini"
  • It does work, here is a functional package.json
  • If it seems mysterious, use ES2049PACKAGE_DEBUG and possibly ES2049PACKAGE_RESOLVE or ES2049PACKAGE_LOAD as described below

A package.json using es2049package can be found here

Fields in package.json

Fields used are the rollup key as well as standard top-level keys name, main, module

Rollup keys:

  • input: optional string or array, default src/index.js or src/index.mjs: the entry point used for compilation. If this is an array, it is of objects each describing a compilation with keys: input output dependencies main module external node print shebang targets eslint. Those keys overrides the rollup keys.
    • main: boolean, default false. use main field as output
    • module: boolean, default false. use module field as output
  • output: optional array or object. A rollup object with file and format (cjs, es) properties. default is according to main or module (or both), if none present it is './build/<package-name>', used for command-line executables
  • external: optional string, array of string: list of packages or filenames that are to be external
  • clean: string or list of strings, desribed below under clean command
  • node: boolean default true. If true, the standard library are added as externals. Should normally be used for all Node.js programs
  • targets: optional string
    • "stable" Node.js 4.8.1 LTS maintenance
    • "current" The currently executing Node.js
    • a target object as defined by babelJS
    • "mini" indicates Node.js 9+
    Default is Node.js 6.10 LTS active.
  • dependencies: optional boolean default true whether dependencies in package.json should be external. Use false if building a self-contained executable.
  • shebang: boolean, default false. If true: the output is an executable, with a shebang line and proper permissions.
  • eslint: boolean, default true if ./.eslintrc.json and ./.eslintrc.yaml are missing. If true: A default eslint configuration based on babel-eslint is provided.

clean command

Intended to provide a clean command for use with yarn. Clean, when invoked using yarn clean, removes any files or directories provided to it as command-line arguments or if no argments from the rollup.clean field of package.json

"rollup": {
 "clean": "bin"

or:

"scripts": {
 "clean": "clean lib bin"

rollup command

The ability to use Rollup although it is a transitive dependency.

Requirements

To develop or compile the ECMAScript 2049 project Yarn 1+ and Node.js current (v8.5+) are required.

Troubles

Using environment variables, diagnostic printouts can be reviewed. On Linux, this is like:
ES2049PACKAGE_DEBUG=1 $(yarn bin)/rollup --config node:es2049package which prints configuration data and filenames processed by Babel.
Additionally, ES2049PACKAGE_RESOLVE prints all resolved import statements, thousands of lines.
ES2049PACKAGE_LOAD prints all files included in the bundle, also in the thousands.

As of February 2018, eslint has a problem in that configuration extends statements in eslint configuration files are resolved by the eslint path, not the eslint.rc path. Impact is that if es2049package, that holds eslint, is symlinked from an out-of-project-tree location, the extends file may not be found. eslint #9904

© Harald Rudell created ECMAScript 2049 in December 2017. ISC License

Keywords

FAQs

Last updated on 17 Mar 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc