more experiments for mixing javascript and typescript

pull/2746/head
Torkel Ödegaard 10 years ago
parent 005e1e002b
commit a8197df1c1
  1. 1
      .gitignore
  2. 7
      public/app/components/panelmeta.d.ts
  3. 37
      public/app/components/panelmeta.ts
  4. 2
      public/app/components/require.config.js
  5. 6
      public/app/controllers/fileSearcher.d.ts
  6. 13
      public/app/controllers/fileSearcher.js
  7. 1
      public/app/controllers/fileSearcher.js.map
  8. 6
      public/app/controllers/testCtrl.d.ts
  9. 15
      public/app/controllers/testCtrl.js
  10. 1
      public/app/controllers/testCtrl.js.map
  11. 1
      public/app/controllers/testCtrl.ts
  12. 2
      public/views/index.html
  13. 10
      tasks/options/copy.js
  14. 21
      tasks/options/typescript.js
  15. 17
      tasks/options/watch.js
  16. 17
      tsconfig.json

1
.gitignore vendored

@ -4,6 +4,7 @@ coverage/
awsconfig
/dist
/emails/dist
/public/app_gen
/tmp
docs/AWS_S3_BUCKET

@ -1,7 +0,0 @@
/// <reference path="../headers/require.d.ts" />
declare class Base {
constructor();
testFunc(): number
getName(): string
}
export = Base;

@ -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;

@ -1,6 +1,6 @@
require.config({
urlArgs: 'bust=' + (new Date().getTime()),
baseUrl: 'public/app',
baseUrl: 'public/app_gen',
paths: {
config: 'components/config',

@ -1,6 +0,0 @@
/// <reference path="../headers/require.d.ts" />
declare class FileSearcher {
constructor();
getFiles(): string[];
}
export = FileSearcher;

@ -1,13 +0,0 @@
///<reference path="../headers/require.d.ts" />
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

@ -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"}

@ -1,6 +0,0 @@
/// <reference path="../headers/require.d.ts" />
declare class Base {
constructor();
getName(): string;
}
export = Base;

@ -1,15 +0,0 @@
///<reference path="../headers/require.d.ts" />
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

@ -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"}

@ -2,7 +2,6 @@
///<amd-dependency path="../components/panelmeta" />
import PanelMeta = require('../components/panelmeta');
import FileSearcher = require('./fileSearcher');
class Base {

@ -19,7 +19,7 @@
<!-- build:js [[.AppSubUrl]]/app/app.js -->
<script src="[[.AppSubUrl]]/public/vendor/requirejs/require.js"></script>
<script src="[[.AppSubUrl]]/public/app/components/require.config.js"></script>
<script src="[[.AppSubUrl]]/public/app_gen/components/require.config.js"></script>
<!-- endbuild -->
</head>

@ -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'
}
};
};

@ -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,
}
}
};

@ -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
}
}
};
};

@ -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"
]
}
Loading…
Cancel
Save