Skip to content

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Sep 28, 2020

Acorn plugins were resolving incorrectly when mongosh packages were webpacked from vscode. Two of the 4 acorn plugins were exporting an object with default but not as a function. Converting the await.js file to typescript, bumping the acorn plugin versions, and importing them as es6 modules makes them work correctly when built from browser-repl and vscode.
This error also existed in the browser-repl when the await.js file was converted to typescript. Changing to es6 modules fixed the importing since it made the acorn plugins build correctly as functions (not .default).

Needed for https://jira.mongodb.org/browse/VSCODE-172

Open q: was the imports reason the await.js file was in js not typescript?

"acorn-numeric-separator": "^0.3.2",
"acorn-private-methods": "^0.3.1",
"acorn-static-class-features": "^0.2.1",
"acorn-class-fields": "^0.3.7",
Copy link
Collaborator

@mcasimir mcasimir Sep 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to pin those to an exact version? or is too much paranoid?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah. doesn't hurt. Let's do it. Pushed update

@Anemy
Copy link
Member Author

Anemy commented Sep 28, 2020

Confused by why the check fails:
https://evergreen.mongodb.com/task/mongosh_darwin_check_patch_4d0fdc8d4cdbcc92ed78b515427507258491a764_5f71fdd1c9ec44748867c2f4_20_09_28_15_14_26

[2020/09/28 15:32:24.624] lerna ERR! npm run check exited 1 in '@mongodb-js/compass-shell'
[2020/09/28 15:32:24.624] lerna ERR! npm run check stdout:
[2020/09/28 15:32:24.624] > @mongodb-js/compass-shell@0.4.0 check /data/mci/b93dbec99b4a0f3abe4742c04f31c665/src/packages/compass-shell
[2020/09/28 15:32:24.624] > mongodb-js-precommit './src/**/*{.js,.jsx}' './test/**/*.js' './electron/**/*.js' './config/**/*{.js,.jsx}'
[2020/09/28 15:32:24.624] Checking for potential errors…
[2020/09/28 15:32:24.624]   › Checking for dependencies used in code but not added to package.json…
[2020/09/28 15:32:24.624]   ✖  1 dependencies|devDependencies missing from package.json
[2020/09/28 15:32:24.624]   › Checking for dependencies in package.json not used in code…
[2020/09/28 15:32:24.624]   ✔  No extra dependencies in package.json
[2020/09/28 15:32:24.624]   › Running eslint on 36 files…
[2020/09/28 15:32:24.624]   ✔  No errors found by eslint
[2020/09/28 15:32:24.624] lerna ERR! npm run check stderr:
[2020/09/28 15:32:24.624] ✖ 1 of 3 check(s) failed:
[2020/09/28 15:32:24.624]   1 dependencies|devDependencies missing from package.json
[2020/09/28 15:32:24.624]       You can correct this error by running:
[2020/09/28 15:32:24.624]           npm install --save acorn;
[2020/09/28 15:32:24.624]       Please see the configuration docs for more info:
[2020/09/28 15:32:24.624]       https://github.com/mongodb-js/precommit#configuration
[2020/09/28 15:32:24.624] npm ERR! code ELIFECYCLE
[2020/09/28 15:32:24.624] npm ERR! errno 1
[2020/09/28 15:32:24.624] npm ERR! @mongodb-js/compass-shell@0.4.0 check: `mongodb-js-precommit './src/**/*{.js,.jsx}' './test/**/*.js' './electron/**/*.js' './config/**/*{.js,.jsx}'`
[2020/09/28 15:32:24.624] npm ERR! Exit status 1
[2020/09/28 15:32:24.624] npm ERR!
[2020/09/28 15:32:24.624] npm ERR! Failed at the @mongodb-js/compass-shell@0.4.0 check script.
[2020/09/28 15:32:24.624] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[2020/09/28 15:32:24.624] npm ERR! A complete log of this run can be found in:
[2020/09/28 15:32:24.624] npm ERR!     /Users/mci/.npm/_logs/2020-09-28T15_32_24_608Z-debug.log
[2020/09/28 15:32:24.629] lerna ERR! npm run check exited 1 in '@mongodb-js/compass-shell'
[2020/09/28 15:32:24.629] npm ERR! code ELIFECYCLE
[2020/09/28 15:32:24.631] npm ERR! errno 1
[2020/09/28 15:32:24.631] npm ERR! mongosh@ check-ci: `lerna run check`

Running npm install --save acorn does make it go away, but why should it be required by the dependency checker? 🤔

@Anemy
Copy link
Member Author

Anemy commented Sep 29, 2020

Looks like a codesign issue now 🤔
I added acorn as a dependency - I'm not sure if it's our dependency check that's bugging or if it's something with how the npm packages are being resolved. depcheck does not error out saying we need acorn so I'm thinking it's maybe just something with the checker.

[2020/09/29 09:37:23.142] if [ ! -r node -o ! -L node ]; then \
[2020/09/29 09:37:23.143] 	  ln -fs out/Release/node node; fi
[2020/09/29 09:37:23.143] mongosh: signing: /data/mci/e95f0c9430daec14702566078b3a99f0/src/dist/mongosh
[2020/09/29 09:37:23.156] /data/mci/e95f0c9430daec14702566078b3a99f0/src/scripts/evergreen-release.js:35
[2020/09/29 09:37:23.156]   (err) => process.nextTick(() => { throw err; }));
[2020/09/29 09:37:23.156]                                     ^
[2020/09/29 09:37:23.156] Error: No files found for /data/mci/e95f0c9430daec14702566078b3a99f0/src/dist/mongosh//data/mci/e95f0c9430daec14702566078b3a99f0/src/dist/mongosh/Contents/Frameworks/*
[2020/09/29 09:37:23.156]     at /data/mci/e95f0c9430daec14702566078b3a99f0/src/node_modules/node-codesign/index.js:97:17
[2020/09/29 09:37:23.156]     at f (/data/mci/e95f0c9430daec14702566078b3a99f0/src/node_modules/once/once.js:25:25)
[2020/09/29 09:37:23.156]     at Glob.<anonymous> (/data/mci/e95f0c9430daec14702566078b3a99f0/src/node_modules/glob/glob.js:151:7)
[2020/09/29 09:37:23.156]     at Glob.emit (events.js:315:20)
[2020/09/29 09:37:23.156]     at Glob.EventEmitter.emit (domain.js:483:12)
[2020/09/29 09:37:23.156]     at Glob._finish (/data/mci/e95f0c9430daec14702566078b3a99f0/src/node_modules/glob/glob.js:197:8)
[2020/09/29 09:37:23.156]     at done (/data/mci/e95f0c9430daec14702566078b3a99f0/src/node_modules/glob/glob.js:182:14)
[2020/09/29 09:37:23.156]     at Glob._processReaddir2 (/data/mci/e95f0c9430daec14702566078b3a99f0/src/node_modules/glob/glob.js:379:12)
[2020/09/29 09:37:23.156]     at /data/mci/e95f0c9430daec14702566078b3a99f0/src/node_modules/glob/glob.js:371:17
[2020/09/29 09:37:23.156]     at RES (/data/mci/e95f0c9430daec14702566078b3a99f0/src/node_modules/inflight/inflight.js:31:16)
[2020/09/29 09:37:23.186] npm ERR! code ELIFECYCLE
[2020/09/29 09:37:23.186] npm ERR! errno 1
[2020/09/29 09:37:23.186] npm ERR! mongosh@ evergreen-release: `node scripts/evergreen-release.js "package"`
[2020/09/29 09:37:23.186] npm ERR! Exit status 1

@Anemy Anemy force-pushed the rh/testing-acorn-deps branch from dfdaec0 to 51708a4 Compare September 29, 2020 10:05
@lrlna
Copy link
Contributor

lrlna commented Sep 29, 2020

@Anemy do any of these errors happen locally or only on our hosts? I find it strange that compass-shell would require acorn as a dep 🤔 What would happen if you added acorn to top-level package.json? We do that for some our build deps.

@Anemy
Copy link
Member Author

Anemy commented Sep 29, 2020

@lrlna It happens locally as well:

npm run bootstrap-ci
npm run check-ci

or just npm check in the compass-shell package

> mongodb-js-precommit './src/**/*{.js,.jsx}' './test/**/*.js' './electron/**/*.js' './config/**/*{.js,.jsx}'

Checking for potential errors…
  › Checking for dependencies used in code but not added to package.json…
  ✖  1 dependencies|devDependencies missing from package.json
  › Checking for dependencies in package.json not used in code…
  ✔  No extra dependencies in package.json
  › Running eslint on 36 files…
  ✔  No errors found by eslint
✖ 1 of 3 check(s) failed:
  1 dependencies|devDependencies missing from package.json
      You can correct this error by running:
          npm install --save acorn;
      
      Please see the configuration docs for more info:
      https://github.com/mongodb-js/precommit#configuration

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @mongodb-js/compass-shell@0.4.0 check: `mongodb-js-precommit './src/**/*{.js,.jsx}' './test/**/*.js' './electron/**/*.js' './config/**/*{.js,.jsx}'`

I think it's strange it's marked as missing here. I can add it into the dependency-check.ignore in the package.json which makes it go away, but I'd like to know why it's failing. (I've pushed up the version without the dependency, and with acorn ignored in the dependency-check).

I think we want it at the package level since it's a dependency, not a dev-dependency.

"ignore": [
"@hot-loader/react-dom",
"debug",
"acorn"
Copy link
Member Author

@Anemy Anemy Sep 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the big diff in this file and package-lock.json - it was using single space and not double space for indentation. The only change in this file is adding acorn here to the ignore for dependency-check.

@Anemy Anemy force-pushed the rh/testing-acorn-deps branch from daa0a12 to 3eeb021 Compare September 29, 2020 14:23
@Anemy
Copy link
Member Author

Anemy commented Sep 29, 2020

I think it should be good to go, except ps is now failing in the windows ci:

lerna ERR! npm run test-ci exited 1 in '@mongosh/i18n'
[2020/09/29 14:28:02.857] lerna ERR! npm run test-ci stdout:
[2020/09/29 14:28:02.857] > @mongosh/i18n@0.4.0 test-ci C:\data\mci\8219dfc79114933af1982721c89e5215\src\packages\i18n
[2020/09/29 14:28:02.857] > mocha -r "../../scripts/import-expansions.js" --timeout 60000 -r ts-node/register "./src/**/*.spec.ts"
[2020/09/29 14:28:02.857] Imported expansions: alias, apple_app_identity, apple_dev_password, apple_dev_user, author, aws_key, aws_secret, barque_api_key, barque_username, branch_name, build_id, build_variant, created_at, decompress, devtools_ci_aws_key, devtools_ci_aws_secret, devtoolsbot_github_token, devtoolsbot_npm_token, distro_id, download_center_aws_key, download_center_aws_secret, downloads_aws_key, downloads_aws_secret, execution, feature_branch_aws_key, feature_branch_aws_secret, feature_branch_s3_bucket, github_author, github_org, github_pr_number, github_repo, github_token, global_github_oauth_token, is_ci, is_patch, kill_pid, killall_mci, project, project_tags, ps, revision, revision_order_id, scons, scons_prune_ratio, segment_api_key, signing_auth_token_44, stitch_test_app_id, stitch_test_service_name, task_id, task_name, version_id, workdir
[2020/09/29 14:28:02.857] lerna ERR! npm run test-ci stderr:
[2020/09/29 14:28:02.857] TSError: ⨯ Unable to compile TypeScript:
[2020/09/29 14:28:02.857] Z:/data/mci/8219dfc79114933af1982721c89e5215/src/packages/shell-api/src/aggregation-cursor.ts(12,8): error TS2307: Cannot find module '@mongosh/service-provider-core' or its corresponding type declarations.
[2020/09/29 14:28:02.857]     at createTSError (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:434:12)
[2020/09/29 14:28:02.857]     at reportTSError (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:438:19)
[2020/09/29 14:28:02.857]     at getOutput (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:578:36)
[2020/09/29 14:28:02.857]     at Object.compile (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:775:32)
[2020/09/29 14:28:02.857]     at Module.m._compile (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:858:43)
[2020/09/29 14:28:02.857]     at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
[2020/09/29 14:28:02.857]     at Object.require.extensions.<computed> [as .ts] (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:861:12)
[2020/09/29 14:28:02.857]     at Module.load (internal/modules/cjs/loader.js:985:32)
[2020/09/29 14:28:02.857]     at Function.Module._load (internal/modules/cjs/loader.js:878:14)
[2020/09/29 14:28:02.857]     at Module.require (internal/modules/cjs/loader.js:1025:19)
[2020/09/29 14:28:02.857]     at require (internal/modules/cjs/helpers.js:72:18)
[2020/09/29 14:28:02.857]     at Object.<anonymous> (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\packages\shell-api\src\index.ts:1:1)
[2020/09/29 14:28:02.857]     at Module._compile (internal/modules/cjs/loader.js:1137:30)
[2020/09/29 14:28:02.857]     at Module.m._compile (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:858:23)
[2020/09/29 14:28:02.857]     at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
[2020/09/29 14:28:02.857]     at Object.require.extensions.<computed> [as .ts] (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:861:12)
[2020/09/29 14:28:02.857]     at Module.load (internal/modules/cjs/loader.js:985:32)
[2020/09/29 14:28:02.857]     at Function.Module._load (internal/modules/cjs/loader.js:878:14)
[2020/09/29 14:28:02.857]     at Module.require (internal/modules/cjs/loader.js:1025:19)
[2020/09/29 14:28:02.857]     at require (internal/modules/cjs/helpers.js:72:18)
[2020/09/29 14:28:02.857]     at Object.<anonymous> (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\packages\i18n\src\missing-help.spec.ts:3:1)
[2020/09/29 14:28:02.857]     at Module._compile (internal/modules/cjs/loader.js:1137:30)
[2020/09/29 14:28:02.857]     at Module.m._compile (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:858:23)
[2020/09/29 14:28:02.857]     at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
[2020/09/29 14:28:02.857]     at Object.require.extensions.<computed> [as .ts] (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\ts-node\src\index.ts:861:12)
[2020/09/29 14:28:02.857]     at Module.load (internal/modules/cjs/loader.js:985:32)
[2020/09/29 14:28:02.857]     at Function.Module._load (internal/modules/cjs/loader.js:878:14)
[2020/09/29 14:28:02.857]     at Module.require (internal/modules/cjs/loader.js:1025:19)
[2020/09/29 14:28:02.857]     at require (internal/modules/cjs/helpers.js:72:18)
[2020/09/29 14:28:02.857]     at requireOrImport (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\mocha\lib\esm-utils.js:15:12)
[2020/09/29 14:28:02.857]     at Object.exports.loadFilesAsync (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\mocha\lib\esm-utils.js:28:26)
[2020/09/29 14:28:02.857]     at Mocha.loadFilesAsync (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\mocha\lib\mocha.js:386:19)
[2020/09/29 14:28:02.857]     at singleRun (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\mocha\lib\cli\run-helpers.js:149:15)
[2020/09/29 14:28:02.857]     at exports.runMocha (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\mocha\lib\cli\run-helpers.js:186:11)
[2020/09/29 14:28:02.857]     at Object.exports.handler (Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\mocha\lib\cli\run.js:319:11)
[2020/09/29 14:28:02.857]     at Z:\data\mci\8219dfc79114933af1982721c89e5215\src\node_modules\mocha\node_modules\yargs\lib\command.js:241:49
[2020/09/29 14:28:02.857]     at processTicksAndRejections (internal/process/task_queues.js:97:5)
[2020/09/29 14:28:02.857] npm ERR! code ELIFECYCLE
[2020/09/29 14:28:02.857] npm ERR! errno 1
[2020/09/29 14:28:02.857] npm ERR! @mongosh/i18n@0.4.0 test-ci: `mocha -r "../../scripts/import-expansions.js" --timeout 60000 -r ts-node/register "./src/**/*.spec.ts"`
[2020/09/29 14:28:02.857] npm ERR! Exit status 1
[2020/09/29 14:28:02.857] npm ERR!

Fixed by reverting the changes I had on the top level package-lock.json

@Anemy Anemy merged commit 60ce367 into master Sep 29, 2020
@Anemy Anemy deleted the rh/testing-acorn-deps branch September 29, 2020 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants