gristlabs_grist-core/sandbox/install_tz.js
Paul Fitzpatrick bde44323c5 (core) apply some dependabot suggestions
Summary:
This applies the set of dependabot suggestions that are currently
passing tests on grist-core. There are a lot more suggestions to
come, an unusual number are not passing tests because tests were
briefly broken.

The list of suggestions is extracted from:

https://api.github.com/repos/gristlabs/grist-core/pulls?search=status:success+state:open

And then applied using:

  yarn upgrade package1@version1 package2@version2 ....

After application, any new entries in package.json are pruned, leaving
just updated entries and yarn.lock changes.

Non-trivial code updates include:
 * A change related to axios typing
 * A change related to jquery dropping `size()` in favor of `length`

Test Plan: existing tests should pass

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D3621
2022-09-07 14:15:34 -04:00

28 lines
783 B
JavaScript

/**
* This script converts the timezone data from moment-timezone to marshalled format, for fast
* loading by Python.
*/
const marshal = require('app/common/marshal');
const fse = require('fs-extra');
const moment = require('moment-timezone');
const DEST_FILE = 'sandbox/grist/tzdata.data';
function main() {
const zones = moment.tz.names().map((name) => {
const z = moment.tz.zone(name);
return marshal.wrap('TUPLE', [z.name, z.abbrs, z.offsets, z.untils]);
});
const marshaller = new marshal.Marshaller({version: 2});
marshaller.marshal(zones);
const contents = marshaller.dumpAsBuffer();
return fse.writeFile(DEST_FILE, contents);
}
if (require.main === module) {
main().catch((e) => {
console.log("ERROR", e.message);
process.exit(1);
});
}