es2049package
ECMAScript 2049 package: zero-configuration libraries and command-line utilies by Harald Rudell
Last updated 16 days ago by haraldrudell .
ISC · Repository · Original npm · Tarball · package.json
$ cnpm install es2049package 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.0                                ...           latest (16 days ago)

24 Versions

  • 1.1.0                                ...           16 days ago
  • 1.0.1                                ...           8 months ago
  • 1.0.0                                ...           8 months ago
  • 0.0.23                                ...           2 years ago
  • 0.0.21                                ...           2 years ago
  • 0.0.20                                ...           2 years ago
  • 0.0.19                                ...           2 years ago
  • 0.0.18                                ...           2 years ago
  • 0.0.17                                ...           2 years ago
  • 0.0.15                                ...           2 years ago
  • 0.0.14                                ...           2 years ago
  • 0.0.13                                ...           2 years ago
  • 0.0.12                                ...           2 years ago
  • 0.0.11                                ...           2 years ago
  • 0.0.10                                ...           2 years ago
  • 0.0.9                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago

Copyright 2014 - 2016 © taobao.org |