typescript: Move TS files into JS directory.

This is just a code reorganization to avoid making it difficult to
find things as we migrate more file to TypeScript.
This commit is contained in:
Thomas Ip 2019-03-24 15:37:53 +08:00 committed by Tim Abbott
parent 9ed1dcc4b6
commit a2872c107e
31 changed files with 31 additions and 38 deletions

View File

@ -1,7 +1,7 @@
require('ts-node').register({ require('ts-node').register({
project: 'static/ts/tsconfig.json', project: 'static/js/tsconfig.json',
compilerOptions: { compilerOptions: {
typeRoots: ["node_modules/@types", "../../static/ts/js_typings"], typeRoots: ["node_modules/@types", "../../static/js/js_typings"],
// We don't have webpack to handle es6 modules here so directly // We don't have webpack to handle es6 modules here so directly
// transpile to CommonJS format. // transpile to CommonJS format.
module: "commonjs", module: "commonjs",
@ -27,7 +27,7 @@ global.window = _.extend({}, windowObj, {
}, },
}); });
global.Dict = require('ts/dict.ts').Dict; global.Dict = require('js/dict').Dict;
// Create a helper function to avoid sneaky delays in tests. // Create a helper function to avoid sneaky delays in tests.
function immediate(f) { function immediate(f) {

View File

@ -20,19 +20,12 @@ exports.patch_builtin = function (name, val) {
}; };
exports.zrequire = function (name, fn) { exports.zrequire = function (name, fn) {
var path;
if (fn === undefined) { if (fn === undefined) {
try { fn = 'js/' + name;
path = require.resolve('js/' + name);
} catch (_e /* MODULE_NOT_FOUND */) {
path = require.resolve('ts/' + name);
}
} else {
path = require.resolve(fn);
} }
delete require.cache[path]; delete require.cache[require.resolve(fn)];
var obj = require(path); var obj = require(fn);
requires.push(path); requires.push(fn);
set_global(name, obj); set_global(name, obj);
return obj; return obj;
}; };

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var activity = (function () { var activity = (function () {
var exports = {}; var exports = {};

View File

@ -37,7 +37,7 @@ import "js/search_util.js";
import "js/keydown_util.js"; import "js/keydown_util.js";
import "js/lightbox_canvas.js"; import "js/lightbox_canvas.js";
import "js/rtl.js"; import "js/rtl.js";
import "ts/dict.ts"; import "js/dict.ts";
import "js/scroll_util.js"; import "js/scroll_util.js";
import "js/components.js"; import "js/components.js";
import "js/feedback_widget.js"; import "js/feedback_widget.js";

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var color_data = (function () { var color_data = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var condense = (function () { var condense = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var muting = (function () { var muting = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var narrow_state = (function () { var narrow_state = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var people = (function () { var people = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var pm_conversations = (function () { var pm_conversations = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var reactions = (function () { var reactions = (function () {
var exports = {}; var exports = {};

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var recent_senders = (function () { var recent_senders = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var settings_sections = (function () { var settings_sections = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var settings_streams = (function () { var settings_streams = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var starred_messages = (function () { var starred_messages = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var stream_data = (function () { var stream_data = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var stream_list = (function () { var stream_list = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var topic_data = (function () { var topic_data = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var topic_list = (function () { var topic_list = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var typeahead_helper = (function () { var typeahead_helper = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var typing_data = (function () { var typing_data = (function () {
var exports = {}; var exports = {};

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
// See https://zulip.readthedocs.io/en/latest/subsystems/pointer.html for notes on // See https://zulip.readthedocs.io/en/latest/subsystems/pointer.html for notes on
// how this system is designed. // how this system is designed.

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var user_groups = (function () { var user_groups = (function () {

View File

@ -1,4 +1,4 @@
var Dict = require('../ts/dict').Dict; var Dict = require('./dict').Dict;
var user_status = (function () { var user_status = (function () {

View File

@ -93,7 +93,7 @@ def run():
linter_config.external_linter('eslint', ['node', 'node_modules/.bin/eslint', linter_config.external_linter('eslint', ['node', 'node_modules/.bin/eslint',
'--quiet', '--cache'], ['js']) '--quiet', '--cache'], ['js'])
linter_config.external_linter('tslint', ['node', 'node_modules/.bin/tslint', '-c', linter_config.external_linter('tslint', ['node', 'node_modules/.bin/tslint', '-c',
'static/ts/tslint.json'], ['ts']) 'static/js/tslint.json'], ['ts'])
linter_config.external_linter('puppet', ['puppet', 'parser', 'validate'], ['pp']) linter_config.external_linter('puppet', ['puppet', 'parser', 'validate'], ['pp'])
linter_config.external_linter('puppet-lint', linter_config.external_linter('puppet-lint',
['puppet-lint'] + PUPPET_CHECK_RULES_TO_EXCLUDE, ['pp']) ['puppet-lint'] + PUPPET_CHECK_RULES_TO_EXCLUDE, ['pp'])

View File

@ -29,7 +29,7 @@ export default (env?: string) : webpack.Configuration => {
test: /\.tsx?$/, test: /\.tsx?$/,
loader: 'ts-loader', loader: 'ts-loader',
options: { options: {
configFile: require.resolve('../static/ts/tsconfig.json') configFile: require.resolve('../static/js/tsconfig.json')
} }
}, },
// Uses script-loader on minified files so we don't change global variables in them. // Uses script-loader on minified files so we don't change global variables in them.