Skip to content

Commit 0f87f06

Browse files
author
AJ Keller
authored
Merge pull request #2 from alexcastillo/development
Better import naming
2 parents 681e58b + ce367fd commit 0f87f06

File tree

7 files changed

+28
-18
lines changed

7 files changed

+28
-18
lines changed

examples/node/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11

22
const OpenBCIUtilities = require('../..');
3-
const { Constansts, Debug, Utilities } = require('../..');
3+
const { constansts, debug, utilities } = require('../..');
4+
5+
const { extractRawDataPackets } = require('../../dist/utilities');
6+
const OpenBCICnstants = require('../../dist/constants');
7+
const debug2 = require('../../dist/debug');
48

59
console.log('OpenBCIUtilities', OpenBCIUtilities);
6-
console.log('Constansts', Constansts);
7-
console.log('Debug', Debug);
8-
console.log('Utilities', Utilities);
10+
console.log('constansts, debug, utilities', constansts, debug, utilities);
11+
console.log('extractRawDataPackets', extractRawDataPackets);
12+
console.log('OpenBCICnstants', OpenBCICnstants);
13+
console.log('debug2', debug2);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "openbci-utilities",
33
"version": "0.3.0",
44
"description": "The official utility package of Node.js SDK for the OpenBCI Biosensor Boards.",
5-
"main": "dist/openbci-utilities.umd.js",
5+
"main": "dist/openbci-utilities.js",
66
"module": "src/index.js",
77
"scripts": {
88
"build": "webpack",
File renamed without changes.

src/openBCIDebug.js renamed to src/debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Buffer } from 'buffer/';
77
* @param data - bytes to output, a buffer or string
88
* @private
99
*/
10-
export function debugBytes (prefix, data) {
10+
export default function debugBytes (prefix, data) {
1111
if (typeof data === 'string') data = new Buffer(data);
1212

1313
console.log('Debug bytes:');

src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import Constants from './openBCIConstants';
2-
import * as Debug from './openBCIDebug';
3-
import Utilities from './openBCIUtilities';
1+
import constants from './constants';
2+
import * as debug from './debug';
3+
import utilities from './utilities';
44

55
export default {
6-
Constants,
7-
Debug,
8-
Utilities
6+
constants,
7+
debug,
8+
utilities
99
};

src/openBCIUtilities.js renamed to src/utilities.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
import gaussian from 'gaussian';
4-
import k from './openBCIConstants';
4+
import k from './constants';
55
import StreamSearch from 'streamsearch';
66
import { Buffer } from 'buffer/';
77
import _ from 'lodash';

webpack.config.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ const librarySnakeCase = 'openbci-utilities';
55
const libraryExport = 'default';
66

77
const config = {
8-
entry: './src/index.js',
8+
entry: {
9+
[librarySnakeCase]: './src/index.js',
10+
utilities: './src/utilities.js',
11+
constants: './src/constants.js',
12+
debug: './src/debug.js'
13+
},
914
module: {
1015
rules: [
1116
{
@@ -24,18 +29,18 @@ const config = {
2429
}
2530
};
2631

27-
const exportLibraryTarget = libraryTarget =>
32+
const exportLibraryTarget = (libraryTarget, name) =>
2833
Object.assign({}, config, {
2934
output: {
3035
path: path.resolve(__dirname, 'dist'),
31-
filename: `${librarySnakeCase}.${libraryTarget}.js`,
36+
filename: `${name}.js`,
3237
library,
3338
libraryTarget,
3439
libraryExport
3540
}
3641
});
3742

3843
module.exports = [
39-
exportLibraryTarget('umd'),
40-
exportLibraryTarget('var'),
44+
exportLibraryTarget('umd', '[name]'),
45+
exportLibraryTarget('var', '[name].var')
4146
];

0 commit comments

Comments
 (0)