Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Yarn v3.0.0-rc2 #653

Merged
merged 14 commits into from
Jun 1, 2021
Merged

Upgrade to Yarn v3.0.0-rc2 #653

merged 14 commits into from
Jun 1, 2021

Conversation

kinow
Copy link
Member

@kinow kinow commented Apr 28, 2021

This closes #593

  • Followed migration guide
  • New release of Yarn with fix for optional dependencies (see comments below; fixed using v3.0.0-rc2)
  • Confirmed whether we are going with PNP, Zero-Install, and/or other new features in Yarn (no PnP, doesn't work with sass-loader)
  • Fixed CI
  • Updated docs — if necessary
  • Fix import in src/styles/cylc/_tree.scss (Using PNP, there's no node_modules to import Vuetify's sass variables from! 🤔 )

Requirements check-list

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Already covered by existing tests.
  • No change log entry required (why? e.g. invisible to users).
  • No documentation update required.

@kinow kinow added this to the 0.5.0 milestone Apr 28, 2021
@kinow kinow self-assigned this Apr 28, 2021
@kinow
Copy link
Member Author

kinow commented Apr 28, 2021

Followed the migration docs, but it failed in yarn install. Searched a bit, and found this issue, fixed in this PR.

As it's not yet released, I used the sources installation (instead of Berry, Yarn V2), and confirmed it fixes the issue of the optional dependency in vue-cli-service.

Instead of asking others to use master branch too (yarn upgrades automagically I think, but takes ages), I've marked the PR as draft, and will wait for their release, which hopefully should happen soon.

@kinow
Copy link
Member Author

kinow commented May 2, 2021

yarn set version 3.0.0-rc.2 appears to work. Then yarn run build reports several errors, but the only one that blocked me again was sass-loader. I think it's not working with Yarn V2/V3... trying to understand why our imports are not working as expected.

@kinow
Copy link
Member Author

kinow commented May 3, 2021

Gave up on PnP. The sass-loader/style-loader/vue-loader were not finding a way to load the SCSS variables as they were not in node_modules 🤷‍♂️

Tried this too - https://gist.github.com/kubijo/8c2346dcfe6a3380a700906c4bd6bb04, without luck.

@codecov-commenter
Copy link

codecov-commenter commented May 3, 2021

Codecov Report

Merging #653 (24e6f7e) into master (e56ff97) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #653   +/-   ##
=======================================
  Coverage   85.24%   85.24%           
=======================================
  Files          69       69           
  Lines        1491     1491           
  Branches      114      114           
=======================================
  Hits         1271     1271           
  Misses        186      186           
  Partials       34       34           
Flag Coverage Δ
e2e 68.07% <100.00%> (ø)
unittests 76.51% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/router/index.js 96.66% <ø> (ø)
src/utils/aotf.js 92.26% <ø> (ø)
src/components/cylc/tree/Tree.vue 78.78% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e56ff97...24e6f7e. Read the comment docs.

@kinow kinow changed the title Upgrade to Yarn v2 berry Upgrade to Yarn v3.0.0-rc2 May 3, 2021
@kinow kinow marked this pull request as ready for review May 3, 2021 02:32
@kinow
Copy link
Member Author

kinow commented May 3, 2021

Appears to be working OK. Should unblock some work for #651

.github/workflows/main.yml Outdated Show resolved Hide resolved
@kinow kinow mentioned this pull request May 5, 2021
6 tasks
@hjoliver
Copy link
Member

@kinow is this ready to go now, after deconflicting?

@kinow
Copy link
Member Author

kinow commented May 12, 2021

Yes, I was just waiting for yarn to finish running to resolve the conflicts here.

If you review it locally, it will install yarn V3. It may take a while. After that, when you switch to a different branch, everything should work fine, but you may have a .yarn folder in Cylc UI with some files that you can remove with git clean -d -f, and also some files in ~/.yarn I think (though those ones will be used anyway after this is merged, so harmless to leave them if you'd like).

Thanks!

@kinow
Copy link
Member Author

kinow commented May 12, 2021

And now the build is not happy with our enums I think. Looked at the diff of the push-force, nothing out of ordinary. Guess will need to fix this one in the morning after some strong ☕

@kinow
Copy link
Member Author

kinow commented May 12, 2021

Alright, removing the istanbul-instrumenter-loader everything works I think, but breaks coverage. 🤔

@kinow
Copy link
Member Author

kinow commented May 12, 2021

Tests pass, coverage appears to be OK, linter OK... now build is failing due to the webpack loaders 😅

 error  in ./node_modules/graphql-language-service-interface/esm/GraphQLLanguageService.js

Module parse failed: Unexpected token (100:23)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|         }
|         let customRules = null;
>         if (extensions?.customValidationRules &&
|             typeof extensions.customValidationRules === 'function') {
|             customRules = extensions.customValidationRules(this._graphQLConfig);

I think the ? is new, and we need a babel plugin or a loader somewhere in webpack...

Related perhaps to vuejs/vue#11088, although that issue is about optional chaining in Vue templates.

But more likely related to this issue vuejs/vue-loader#1697

@kinow
Copy link
Member Author

kinow commented May 13, 2021

The problem I was having with the optional null was not related to the Vue issues linked above. Turns out I simply forgot about vue.config.js's transpileDependencies key.

Adding the GraphQL libraries there enabled Babel to transpile them using the plug-ins for null/coalesce operator.

@kinow
Copy link
Member Author

kinow commented May 13, 2021

@hjoliver ready for review now.

CI is passing. I was worried about coverage, but looks like it's working fine. 🎉

babel.config.js Outdated
['babel-plugin-istanbul', { extension: ['.js', '.vue'] }]
]
return { presets, plugins }
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Different syntax to make it clear that we have an array, and also to access the api object and enable the cache. It's also possible to access the NODE_ENV that way if necessary, and write JS code to enable/disable plug-ins per environment (e.g. I'll probably completely disable everything related to istanbul & coverage when env === 'production', but for another PR)

Copy link
Member Author

Choose a reason for hiding this comment

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

The important new lines here are

    ['@babel/plugin-proposal-nullish-coalescing-operator'],
    ['@babel/plugin-proposal-optional-chaining']

For the object?.property operator.

transpileDependencies: ['vuetify'],
transpileDependencies: [
'graphql-language-service-interface',
'graphql-language-service-parser',
Copy link
Member Author

Choose a reason for hiding this comment

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

These two dependencies broke the build due to the null-coallesce operator. I think that could happen in our current Yarn V1 build too at some point?

@@ -678,7 +678,7 @@ export async function mutate (mutation, args, apolloClient) {
}
// command in a different format (e.g. info command)
return [TaskState.SUBMITTED, result]
} catch {
} catch (error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I think one of the Webpack loaders was not happy about this syntax, even though it was working before. I think a new and more strict rule was added somewhere in some dependency 🤷‍♂️

@@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@import '../../../node_modules/vuetify/src/styles/styles';
@import '~vuetify/src/styles/styles';
Copy link
Member Author

Choose a reason for hiding this comment

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

The ~ is the correct way. The other syntax is valid depending on your build tools. And I think ~@ means that it's a file in the current project, while ~ means it's a file in the node_modules folder. This broke with Yarn V3 with PnP mode (plug-and-play, when you have no node_modules folder, but instead each dependency loaded from a cache, from what I understand).

@@ -160,7 +160,7 @@ import TreeItem from '@/components/cylc/tree/TreeItem'
import Vue from 'vue'
import TaskState from '@/model/TaskState.model'
import Task from '@/components/cylc/Task'
import clonedeep from 'lodash.clonedeep'
import cloneDeep from 'lodash/cloneDeep'
Copy link
Member Author

Choose a reason for hiding this comment

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

The first one was using the lodash.clonedeep single dependency, which was a transitive dependency.

Our build failed as Yarn is more strict about the transitive dependencies not declared in our package.json (we had similar issue in Python & setuptools I think? Maybe a trend in build tools? anyhoo).

Instead of simply adding the new dependency, the change here is using importing the cloneDeep module from our already imported lodash dependency. Tree shaking doesn't seem to work too well for Lodash at the moment with our Vue-CLI/Babel/Webpack build chain, but it does with RollUp and with with Vite, which we will probably have a chance to look into when moving to Vue 3.

autoprefixer: {}
}
plugins: [
require('autoprefixer')
Copy link
Member Author

Choose a reason for hiding this comment

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

Yarn failed to build due to the old syntax? 🤷‍♂️ copied this from the autoprefixer docs.

@kinow
Copy link
Member Author

kinow commented May 14, 2021

I've updated the README.md, and verified that each command in the building section works, includnig Cypress 7.3.0 running our e2e tests 👍

Copy link
Member

@hjoliver hjoliver left a comment

Choose a reason for hiding this comment

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

Works for me 👍

package.json Outdated Show resolved Hide resolved
@merceyz
Copy link

merceyz commented May 20, 2021

(no PnP, doesn't work with sass-loader)

Interesting, what was the error? I'm using Vue cli, sass, and PnP without issues

@kinow
Copy link
Member Author

kinow commented May 20, 2021

(no PnP, doesn't work with sass-loader)

Interesting, what was the error? I'm using Vue cli, sass, and PnP without issues

It was failing to locate files from local (as in the project source) and from Vuetify (before in the node_modules, now in the cache? zipped I think?).

Like this one:

@import '~@lumino/default-theme/style/index.css';
@import '~vuetify/src/styles/styles.sass';

package.json Outdated Show resolved Hide resolved
@merceyz
Copy link

merceyz commented May 20, 2021

It was failing to locate files from local (as in the project source) and from Vuetify (before in the node_modules, now in the cache? zipped I think?).

Like this one:

@import '~@lumino/default-theme/style/index.css';
@import '~vuetify/src/styles/styles.sass';

I cloned this PR, enabled PnP, ran yarn build, and after adding the missing dependencies

    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2",
    "@babel/plugin-proposal-private-methods": "^7.13.0",

it fails due to cyclic dependencies

Cyclic dependency: src\components\graphqlFormGenerator\FormInput.vue -> src\components\graphqlFormGenerator\FormInput.vue?vue&type=script&lang=js& -> src\components\graphqlFormGenerator\FormInput.vue?vue&type=script&lang=js& -> src\components\graphqlFormGenerator\mixins.js -> src\components\graphqlFormGenerator\FormInput.vue

@kinow
Copy link
Member Author

kinow commented May 20, 2021

@merceyz trying it now too.

diff --git a/.yarnrc.yml b/.yarnrc.yml
index 2b422cd3..b89f1a5a 100644
--- a/.yarnrc.yml
+++ b/.yarnrc.yml
@@ -1,4 +1,4 @@
-nodeLinker: node-modules
+nodeLinker: pnp
 
 yarnPath

Then rm -rf node_modules, and yarn install.

...
➤ YN0062: │ fsevents@patch:fsevents@npm%3A1.2.13#~builtin<compat/fsevents>::version=1.2.13&hash=1cc4b2 The platform linux is incompatible with this module, build skipped.
➤ YN0000: └ Completed in 0s 800ms
➤ YN0000: Done with warnings in 2s 378ms

All good. But now yarn run lint fails.

 ERROR  Error: Your application tried to access @babel/plugin-proposal-private-methods, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.

Required package: @babel/plugin-proposal-private-methods
Required by: /home/kinow/Development/python/workspace/cylc-ui/

Require stack:
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/config/files/plugins.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/config/files/index.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/index.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/@vue-cli-plugin-babel-virtual-b65a631ec3/0/cache/@vue-cli-plugin-babel-npm-4.5.13-655520332c-020ffd412d.zip/node_modules/@vue/cli-plugin-babel/index.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/@vue-cli-service-virtual-56dd58e06a/0/cache/@vue-cli-service-npm-4.5.13-1a50881d57-21c836bf2d.zip/node_modules/@vue/cli-service/lib/Service.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/@vue-cli-service-virtual-56dd58e06a/0/cache/@vue-cli-service-npm-4.5.13-1a50881d57-21c836bf2d.zip/node_modules/@vue/cli-service/bin/vue-cli-service.js
Error: Your application tried to access @babel/plugin-proposal-private-methods, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.

Required package: @babel/plugin-proposal-private-methods
Required by: /home/kinow/Development/python/workspace/cylc-ui/

Require stack:
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/config/files/plugins.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/config/files/index.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/index.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/@vue-cli-plugin-babel-virtual-b65a631ec3/0/cache/@vue-cli-plugin-babel-npm-4.5.13-655520332c-020ffd412d.zip/node_modules/@vue/cli-plugin-babel/index.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/@vue-cli-service-virtual-56dd58e06a/0/cache/@vue-cli-service-npm-4.5.13-1a50881d57-21c836bf2d.zip/node_modules/@vue/cli-service/lib/Service.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/@vue-cli-service-virtual-56dd58e06a/0/cache/@vue-cli-service-npm-4.5.13-1a50881d57-21c836bf2d.zip/node_modules/@vue/cli-service/bin/vue-cli-service.js
    at Function.external_module_.Module._resolveFilename (/home/kinow/Development/python/workspace/cylc-ui/.pnp.cjs:29862:55)
    at resolve (internal/modules/cjs/helpers.js:80:19)
    at resolveStandardizedName (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/config/files/plugins.js:111:7)
    at resolvePlugin (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/config/files/plugins.js:55:10)
    at loadPlugin (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/config/files/plugins.js:63:20)
    at loadPlugin.next (<anonymous>)
    at createDescriptor (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/@babel-core-npm-7.14.3-9181aae4d9-b91ed6adc7.zip/node_modules/@babel/core/lib/config/config-descriptors.js:187:16)
    at createDescriptor.next (<anonymous>)
    at evaluateSync (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/gensync-npm-1.0.0-beta.2-224666d72f-a7437e58c6.zip/node_modules/gensync/index.js:251:28)
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/gensync-npm-1.0.0-beta.2-224666d72f-a7437e58c6.zip/node_modules/gensync/index.js:31:34

Let's try installing that dependency.

kinow@ranma:~/Development/python/workspace/cylc-ui$ yarn add -D @babel/plugin-proposal-private-methods
➤ YN0001: Error: Assertion failed: Expected an error to have been set
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/releases/yarn-3.0.0-rc.2.cjs:297:21682
    at Function.start (/home/kinow/Development/python/workspace/cylc-ui/.yarn/releases/yarn-3.0.0-rc.2.cjs:282:3885)
    at Zh.execute (/home/kinow/Development/python/workspace/cylc-ui/.yarn/releases/yarn-3.0.0-rc.2.cjs:297:21471)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Zh.validateAndExecute (/home/kinow/Development/python/workspace/cylc-ui/.yarn/releases/yarn-3.0.0-rc.2.cjs:193:618)
    at async Hn.run (/home/kinow/Development/python/workspace/cylc-ui/.yarn/releases/yarn-3.0.0-rc.2.cjs:205:1845)
    at async Hn.runExit (/home/kinow/Development/python/workspace/cylc-ui/.yarn/releases/yarn-3.0.0-rc.2.cjs:205:2012)
    at async i (/home/kinow/Development/python/workspace/cylc-ui/.yarn/releases/yarn-3.0.0-rc.2.cjs:297:12327)
    at async r (/home/kinow/Development/python/workspace/cylc-ui/.yarn/releases/yarn-3.0.0-rc.2.cjs:297:10681)

➤ Errors happened when preparing the environment required to run this command.

That started happening with V3. Is there another way to install dev dependencies with V3 @merceyz ? I added it manually, as well as other dependencies (@oliver-sanders one of the errors that happened was missing eslint-plugin-promise 👈 ). With the diff below yarn install and yarn run lint both run OK.

diff --git a/.yarnrc.yml b/.yarnrc.yml
index 2b422cd3..b89f1a5a 100644
--- a/.yarnrc.yml
+++ b/.yarnrc.yml
@@ -1,4 +1,4 @@
-nodeLinker: node-modules
+nodeLinker: pnp
 
 yarnPath: .yarn/releases/yarn-3.0.0-rc.2.cjs
 
diff --git a/package.json b/package.json
index 90e3fdf9..d93606a2 100644
--- a/package.json
+++ b/package.json
@@ -55,7 +55,9 @@
     "@babel/core": "^7.13.16",
     "@babel/eslint-parser": "^7.13.14",
     "@babel/plugin-proposal-class-properties": "^7.13.0",
+    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.2",
     "@babel/plugin-proposal-optional-chaining": "^7.14.2",
+    "@babel/plugin-proposal-private-methods": "^7.13.0",
     "@cypress/code-coverage": "^3.9.5",
     "@cypress/webpack-preprocessor": "^5.7.0",
     "@mdi/js": "^5.9.55",
@@ -81,8 +83,10 @@
     "eslint-config-standard": "^16.0.2",
     "eslint-config-vuetify": "^0.5.0",
     "eslint-import-resolver-node": "^0.3.4",
+    "eslint-plugin-cypress": "^2.11.3",
     "eslint-plugin-import": "^2.22.1",
     "eslint-plugin-node": "^11.1.0",
+    "eslint-plugin-promise": "^5.1.0",
     "eslint-plugin-vue": "^7.9.0",
     "graphql-language-service-utils": "^2.5.2",
     "istanbul-instrumenter-loader": "^3.0.1",
diff --git a/yarn.lock b/yarn.lock
index 92476c45..0b0efc82 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6541,7 +6541,9 @@ __metadata:
     "@babel/core": ^7.13.16
     "@babel/eslint-parser": ^7.13.14
     "@babel/plugin-proposal-class-properties": ^7.13.0
+    "@babel/plugin-proposal-nullish-coalescing-operator": ^7.14.2
     "@babel/plugin-proposal-optional-chaining": ^7.14.2
+    "@babel/plugin-proposal-private-methods": ^7.13.0
     "@cypress/code-coverage": ^3.9.5
     "@cypress/webpack-preprocessor": ^5.7.0
     "@lumino/algorithm": ^1.6.0
@@ -6578,8 +6580,10 @@ __metadata:
     eslint-config-standard: ^16.0.2
     eslint-config-vuetify: ^0.5.0
     eslint-import-resolver-node: ^0.3.4
+    eslint-plugin-cypress: ^2.11.3
     eslint-plugin-import: ^2.22.1
     eslint-plugin-node: ^11.1.0
+    eslint-plugin-promise: ^5.1.0
     eslint-plugin-vue: ^7.9.0
     graphiql: ^1.4.1
     graphql: ^15.5.0
@@ -7873,7 +7877,7 @@ __metadata:
   languageName: node
   linkType: hard
 
-"eslint-plugin-cypress@npm:^2.10.3":
+"eslint-plugin-cypress@npm:^2.10.3, eslint-plugin-cypress@npm:^2.11.3":
   version: 2.11.3
   resolution: "eslint-plugin-cypress@npm:2.11.3"
   dependencies:
@@ -7996,6 +8000,15 @@ __metadata:
   languageName: node
   linkType: hard
 
+"eslint-plugin-promise@npm:^5.1.0":
+  version: 5.1.0
+  resolution: "eslint-plugin-promise@npm:5.1.0"
+  peerDependencies:
+    eslint: ^7.0.0
+  checksum: e62947aaea6882951a1a9f5fe3e3c7925b8dcc222338f7979bd1495ba0f0dc701820116b108be1e801f6e5156eb9a928142f29c659fd21a5d65a4be495bb327d
+  languageName: node
+  linkType: hard
+
 "eslint-plugin-promise@npm:~4.2.1":
   version: 4.2.1
   resolution: "eslint-plugin-promise@npm:4.2.1"

However, the following still fail

kinow@ranma:~/Development/python/workspace/cylc-ui$ yarn run serve
[SERVER] Error: snapshots directory . doesn't exist
[SERVER] yarn run serve:jupyterhub exited with code 1
--> Sending SIGTERM to other processes..
[CLIENT] yarn run serve:vue exited with code SIGTERM
kinow@ranma:~/Development/python/workspace/cylc-ui$ yarn run test:unit
Download the Vue Devtools extension for a better development experience:
https://github.com/vuejs/vue-devtools
You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html
 WEBPACK  Compiling...

  [=================        ] 69% (building)[BABEL] Note: The code generator has deoptimised the styling of /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/vuetify-virtual-3e336ec291/0/cache/vuetify-npm-2.5.0-b368b19310-07ab169ce9.zip/node_modules/vuetify/dist/vuetify.js as it exceeds the max of 500KB.
  [=========================] 98% (after emitting)

 WARNING  Compiled with 1 warning

 warning  in ./.yarn/__virtual__/follow-redirects-virtual-0c4ea90a75/0/cache/follow-redirects-npm-1.14.1-e6bdc0f8e5-7381a55bdc.zip/node_modules/follow-redirects/debug.js

Module not found: Error: follow-redirects tried to access debug (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: debug
Required by: follow-redirects@virtual:d192f6b3b31cd5d11a443145a3883a70c04cbd7c813c53085dbaf50263735f1162f10fdbddd53c24e162ec3bc37b90966413084323739b7cf942b8bfb4da8831#npm:1.14.1 (via /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/follow-redirects-virtual-0c4ea90a75/0/cache/follow-redirects-npm-1.14.1-e6bdc0f8e5-7381a55bdc.zip/node_modules/follow-redirects/debug.js)

Ancestor breaking the chain: axios@npm:0.21.1
Ancestor breaking the chain: http-proxy@npm:1.18.1



  [=========================] 100% (completed)

 WEBPACK  Compiled with 1 warning(s)

Warning in ./.yarn/__virtual__/follow-redirects-virtual-0c4ea90a75/0/cache/follow-redirects-npm-1.14.1-e6bdc0f8e5-7381a55bdc.zip/node_modules/follow-redirects/debug.js

  Module not found: follow-redirects tried to access debug (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.
  
  Required package: debug
  Required by: follow-redirects@virtual:d192f6b3b31cd5d11a443145a3883a70c04cbd7c813c53085dbaf50263735f1162f10fdbddd53c24e162ec3bc37b90966413084323739b7cf942b8bfb4da8831#npm:1.14.1 (via /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/follow-redirects-virtual-0c4ea90a75/0/cache/follow-redirects-npm-1.14.1-e6bdc0f8e5-7381a55bdc.zip/node_modules/follow-redirects/debug.js)
  
  Ancestor breaking the chain: axios@npm:0.21.1
  Ancestor breaking the chain: http-proxy@npm:1.18.1

 MOCHA  Testing...

 RUNTIME EXCEPTION  Exception occurred while loading your tests

Error: Qualified path resolution failed - none of those files can be found on the disk.

Source path: /home/kinow/Development/python/workspace/cylc-ui/dist/js/main.js
Not found: /home/kinow/Development/python/workspace/cylc-ui/dist/js/main.js
Not found: /home/kinow/Development/python/workspace/cylc-ui/dist/js/main.js.js
Not found: /home/kinow/Development/python/workspace/cylc-ui/dist/js/main.js.json
Not found: /home/kinow/Development/python/workspace/cylc-ui/dist/js/main.js.node
Not found: /home/kinow/Development/python/workspace/cylc-ui/dist/js/main.js.jsx
Not found: /home/kinow/Development/python/workspace/cylc-ui/dist/js/main.js.react

Require stack:
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/mocha-npm-6.2.3-b87ac0ebf8-c069edeffb.zip/node_modules/mocha/lib/mocha.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/mocha-npm-6.2.3-b87ac0ebf8-c069edeffb.zip/node_modules/mocha/index.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/mochapack-virtual-fa9e096079/0/cache/mochapack-npm-1.1.15-394a78aec0-31e2380046.zip/node_modules/mochapack/lib/runner/configureMocha.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/mochapack-virtual-fa9e096079/0/cache/mochapack-npm-1.1.15-394a78aec0-31e2380046.zip/node_modules/mochapack/lib/runner/TestRunner.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/mochapack-virtual-fa9e096079/0/cache/mochapack-npm-1.1.15-394a78aec0-31e2380046.zip/node_modules/mochapack/lib/MochaWebpack.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/mochapack-virtual-fa9e096079/0/cache/mochapack-npm-1.1.15-394a78aec0-31e2380046.zip/node_modules/mochapack/lib/createMochaWebpack.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/mochapack-virtual-fa9e096079/0/cache/mochapack-npm-1.1.15-394a78aec0-31e2380046.zip/node_modules/mochapack/lib/cli/index.js
- /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/mochapack-virtual-fa9e096079/0/cache/mochapack-npm-1.1.15-394a78aec0-31e2380046.zip/node_modules/mochapack/bin/mochapack
    at Function.external_module_.Module._resolveFilename (/home/kinow/Development/python/workspace/cylc-ui/.pnp.cjs:29904:55)
    at Function._resolveFilename (/home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/mochapack-virtual-fa9e096079/0/cache/mochapack-npm-1.1.15-394a78aec0-31e2380046.zip/node_modules/mochapack/src/util/registerRequireHook.ts:21:34)
    at Function.external_module_.Module._load (/home/kinow/Development/python/workspace/cylc-ui/.pnp.cjs:29724:48)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/mocha-npm-6.2.3-b87ac0ebf8-c069edeffb.zip/node_modules/mocha/lib/mocha.js:334:36
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/mocha-npm-6.2.3-b87ac0ebf8-c069edeffb.zip/node_modules/mocha/lib/mocha.js:331:14)
    at Mocha.run (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/mocha-npm-6.2.3-b87ac0ebf8-c069edeffb.zip/node_modules/mocha/lib/mocha.js:809:10)
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/mochapack-virtual-fa9e096079/0/cache/mochapack-npm-1.1.15-394a78aec0-31e2380046.zip/node_modules/mochapack/src/runner/TestRunner.ts:105:23
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/mochapack-virtual-fa9e096079/0/cache/mochapack-npm-1.1.15-394a78aec0-31e2380046.zip/node_modules/mochapack/src/webpack/compiler/registerReadyCallback.ts:14:7
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/tapable-npm-1.1.3-f1c2843426-53ff4e7c39.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:43:1)
    at AsyncSeriesHook.lazyCompileHook (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/tapable-npm-1.1.3-f1c2843426-53ff4e7c39.zip/node_modules/tapable/lib/Hook.js:154:20)
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/webpack-virtual-be1be79997/0/cache/webpack-npm-4.46.0-a8158cfa7f-013fa24c00.zip/node_modules/webpack/lib/Compiler.js:304:22
    at Compiler.emitRecords (/home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/webpack-virtual-be1be79997/0/cache/webpack-npm-4.46.0-a8158cfa7f-013fa24c00.zip/node_modules/webpack/lib/Compiler.js:499:39)
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/webpack-virtual-be1be79997/0/cache/webpack-npm-4.46.0-a8158cfa7f-013fa24c00.zip/node_modules/webpack/lib/Compiler.js:298:10
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/webpack-virtual-be1be79997/0/cache/webpack-npm-4.46.0-a8158cfa7f-013fa24c00.zip/node_modules/webpack/lib/Compiler.js:485:14
    at eval (eval at create (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/tapable-npm-1.1.3-f1c2843426-53ff4e7c39.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/copy-webpack-plugin-virtual-e8b1b4d051/0/cache/copy-webpack-plugin-npm-5.1.2-b9289299c7-e398884dee.zip/node_modules/copy-webpack-plugin/dist/index.js:115:7
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/tapable-npm-1.1.3-f1c2843426-53ff4e7c39.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at AsyncSeriesHook.lazyCompileHook (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/tapable-npm-1.1.3-f1c2843426-53ff4e7c39.zip/node_modules/tapable/lib/Hook.js:154:20)
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/webpack-virtual-be1be79997/0/cache/webpack-npm-4.46.0-a8158cfa7f-013fa24c00.zip/node_modules/webpack/lib/Compiler.js:482:27
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/neo-async-npm-2.6.2-75d6902586-deac9f8d00.zip/node_modules/neo-async/async.js:2818:7
    at done (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/neo-async-npm-2.6.2-75d6902586-deac9f8d00.zip/node_modules/neo-async/async.js:3522:9)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/tapable-npm-1.1.3-f1c2843426-53ff4e7c39.zip/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at /home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/webpack-virtual-be1be79997/0/cache/webpack-npm-4.46.0-a8158cfa7f-013fa24c00.zip/node_modules/webpack/lib/Compiler.js:464:33
    at MemoryFileSystem.writeFile (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/memory-fs-npm-0.4.1-0a5f9b8954-6db6c8682e.zip/node_modules/memory-fs/lib/MemoryFileSystem.js:328:9)
    at writeOut (/home/kinow/Development/python/workspace/cylc-ui/.yarn/__virtual__/webpack-virtual-be1be79997/0/cache/webpack-npm-4.46.0-a8158cfa7f-013fa24c00.zip/node_modules/webpack/lib/Compiler.js:462:30)
    at Immediate._onImmediate (/home/kinow/Development/python/workspace/cylc-ui/.yarn/cache/memory-fs-npm-0.4.1-0a5f9b8954-6db6c8682e.zip/node_modules/memory-fs/lib/MemoryFileSystem.js:288:4)
    at processImmediate (internal/timers.js:461:21)

 ERROR  mochapack exited with code 1.

Haven't tried Cypress with yarn run test:e2e yet, but I remember having some issues with that as well.

I had so many strange issues like these above, that I thought easier to keep the node_modules, and just move to Yarn V3 so that the Vuepress pull request was not blocked any longer, then revisit it later (possibly when V3 final version is released) 😥

@merceyz
Copy link

merceyz commented May 20, 2021

Error: Assertion failed: Expected an error to have been set
That started happening with V3. Is there another way to install dev dependencies with V3 @merceyz ?

Looks like a bug with the enableNetwork: false and networkSettings combo, this diff works around it

diff --git a/.yarnrc.yml b/.yarnrc.yml
index 2b422cd..5d3489a 100644
--- a/.yarnrc.yml
+++ b/.yarnrc.yml
@@ -2,7 +2,6 @@ nodeLinker: node-modules
 
 yarnPath: .yarn/releases/yarn-3.0.0-rc.2.cjs
 
-enableNetwork: false
 enableStrictSsl: true
 
 networkSettings:
@@ -10,3 +9,5 @@ networkSettings:
     enableNetwork: true
   "registry.npmjs.org":
     enableNetwork: true
+  "*":
+    enableNetwork: false

I had so many strange issues like these above, that I thought easier to keep the node_modules, and just move to Yarn V3 so that the Vuepress pull request was not blocked any longer, then revisit it later (possibly when V3 final version is released) 😥

Yeah, that is the recommended migration path, was just curious why it wasn't working 👍

@kinow
Copy link
Member Author

kinow commented May 20, 2021

I should have more time to troubleshoot PnP in the next days/weeks @merceyz, but probably after this PR has been merged. But great to hear someone else got vue cli/sass/pnp working. Would you be able to share a link to the repository so I can take a look at it later, please? Thanks!

Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

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

Chucking in a quick review though I don't understand the yarn3 migration whatsoever.

Installed with yarn and built the UI (build:watch) all seems fine to me.

A few messages in the "resolution step" that name our package:

➤ YN0060: │ cylc-ui@workspace:. provides eslint (p590b5) with version 7.26.0, which doesn't satisfy what @vue/cli-plugin-eslint and some of its descendants request
➤ YN0060: │ cylc-ui@workspace:. provides eslint (p83bdf) with version 7.26.0, which doesn't satisfy what eslint-config-vuetify and some of its descendants request
➤ YN0002: │ cylc-ui@workspace:. doesn't provide eslint-plugin-promise (pcd7ff), requested by eslint-config-standard
➤ YN0060: │ cylc-ui@workspace:. provides preact (p4c785) with version 10.5.13, which doesn't satisfy what preact-compat and some of its descendants request
➤ YN0002: │ cylc-ui@workspace:. doesn't provide prop-types (pcd96f), requested by graphiql
➤ YN0002: │ cylc-ui@workspace:. doesn't provide react (p8b0df), requested by graphiql
➤ YN0002: │ cylc-ui@workspace:. doesn't provide react-dom (p70cdb), requested by graphiql

Dunno?

I don't know if the other review is resolved so leaving to someone else to hit the merge button.

@kinow
Copy link
Member Author

kinow commented May 25, 2021

Thanks for the reviews!!! We have a few more warnings when running tests too that I intend to fix after yarn v3 migration (and also after confirming whether we can update any dependencies; in case that fixes some of these warnings too).

These are eslint issues, which doesn't worry me too much. The eslint-plugin-promise can be fixed, I think, by simply installing the dependency in our package.json, but it should be OK to fix this one later (and as far as I could tell, eslint is still working on yarn run lint and locally with my IDE too).

➤ YN0060: │ cylc-ui@workspace:. provides eslint (p590b5) with version 7.26.0, which doesn't satisfy what @vue/cli-plugin-eslint and some of its descendants request
➤ YN0060: │ cylc-ui@workspace:. provides eslint (p83bdf) with version 7.26.0, which doesn't satisfy what eslint-config-vuetify and some of its descendants request
➤ YN0002: │ cylc-ui@workspace:. doesn't provide eslint-plugin-promise (pcd7ff), requested by eslint-config-standard

For these related to GraphiQL and React, we use preact that should provide react, prop-types and other deps required by GraphiQL. But maybe due to the alias these warnings were raised.

➤ YN0060: │ cylc-ui@workspace:. provides preact (p4c785) with version 10.5.13, which doesn't satisfy what preact-compat and some of its descendants request
➤ YN0002: │ cylc-ui@workspace:. doesn't provide prop-types (pcd96f), requested by graphiql
➤ YN0002: │ cylc-ui@workspace:. doesn't provide react (p8b0df), requested by graphiql
➤ YN0002: │ cylc-ui@workspace:. doesn't provide react-dom (p70cdb), requested by graphiql

I don't know if the other review is resolved so leaving to someone else to hit the merge button.

merceyz 's review? If so, we had a good chat about Yarn V3 with PNP (doesn't need node_modules folder) and issues I had when I tried that. I will try that again, but since it's not a must-have for us now, I think it should be OK to use Yarn V3 with the node_modules directory.

@kinow
Copy link
Member Author

kinow commented Jun 1, 2021

Two approvals, and appears to be working fine (just tested locally again). I've rebased, and push-forced. If CI build passes then I will merge it 👍

@kinow kinow merged commit 6797b87 into cylc:master Jun 1, 2021
@kinow kinow deleted the yarn-v2 branch June 1, 2021 04:34
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.

upgrade to yarn 2
5 participants