Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7b2a250

Browse files
committedMar 18, 2016
3.2.0
Fixes #347 Fixes #353 Fixes #356
1 parent 4a41c1c commit 7b2a250

32 files changed

+746
-565
lines changed
 

‎.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015"]
3+
}

‎.bowerrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎.github/CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing
2+
3+
[Read the Contributing Guide](http://js-data.io/docs/contributing).
4+
5+
## Support
6+
7+
[Find out how to Get Support](http://js-data.io/docs/support).
8+
9+
## Community
10+
11+
[Explore the Community](http://js-data.io/docs/community).
12+
13+
### Have write access?
14+
15+
To cut a release:
16+
17+
1. Checkout master
18+
1. Bump version in `package.json` appropriately
19+
1. Run `npm run release`
20+
1. Update `CHANGELOG.md` appropriately
21+
1. Commit and push changes, including the `dist/` folder
22+
1. Make a GitHub release
23+
- set tag name to version
24+
- set release name to version
25+
- set release body to changelog entry for the version
26+
- attach the files in the `dist/` folder
27+
1. `npm publish .`

‎.github/ISSUE_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(delete this line) GitHub Issues are NOT for support questions.
2+
(delete this line) GitHub Issues ARE for bug reports, feature requests, and other issues.
3+
(delete this line) Find out how to Get Support here: http://js-data.io/docs/support.
4+
5+
<your detailed, discussable, actionable, and helpful text goes here>
6+
7+
Thanks!

‎.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Fixes #<issue_number_goes_here> (it's a good idea to open an issue first for discussion)
2+
3+
- [ ] - `npm test` succeeds
4+
- [ ] - Pull request has been squashed into 1 commit
5+
- [ ] - I did NOT commit changes to `dist/`
6+
- [ ] - Code coverage does not decrease (if any source code was changed)
7+
- [ ] - Appropriate JSDoc comments were updated in source code (if applicable)
8+
- [ ] - Approprate changes to js-data.io docs have been suggested ("Suggest Edits" button)

‎.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ build_examples/browserify/bundle.js
2626
build_examples/webpack/bundle.js
2727
build_examples/webpack_es6/bundle.js
2828
build_examples/webpack_es6_2/bundle.js
29+
.js-data-http.js
30+
.js-data-http/

‎.mailmap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
InternalFX <bryan@internalfx.com> Bryan <bryan@internalfx.com>
2+
InternalFX <bryan@internalfx.com> Bryan Morris <bryan@internalfx.com>
3+
Jason Dobry <jason.dobry@gmail.com> Jason Dobry <jmdobry@users.noreply.github.com>
4+
Kent C. Dodds <kent@doddsfamily.us> Kent C. Dodds <kent+github@doddsfamily.us>
5+
Robert Porter <rob@Roberts-MacBook-Pro.local> Robert P <rob@Roberts-MacBook-Pro.local>

‎.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ bower_components/
88
karma*
99
guide/
1010
doc/
11+
webpack.config.js
12+
circle.yml
13+
14+
.js-data-http.js
15+
.js-data-http/

‎AUTHORS

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This is the official list of js-data-angular project authors.
2+
#
3+
# Names are formatted as:
4+
# Name or Organization <email address>
5+
# The email address is not required for organizations.
6+
Andre Deutmeyer <a.deutmeyer@gmail.com>
7+
Artemy Tregubenko <me@arty.name>
8+
Asaf Katz <asf.ktz@gmail.com>
9+
Chase Noel <chase.i.noel@gmail.com>
10+
Clark Pan <clark.pan@ansarada.com>
11+
David Tang <dtang859@gmail.com>
12+
Gabo Esquivel <contact@gaboesquivel.com>
13+
Jason Aden <jasonaden@gmail.com>
14+
Jason Dobry <jason.dobry@gmail.com>
15+
Kent C. Dodds <kent@doddsfamily.us>
16+
Loïc Mahieu <mahieuloic@gmail.com>
17+
Nikolay <garmash.nikolay@gmail.com>
18+
Peter Dave Hello <PeterDaveHello@users.noreply.github.com>
19+
Shai Reznik <shai.reznik@gmail.com>
20+
thorn0 <thorn.mailbox@gmail.com>
21+
Tim Chen <timchen1@gmail.com>
22+
Timothy Krell <timothykrell@gmail.com>
23+
vollnhals <lion.vollnhals@googlemail.com>
24+
Wes Cruver <chieffancypants@gmail.com>

‎CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
##### 3.2.0 - 17 March 2016
2+
3+
###### Backwards compatible bug fixes
4+
- #347 - BindOne recomputing computed properties
5+
- #353 - jshint or standard?
6+
- #356 - Multiple parents isn't working
7+
18
##### 3.1.1 - 20 September 2015
29

310
Stable Version 3.1.0

‎CONTRIBUTING.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎Gruntfile.js

Lines changed: 0 additions & 173 deletions
This file was deleted.

‎LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014-2015 Jason Dobry
3+
Copyright (c) 2014-2016 js-data-angular project authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

‎bower.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"author": "Jason Dobry",
2+
"author": "js-data-angular project authors",
33
"name": "js-data-angular",
44
"description": "Angular wrapper for js-data (originally angular-data).",
5-
"homepage": "http://www.js-data.io/docs/js-data-angular",
5+
"homepage": "https://github.com/js-data/js-data-angular",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/js-data/js-data-angular.git"
@@ -13,17 +13,18 @@
1313
".*",
1414
"*.iml",
1515
"src/",
16-
"Gruntfile.js",
1716
"node_modules/",
17+
"doc",
18+
"coverage",
19+
"test",
1820
"package.json"
1921
],
2022
"devDependencies": {
2123
"angular-1.3.2": "angular#1.3.2",
2224
"angular-mocks-1.3.2": "angular-mocks#1.3.2"
2325
},
2426
"dependencies": {
25-
"js-data": ">=2.0.0",
26-
"js-data-http": ">=2.0.0",
27+
"js-data": ">=2.0.0 <3",
2728
"angular": ">=1.1.0"
2829
}
2930
}

‎dist/js-data-angular.js

Lines changed: 179 additions & 140 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/js-data-angular.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/js-data-angular.min.js

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/js-data-angular.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎karma.conf.js

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,78 @@
1-
// an example karma.conf.js
1+
var customLaunchers = {
2+
bs_ie9_windows7: {
3+
base: 'BrowserStack',
4+
browser: 'ie',
5+
browser_version: '9.0',
6+
os: 'Windows',
7+
os_version: '7'
8+
},
9+
bs_safari7_osxmavericks: {
10+
base: 'BrowserStack',
11+
browser: 'safari',
12+
browser_version: '7.1',
13+
os: 'OS X',
14+
os_version: 'Mavericks'
15+
},
16+
bs_firefox41_windows7: {
17+
base: 'BrowserStack',
18+
browser: 'firefox',
19+
browser_version: '41.0',
20+
os: 'Windows',
21+
os_version: '7'
22+
},
23+
bs_chrome46_windows7: {
24+
base: 'BrowserStack',
25+
browser: 'chrome',
26+
browser_version: '46.0',
27+
os: 'Windows',
28+
os_version: '7'
29+
}
30+
}
31+
32+
var browsers = ['PhantomJS']
33+
if (
34+
process.env.BROWSERSTACK_USERNAME &&
35+
process.env.BROWSERSTACK_ACCESS_KEY
36+
) {
37+
browsers = browsers.concat(Object.keys(customLaunchers))
38+
}
39+
240
module.exports = function (config) {
341
config.set({
4-
// base path, that will be used to resolve files and exclude
542
basePath: './',
643
frameworks: ['sinon', 'chai', 'mocha'],
744
plugins: [
8-
// these plugins will be require() by Karma
945
'karma-sinon',
1046
'karma-mocha',
1147
'karma-chai',
12-
'karma-chrome-launcher',
1348
'karma-phantomjs-launcher',
14-
'karma-firefox-launcher',
15-
'karma-coverage',
16-
'karma-spec-reporter'
49+
'karma-coverage'
1750
],
1851
autoWatch: false,
1952
browserNoActivityTimeout: 30000,
20-
browsers: ['Chrome'],
21-
22-
// list of files / patterns to load in the browser
53+
browsers: browsers,
2354
files: [
2455
'bower_components/angular-1.3.2/angular.js',
2556
'bower_components/angular-mocks-1.3.2/angular-mocks.js',
57+
'node_modules/babel-polyfill/dist/polyfill.js',
2658
'node_modules/js-data/dist/js-data.js',
2759
'dist/js-data-angular.js',
2860
'karma.start.js',
2961
'test/**/*.js'
3062
],
31-
32-
reporters: ['spec', 'coverage'],
33-
63+
reporters: ['dots', 'coverage'],
3464
preprocessors: {
3565
'dist/js-data-angular.js': ['coverage']
3666
},
37-
38-
// optionally, configure the reporter
3967
coverageReporter: {
4068
type: 'lcov',
4169
dir: 'coverage/'
4270
},
43-
44-
// web server port
4571
port: 9876,
46-
47-
// cli runner port
4872
runnerPort: 9100,
49-
50-
// enable / disable colors in the output (reporters and logs)
5173
colors: true,
52-
53-
// level of logging
5474
logLevel: config.LOG_INFO,
55-
56-
// If browser does not capture in given timeout [ms], kill it
5775
captureTimeout: 30000,
58-
59-
// Continuous Integration mode
60-
// if true, it capture browsers, run tests and exit
6176
singleRun: true
62-
});
63-
};
77+
})
78+
}

‎karma.start.js

Lines changed: 127 additions & 127 deletions
Large diffs are not rendered by default.

‎package.json

Lines changed: 53 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,70 @@
11
{
22
"name": "js-data-angular",
33
"description": "Angular wrapper for js-data.",
4-
"version": "3.1.0",
4+
"version": "3.2.0",
55
"homepage": "http://www.js-data.io/docs/js-data-angular",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/js-data/js-data-angular.git"
99
},
10-
"author": {
11-
"name": "Jason Dobry",
12-
"url": "http://www.pseudobry.com",
13-
"email": "jason.dobry@gmail.com"
14-
},
15-
"licenses": [
16-
{
17-
"type": "MIT",
18-
"url": "https://github.com/js-data/js-data-angular/blob/master/LICENSE"
19-
}
20-
],
10+
"author": "js-data-angular project authors",
11+
"license": "MIT",
2112
"main": "dist/js-data-angular.js",
22-
"devDependencies": {
23-
"babel-core": "5.8.25",
24-
"babel-eslint": "4.1.7",
25-
"babel-loader": "5.3.2",
26-
"grunt": "0.4.5",
27-
"grunt-contrib-clean": "0.6.0",
28-
"grunt-contrib-uglify": "0.9.2",
29-
"grunt-contrib-watch": "0.6.1",
30-
"grunt-karma": "0.12.1",
31-
"grunt-karma-coveralls": "2.5.4",
32-
"grunt-webpack": "1.0.11",
33-
"jit-grunt": "0.9.1",
34-
"jshint-loader": "0.8.3",
35-
"karma": "0.13.9",
36-
"karma-chai": "0.1.0",
37-
"karma-chrome-launcher": "0.2.0",
38-
"karma-coverage": "0.5.2",
39-
"karma-firefox-launcher": "0.1.6",
40-
"karma-mocha": "0.2.0",
41-
"karma-phantomjs-launcher": "0.2.1",
42-
"karma-script-launcher": "0.1.0",
43-
"karma-sinon": "1.0.4",
44-
"karma-spec-reporter": "0.0.20",
45-
"standard": "5.3.1",
46-
"time-grunt": "1.2.1",
47-
"webpack-dev-server": "1.11.0"
13+
"standard": {
14+
"parser": "babel-eslint",
15+
"globals": [
16+
"Headers",
17+
"fetch",
18+
"Request",
19+
"action",
20+
"describe",
21+
"it",
22+
"sinon",
23+
"before",
24+
"after",
25+
"beforeEach",
26+
"afterEach"
27+
]
4828
},
4929
"scripts": {
50-
"test": "grunt test"
30+
"lint": "repo-tools lint karma.conf.js src/*.js scripts/*.js",
31+
"webpack": "node scripts/js-data-http.js && webpack --config webpack.config.js",
32+
"min": "uglifyjs dist/js-data-angular.js -o dist/js-data-angular.min.js --source-map dist/js-data-angular.min.map --source-map-url js-data-angular.min.map -v -m -c --screw-ie8",
33+
"version": "node scripts/version.js",
34+
"banner": "node scripts/banner.js",
35+
"gzip": "echo js-data-angular gzipped size: $(cat dist/js-data-angular.min.js | gzip -f9 | wc -c)kb",
36+
"build": "npm run lint && npm run webpack && npm run min && npm run version && npm run banner",
37+
"karma": "karma start",
38+
"test": "npm run build && npm run karma",
39+
"repo-tools": "repo-tools updates && repo-tools changelog && repo-tools authors",
40+
"release": "npm test && npm run repo-tools",
41+
"ci": "npm test && cat ./coverage/PhantomJS*/lcov.info | coveralls || true"
5142
},
5243
"peerDependencies": {
5344
"angular": ">=1.1.0",
54-
"js-data": ">=2.0.0"
45+
"js-data": ">=2.0.0 <3"
5546
},
56-
"standard": {
57-
"parser": "babel-eslint"
58-
},
59-
"dependencies": {
60-
"js-data-http": ">=2.0.0"
47+
"devDependencies": {
48+
"babel-core": "6.7.2",
49+
"babel-loader": "6.2.4",
50+
"babel-polyfill": "6.7.2",
51+
"babel-preset-es2015": "6.6.0",
52+
"chai": "3.5.0",
53+
"coveralls": "2.11.8",
54+
"js-data-repo-tools": "0.2.0",
55+
"karma": "0.13.22",
56+
"karma-browserstack-launcher": "0.1.10",
57+
"karma-chai": "0.1.0",
58+
"karma-mocha": "0.2.2",
59+
"karma-phantomjs-launcher": "1.0.0",
60+
"karma-sinon": "1.0.4",
61+
"mocha": "2.4.5",
62+
"phantomjs-prebuilt": "2.1.5",
63+
"request": "^2.69.0",
64+
"sinon": "1.17.3",
65+
"tar.gz": "^1.0.3",
66+
"tarball-extract": "0.0.3",
67+
"uglify-js": "2.6.2",
68+
"webpack": "1.12.14"
6169
}
6270
}

‎scripts/AUTHORS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is the official list of js-data-http project authors.
2+
#
3+
# This file is controlled by scripts/authors.js
4+
#
5+
# Names are formatted as:
6+
# Name or Organization <email address>
7+
# The email address is not required for organizations.

‎scripts/CONTRIBUTORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# People who have contributed to the js-data-http project.
2+
#
3+
# This file is controlled by scripts/authors.js
4+
#
5+
# Names should be added to this file as:
6+
# [commit count] Name <email address>

‎scripts/authors.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
var fs = require('fs')
2+
var exec = require('child_process').exec
3+
var path = require('path')
4+
5+
console.log('Writing AUTHORS file...')
6+
7+
var authorsFile = fs.readFileSync(path.join(__dirname, '/AUTHORS'), {
8+
encoding: 'utf-8'
9+
})
10+
var contributorsFile = fs.readFileSync(path.join(__dirname, '/CONTRIBUTORS'), {
11+
encoding: 'utf-8'
12+
})
13+
14+
var tty = process.platform === 'win32' ? 'CON' : '/dev/tty'
15+
16+
exec('git shortlog -s -e < ' + tty, function (err, stdout, stderr) {
17+
if (err) {
18+
console.error(err)
19+
process.exit(-1)
20+
} else {
21+
var lines = stdout.split('\n')
22+
var countsAndNames = lines.map(function (line) {
23+
return line.split('\t')
24+
})
25+
var names = countsAndNames.map(function (pair) {
26+
return pair[1]
27+
})
28+
29+
// Add to or otherwise modify "names" if necessary
30+
31+
fs.writeFileSync(path.join(__dirname, '/../AUTHORS'), authorsFile + names.join('\n'), {
32+
encoding: 'utf-8'
33+
})
34+
fs.writeFileSync(path.join(__dirname, '/../fetch/AUTHORS'), authorsFile + names.join('\n'), {
35+
encoding: 'utf-8'
36+
})
37+
fs.writeFileSync(path.join(__dirname, '/../node/AUTHORS'), authorsFile + names.join('\n'), {
38+
encoding: 'utf-8'
39+
})
40+
console.log('Done!')
41+
console.log('Writing CONTRIBUTORS file...')
42+
43+
names = lines
44+
45+
// Add to or otherwise modify "names" if necessary
46+
47+
fs.writeFileSync(path.join(__dirname, '/../CONTRIBUTORS'), contributorsFile + names.join('\n'), {
48+
encoding: 'utf-8'
49+
})
50+
fs.writeFileSync(path.join(__dirname, '/../fetch/CONTRIBUTORS'), contributorsFile + names.join('\n'), {
51+
encoding: 'utf-8'
52+
})
53+
fs.writeFileSync(path.join(__dirname, '/../node/CONTRIBUTORS'), contributorsFile + names.join('\n'), {
54+
encoding: 'utf-8'
55+
})
56+
console.log('Done!')
57+
}
58+
})

‎scripts/banner.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var fs = require('fs')
2+
var pkg = require('../package.json')
3+
4+
var banner = '/*!\n' +
5+
'* js-data-angular\n' +
6+
'* @version ' + pkg.version + ' - Homepage <https://github.com/js-data/js-data-angular>\n' +
7+
'* @copyright (c) 2014-2016 js-data-angular project authors\n' +
8+
'* @license MIT <https://github.com/js-data/js-data-angular/blob/master/LICENSE>\n' +
9+
'*\n' +
10+
'* @overview Angular wrapper for js-data.\n' +
11+
'*/\n'
12+
13+
console.log('Adding banner to dist/ files...')
14+
15+
function addBanner (filepath) {
16+
var contents = fs.readFileSync(filepath, {
17+
encoding: 'utf-8'
18+
})
19+
if (contents.substr(0, 3) !== '/*!') {
20+
fs.writeFileSync(filepath, banner + contents, {
21+
encoding: 'utf-8'
22+
})
23+
}
24+
}
25+
26+
addBanner('dist/js-data-angular.js')
27+
addBanner('dist/js-data-angular.min.js')
28+
29+
console.log('Done!')

‎scripts/cleanup.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var fs = require('fs')
2+
3+
var pkg = require('../package.json')
4+
5+
var path = './doc/js-data-angular/' + pkg.version + '/styles/'
6+
7+
var files = fs.readdirSync(path)
8+
files.forEach(function (file) {
9+
if (file.indexOf('site') === 0) {
10+
if (file.indexOf('lumen') === -1 && file.indexOf('dibs') === -1) {
11+
fs.unlinkSync(path + file)
12+
}
13+
}
14+
})
15+
16+
path = './doc/js-data-angular/' + pkg.version
17+
18+
files = fs.readdirSync(path)
19+
files.forEach(function (file) {
20+
if (file.indexOf('.html') === file.length - 5) {
21+
var content = fs.readFileSync(path + '/' + file, { encoding: 'utf8' })
22+
content = content.replace(/\/home\/ubuntu\/workspace\//gi, '')
23+
fs.writeFileSync(path + '/' + file, content, { encoding: 'utf8' })
24+
}
25+
})

‎scripts/js-data-http.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
var fs = require('fs')
2+
var url = 'https://github.com/js-data/js-data-http/archive/2.2.1.tar.gz'
3+
var directory = './.js-data-http/'
4+
var request = require('request')
5+
var targz = require('tar.gz')
6+
7+
// Streams
8+
try {
9+
fs.statSync(directory)
10+
console.log('js-data-http already downloaded')
11+
} catch (err) {
12+
console.log('downloading js-data-http')
13+
var read = request.get(url)
14+
var write = targz().createWriteStream(directory)
15+
16+
read.pipe(write)
17+
18+
write.on('finish', function () {
19+
var copyRead = fs.createReadStream(directory + 'js-data-http-2.2.1/src/index.js')
20+
var copyWrite = fs.createWriteStream('./.js-data-http.js')
21+
copyRead.pipe(copyWrite)
22+
})
23+
}

‎scripts/version.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
var fs = require('fs')
2+
var pkg = require('../package.json')
3+
4+
console.log('Adding version to dist/ files...')
5+
6+
function version (filepath) {
7+
var file = fs.readFileSync(filepath, {
8+
encoding: 'utf-8'
9+
})
10+
11+
file = file.replace(/<%= pkg\.version %>/gi, pkg.version)
12+
13+
var parts = pkg.version.split('-')
14+
var numbers = parts[0].split('.')
15+
16+
file = file.replace(/<%= major %>/gi, numbers[0])
17+
file = file.replace(/<%= minor %>/gi, numbers[1])
18+
file = file.replace(/<%= patch %>/gi, numbers[2])
19+
20+
if (pkg.version.indexOf('alpha') !== -1) {
21+
file = file.replace(/<%= alpha %>/gi, parts[1].replace('alpha.', '') + (parts.length > 2 ? '-' + parts[2] : ''))
22+
} else {
23+
file = file.replace(/<%= alpha %>/gi, false)
24+
}
25+
26+
if (pkg.version.indexOf('beta') !== -1) {
27+
file = file.replace(/<%= beta %>/gi, parts[1].replace('beta.', '') + (parts.length > 2 ? '-' + parts[2] : ''))
28+
} else {
29+
file = file.replace(/<%= beta %>/gi, false)
30+
}
31+
32+
fs.writeFileSync(filepath, file, {
33+
encoding: 'utf-8'
34+
})
35+
}
36+
37+
version('dist/js-data-angular.js')
38+
39+
console.log('Done!')

‎src/index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* jshint loopfunc:true */
22
let JSData = require('js-data')
3-
let DSHttpAdapter = require('../node_modules/js-data-http/src/index.js')
3+
let DSHttpAdapter = require('../.js-data-http.js')
44
let angular = require('angular')
55

66
let { DSUtils, DSErrors } = JSData
7-
let { isString, isNumber, isObject, set, resolveId } = DSUtils
7+
let { get, isString, isNumber, isObject, set, resolveId } = DSUtils
88

99
let adapters = [
1010
{
@@ -99,9 +99,16 @@ class DSProvider {
9999
throw new DSErrors.IA('"expr" must be a string!')
100100
}
101101

102+
let idAttribute = _this.definitions[resourceName].idAttribute
103+
102104
try {
103105
return scope.$watch(() => _this.lastModified(resourceName), () => {
104106
let items = _this.filter(resourceName, params)
107+
if (items && items.length) {
108+
angular.forEach(items, (item) => {
109+
_this.compute(resourceName, get(item, idAttribute))
110+
})
111+
}
105112
set(scope, expr, items)
106113
if (cb) {
107114
cb(null, items)
@@ -233,4 +240,6 @@ for (var i = 0; i < adapters.length; i++) {
233240

234241
// return the module name
235242
module.exports = 'js-data'
236-
module.exports.name = 'js-data'
243+
try {
244+
module.exports.name = 'js-data'
245+
} catch (e) {}

‎test/datastore/sync_methods/bindAll.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ describe('DS.bindAll', function () {
1313
it('should throw an error when method pre-conditions are not met', function () {
1414
assert.throws(function () {
1515
DS.bindAll('does not exist');
16-
}, DS.errors.NonexistentResourceError, 'does not exist is not a registered resource!');
16+
}, Error, 'does not exist is not a registered resource!');
1717

1818
angular.forEach(TYPES_EXCEPT_OBJECT, function (key) {
1919
if (key) {
2020
assert.throws(function () {
2121
DS.bindAll('post', key);
22-
}, DS.errors.IllegalArgumentError, '"params" must be an object!');
22+
}, Error, '"params" must be an object!');
2323
}
2424
});
2525

2626
angular.forEach(TYPES_EXCEPT_OBJECT, function (key) {
2727
assert.throws(function () {
2828
DS.bindAll('post', {}, key);
29-
}, DS.errors.IllegalArgumentError, '"scope" must be an object!');
29+
}, Error, '"scope" must be an object!');
3030
});
3131

3232
angular.forEach(TYPES_EXCEPT_STRING, function (key) {
3333
assert.throws(function () {
3434
DS.bindAll('post', {}, $scope, key);
35-
}, DS.errors.IllegalArgumentError, '"expr" must be a string!');
35+
}, Error, '"expr" must be a string!');
3636
});
3737
});
3838
it('should bind an item in the data store to the scope', function () {

‎test/datastore/sync_methods/bindOne.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ describe('DS.bindOne', function () {
1313
it('should throw an error when method pre-conditions are not met', function () {
1414
assert.throws(function () {
1515
DS.bindOne('does not exist');
16-
}, DS.errors.NonexistentResourceError, 'does not exist is not a registered resource!');
16+
}, Error, 'does not exist is not a registered resource!');
1717

1818
angular.forEach(TYPES_EXCEPT_STRING_OR_NUMBER, function (key) {
1919
assert.throws(function () {
2020
DS.bindOne('post', key);
21-
}, DS.errors.IllegalArgumentError, '"id" must be a string or a number!');
21+
}, Error, '"id" must be a string or a number!');
2222
});
2323

2424
angular.forEach(TYPES_EXCEPT_OBJECT, function (key) {
2525
assert.throws(function () {
2626
DS.bindOne('post', 5, key);
27-
}, DS.errors.IllegalArgumentError, '"scope" must be an object!');
27+
}, Error, '"scope" must be an object!');
2828
});
2929

3030
angular.forEach(TYPES_EXCEPT_STRING, function (key) {
3131
assert.throws(function () {
3232
DS.bindOne('post', 5, $scope, key);
33-
}, DS.errors.IllegalArgumentError, '"expr" must be a string!');
33+
}, Error, '"expr" must be a string!');
3434
});
3535
});
3636
it('should bind an item in the data store to the scope', function () {

‎webpack.config.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var path = require('path')
2+
3+
module.exports = {
4+
devtool: 'source-map',
5+
entry: {
6+
'./dist/js-data-angular.js': './src/index.js'
7+
},
8+
output: {
9+
filename: '[name]',
10+
libraryTarget: 'umd2',
11+
library: 'jsDataAngularModuleName'
12+
},
13+
externals: {
14+
'js-data': {
15+
amd: 'js-data',
16+
commonjs: 'js-data',
17+
commonjs2: 'js-data',
18+
root: 'JSData'
19+
},
20+
'axios': 'axios',
21+
'angular': 'angular'
22+
},
23+
module: {
24+
loaders: [
25+
{
26+
loader: 'babel-loader',
27+
include: [
28+
path.resolve(__dirname, 'src'),
29+
path.resolve(__dirname)
30+
],
31+
test: /\.js$/
32+
}
33+
]
34+
}
35+
}

0 commit comments

Comments
 (0)
Please sign in to comment.