mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-08 20:56:25 +00:00
use sync 2.0-rc11
This commit is contained in:
parent
272c996a5f
commit
b17dcddd17
@ -1,5 +1,5 @@
|
|||||||
PACKAGE_NAME=realm-js
|
PACKAGE_NAME=realm-js
|
||||||
VERSION=1.8.3
|
VERSION=1.8.3
|
||||||
REALM_CORE_VERSION=3.0.0-rc2
|
REALM_CORE_VERSION=3.0.0-rc3
|
||||||
REALM_SYNC_VERSION=2.0.0-rc10
|
REALM_SYNC_VERSION=2.0.0-rc11
|
||||||
REALM_OBJECT_SERVER_VERSION=2.0.0-alpha9
|
REALM_OBJECT_SERVER_VERSION=2.0.0-alpha9
|
||||||
|
@ -78,11 +78,12 @@
|
|||||||
"check-environment": "node scripts/check-environment.js"
|
"check-environment": "node scripts/check-environment.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"extract-zip": "^1.6.0",
|
"command-line-args": "^4.0.6",
|
||||||
|
"decompress": "^4.2.0",
|
||||||
"ini": "^1.3.4",
|
"ini": "^1.3.4",
|
||||||
"nan": "^2.3.3",
|
"nan": "^2.3.3",
|
||||||
"node-fetch": "^1.6.3",
|
"node-fetch": "^1.6.3",
|
||||||
"node-pre-gyp": "^0.6.30",
|
"node-pre-gyp": "^0.6.36",
|
||||||
"request": "^2.78.0",
|
"request": "^2.78.0",
|
||||||
"sync-request": "^3.0.1",
|
"sync-request": "^3.0.1",
|
||||||
"url-parse": "^1.1.7"
|
"url-parse": "^1.1.7"
|
||||||
|
16
realm.gypi
16
realm.gypi
@ -116,28 +116,14 @@
|
|||||||
"<(module_root_dir)/vendor/realm-node/osx"
|
"<(module_root_dir)/vendor/realm-node/osx"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"conditions": [
|
|
||||||
["realm_download_binaries and OS=='win'", {
|
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"action_name": "download-realm",
|
"action_name": "download-realm",
|
||||||
"inputs": [ "<(module_root_dir)/scripts/download-realm.js" ],
|
"inputs": [ "<(module_root_dir)/scripts/download-realm.js" ],
|
||||||
"outputs": [ "<(module_root_dir)/vendor/realm-node" ],
|
"outputs": [ "<(module_root_dir)/vendor/realm-node" ],
|
||||||
"action": [ "node", "<(module_root_dir)/scripts/download-realm.js", "node", "<(use_realm_debug)" ]
|
"action": [ "node", "<(module_root_dir)/scripts/download-realm.js", "<(OS)", "--debug=<(use_realm_debug)", "--sync=<(realm_enable_sync)", "--arch=<(target_arch)" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}],
|
|
||||||
["realm_download_binaries and OS!='win'", {
|
|
||||||
"actions": [
|
|
||||||
{
|
|
||||||
"action_name": "download-realm",
|
|
||||||
"inputs": [ ],
|
|
||||||
"outputs": [ "<(module_root_dir)/vendor/realm-node" ],
|
|
||||||
"action": [ "<(module_root_dir)/scripts/download-core.sh", "node", "<(realm_enable_sync)" ]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}]
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -22,15 +22,14 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const ini = require('ini').parse;
|
const ini = require('ini').parse;
|
||||||
const unzip = require('extract-zip');
|
const decompress = require('decompress');
|
||||||
|
|
||||||
function download(url, destination) {
|
function download(url, destination) {
|
||||||
return fetch(url).then((response) => {
|
return fetch(url).then((response) => {
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
throw new Error(`Error downloading ${url} - received status ${response.status} ${response.statusText}`);
|
throw new Error(`Error downloading ${url} - received status ${response.status} ${response.statusText}`);
|
||||||
} else if (response.headers.get('content-type') !== 'application/zip') {
|
}
|
||||||
throw new Error(`Unexpected response content type - ${response.headers.get('content-type')}`);
|
|
||||||
} else {
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const file = fs.createWriteStream(destination);
|
const file = fs.createWriteStream(destination);
|
||||||
response.body.pipe(file)
|
response.body.pipe(file)
|
||||||
@ -38,30 +37,40 @@ function download(url, destination) {
|
|||||||
file.close(resolve);
|
file.close(resolve);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function extract(archive, destination) {
|
const optionDefinitions = [
|
||||||
return new Promise((resolve, reject) => {
|
{ name: 'platform', type: String, defaultOption: true },
|
||||||
unzip(archive, { dir: destination }, (error) => {
|
{ name: 'arch', type: String },
|
||||||
if (error) {
|
{ name: 'sync', type: Boolean },
|
||||||
reject(error);
|
{ name: 'debug', type: Boolean },
|
||||||
} else {
|
];
|
||||||
resolve();
|
const options = require('command-line-args')(optionDefinitions);
|
||||||
}
|
|
||||||
});
|
console.log(options);
|
||||||
});
|
|
||||||
}
|
let product, archive, extractedFolder;
|
||||||
|
|
||||||
const dependencies = ini(fs.readFileSync(path.resolve(__dirname, '../dependencies.list'), 'utf8'));
|
const dependencies = ini(fs.readFileSync(path.resolve(__dirname, '../dependencies.list'), 'utf8'));
|
||||||
const coreArchive = `realm-core-windows-${dependencies.REALM_CORE_VERSION}.zip`;
|
if (!options.sync) {
|
||||||
const coreUrl = `https://static.realm.io/downloads/core/${coreArchive}`;
|
throw new Error("Downloading core is not yet supported!");
|
||||||
|
} else {
|
||||||
|
product = 'sync';
|
||||||
|
switch (options.platform) {
|
||||||
|
case 'mac':
|
||||||
|
archive = `realm-sync-node-cocoa-${dependencies.REALM_SYNC_VERSION}.tar.gz`
|
||||||
|
extractedFolder = `realm-sync-node-cocoa-${dependencies.REALM_SYNC_VERSION}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = `https://static.realm.io/downloads/${product}/${archive}`;
|
||||||
const vendorDir = path.resolve(__dirname, '../vendor');
|
const vendorDir = path.resolve(__dirname, '../vendor');
|
||||||
const downloadedCoreArchive = path.resolve(vendorDir, coreArchive);
|
const downloadedArchive = path.resolve(vendorDir, archive);
|
||||||
const realmDir = path.resolve(vendorDir, 'realm-node');
|
const realmDir = path.resolve(vendorDir, 'realm-node');
|
||||||
|
|
||||||
if (!fs.existsSync(realmDir)) {
|
if (!fs.existsSync(realmDir)) {
|
||||||
const downloadTask = fs.existsSync(downloadedCoreArchive) ? Promise.resolve() : download(coreUrl, downloadedCoreArchive);
|
const downloadTask = fs.existsSync(downloadedArchive) ? Promise.resolve() : download(url, downloadedArchive);
|
||||||
downloadTask.then(() => extract(downloadedCoreArchive, realmDir));
|
downloadTask.then(() => decompress(downloadedArchive, vendorDir))
|
||||||
|
.then(() => fs.renameSync(path.resolve(vendorDir, extractedFolder), realmDir));
|
||||||
}
|
}
|
@ -43,16 +43,14 @@
|
|||||||
"Debug": {
|
"Debug": {
|
||||||
"msvs_settings": {
|
"msvs_settings": {
|
||||||
"VCCLCompilerTool": {
|
"VCCLCompilerTool": {
|
||||||
"RuntimeTypeInfo": "true",
|
"RuntimeTypeInfo": "true"
|
||||||
"AdditionalOptions": [ "/MDd" ]
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Release": {
|
"Release": {
|
||||||
"msvs_settings": {
|
"msvs_settings": {
|
||||||
"VCCLCompilerTool": {
|
"VCCLCompilerTool": {
|
||||||
"RuntimeTypeInfo": "true",
|
"RuntimeTypeInfo": "true"
|
||||||
"AdditionalOptions": [ "/MD" ]
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user