diff --git a/.gitignore b/.gitignore index 96824b93aa3..f25714d3759 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ coverage/ awsconfig /dist /emails/dist +/public/app_gen /tmp docs/AWS_S3_BUCKET diff --git a/public/app/components/panelmeta.d.ts b/public/app/components/panelmeta.d.ts deleted file mode 100644 index 42258894622..00000000000 --- a/public/app/components/panelmeta.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// -declare class Base { - constructor(); - testFunc(): number - getName(): string -} -export = Base; diff --git a/public/app/components/panelmeta.js b/public/app/components/panelmeta.ts similarity index 72% rename from public/app/components/panelmeta.js rename to public/app/components/panelmeta.ts index 9f0b2cfcdd5..801727481f0 100644 --- a/public/app/components/panelmeta.js +++ b/public/app/components/panelmeta.ts @@ -1,9 +1,13 @@ -define([ -], -function () { - "use strict"; - - function PanelMeta(options) { +class PanelMeta { + description: any + fullscreen: any + editIcon: any + panelName: any + menu: any + editorTabs: any + extendedMenu: any + + constructor(options : any) { this.description = options.description; this.fullscreen = options.fullscreen; this.editIcon = options.editIcon; @@ -29,22 +33,17 @@ function () { this.addExtendedMenuItem('Panel JSON', '', 'editPanelJson(); dismiss();'); } - PanelMeta.prototype.addMenuItem = function(text, icon, click, role) { + addMenuItem (text, icon, click, role?) { this.menu.push({text: text, icon: icon, click: click, role: role}); - }; - - PanelMeta.prototype.getName = function() { - return "javascript"; - }; + } - PanelMeta.prototype.addExtendedMenuItem = function(text, icon, click, role) { + addExtendedMenuItem (text, icon, click, role?) { this.extendedMenu.push({text: text, icon: icon, click: click, role: role}); - }; + } - PanelMeta.prototype.addEditorTab = function(title, src) { + addEditorTab (title, src) { this.editorTabs.push({title: title, src: src}); - }; - - return PanelMeta; + } +} -}); +export = PanelMeta; diff --git a/public/app/components/require.config.js b/public/app/components/require.config.js index f255418414e..7db59e2b59a 100644 --- a/public/app/components/require.config.js +++ b/public/app/components/require.config.js @@ -1,6 +1,6 @@ require.config({ urlArgs: 'bust=' + (new Date().getTime()), - baseUrl: 'public/app', + baseUrl: 'public/app_gen', paths: { config: 'components/config', diff --git a/public/app/controllers/fileSearcher.d.ts b/public/app/controllers/fileSearcher.d.ts deleted file mode 100644 index dbac066880e..00000000000 --- a/public/app/controllers/fileSearcher.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -declare class FileSearcher { - constructor(); - getFiles(): string[]; -} -export = FileSearcher; diff --git a/public/app/controllers/fileSearcher.js b/public/app/controllers/fileSearcher.js deleted file mode 100644 index 24842f571d2..00000000000 --- a/public/app/controllers/fileSearcher.js +++ /dev/null @@ -1,13 +0,0 @@ -/// -define(["require", "exports"], function (require, exports) { - var FileSearcher = (function () { - function FileSearcher() { - } - FileSearcher.prototype.getFiles = function () { - return ["asd"]; - }; - return FileSearcher; - })(); - return FileSearcher; -}); -//# sourceMappingURL=fileSearcher.js.map \ No newline at end of file diff --git a/public/app/controllers/fileSearcher.js.map b/public/app/controllers/fileSearcher.js.map deleted file mode 100644 index 8fee4ea258a..00000000000 --- a/public/app/controllers/fileSearcher.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fileSearcher.js","sourceRoot":"","sources":["fileSearcher.ts"],"names":["FileSearcher","FileSearcher.constructor","FileSearcher.getFiles"],"mappings":"AAAA,+CAA+C;;IAE/C;QAEIA;QACAC,CAACA;QAEMD,+BAAQA,GAAfA;YACEE,MAAMA,CAACA,CAACA,KAAKA,CAACA,CAACA;QACjBA,CAACA;QACLF,mBAACA;IAADA,CAACA,AARD,IAQC;IAEqB,AAAtB,OAAS,YAAY,CAAC"} \ No newline at end of file diff --git a/public/app/controllers/testCtrl.d.ts b/public/app/controllers/testCtrl.d.ts deleted file mode 100644 index fd80685535d..00000000000 --- a/public/app/controllers/testCtrl.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -declare class Base { - constructor(); - getName(): string; -} -export = Base; diff --git a/public/app/controllers/testCtrl.js b/public/app/controllers/testCtrl.js deleted file mode 100644 index 878d3934e7b..00000000000 --- a/public/app/controllers/testCtrl.js +++ /dev/null @@ -1,15 +0,0 @@ -/// -define(["require", "exports", './fileSearcher', "../components/panelmeta"], function (require, exports, FileSearcher) { - var Base = (function () { - function Base() { - var test = new FileSearcher(); - test.getFiles(); - } - Base.prototype.getName = function () { - return "asd"; - }; - return Base; - })(); - return Base; -}); -//# sourceMappingURL=testCtrl.js.map \ No newline at end of file diff --git a/public/app/controllers/testCtrl.js.map b/public/app/controllers/testCtrl.js.map deleted file mode 100644 index 22984a48a83..00000000000 --- a/public/app/controllers/testCtrl.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"testCtrl.js","sourceRoot":"","sources":["testCtrl.ts"],"names":["Base","Base.constructor","Base.getName"],"mappings":"AAAA,+CAA+C;;IAO/C;QAEIA;YACEC,IAAIA,IAAIA,GAAGA,IAAIA,YAAYA,EAAEA,CAACA;YAC9BA,IAAIA,CAACA,QAAQA,EAAEA,CAACA;QAClBA,CAACA;QAEMD,sBAAOA,GAAdA;YACEE,MAAMA,CAACA,KAAKA,CAACA;QACfA,CAACA;QACLF,WAACA;IAADA,CAACA,AAVD,IAUC;IAEa,AAAd,OAAS,IAAI,CAAC"} \ No newline at end of file diff --git a/public/app/controllers/testCtrl.ts b/public/app/controllers/testCtrl.ts index 596d8f67a1d..48e5f094375 100644 --- a/public/app/controllers/testCtrl.ts +++ b/public/app/controllers/testCtrl.ts @@ -2,7 +2,6 @@ /// -import PanelMeta = require('../components/panelmeta'); import FileSearcher = require('./fileSearcher'); class Base { diff --git a/public/views/index.html b/public/views/index.html index b3c1763ce51..69b3dd6a66b 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -19,7 +19,7 @@ - + diff --git a/tasks/options/copy.js b/tasks/options/copy.js index ae068eba3c0..48d4514e612 100644 --- a/tasks/options/copy.js +++ b/tasks/options/copy.js @@ -4,8 +4,16 @@ module.exports = function(config) { everything_but_less_to_temp: { cwd: '<%= srcDir %>', expand: true, - src: ['**/*', '!**/*.less', '!config.js'], + src: ['**/*', '!**/*.less'], dest: '<%= tempDir %>' + }, + + app_gen_build: { + cwd: '<%= srcDir %>/app', + expand: true, + src: ['**/*.js', '**/*.html'], + dest: '<%= srcDir %>/app_gen' } + }; }; diff --git a/tasks/options/typescript.js b/tasks/options/typescript.js index 79251c77eb6..752b8ab4eb7 100644 --- a/tasks/options/typescript.js +++ b/tasks/options/typescript.js @@ -2,16 +2,29 @@ module.exports = function() { 'use strict'; return { - base: { + build: { src: ['public/app/**/*.ts'], - dest: '', + dest: 'public/app_gen', options: { module: 'amd', //or commonjs target: 'es5', //or es3 - keepDirectoryHierarchy: true, + rootDir: 'public/app', declaration: true, - watch: true, sourceMap: true, + generateTsConfig: true, + } + }, + watch: { + src: ['public/app/**/*.ts'], + dest: 'public/app_gen', + options: { + module: 'amd', //or commonjs + target: 'es5', //or es3 + rootDir: 'public/app', + declaration: true, + sourceMap: true, + watch: true, + generateTsConfig: true, } } }; diff --git a/tasks/options/watch.js b/tasks/options/watch.js index c97609d9e53..692ec08e179 100644 --- a/tasks/options/watch.js +++ b/tasks/options/watch.js @@ -6,6 +6,23 @@ module.exports = function(config) { options: { spawn: false } + }, + + app_gen: { + files: ['<%= srcDir %>/app/**/*.js', '<%= srcDir %>/app/**/*.html'], + tasks: ['copy:app_gen_build'], + options: { + spawn: false + } + }, + + typescript: { + files: ['<%= srcDir %>/app/**/*.ts'], + tasks: ['typescript:build'], + options: { + spawn: false + } } + }; }; diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000000..a89d0f30933 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "sourceMap": true, + "declaration": true, + "outDir": "public/app_gen", + "target": "ES5", + "rootDir": "public/app", + "module": "amd", + "noEmitOnError": true + }, + "files": [ + "public/app/components/panelmeta.ts", + "public/app/controllers/fileSearcher.ts", + "public/app/controllers/testCtrl.ts", + "public/app/headers/require.d.ts" + ] +} \ No newline at end of file