realm-js/scripts/prepublish.js
Yavor Georgiev db8ebd9333 Node.js Win32 support (#864)
* Remove the windows install check

* Node.js Win32 support

* Bring back the `REALM_HAVE_CONFIG` definition

* Download core for Windows when building

* Implement cross-platform node platform.cpp with libuv

* wip

* Make jasmine run quicker

https://github.com/jasmine/jasmine/issues/1204

* Wait for worker process to close in AsyncTests

* Cross-platform paths in tests

* Normalize path separator for forward slash on Windows

* MSVC exception voodoo

* cross-platform uv_cwd

* fix linux build

* make the prepublish script cross-platform

* Disable encryption tests on windows

* ignore vendor/realm-node

* jenkinsfile work

* Only run the prepublish script for publish and pack

* Jenkinsfile work

* Include gyp files in package

* rewrite default_realm_file_directory()

* fix React Native Android build

* delete all realm artifacts in remove_realm_files_from_directory

* bring back build environment variables

* node-pre-gyp windows

* Update CHANGELOG.md
2017-03-07 23:24:30 +01:00

44 lines
1.6 KiB
JavaScript

////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
'use strict';
const fs = require('fs');
const path = require('path');
const exec = require('child_process').execFileSync;
const dependencies = ini(fs.readFileSync(path.resolve(__dirname, '../dependencies.list'), 'utf8'));
console.log(`Core version: ${dependencies.REALM_CORE_VERSION}`);
console.log(`Sync version: ${dependencies.REALM_SYNC_VERSION}`);
if ('REALM_BUILD_ANDROID' in process.env) {
const gradlew = process.platform === 'win32' ? 'gradlew.bat' : 'gradlew';
const androidPath = path.resolve(__dirname, '../react-native/android');
exec(`${androidPath}/${gradlew}`, ['publishAndroid', '-PbuildWithSync=true'], { cwd: androidPath, stdio: 'inherit' });
}
function ini(string) {
const result = Object.create(null);
for (const line of string.split(/\r?\n/)) {
const parts = line.split('=');
result[parts[0]] = parts[1];
}
return result;
}