Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce React, TypeScript, TSLint and React-StyleGuidist #2219

Merged
merged 23 commits into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
26f69b6
Gruntfile: Remove edits to background.js; no longer applicable
scottnonnenberg-signal Mar 22, 2018
e32dad2
Gruntfile: limit jshint/jscs watch tasks to own files, not *.js
scottnonnenberg-signal Mar 22, 2018
1ad2b08
Move moment from bower deps to npm deps
scottnonnenberg-signal Mar 24, 2018
f86a6ef
Update style of i18n, pull it in via preload instead of .html
scottnonnenberg-signal Mar 24, 2018
893fb1c
Introduce React/TypeScript/TSLint into app for new UI components
scottnonnenberg-signal Mar 26, 2018
1326b26
Full styleguide now available via `yarn styleguide`
scottnonnenberg-signal Apr 3, 2018
3899eb8
Add 'use strict' to i18n.js
scottnonnenberg-signal Apr 4, 2018
104a1ca
Remove i18n.js from jshint run, fix missing semicolon
scottnonnenberg-signal Apr 5, 2018
ed12e1b
Add mp3 to project, make binary files available in rsg on util
scottnonnenberg-signal Apr 5, 2018
887abd7
Add missing shim, fix typo
scottnonnenberg-signal Apr 5, 2018
be91a89
Parse theme from querystring, put on util. Moment from require()
scottnonnenberg-signal Apr 5, 2018
1052341
Fix tslint errors and add tslint to CI task in package.json
scottnonnenberg-signal Apr 5, 2018
23293a3
New tslint rule: Interfaces must not start with I
scottnonnenberg-signal Apr 5, 2018
bb73d47
Gruntfile: Sort lines in jshint/jscs config
scottnonnenberg-signal Apr 5, 2018
2384092
Use Array.isArray in i18n.js
scottnonnenberg-signal Apr 5, 2018
61a7846
Fix typo in index.ts
scottnonnenberg-signal Apr 5, 2018
cdd16c9
Rename test-only MessageParents to ConversationContext
scottnonnenberg-signal Apr 5, 2018
e5322e8
Finish rename of MessageParents, re-add moment to page
scottnonnenberg-signal Apr 5, 2018
76be135
js/i18n.js -> js/modules/i18n.js
scottnonnenberg-signal Apr 5, 2018
50d4dba
Remove 'use strict' from i18n.js
scottnonnenberg-signal Apr 5, 2018
2353754
Big refactor: ts/ directory for all typescript, including react
scottnonnenberg-signal Apr 5, 2018
0530323
window.Signal.React -> window.Signal.Components
scottnonnenberg-signal Apr 5, 2018
96bd90a
Simplify assignment; add warning to preload.js about Style Guide
scottnonnenberg-signal Apr 6, 2018
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
5 changes: 4 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ libtextsecure/**
# these aren't ready yet, pulling files in one-by-one
js/*.js
js/models/**/*.js
js/react/**/*.js
js/views/**/*.js
test/*.js
test/models/*.js
test/views/*.js
/*.js

# typescript-generated files
ts/**/*.js

# ES2015+ files
!js/background.js
!js/backup.js
Expand All @@ -22,6 +24,7 @@ test/views/*.js
!js/models/conversations.js
!js/views/attachment_view.js
!js/views/conversation_search_view.js
!js/views/backbone_wrapper_view.js
!js/views/debug_log_view.js
!js/views/file_input_view.js
!js/views/inbox_view.js
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ js/libtextsecure.js
stylesheets/*.css
test/test.js
libtextsecure/test/test.js

# React / TypeScript
ts/**/*.js
1 change: 0 additions & 1 deletion .yarnclean
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ assets

# examples
example
examples

# code coverage directories
coverage
Expand Down
57 changes: 24 additions & 33 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,19 @@ module.exports = function(grunt) {
'Gruntfile.js',
'js/**/*.js',
'!js/background.js',
'!js/backup.js',
'!js/components.js',
'!js/database.js',
'!js/jquery.js',
'!js/libtextsecure.js',
'!js/WebAudioRecorderMp3.js',
'!js/Mp3LameEncoder.min.js',
'!js/libsignal-protocol-worker.js',
'!js/components.js',
'!js/libtextsecure.js',
'!js/logging.js',
'!js/backup.js',
'!js/modules/**/*.js',
'!js/Mp3LameEncoder.min.js',
'!js/signal_protocol_store.js',
'!js/views/conversation_search_view.js',
'!js/views/debug_log_view.js',
'!js/signal_protocol_store.js',
'!js/database.js',
'!js/WebAudioRecorderMp3.js',
'_locales/**/*'
],
options: { jshintrc: '.jshintrc' },
Expand Down Expand Up @@ -149,38 +149,19 @@ module.exports = function(grunt) {
},
src: {
files: [{ expand: true, dest: 'dist/', src: ['<%= dist.src %>'] }],
options: {
process: function(content, srcpath) {
if (srcpath.match('background.js')) {
return content.replace(
/textsecure-service-staging.whispersystems.org/g,
'textsecure-service-ca.whispersystems.org');
} else if (srcpath.match('expire.js')) {
var gitinfo = grunt.config.get('gitinfo');
var commited = gitinfo.local.branch.current.lastCommitTime;
var time = Date.parse(commited) + 1000 * 60 * 60 * 24 * 90;
return content.replace(
/var BUILD_EXPIRATION = 0/,
"var BUILD_EXPIRATION = " + time
);
} else {
return content;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🎆

}
},
jscs: {
all: {
src: [
'Gruntfile',
'js/**/*.js',
'!js/libtextsecure.js',
'!js/WebAudioRecorderMp3.js',
'!js/Mp3LameEncoder.min.js',
'!js/libsignal-protocol-worker.js',
'!js/components.js',
'!js/libsignal-protocol-worker.js',
'!js/libtextsecure.js',
'!js/modules/**/*.js',
'!js/Mp3LameEncoder.min.js',
'!js/WebAudioRecorderMp3.js',
'test/**/*.js',
'!test/blanket_mocha.js',
'!test/modules/**/*.js',
Expand All @@ -202,17 +183,24 @@ module.exports = function(grunt) {
tasks: ['copy_dist']
},
scripts: {
files: ['<%= jshint.files %>', './js/**/*.js'],
files: ['<%= jshint.files %>'],
tasks: ['jshint']
},
style: {
files: ['<%= jscs.all.src %>', './js/**/*.js'],
files: ['<%= jscs.all.src %>'],
Copy link
Contributor

Choose a reason for hiding this comment

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

In the past, I’ve liked using git ls-files to only target files we are actually tracking but I know this can break down in places where we don’t have Git. In our case, we even have Git on CI though, right? Would you be open to that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you're suggesting here. We've already specified, in detail, what the jscs task applies to, so we'll be using that for the watch.

Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies if I wasn’t clear. I meant that we often reference js/**/*.js but that includes all files in the repo, regardless of whether they’re tracked in Git or not. When working on a new feature, one can have JS files in the project that haven’t been checked in but still trigger lint errors, etc.

tasks: ['jscs']
},
transpile: {
files: ['./ts/**/*.js'],
tasks: ['exec:transpile']
}
},
exec: {
'tx-pull': {
cmd: 'tx pull'
},
'transpile': {
cmd: 'npm run transpile',
}
},
'test-release': {
Expand Down Expand Up @@ -496,5 +484,8 @@ module.exports = function(grunt) {
grunt.registerTask('copy_dist', ['gitinfo', 'copy:res', 'copy:src']);
grunt.registerTask('date', ['gitinfo', 'getExpireTime']);
grunt.registerTask('prep-release', ['gitinfo', 'clean-release', 'fetch-release']);
grunt.registerTask('default', ['concat', 'copy:deps', 'sass', 'date']);
grunt.registerTask(
'default',
['concat', 'copy:deps', 'sass', 'date', 'exec:transpile']
);
};
8 changes: 7 additions & 1 deletion background.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
<title>Signal</title>
<link href='images/icon_128.png' rel='shortcut icon'>
<link href="stylesheets/manifest.css" rel="stylesheet" type="text/css" />

<!-- When making changes to these templates, be sure to update these two places:
1) test/styleguide/legacy_templates.js
2) test/index.html
-->
Copy link
Contributor

Choose a reason for hiding this comment

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

👏 👏 👏 Super helpful!


<script type='text/x-tmpl-mustache' id='app-migration-screen'>
<div class='content'>
<img src='images/icon_128.png'>
Expand Down Expand Up @@ -909,8 +915,8 @@ <h3>{{ message }}</h3>
<script type='text/javascript' src='js/expire.js'></script>
<script type='text/javascript' src='js/conversation_controller.js'></script>
<script type='text/javascript' src='js/emoji_util.js'></script>
<script type='text/javascript' src='js/i18n.js'></script>

<script type='text/javascript' src='js/views/backbone_wrapper_view.js'></script>
<script type='text/javascript' src='js/views/whisper_view.js'></script>
<script type='text/javascript' src='js/views/last_seen_indicator_view.js'></script>
<script type='text/javascript' src='js/views/scroll_down_button_view.js'></script>
Expand Down
4 changes: 0 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"protobuf": "~3.8.0",
"mustache": "~0.8.2",
"qrcode": "https://github.com/davidshimjs/qrcodejs.git#1c78ccd71",
"moment": "~2.14.0",
"indexeddb-backbonejs-adapter": "*",
"intl-tel-input": "~4.0.1",
"blueimp-load-image": "~1.13.0",
Expand Down Expand Up @@ -57,9 +56,6 @@
"chai": [
"chai.js"
],
"moment": [
"min/moment-with-locales.js"
],
"indexeddb-backbonejs-adapter": [
"backbone-indexeddb.js"
],
Expand Down
Loading