Skip to content

Commit

Permalink
Merge pull request #15 from Mogztter/esm
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie authored Nov 1, 2020
2 parents 3c37e22 + 7329f07 commit 6c4c3c5
Show file tree
Hide file tree
Showing 12 changed files with 20,901 additions and 66 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
os: [ubuntu-latest]
node-version:
- 12.17
- 14.x
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
## Usage

```javascript
var Opal = require('opal-runtime').Opal;
import Opal from 'asciidoctor-opal-runtime'
// Now let's have fun with Opal!
```

This library is also available as a CommonJS module:

```javascript
const Opal = require('asciidoctor-opal-runtime')
// Now let's have fun with Opal!
```
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@
"directories": {
"lib": "src"
},
"main": "src/index.js",
"type": "module",
"main": "./src/index.cjs",
"exports": {
"import": "./src/index.js",
"require": "./src/index.cjs"
},
"scripts": {
"build": "rollup --config",
"test": "mocha spec/*.spec.js",
"lint": "standard src/index.js spec"
},
Expand All @@ -39,6 +45,12 @@
"chai": "4.2.0",
"dirty-chai": "^2.0.1",
"mocha": "8.2.0",
"rollup": "^2.10.9",
"standard": "16.0.0"
},
"standard": {
"env": {
"mocha": true
}
}
}
8 changes: 8 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
input: 'src/index.js',
output: {
file: 'src/index.cjs',
format: 'cjs',
},
external: [ 'fs', 'glob', 'os', 'path', 'unxhr', 'util' ]
}
11 changes: 5 additions & 6 deletions spec/main.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* global describe, it */
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
import chai from 'chai'
import dirtyChai from 'dirty-chai'
import 'mocha'
import Opal from '../src/index.js'

chai.use(dirtyChai)
const expect = chai.expect

const fundamentalObjects = [
Function,
Expand All @@ -23,8 +24,6 @@ for (const index in fundamentalObjects) {
fundamentalToStringValues.push(fundamentalObject.toString())
}

const Opal = require('../src/index').Opal

describe('Opal Node Runtime', function () {
describe('When loaded', function () {
it('should export Opal object', function () {
Expand Down
Loading

0 comments on commit 6c4c3c5

Please sign in to comment.