Skip to content

Commit 9008bfc

Browse files
authored
chore: publish NPM packages from CI MONGOSH-246 (#535)
* wip: use tag version as release version * feat publish npm packages in CI * temporarily restore publish-npm task * revert package json versions * fix lerna commands and comment out publish * rename analyticsConfigFilePath * wip remove publish-npm * chore: extract writeAnalyticsConfig to publish * add writeAnalyticsConfig to release.ts * readd project root * rename analyticsConfig to analyticsConfigFilePath * test writeAnalyticsConfig arguments * chore remove publish-npm from package.json * bump pkg-rpm to support prereleases
1 parent e73b4ae commit 9008bfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+359
-323
lines changed

.evergreen.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ functions:
219219
export NODE_JS_VERSION=${node_js_version}
220220
source .evergreen/.setup_env
221221
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
222+
echo "//registry.npmjs.org/:_authToken=${DEVTOOLSBOT_NPM_TOKEN}" > .npmrc
222223
npm run evergreen-release publish
223224
224225
# Tasks will show up as the individual blocks in the Evergreen UI that can

config/build.conf.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
const child_process = require('child_process');
2+
33
const path = require('path');
44
const os = require('os');
55

@@ -11,22 +11,22 @@ const ROOT = path.join(__dirname, '..');
1111
/**
1212
* The mongosh package.
1313
*/
14-
const MONGOSH = path.join(ROOT, 'packages', 'cli-repl');
14+
const CLI_REPL_DIR = path.join(ROOT, 'packages', 'cli-repl');
1515

1616
/**
1717
* The project config.
1818
*/
19-
const CONFIG = require(path.join(MONGOSH, 'package.json'));
19+
const CLI_REPL_PACKAGE_JSON = require(path.join(CLI_REPL_DIR, 'package.json'));
2020

2121
/**
2222
* The input for the build.
2323
*/
24-
const INPUT = path.join(MONGOSH, 'lib', 'run.js');
24+
const INPUT = path.join(CLI_REPL_DIR, 'lib', 'run.js');
2525

2626
/**
2727
* The input for the exec.
2828
*/
29-
const EXEC_INPUT = path.join(MONGOSH, 'dist', 'mongosh.js');
29+
const EXEC_INPUT = path.join(CLI_REPL_DIR, 'dist', 'mongosh.js');
3030

3131
/**
3232
* The output dir for the build.
@@ -36,7 +36,7 @@ const OUTPUT_DIR = path.join(ROOT, 'dist');
3636
/**
3737
* Analytics configuration file.
3838
*/
39-
const ANALYTICS_CONFIG = path.join(MONGOSH, 'lib', 'analytics-config.js');
39+
const ANALYTICS_CONFIG_FILE_PATH = path.join(CLI_REPL_DIR, 'lib', 'analytics-config.js');
4040

4141
/**
4242
* The bundle id for MacOs.
@@ -56,12 +56,12 @@ const BUILD_VARIANT = (process.env.BUILD_VARIANT || '').split('_')[0];
5656
* Export the configuration for the build.
5757
*/
5858
module.exports = {
59-
version: CONFIG.version,
59+
version: CLI_REPL_PACKAGE_JSON.version,
6060
rootDir: ROOT,
6161
input: INPUT,
6262
execInput: EXEC_INPUT,
6363
outputDir: OUTPUT_DIR,
64-
analyticsConfig: ANALYTICS_CONFIG,
64+
analyticsConfigFilePath: ANALYTICS_CONFIG_FILE_PATH,
6565
project: process.env.PROJECT,
6666
revision: REVISION,
6767
branch: process.env.BRANCH_NAME,

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "0.6.1"
5+
"version": "0.0.0-dev.0"
66
}

package-lock.json

Lines changed: 18 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"compile-all": "npm run compile-compass && npm run compile-exec",
4949
"preevergreen-release": "npm run compile-ts",
5050
"evergreen-release": "node scripts/evergreen-release.js",
51-
"publish-npm": "node scripts/publish-npm.js",
5251
"report-missing-help": "lerna run --stream --scope @mongosh/shell-api report-missing-help",
5352
"report-supported-api": "lerna run --stream --scope @mongosh/shell-api report-supported-api",
5453
"generate-homebrew-formula": "node scripts/generate-homebrew-formula",
@@ -131,7 +130,7 @@
131130
"nyc": "^15.1.0",
132131
"parcel-bundler": "^1.12.4",
133132
"pkg-deb": "^1.1.2",
134-
"pkg-rpm": "^1.0.2",
133+
"pkg-rpm": "^1.0.3",
135134
"rimraf": "^3.0.2",
136135
"semver": "^7.3.2",
137136
"sinon": "^7.5.0",

packages/async-rewriter/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/async-rewriter/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mongosh/async-rewriter",
3-
"version": "0.6.1",
3+
"version": "0.0.0-dev.0",
44
"description": "MongoDB Shell Async Rewriter Package",
55
"main": "./lib/index.js",
66
"scripts": {
@@ -32,7 +32,7 @@
3232
"@babel/template": "^7.8.6",
3333
"@babel/traverse": "^7.9.0",
3434
"@babel/types": "^7.9.0",
35-
"@mongosh/errors": "^0.6.1",
35+
"@mongosh/errors": "0.0.0-dev.0",
3636
"@types/babel__core": "^7.1.6",
3737
"@types/babel__traverse": "^7.0.9",
3838
"acorn": "^7.2.0",

packages/autocomplete/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/autocomplete/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mongosh/autocomplete",
3-
"version": "0.6.1",
3+
"version": "0.0.0-dev.0",
44
"description": "MongoDB Shell Autocomplete Package",
55
"homepage": "https://github.com/mongodb-js/mongosh",
66
"license": "Apache-2.0",
@@ -28,7 +28,7 @@
2828
"mocha": "^7.1.2"
2929
},
3030
"dependencies": {
31-
"@mongosh/shell-api": "^0.6.1",
31+
"@mongosh/shell-api": "0.0.0-dev.0",
3232
"mongodb-ace-autocompleter": "^0.4.14",
3333
"semver": "^7.3.2"
3434
}

packages/browser-repl/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/browser-repl/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mongosh/browser-repl",
3-
"version": "0.6.1",
3+
"version": "0.0.0-dev.0",
44
"description": "Browser presentation component for Mongo Shell",
55
"engines": {
66
"node": ">=12.4.0"
@@ -39,11 +39,11 @@
3939
"@leafygreen-ui/icon": "^4.0.0",
4040
"@leafygreen-ui/palette": "^2.0.0",
4141
"@leafygreen-ui/syntax": "^2.2.0",
42-
"@mongosh/browser-runtime-core": "^0.6.1",
43-
"@mongosh/history": "^0.6.1",
44-
"@mongosh/i18n": "^0.6.1",
45-
"@mongosh/service-provider-core": "^0.6.1",
46-
"@mongosh/shell-evaluator": "^0.6.1",
42+
"@mongosh/browser-runtime-core": "0.0.0-dev.0",
43+
"@mongosh/history": "0.0.0-dev.0",
44+
"@mongosh/i18n": "0.0.0-dev.0",
45+
"@mongosh/service-provider-core": "0.0.0-dev.0",
46+
"@mongosh/shell-evaluator": "0.0.0-dev.0",
4747
"pretty-bytes": "^5.3.0",
4848
"text-table": "^0.2.0"
4949
},

packages/browser-runtime-core/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/browser-runtime-core/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mongosh/browser-runtime-core",
3-
"version": "0.6.1",
3+
"version": "0.0.0-dev.0",
44
"description": "Mongosh browser runtime core",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -29,17 +29,17 @@
2929
"access": "public"
3030
},
3131
"devDependencies": {
32-
"@mongosh/types": "^0.6.1",
32+
"@mongosh/types": "0.0.0-dev.0",
3333
"@types/babel__generator": "^7.6.2",
3434
"@types/babel__template": "^7.0.3",
3535
"rimraf": "^3.0.2"
3636
},
3737
"dependencies": {
3838
"@babel/generator": "^7.9.4",
3939
"@babel/parser": "^7.9.4",
40-
"@mongosh/autocomplete": "^0.6.1",
41-
"@mongosh/service-provider-core": "^0.6.1",
42-
"@mongosh/shell-api": "^0.6.1",
43-
"@mongosh/shell-evaluator": "^0.6.1"
40+
"@mongosh/autocomplete": "0.0.0-dev.0",
41+
"@mongosh/service-provider-core": "0.0.0-dev.0",
42+
"@mongosh/shell-api": "0.0.0-dev.0",
43+
"@mongosh/shell-evaluator": "0.0.0-dev.0"
4444
}
4545
}

packages/browser-runtime-electron/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/browser-runtime-electron/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mongosh/browser-runtime-electron",
3-
"version": "0.6.1",
3+
"version": "0.0.0-dev.0",
44
"description": "Mongosh browser runtime electron",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -29,13 +29,13 @@
2929
"access": "public"
3030
},
3131
"dependencies": {
32-
"@mongosh/types": "^0.6.1",
33-
"@mongosh/browser-runtime-core": "^0.6.1",
34-
"@mongosh/service-provider-core": "^0.6.1",
35-
"@mongosh/shell-evaluator": "^0.6.1"
32+
"@mongosh/browser-runtime-core": "0.0.0-dev.0",
33+
"@mongosh/service-provider-core": "0.0.0-dev.0",
34+
"@mongosh/shell-evaluator": "0.0.0-dev.0",
35+
"@mongosh/types": "0.0.0-dev.0"
3636
},
3737
"devDependencies": {
38-
"@mongosh/service-provider-server": "^0.6.1",
38+
"@mongosh/service-provider-server": "0.0.0-dev.0",
3939
"@types/sinon": "^7.5.1",
4040
"@types/sinon-chai": "^3.2.3",
4141
"rimraf": "^3.0.2"

packages/build/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const config = {
5151
input: 'input',
5252
execInput: 'execInput',
5353
outputDir: 'outputDir',
54-
analyticsConfig: 'analyticsConfig',
54+
analyticsConfigFilePath: 'analyticsConfigFilePath',
5555
project: 'project',
5656
revision: 'revision',
5757
branch: 'branch',
@@ -123,15 +123,15 @@ const config = {
123123
input: 'path/to/input',
124124
execInput: 'path/to/exec/input',
125125
outputDir: 'path/to/output/directory',
126-
analyticsConfig: 'path/to/analytics/config',
126+
analyticsConfigFilePath: 'path/to/analytics/config',
127127
segmentKey: 'SEGMENT_API_KEY_23481k',
128128
}
129129
await compileExec(
130130
config.input,
131131
config.execInput,
132132
config.outputDir,
133133
os.platform(),
134-
config.analyticsConfig,
134+
config.analyticsConfigFilePath,
135135
config.segmentKey
136136
);
137137
```

packages/build/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mongosh/build",
3-
"version": "0.6.1",
3+
"version": "0.0.0-dev.0",
44
"private": true,
55
"description": "MongoDB Shell Build Tools",
66
"main": "lib/index.js",

packages/build/src/analytics.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,25 @@ const createAnalyticsConfig = (segmentKey: string): string => {
2222
/**
2323
* Write the analytics config.
2424
*
25-
* @param {string} file - The filename.
25+
* @param {string} analyticsConfigFilePath - The filename.
2626
* @param {string} segmentKey - The segment key.
2727
*/
28-
const writeAnalyticsConfig = (file: string, segmentKey: string): Promise<void> => {
28+
const writeAnalyticsConfig = (
29+
analyticsConfigFilePath?: string,
30+
segmentKey?: string
31+
): Promise<void> => {
32+
if (!analyticsConfigFilePath) {
33+
throw new Error('Analytics config file path is required');
34+
}
35+
36+
if (!segmentKey) {
37+
throw new Error('Segment key is required');
38+
}
39+
2940
const template = createAnalyticsConfig(segmentKey);
30-
console.info('mongosh: writing analytics template:', file);
41+
console.info('mongosh: writing analytics template:', analyticsConfigFilePath);
3142
// Cannot use fs/promises on Cygwin.
32-
return util.promisify(fs.writeFile)(file, template);
43+
return util.promisify(fs.writeFile)(analyticsConfigFilePath, template);
3344
};
3445

3546
export default writeAnalyticsConfig;

packages/build/src/barque.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Barque', () => {
1919
input: 'input',
2020
execInput: 'execInput',
2121
outputDir: 'outputDir',
22-
analyticsConfig: 'analyticsConfig',
22+
analyticsConfigFilePath: 'analyticsConfigFilePath',
2323
project: 'project',
2424
revision: 'revision',
2525
branch: 'branch',

packages/build/src/compile-exec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ const compileExec = async(
5252
execInput: string,
5353
outputDir: string,
5454
execNodeVersion: string,
55-
analyticsConfig: string,
55+
analyticsConfigFilePath: string,
5656
segmentKey: string): Promise<string> => {
5757
// We use Parcel to bundle up everything into a single JS under
5858
// cli-repl/dist/mongosh.js that the executable generator can use as input.
5959
// This JS also takes care of the analytics config file being written.
60-
await generateInput(input, execInput, analyticsConfig, segmentKey);
60+
await generateInput(input, execInput, analyticsConfigFilePath, segmentKey);
6161

6262
const executable = executablePath(outputDir, os.platform());
6363
console.info('mongosh: creating binary:', executable);

0 commit comments

Comments
 (0)