mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) move data engine code to core
Summary: this moves sandbox/grist to core, and adds a requirements.txt file for reconstructing the content of sandbox/thirdparty. Test Plan: existing tests pass. Tested core functionality manually. Tested docker build manually. Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2563
This commit is contained in:
31
sandbox/install_tz.js
Normal file
31
sandbox/install_tz.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const path = require('path');
|
||||
require('app-module-path').addPath(path.dirname(__dirname));
|
||||
require('ts-node').register();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user