Skip to content

Commit

Permalink
Merge pull request #10 from frictionlessdata/2-cleaning-up-and-syncin…
Browse files Browse the repository at this point in the history
…g-with-py-lib

2 cleaning up and syncing with py lib
  • Loading branch information
rufuspollock committed May 1, 2016
2 parents 9ce1ffb + 2d14020 commit f9df973
Show file tree
Hide file tree
Showing 42 changed files with 8,115 additions and 130 deletions.
6 changes: 6 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": ["es2015"],
"plugins": [
"add-module-exports"
]
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/schemas/*
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
parser: babel-eslint
extends: airbnb/base
env:
node: true
browser: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# Compiled ES5 files
lib/
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Source ES6 files
src/

This comment has been minimized.

Copy link
@akariv

akariv May 2, 2016

This breaks the code of everyone using this library as a git dependency...

This comment has been minimized.

Copy link
@pwalsh

pwalsh May 2, 2016

Contributor

Was the latest npm package not up to date? I can't fix this from where I am now but feel free to revert as required for a temp fix.

This comment has been minimized.

Copy link
@akariv

akariv May 2, 2016

Not sure why I was using this as a git dependency (probably tried to make sure I was using the latest code).
With this latest commit, neither the src/ nor the lib/ folders are pulled from git, which makes it impossible to import.
I often find myself using git dependencies in case I want to test a change before creating a pull request, so this is q common use case.
As a workaround I fixed my dependencies to the previous commit (or I might just use the npm version), so this is probably not so urgent (but still needs to be fixed, though 😄 )

This comment has been minimized.

Copy link
@pwalsh

pwalsh May 2, 2016

Contributor

Ok. Revert if needed, otherwise let's look at our git workflows here and elsewhere and see how we ensure that stuff gets built properly with npm hooks. If you remember, I sorted that issue for one of our other code bases a month or so ago. Babbage.ui maybe? It is a matter of using npm hooks properly to build sources IIRC.


# Coverage directory used by tools like istanbul
coverage/

# Compiled files for the browser
dist/
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
language: node_js
node_js:
- "4.1.1"
- "4.2"
- "5.5"
cache:
directories:
- node_modules
- .nvm
install: npm install
script: npm run coverage
after_script: npm run coveralls
branches:
only:
- master
notifications:
email:
on_success: never
Expand Down
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Data Package Registry

[![Travis Build Status](https://travis-ci.org/okfn/datapackage-registry-js.svg?branch=master)](https://travis-ci.org/okfn/datapackage-registry-js)
[![Coveralls](http://img.shields.io/coveralls/okfn/datapackage-registry-js.svg?branch=master)](https://coveralls.io/r/okfn/datapackage-registry-js?branch=master)

JavaScript package for working with a Data Package registry.

It comes with a cached version of the registry and profiles from
https://github.com/dataprotocols/schemas.

## Usage

```javascript
var Registry = require('datapackage-registry');

// Without parameters, this will use the default registry (http://schemas.datapackages.org/registry.csv)
// When using in NodeJS, this registry is locally cached, so no HTTP requests will de done.
var registry = new Registry();

// See the list of profiles available in the registry
registry.getProfiles()
.then(function (profiles) {
console.log(profiles);
// {
// base:
// { id: 'base',
// title: 'Data Package',
// schema: 'http://schemas.datapackages.org/data-package.json',
// schema_path: 'data-package.json',
// specification: 'http://dataprotocols.org/data-packages' },
// tabular:
// { id: 'tabular',
// title: 'Tabular Data Package',
// schema: 'http://schemas.datapackages.org/tabular-data-package.json',
// schema_path: 'tabular-data-package.json',
// specification: 'http://dataprotocols.org/tabular-data-package/' },
// fiscal:
// { id: 'fiscal',
// title: 'Fiscal Data Package',
// schema: 'http://schemas.datapackages.org/fiscal-data-package.json',
// schema_path: 'fiscal-data-package.json',
// specification: 'http://fiscal.dataprotocols.org/spec/' }
// }
});

// Get a profile
registry.get('base')
.then(function (profile) {
// use profile
})
.catch(function (err) {
// deal with error
});
```

### Browser support

This package requires ES6's `Promise`. If you need to support a browser that
doesn't have it built-in (check in http://caniuse.com/#feat=promises), you have
to use a polyfill like
[es6-promise](https://github.com/jakearchibald/es6-promise).

## Developer notes

These notes are intended to help people that want to contribute to this
package itself. If you just want to use it, you can safely ignore this.

### Updating the local schemas cache

We cache the schemas from <https://github.com/dataprotocols/schemas> using
git-subtree. To update it, use:

git subtree pull --prefix schemas https://github.com/dataprotocols/schemas.git master --squash

0 comments on commit f9df973

Please sign in to comment.