Skip to content

Commit

Permalink
Minor changes for TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Dec 14, 2019
1 parent 48ce788 commit 3a5e68f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ script:
# Install tools
npm install
npm run typescript-compile
npm run tsc
cd Tools
npm install
cd ..
Expand Down
31 changes: 31 additions & 0 deletions Assets/JoplinIconBlack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

# TypeScript

Most of the application is written in JavaScript, however new classes and files should generally be written in [TypeScript](https://www.typescriptlang.org/). Even if you don't write TypeScript code, you will need to build the existing .ts and .tsx files. This is done from the root of the project, by running `npm run typescript-compile`.
Most of the application is written in JavaScript, however new classes and files should generally be written in [TypeScript](https://www.typescriptlang.org/). Even if you don't write TypeScript code, you will need to build the existing .ts and .tsx files. This is done from the root of the project, by running `npm run tsc`.

If you are modifying TypeScript code, the best is to have the compiler watch for changes from a terminal. To do so, run `npm run typescript-watch`.
If you are modifying TypeScript code, the best is to have the compiler watch for changes from a terminal. To do so, run `npm run tsc-watch`.

All TypeScript files are generated next to the .ts or .tsx file. So for example, if there's a file "lib/MyClass.ts", there will be a generated "lib/MyClass.js" next to it. If you create a new TypeScript file, make sure you add the generated .js file to .gitignore. It is implemented that way as it requires minimal changes to integrate TypeScript in the existing JavaScript code base.

Expand Down Expand Up @@ -37,7 +37,7 @@ npm install && cd Tools && npm install

```
rsync --delete -a ReactNativeClient/lib/ ElectronClient/app/lib/
npm run typescript-compile
npm run tsc
cd ElectronClient/app
npm install
yarn dist
Expand All @@ -57,7 +57,7 @@ From `/ElectronClient` you can also run `run.sh` to run the app for testing.

```
xcopy /C /I /H /R /Y /S ReactNativeClient\lib ElectronClient\app\lib
npm run typescript-compile
npm run tsc
cd ElectronClient\app
npm install
yarn dist
Expand All @@ -78,7 +78,7 @@ First you need to setup React Native to build projects with native code. For thi
Then:

```
npm run typescript-compile
npm run tsc
cd ReactNativeClient
npm install
react-native run-ios
Expand Down
2 changes: 1 addition & 1 deletion CliClient/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rsync -a --delete "$ROOT_DIR/../ReactNativeClient/locales/" "$BUILD_DIR/locales/
cp "$ROOT_DIR/package.json" "$BUILD_DIR"

cd $ROOT_DIR/..
npm run typescript-compile
npm run tsc
cd $ROOT_DIR

chmod 755 "$BUILD_DIR/main.js"
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ install:
build_script:
- ps: xcopy /C /I /H /R /Y /S ReactNativeClient\lib ElectronClient\app\lib
- npm install
- npm run typescript-compile
- npm run tsc
- ps: cd Tools
- npm install
- ps: cd ..\ElectronClient\app
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"scripts": {
"linter": "./node_modules/.bin/eslint --fix --ext .js --ext .jsx --ext .ts --ext .tsx",
"linter-ci": "./node_modules/.bin/eslint --ext .js --ext .jsx --ext .ts --ext .tsx",
"typescript-compile": "tsc",
"typescript-watch": "tsc --watch"
"tsc": "tsc",
"tsc-watch": "tsc --watch"
},
"husky": {
"hooks": {
Expand Down

0 comments on commit 3a5e68f

Please sign in to comment.