Skip to content

Commit

Permalink
[bundling-edits] node, esm, umd build
Browse files Browse the repository at this point in the history
  • Loading branch information
jtrein committed Dec 11, 2018
1 parent a224a01 commit bac7818
Show file tree
Hide file tree
Showing 12 changed files with 1,645 additions and 1,625 deletions.
18 changes: 5 additions & 13 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
{
"presets": [
"flow",
["env", {"modules": false}]
"@babel/preset-flow",
["@babel/preset-env", {"modules": false}]
],
"plugins": [
"transform-class-properties",
"transform-object-rest-spread",
["transform-runtime", {
"polyfill": false,
"regenerator": true,
"moduleName": "babel-runtime"
"@babel/plugin-proposal-class-properties",
["@babel/transform-runtime", {
"regenerator": true
}]
// ["module-resolver", {
// "alias": {
// "Openlaw": "./target/scala-2.12/client.js"
// }
// }]
],
"ignore": [
"./target/scala-2.12/client.js"
Expand Down
10 changes: 2 additions & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"extends": [
"eslint:recommended",
"plugin:flowtype/recommended",
"plugin:security/recommended",
"plugin:react/recommended"
"plugin:security/recommended"
],
"globals": {
"describe": true,
Expand All @@ -17,13 +16,9 @@
"beforeAll": true,
"beforeEach": true,
"expect": true,
"jest": true,
"test": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
Expand All @@ -49,7 +44,6 @@
"error",
"always"
],
"no-console": 0,
"react/jsx-uses-vars": "error"
"no-console": 0
}
}
22 changes: 16 additions & 6 deletions js/src/APIClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,26 @@ import axios from 'axios';
import queryString from 'query-string';

type AuthConfiguration = {
username: string,
password: string
username: string,
password: string,
}

type Configuration = {
root: string,
auth: ?AuthConfiguration
root: string,
auth: ?AuthConfiguration,
}

import type {Template} from './shared-types.js';
type Template = {
id: string,
name: string,
compiledTemplate: Object,
structuredDocument: Object,
timestamp: number,
title: string,
version: string,
index: number,
creatorId: string,
};

class APIClient {

Expand Down Expand Up @@ -569,4 +579,4 @@ class APIClient {

}

export default APIClient;
export default APIClient;
12 changes: 12 additions & 0 deletions js/src/index.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* This file will be copied into `dist/esm` on build:esm.
* It is so that consumer apps who are compatible with ES6 modules can:
* 1. Easily pull the es module files in
* 2. Tree-shake unneeded (dead) code (e.g. An app only wants to use the
* `APIClient` b/c `Openlaw` is already on their server)
*/

import {Openlaw} from './openlaw.js';
import APIClient from './APIClient';

export {Openlaw, APIClient};
11 changes: 6 additions & 5 deletions js/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import APIClient from './APIClient';
/**
* Webpack entry-point for UMD build
*/

import {Openlaw} from '../../target/scala-2.12/client.js';
import APIClient from './APIClient';

export {
APIClient,
Openlaw as default,
};
export {Openlaw, APIClient};
12 changes: 0 additions & 12 deletions js/src/shared-types.js

This file was deleted.

Loading

0 comments on commit bac7818

Please sign in to comment.