Skip to content

Commit 2e1775e

Browse files
author
Thomas Grainger
committed
support umd
1 parent a08cb60 commit 2e1775e

13 files changed

+29
-297
lines changed

Gruntfile.js

-6
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@ module.exports = function(grunt) {
1919
flow: {
2020
files: {
2121
'dist/ng-flow.js': [
22-
'src/provider.js',
23-
'src/directives/init.js',
24-
'src/directives/*.js',
2522
'src/*.js'
2623
],
2724
'dist/ng-flow-standalone.js': [
2825
'bower_components/flow.js/dist/flow.js',
29-
'src/provider.js',
30-
'src/directives/init.js',
31-
'src/directives/*.js',
3226
'src/*.js'
3327
]
3428
}

index.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
/* for module loading using webpack or similar package bundlers */
2-
window.Flow = require('./dist/ng-flow-standalone');
3-
module.exports = 'flow';
1+
/* backwards compatable with deprecated index.js*/
2+
try {
3+
console.warn(new Error("use const ngFlow = require('@flowjs/ng-flow');"));
4+
} catch (e) {
5+
// do nothing
6+
}
7+
module.exports = require('./src/ng-flow');

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"test": "grunt test"
77
},
8-
"main": "dist/ng-flow.js",
8+
"main": "src/ng-flow.js",
99
"repository": {
1010
"type": "git",
1111
"url": "git://github.com/flowjs/ng-flow.git"
@@ -36,5 +36,11 @@
3636
"karma-firefox-launcher": "0.1.7",
3737
"karma-jasmine": "^0.3.6",
3838
"karma-sauce-launcher": "0.3.1"
39+
},
40+
"dependencies": {
41+
"@flowjs/flow.js": "^2.13.0"
42+
},
43+
"peerDependencies": {
44+
"angular": "^1.2"
3945
}
4046
}

src/angular-flow.js

-2
This file was deleted.

src/directives/btn.js

-14
This file was deleted.

src/directives/drag-events.js

-57
This file was deleted.

src/directives/drop.js

-26
This file was deleted.

src/directives/events.js

-50
This file was deleted.

src/directives/img.js

-22
This file was deleted.

src/directives/init.js

-43
This file was deleted.

src/directives/transfers.js

-10
This file was deleted.

dist/ng-flow.js renamed to src/ng-flow.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
(function (root, factory) {
2+
if (typeof define === 'function' && define.amd) {
3+
define(['angular', '@flowjs/flow.js'], factory);
4+
} else if (typeof exports === 'object') {
5+
// Node, CommonJS-like
6+
module.exports = factory(require('angular'), require('@flowjs/flow.js'));
7+
} else {
8+
// Browser globals (root is window)
9+
root.ngFlow = factory(root.angular, root.Flow);
10+
}
11+
}(this, function (angular, Flow) {
112
/**
213
* @description
314
* var app = angular.module('App', ['flow.provider'], function(flowFactoryProvider){
@@ -286,4 +297,7 @@ angular.module('flow.transfers', ['flow.init'])
286297
};
287298
}]);
288299
angular.module('flow', ['flow.provider', 'flow.init', 'flow.events', 'flow.btn',
289-
'flow.drop', 'flow.transfers', 'flow.img', 'flow.dragEvents']);
300+
'flow.drop', 'flow.transfers', 'flow.img', 'flow.dragEvents']);
301+
302+
return 'flow';
303+
}));

src/provider.js

-62
This file was deleted.

0 commit comments

Comments
 (0)