Skip to content

Commit

Permalink
Define basic scripts and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gnandretta committed Jun 12, 2015
1 parent 34be235 commit f44e999
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
Empty file added build/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions build/build.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@
<!--.auth0-lock -->



<div id="lock"></div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="build/build.js"></script>
</body>
</html>
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "lock-refactor",
"version": "0.0.0",
"main": "src/main.js",
"license": "MIT",
"browserify": {
"transform": [
[
"babelify",
{
"blacklist": [
"regenerator"
]
}
]
]
},
"scripts": {
"start": "npm run build && serve .",
"build": "browserify --extension=.jsx --extension=.js src/main.js | uglifyjs > build/build.js",
"watch": "watchify --extension=.jsx --extension=.js src/main.js -o build/build.js --debug --verbose & serve .",
"test": "mochify --recursive --extension=.jsx --extension=.js",
"autotest": "mochify --watch --recursive --extension=.jsx --extension=.js"
},
"devDependencies": {
"babelify": "^6.1.2",
"browserify": "^10.2.4",
"mocha": "^2.2.5",
"mochify": "^2.9.0",
"packageify": "^0.2.2",
"serve": "^1.4.0",
"uglify-js": "^2.4.23",
"watchify": "^3.2.2"
},
"dependencies": {
"auth0-js": "^6.4.2",
"bonzo": "^2.0.0",
"domready": "^1.0.8",
"flux": "^2.0.3",
"react": "^0.13.3",
"trim": "0.0.1",
"underscore": "^1.8.3"
}
}
7 changes: 7 additions & 0 deletions src/components/widget.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

export default class Widget extends React.Component {
render() {
return <h1>Hello world!</h1>;
}
}
7 changes: 7 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';
import Widget from './components/widget';

React.render(
<Widget />,
document.getElementById('lock')
);
31 changes: 31 additions & 0 deletions test/components/widget-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import Widget from '../../src/components/widget';
import assert from 'assert';

describe('Widget', function(){

var div;
var comp;

function render() {
comp = React.render(React.createElement(Widget), div);
}

beforeEach(function () {
div = document.createElement("div");
});

afterEach(function () {
if (div) {
React.unmountComponentAtNode(div);
comp = null;
}
});

it('renders a h1 that says "Hello world!"', function(){
render();

assert(div.querySelector('h1'));
assert.equal(div.querySelector('h1').textContent, 'Hello world!')
});
});

0 comments on commit f44e999

Please sign in to comment.