Skip to content

Commit 1572683

Browse files
author
Lee Richmond
committed
tmp
1 parent 470e212 commit 1572683

22 files changed

+775
-126
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+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@ jspm_packages
4949
*.swn
5050
*.swo
5151

52+
dist/*
5253
tmp/*
5354
!tmp/.keepme
55+
!.keepme

dist/.keepme

Whitespace-only changes.

example/foo.es6.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// babel example/foo.es6.js -o example/foo.js
2+
3+
import { Config, Model } from '../dist/jsorm';
4+
5+
console.log('exmaple file', Model.baseUrl);

example/foo.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
var _jsorm = require('../dist/jsorm');
4+
5+
console.log('exmaple file', _jsorm.Model.baseUrl); // babel example/foo.es6.js -o example/foo.js

gulpfile.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
const gulp = require('gulp');
22
const mocha = require('gulp-mocha');
3-
const clean = require('gulp-clean');
43
const webpack = require('webpack-stream');
54
const ts = require('gulp-typescript');
5+
const del = require('del');
66

77
var tsProject = ts.createProject('tsconfig.json');
88

9-
gulp.task('test_clean', function () {
10-
//return gulp.src('./tmp/test/**/*', { read: false })
11-
//.pipe(clean());
9+
gulp.task('clean:test', function () {
10+
return del(['tmp/test']);
1211
});
1312

14-
gulp.task('test', ['test_clean'], () =>
13+
gulp.task('test', ['clean:test'], () =>
1514
gulp
1615
.src(['./index.d.ts.', './src/**/*.ts', './test/test-helper.ts', './test/**/*-test.ts'], { base: '.' })
1716
.pipe(tsProject())
1817
.pipe(gulp.dest('tmp/test'))
1918
.pipe(mocha())
2019
);
2120

22-
// Use webpack, not tsProject, for browserification
2321
gulp.task('build', function () {
24-
return gulp.src("src/main.ts")
22+
gulp
23+
.src(['./index.d.ts', './src/main.ts'])
24+
.pipe(tsProject())
2525
.pipe(webpack(require('./webpack.config.js') ))
2626
.pipe(gulp.dest('dist/'))
2727
});

index.d.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@ declare var asyncAssert: any;
33

44
// todo deglobalize?, split test
55

6+
declare module NodeJS {
7+
interface Global {
8+
__extends: Function;
9+
sinon: any;
10+
JSORM: any;
11+
}
12+
}
13+
14+
interface IModel {
15+
id: string;
16+
[propName: string]: any;
17+
}
18+
19+
interface anyObject {
20+
[propName: string]: any;
21+
}
22+
23+
interface modelsConfig {
24+
[key: string]: any;
25+
}
26+
627
interface japiDocArray {
728
data: Array<japiResource>;
829
}

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
"main": "./dist/main.js",
66
"types": "./main.d.ts",
77
"scripts": {
8-
"test": "gulp test"
8+
"test": "gulp test",
9+
"main": "dist/jsorm.min.js",
10+
"scripts": {
11+
"prepublish": "webpack --debug; webpack -p"
12+
}
913
},
1014
"author": "Lee Richmond",
1115
"license": "MIT",
@@ -16,17 +20,24 @@
1620
"@types/isomorphic-fetch": "0.0.31",
1721
"@types/mocha": "^2.2.33",
1822
"@types/node": "^6.0.52",
23+
"babel-preset-es2015": "^6.18.0",
1924
"chai": "^3.5.0",
2025
"chai-as-promised": "^6.0.0",
2126
"chai-things": "^0.2.0",
27+
"del": "^2.2.2",
2228
"fetch-mock": "^5.6.2",
2329
"gulp": "^3.9.1",
2430
"gulp-clean": "^0.3.2",
2531
"gulp-mocha": "^3.0.1",
2632
"gulp-typescript": "^3.1.3",
33+
"json-loader": "^0.5.4",
2734
"mocha": "^3.2.0",
2835
"sinon": "^1.17.6",
36+
"ts-loader": "^1.3.3",
37+
"tslint": "^4.1.1",
38+
"tslint-loader": "^3.3.0",
2939
"typescript": "^2.1.4",
40+
"webpack": "^1.14.0",
3041
"webpack-stream": "^3.2.0"
3142
},
3243
"dependencies": {

src/configuration.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference path="../index.d.ts" />
2+
3+
export default class Config {
4+
static models: Object = {};
5+
}

src/main.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
/// <reference path="../index.d.ts" />
22

3-
import * as es6Promise from 'es6-promise';
4-
import 'isomorphic-fetch';
5-
es6Promise.polyfill();
3+
// https://github.com/Microsoft/TypeScript/issues/6425
4+
global.__extends = (this && this.__extends) || function (d, b) {
5+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
6+
function __() { this.constructor = d; }
7+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8+
if (b.inherited) b.inherited(d);
9+
};
610

7-
import Model from "./model";
11+
import Config from './configuration';
12+
import Model from './model';
813

9-
export { Model };
14+
export { Config, Model };

0 commit comments

Comments
 (0)