Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { IAugmentedJQuery, IComponentOptions } from 'angular'
import fromPairs = require('lodash.frompairs')
// import fromPairs = require('lodash.frompairs')
import NgComponent from 'ngcomponent'
import * as React from 'react'
import { render, unmountComponentAtNode } from 'react-dom'

const fromPairs = (x: any) => x.reduce(
(a: any, [k, v]: [string, any]) => (Object as any).assign({}, a, {[k]: v}),
{}
)

/**
* Wraps a React component in Angular. Returns a new Angular component.
*
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
"main:esnext": "index.es2015.js",
"typings": "index.d.ts",
"scripts": {
"build": "npm run clean; tsc -d -t es2015 && mv ./index.js ./index.es2015.js && tsc -t es5",
"build": "npm run clean; ./node_modules/.bin/tsc -d -t es2015 && mv ./index.js ./index.es2015.js && ./node_modules/.bin/tsc -t es5",
"clean": "rm ./*.d.ts; rm ./*.map; exit 0",
"pretest": "npm run build",
"prepare": "npm test",
"test": "karma start --single-run",
"precommit": "npm run build",
"test": "./node_modules/.bin/karma start --single-run",
"tdd": "npm-run-all -pr watch:*",
"watch:ts": "tsc -w",
"watch:test": "karma start"
Expand All @@ -29,19 +28,19 @@
"peerDependencies": {
"prop-types": ">=15",
"react": ">=15",
"react-dom": ">=15",
"@types/angular-mocks": ">=1.5",
"@types/angular": ">=1.5",
"react-dom": ">=15"
},
"devDependencies": {
"@types/jasmine": "^2.5.53",
"@types/jquery": "^3.2.10",
"@types/lodash.frompairs": "^4.0.3",
"@types/prop-types": "^15.5.2",
"@types/react-dom": ">=15",
"@types/react": ">=15"
},
"devDependencies": {
"angular-mocks": ">=1.5",
"expect": "^21.2.1",
"jasmine": "^2.8.0",
"karma": "^1.7.0",
"jasmine-core": "^2.8.0",
"karma": "^1.7.1",
"karma-browserify": "^5.1.1",
"karma-chrome-launcher": "^2.2.0",
"karma-jasmine": "^1.1.0",
Expand All @@ -54,12 +53,13 @@
"react-dom": "^15.6.1",
"rollupify": "^0.4.0",
"tslint": "^5.7.0",
"typescript": "^2.5.2",
"typescript": "^2.6.1",
"watchify": "^3.9.0"
},
"dependencies": {
"angular": ">=1.5.11",
"husky": "^0.14.3",
"lodash.frompairs": "^4.0.1",
"ngcomponent": "^4.0.1"
"ngcomponent": "^4.1.0"
}
}
7 changes: 4 additions & 3 deletions test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { bootstrap, element as $, ICompileService, mock, module } from 'angular'
import 'angular-mocks'
import { $rootScope } from 'ngimport'
import * as PropTypes from 'prop-types'
import * as React from 'react'
import { Simulate } from 'react-dom/test-utils'
import { react2angular } from './'
Expand Down Expand Up @@ -36,9 +37,9 @@ class TestFour extends React.Component<Props> {

class TestFive extends React.Component<Props> {
static propTypes = {
bar: React.PropTypes.array.isRequired,
baz: React.PropTypes.func.isRequired,
foo: React.PropTypes.number.isRequired
bar: PropTypes.array.isRequired,
baz: PropTypes.func.isRequired,
foo: PropTypes.number.isRequired
}

render() {
Expand Down
23 changes: 21 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@
"es2015",
"es2016.array.include"
],
"types": [
"angular-mocks",
"jasmine",
"jquery",
"lodash.frompairs",
"react",
"react-dom"
],
"paths": {
"*" : [
"./node_modules/@types/*",
"*"
]
},
"baseUrl": "./",
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
Expand All @@ -18,10 +33,14 @@
"pretty": true,
"sourceMap": true,
"strictNullChecks": true,
"target": "es2015"
"target": "es6"
},
"exclude": [
"node_modules/@types/angular-mocks/node_modules/@types",
"node_modules/@types/react-dom/node_modules/@types"
],
"files": [
"index.tsx",
"test.tsx"
]
}
}
Loading