Skip to content

Commit e5511ce

Browse files
authored
Conversion to @tubular/util (#4)
* First pass at module format update. * Renaming files and classes. Fixing lint errors. Break out timezone sets as separate webpack outputs. * Fix .npmignore. * Update timezone data to 2020e. Add automatic timezone update polling. Bundle all dependencies for UMD module. Reduce redundant bloat in timezone-large.js and timezone-large-alt.js. * Make use of "timezone" consistent, over "timeZone" and "time zone". * Work out (hopefully) the last of the problems in breaking down the large/large-alt timezone data in separately loadable libraries. Add getTimezones() method. * Add caching for remotely-acquired timezone data. * Fix publishing cached build problem. * Fix unit test timing problem. Fix minor variable name inconsistency. * Fix problem with Node.js code seen by browser compilation. Update zone change to tell listeners if update changes time zones or not. Fix error reporting of zonePollerNode. * Yet another fix for dealing with Node.js dependencies when compiling for a browser target. * Remove lodash dependencies. Change timezone modules to export timezone data as default. Improve ES5 code generation. * Further improve ES5 code generation. Allow <script> included timezones to be automatically installed. Smarter removal of excess timezone data.
1 parent da66f1c commit e5511ce

25 files changed

Lines changed: 3518 additions & 1413 deletions

.eslintrc.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@typescript-eslint",
2222
"chai-friendly"
2323
],
24+
"ignorePatterns": ["dist/**/*"],
2425
"rules": {
2526
"brace-style": [
2627
"error",
@@ -47,30 +48,30 @@
4748
2,
4849
{
4950
"ArrayExpression": "first",
51+
"CallExpression": { "arguments": "off" },
5052
"FunctionDeclaration": { "parameters": "off" },
53+
"FunctionExpression": { "parameters": "off" },
54+
"ignoreComments": true,
5155
"ignoredNodes": [
52-
"CallExpression",
53-
"ClassProperty Literal",
54-
"IfStatement > :expression *",
55-
"MethodDefinition Identifier",
56-
"NewExpression *",
57-
"WhileStatement > :expression *"
56+
"ClassProperty[value]",
57+
"NewExpression[arguments] :expression *"
5858
],
59-
"ignoreComments": true,
6059
"ObjectExpression": "first",
6160
"SwitchCase": 1
6261
}
6362
],
6463
"key-spacing": "off",
6564
"multiline-ternary": "off",
6665
"no-control-regex": "off",
66+
"no-empty": "off",
6767
"no-labels": "off",
6868
"no-mixed-operators": "off",
6969
"no-multi-spaces": "off",
7070
"no-new": "off",
71-
"no-prototype-builtins": "off",
7271
"no-return-assign": "off",
7372
"no-unused-expressions": "off",
73+
"no-useless-constructor": "off",
74+
"@typescript-eslint/no-useless-constructor": "error",
7475
"chai-friendly/no-unused-expressions": "error",
7576
"no-unused-vars": "off",
7677
"@typescript-eslint/no-unused-vars": [
@@ -101,6 +102,7 @@
101102
"error",
102103
"single",
103104
{
105+
"allowTemplateLiterals": true,
104106
"avoidEscape": true
105107
}
106108
],

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ npm-debug.log
3535
testem.log
3636
/typings
3737
/.nyc_output
38+
*.tgz
3839

3940
# e2e
4041
/e2e/*.js

.npmignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
/.idea
22
/coverage
3-
/karma.conf.js
43
/src
54
/tsconfig.json
6-
/tslint.json
5+
/.eslintrc.json
6+
/.eslintignore
77
/docs
8+
/.nyc_output
89
*.js.map
910
*.spec.d.ts
1011
*.spec.js
12+
/webpack.config.cjs
13+
/make-remote-zone-data.ts
14+
*.tgz

karma.conf.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

make-remote-zone-data.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import fs from 'fs';
2+
import timezoneSmall from './src/timezone-small';
3+
import timezoneLarge from './src/timezone-large';
4+
import timezoneLargeAlt from './src/timezone-large-alt';
5+
6+
const zoneSets = {
7+
small: timezoneSmall,
8+
large: timezoneLarge,
9+
'large-alt': timezoneLargeAlt,
10+
};
11+
12+
Object.keys(zoneSets).forEach(set => {
13+
fs.mkdirSync('dist/data', { recursive: true });
14+
fs.writeFileSync(`dist/data/timezone-${set}.js`,
15+
`window.tbTime_timezone_${set.replace(/-/g, '_')} = ` + JSON.stringify(zoneSets[set]));
16+
});

0 commit comments

Comments
 (0)