@mongosh/build
MongoDB Shell Build Tools
Last updated 4 months ago by addaleax .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mongosh/build 
SYNC missed versions from official npm registry.

The Mongo Shell Build System

Evergreen 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:

  • `npm run evergreen-release package
    • A commit triggers an evergreen build based on currently available build variants: MacOS, Windows, Linux, Debian, and RedHat.
    • MacOS, Linux and Windows run three tasks: check, test, and release. Debian and Redhat run two tasks: check and release. Debian and Redhat also depend on tests to pass on Linux.
    • Identical bundle and binary are built on all five variants.
    • Each variant creates its own tarball (.zip, .tgz, .deb, .rpm). Type of tarball is determined by the current build variant.
    • Each variant uploads its own tarball to Evergreen’s AWS.
    • MacOS build variant uploads config file with information about the new version for each platform to Downloads Centre. This only happens on a tagged commit.
    • MacOS build variant creates a github release. This only happens on a tagged commit.
    • The five build variants run in parallel.
  • npm run evergreen-release publish
    • All the previous build steps succeeded.
    • A separate MacOS build variant (darwin_publish_release) uploads config file with information about the new version for each platform to Downloads Centre. This only happens on a tagged commit.
    • A separate MacOS build variant (darwin_publish_release) promotes the draft github release to public. This only happens on a tagged commit.

build flow

Usage

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);
});

API

await release(command, config)

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.

await compileExec()

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
);

createDownloadCenterConfig()

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')

await createTarball(input, outputDir, buildVariant, version, rootDir)

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
);

Installation

npm install --save @mongosh/build

Current Tags

  • 0.4.0                                ...           latest (4 months ago)

19 Versions

  • 0.4.0                                ...           4 months ago
  • 0.3.1                                ...           4 months ago
  • 0.3.0                                ...           4 months ago
  • 0.2.2                                ...           5 months ago
  • 0.2.1                                ...           5 months ago
  • 0.2.0                                ...           5 months ago
  • 0.1.0                                ...           6 months ago
  • 0.0.8                                ...           6 months ago
  • 0.0.7                                ...           7 months ago
  • 0.0.6                                ...           7 months ago
  • 0.0.5                                ...           8 months ago
  • 0.0.4                                ...           8 months ago
  • 0.0.3                                ...           8 months ago
  • 0.0.2-alpha.0                                ...           8 months ago
  • 0.0.1                                ...           8 months ago
  • 0.0.1-alpha.19                                ...           8 months ago
  • 0.0.1-alpha.18                                ...           8 months ago
  • 0.0.1-alpha.17                                ...           8 months ago
  • 0.0.1-alpha.15                                ...           8 months ago
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 2
Last Month 21
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |