Skip to content

Commit

Permalink
Merge pull request #350 from jonschlinkert/bundles
Browse files Browse the repository at this point in the history
Provide commonjs and esm bundles as entry points
  • Loading branch information
TrySound authored Jul 25, 2019
2 parents d627e16 + 5b7159b commit 46671dd
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
3 changes: 0 additions & 3 deletions index.js

This file was deleted.

3 changes: 2 additions & 1 deletion linkify/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "remarkable/linkify",
"main": "../lib/linkify.js"
"main": "../dist/cjs/linkify.js",
"module": "../dist/esm/linkify.js"
}
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,23 @@
"index.js",
"lib"
],
"main": "index.js",
"bin": "./bin/remarkable.js",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"engines": {
"node": ">= 0.10.0"
},
"scripts": {
"test": "make test",
"test-ci": "nyc mocha -r esm -R spec --bail",
"build": "make rollup",
"test": "make rollup && make test",
"test-ci": " make rollup && nyc mocha -r esm -R spec --bail",
"coverage": "yarn add coveralls@2 && nyc report --reporter=text-lcov | coveralls"
},
"nyc": {
"exclude": [
"dist"
]
},
"dependencies": {
"argparse": "^1.0.10",
"autolinker": "~0.28.0"
Expand Down
21 changes: 21 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
import path from 'path';
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import { terser } from 'rollup-plugin-terser';

const name = 'Remarkable';
const external = id => !id.startsWith('.') && !path.isAbsolute(id);

export default [
{
input: ['./lib/index.js', './lib/linkify.js'],
output: { dir: 'dist/cjs', format: 'cjs' },
external,
plugins: [
commonjs(),
]
},

{
input: ['./lib/index.js', './lib/linkify.js'],
output: { dir: 'dist/esm', format: 'esm' },
external,
plugins: [
commonjs(),
]
},

{
input: './lib/umd.js',
output: { file: 'dist/remarkable.js', format: 'umd', name },
Expand All @@ -13,6 +33,7 @@ export default [
commonjs(),
]
},

{
input: './lib/umd.js',
output: { file: 'dist/remarkable.min.js', format: 'umd', name },
Expand Down
4 changes: 2 additions & 2 deletions test/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const ChildProcess = require("child_process")
var assert = require('assert');
import ChildProcess from "child_process";
import assert from 'assert';

// placed here to make multiline indentation easier, feel free to move if you're
// adding more tests here
Expand Down

0 comments on commit 46671dd

Please sign in to comment.