Skip to content

Commit 13c8a22

Browse files
authored
feat: typescript setup is enabled (#229)
TypeScript is enabled as part of the build process. Also, one example module (popup.js) is converted to TS.
1 parent a93c5ce commit 13c8a22

File tree

12 files changed

+2763
-279
lines changed

12 files changed

+2763
-279
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ npm-debug.log
1212
temp
1313
.tmp
1414
tests/reports
15+
tempDist
1516

1617
# App files
1718
**/styles/*.css

Gruntfile.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ module.exports = function (grunt) {
2121
dist: 'dist',
2222
tests: 'tests',
2323
bower: 'bower_components',
24-
grunt: 'grunt'
24+
grunt: 'grunt',
25+
tempDist: 'tempDist'
2526
}
2627
});
2728

app/scripts/popup/popup.js app/scripts/popup/popup.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var utils = require('../modules/utils/utils.js');
44

5-
chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
5+
window.chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
66
// Create a port with background page for continuous message communication
77
var port = utils.getPort();
88

@@ -23,8 +23,8 @@ chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
2323
*/
2424
'on-framework-information': function (message) {
2525
var linksDom;
26-
var library = document.querySelector('library');
27-
var buildtime = document.querySelector('buildtime');
26+
var library: HTMLElement = document.querySelector('library');
27+
var buildtime: HTMLElement = document.querySelector('buildtime');
2828

2929
if (message.frameworkInformation.OpenUI5) {
3030
linksDom = document.querySelector('links[openui5]');

global.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export {};
2+
3+
declare global {
4+
5+
interface Window {
6+
chrome: any;
7+
}
8+
9+
}

grunt/browserify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = function (grunt, config) {
1313
dev: {
1414
files: [{
1515
expand: true,
16-
cwd: '<%= app %>/scripts',
16+
cwd: '<%= tempDist %>/scripts',
1717
src: ['**/*.js', '!modules/**/*.js'],
1818
dest: '<%= dist %>/scripts'
1919
}]

0 commit comments

Comments
 (0)