$ cnpm install @mongosh/build
This package contains all the tools needed to build and release mongosh.
Build process is done on Evergreen and is triggered with every commit.
Releases are triggered by a git tag when ran with npm run publish-npm from the
root of the project.
Current build and release flow is as follows:
.zip, .tgz, .deb, .rpm). Type of
tarball is determined by the current build variant.npm run evergreen-release publish
const release = require('@mongosh/build');
const config = {
version: '0.0.1',
bundleId: 'bundleId',
input: 'input',
execInput: 'execInput',
outputDir: 'outputDir',
analyticsConfig: 'analyticsConfig',
project: 'project',
revision: 'revision',
branch: 'branch',
evgAwsKey: 'evgAwsKey',
evgAwsSecret: 'evgAwsSecret',
downloadCenterAwsKey: 'downloadCenterAwsKey',
downloadCenterAwsSecret: 'downloadCenterAwsSecret',
githubToken: 'githubToken',
segmentKey: 'segmentKey',
appleUser: 'appleUser',
applePassword: 'applePassword',
appleAppIdentity: 'appleAppIdentity',
isCi: true,
platform: 'platform',
buildVariant: 'linux',
repo: {
owner: 'owner',
repo: 'repo',
},
dryRun: false
}
const command = 'package'; // or 'publish'
const runRelease = async() => {
await release(command, config);
};
runRelease().then(() => {
process.exit(0);
});
Run a complete release of mongosh. This will bundle, create the binary and package a tarball for the current build variant. Running a release requires a config object which is usually obtained from evergreen. For current config, see [build.conf.js][build-url]
config: config object necessary for release.
const release = require('@mongosh/build');
const configObject = {};
await release(command, config);
If config.dryRun is set, this will only package a tarball and skip all later
steps.
Create a compiled down binary. Binary is created for the provided platform (e.g.
windows will build mongosh.exe). Before we compile the binary, we bundle
execInput into a single .js file.
input: path to build input.
execInput: path to compiled executive input.
outputDir: path to where the compiled binary will live.
platform: platform to run compileExec on. linux, darwin, and win32
are accepted options.
analyticsConfig: path to analytics config for telemetry.
segmentKey: segment api key for telemetry.
const compileexec = require('@mongosh/build').compileexec;
const config = {
input: 'path/to/input',
execInput: 'path/to/exec/input',
outputDir: 'path/to/output/directory',
analyticsConfig: 'path/to/analytics/config',
segmentKey: 'SEGMENT_API_KEY_23481k',
}
await compileExec(
config.input,
config.execInput,
config.outputDir,
os.platform(),
config.analyticsConfig,
config.segmentKey
);
Output Download Centre config json given a particular version. This json is sent over to Mongodb Downloads Centre to notify of updated package versions.
version: version of the current package to update.
const createDownloadCenterConfig = require('@mongosh/build').createDownloadCenterConfig;
const downloadCentreConfig = createDownloadCenterConfig('1.3.2')
Creates a tarball for a given binary and build variant. Different build variants
will create different tarballs - .tgz, .zip, or .deb.
input: path to binary file.
outputDir: path to where the compiled tarball will live.
buildVariant: build variant to create a tarball for. macos, ubuntu, windows_ps , ordebian` are currently available.
version: version for the tarball.
rootDir: path to root project directory.
const tarball = require('@mongosh/build').tarball;
const executable = 'path/to/executable'
const config = {
outputDir: 'path/to/output/directory',
buildVariant: 'windows_ps',
version: '0.2.0',
rootDir: 'path/to/root/directory',
}
const artifact = await createTarball(
executable,
config.outputDir,
config.buildVariant,
config.version,
config.rootDir
);
npm install --save @mongosh/build
Copyright 2013 - present © cnpmjs.org | Home |