Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

[WIP] Typescript conversion #438

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
22b5aa7
[package] Update to React Native 0.40.0
alloy Jan 27, 2017
669733b
[package] Switch to fork of RN master that has fixed podspec.
alloy Jan 27, 2017
7f7ca64
[ImageView] Switch to using Yoga’s API.
alloy Jan 27, 2017
220fc40
[Typescript] Initial project conversion
l2succes Jan 30, 2017
91d9335
[Typescript] Fixes just enough to get the code to compile and run
l2succes Jan 30, 2017
156c480
[Typescript] fixes type issues for Gene container and sub components
l2succes Jan 31, 2017
85f2cee
[Typescript] Adds relay interfaces using relay2ts
l2succes Feb 1, 2017
63f49a9
[Typescript] Removes storybook file in Example
l2succes Feb 1, 2017
fb5d65c
[Typescript] Fixes tests
l2succes Feb 1, 2017
230a153
[TypeScript] Fixes most type errors in artist components
sarahscott Feb 1, 2017
1f26cdd
[TypeScript] Finishes artist components
sarahscott Feb 2, 2017
773dcf7
stash
alloy Feb 2, 2017
7573b8c
[Typescript] rename relay interfaces
l2succes Feb 1, 2017
a48d856
[Typescript] reset Podfile.lock changes
l2succes Feb 2, 2017
be03af7
[Typescript] removes storybook from Example app entrypoint
l2succes Feb 2, 2017
a954e12
[Typescript] get tests to run locally
l2succes Feb 2, 2017
402f452
[Typescript] converted tests to typscript
l2succes Feb 7, 2017
5775c52
[pod] Update to RN 0.42.0-rc2
alloy Feb 9, 2017
5c1fd4f
[Typescript] updated jest and tests
l2succes Feb 9, 2017
994a990
Adds .nvmrc
l2succes Feb 9, 2017
de6f431
[Typescript] Fixes tests
l2succes Feb 9, 2017
9ae1d9e
[OpaqueImageView] RN now has built-in support for aspect ratios.
alloy Feb 10, 2017
96ed06e
[Home/Artist] Ensure the rail fully takes up its height and pushes si…
alloy Feb 10, 2017
d6db12b
[vscode] Update recommended extensions
orta Feb 19, 2017
c7b3cc5
[Packages] Remove unused packages
orta Feb 19, 2017
da28aeb
Upgrades react-native/yoga to working version
l2succes Feb 21, 2017
5baf183
Merge branch 'typescript' of github.com:artsy/emission into typescript
l2succes Feb 21, 2017
1ac0388
[TypeScript] Converted load failure view to ts
sarahscott Feb 23, 2017
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
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"jest": true
},

"ignore": [
"build/**/*.js"
],

"plugins": [
"react",
"flow-vars",
Expand Down
71 changes: 0 additions & 71 deletions .flowconfig

This file was deleted.

5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
// Because we use Flow - see https://github.com/flowtype/flow-for-vscode#setup
"javascript.validate.enable": false,
"clang.compilationDatabase": "${workspaceRoot}/Example/compile_commands.json",
"flow.useNPMPackagedFlow": true
}
"flow.useNPMPackagedFlow": true,
"typescript.tsdk": "./node_modules/typescript/lib"
}
26 changes: 22 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
{
"version": "0.1.0",
"command": "npm",
"command": "sh",
"args": ["-c"],
"isShellCommand": true,
"showOutput": "always",
"showOutput": "silent",
"suppressTaskName": true,
"tasks": [
{
"taskName": "Start Packager and Storybook Server",
"isBuildCommand": true,
"args": ["start"]
"args": ["npm start"]
},
{
"taskName": "Start Typescript Compiler",
"isBuildCommand": true,
"args": ["tsc"],
"problemMatcher": [
"$tsc"
]
},
{
"taskName": "Start Typescript Compiler (in watch mode)",
"isBuildCommand": true,
"args": ["tsc --watch"],
"isWatching": true,
"problemMatcher": [
"$tsc-watch"
]
}
]
]
}
4 changes: 0 additions & 4 deletions Example/Emission/index.ios.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
/* @flow */
'use strict';

import 'emission';
import './storybook';

17 changes: 0 additions & 17 deletions Example/Emission/storybook.js

This file was deleted.

19 changes: 8 additions & 11 deletions Example/EmissionTests/TestApps.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
/* @flow */
'use strict';

import Emission from 'emission';
import React from 'react';
import ReactNative from 'react-native';
const { View } = ReactNative;
const { TestModule } = ReactNative.NativeModules;
import Emission from 'emission'
import React from 'react'
Copy link
Contributor

@alloy alloy Feb 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this be?

import * as React from 'react'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's correct, still working on converting all the tests. I'll have it updated soon

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, just checked, this doesn't need to change - it's still a JS file, and should stay one probably. It's only referenced by the iOS Sim Test Runner.

import ReactNative from 'react-native'
const { View } = ReactNative
const { TestModule } = ReactNative.NativeModules

class OpaqueImageViewTest extends React.Component {
assert() {
TestModule.verifySnapshot(TestModule.markTestPassed);
TestModule.verifySnapshot(TestModule.markTestPassed)
}

render() {
return (
<View style={this.props.containerStyle}>
<Emission.Components.OpaqueImageView {...this.props.imageView} onLoad={this.assert} />
</View>
);
)
}
}

ReactNative.AppRegistry.registerComponent('OpaqueImageView', () => OpaqueImageViewTest);
ReactNative.AppRegistry.registerComponent('OpaqueImageView', () => OpaqueImageViewTest)
4 changes: 1 addition & 3 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* @flow */

import { danger, fail, warn } from 'danger'
import { includes } from 'lodash'

Expand All @@ -26,7 +24,7 @@ if (packageChanged && !lockfileChanged) {

const someoneAssigned = danger.github.pr.assignee
if (someoneAssigned === null) {
fail('Please assign someone to merge this PR, and optionally include people who should review.');
fail('Please assign someone to merge this PR, and optionally include people who should review.')
}

// Danger JS doesn't support warn yet.
Expand Down
13 changes: 5 additions & 8 deletions index.ios.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
/* @flow */
'use strict'
import Containers from './build/lib/containers'
import Components from './build/lib/components'
import Routes from './build/lib/relay/routes'

import Containers from './lib/containers'
import Components from './lib/components'
import Routes from './lib/relay/routes'

import './lib/relay/config'
import './lib/app_registry'
import './build/lib/relay/config'
import './build/lib/app_registry'

export default {
Containers,
Expand Down
21 changes: 0 additions & 21 deletions lib/components/switch_view.js

This file was deleted.

34 changes: 0 additions & 34 deletions lib/components/tab_view.js

This file was deleted.

29 changes: 0 additions & 29 deletions lib/components/text/headline.js

This file was deleted.

19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@
"lint": "eslint ./lib ./test",
"fixlint": "eslint ./lib ./test --fix",
"start": "npm run clean-example && concurrently --kill-others 'npm run start-packager' 'npm run storybook'",
"start-packager": "cd node_modules/react-native && npm start -- --reset-cache",
"start-packager": "node node_modules/react-native/local-cli/cli.js start --config rn-cli.config.js",
"storybook": "storybook start -p 9001",
"sync-colors": "cd externals/elan && git fetch && git checkout origin/master && cp components/lib/variables/colors.json ../../data",
"sync-externals": "npm run-script sync-schema && npm run-script sync-colors",
"sync-schema": "cd externals/metaphysics && git fetch && git checkout origin/master && npm install && npm run dump-schema -- ../../data && rm -rf node_modules",
"test": "jest",
"testing": "jest --watch",
"rndebugger": "REACT_DEBUGGER=\"open 'rndebugger://set-debugger-loc?host=localhost&port=8081' --args\" npm start"
"rndebugger": "REACT_DEBUGGER=\"open 'rndebugger://set-debugger-loc?host=localhost&port=8081' --args\" npm start",
"ios": "node node_modules/react-native/local-cli/cli.js run-ios"
},
"jest": {
"preset": "jest-react-native",
"testPathIgnorePatterns": [
"\\.snap$",
"/node_modules/"
"/node_modules/",
"/src/"
]
},
"repository": {
Expand Down Expand Up @@ -54,10 +56,16 @@
"react-native": "0.34.1",
"react-native-parallax-scroll-view": "https://github.com/orta/react-native-parallax-scroll-view",
"react-relay": "https://github.com/alloy/relay/releases/download/v0.9.3/react-relay-0.9.3.tgz",
"remove-markdown": "0.1.0"
"remove-markdown": "0.1.0",
"typescript": "^2.1.5"
},
"devDependencies": {
"@kadira/react-native-storybook": "^1.12.6",
"@types/jest": "^18.1.1",
"@types/lodash": "^4.14.52",
"@types/node": "^7.0.4",
"@types/react-native": "^0.37.11",
"@types/react-relay": "^0.9.10",
"apphub": "^0.5.1",
"babel-eslint": "^7.1.1",
"babel-jest": "^17.0.2",
Expand All @@ -75,7 +83,8 @@
"jest-cli": "^17.0.3",
"jest-react-native": "^17.0.3",
"react-storybooks-relay-container": "^1.0.0",
"react-test-renderer": "^15.3.0"
"react-test-renderer": "^15.3.0",
"tslint": "^4.4.2"
},
"peerDependencies": {
"babel-relay-plugin": "^0.9.0"
Expand Down
10 changes: 9 additions & 1 deletion rn-cli.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ var config = {
return blacklist(platform, [
/coverage\/.*/
])
}
},

getSourceExts() {
return ["js", "ts", "tsx"]
},

getTransformModulePath() {
return require.resolve("./transformer")
},
}

module.exports = config
14 changes: 14 additions & 0 deletions src/data/colors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
"gray-light": "#f8f8f8",
"gray-regular": "#e5e5e5",
"gray-medium": "#cccccc",
"gray-semibold": "#666666",
"gray-bold": "#333333",
"purple-light": "#e2d2ff",
"purple-regular": "#6e1fff",
"red-regular": "#f7625a",
"yellow-regular": "#fdefd1",
"yellow-medium": "#fce1a8",
"yellow-bold": "#f1af1b",
"green-regular": "#0eda83"
}
1 change: 1 addition & 0 deletions src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare const __DEV__: boolean;
Loading