-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Chore: Fix CI #10646
Chore: Fix CI #10646
Conversation
import dayjs = require('dayjs'); | ||
import dayJsRelativeTime = require('dayjs/plugin/relativeTime'); | ||
import * as dayjs from 'dayjs'; | ||
import * as dayJsRelativeTime from 'dayjs/plugin/relativeTime'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import = require
import style was failing here:
error ../utils/time.ts: /home/runner/work/joplin/joplin/packages/utils/time.ts: `import dayjs = require('dayjs')` is not supported by @babel/plugin-transform-typescript
Please consider using `import dayjs from 'dayjs';` alongside Typescript's --allowSyntheticDefaultImports option.
SyntaxError: /home/runner/work/joplin/joplin/packages/utils/time.ts: `import dayjs = require('dayjs')` is not supported by @babel/plugin-transform-typescript
Please consider using `import dayjs from 'dayjs';` alongside Typescript's --allowSyntheticDefaultImports option.
4 | // -----------------------------------------------------------------------------------------------
5 |
> 6 | import dayjs = require('dayjs');
4 | // -----------------------------------------------------------------------------------------------
5 |
> 6 | import dayjs = require('dayjs');
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 | import dayJsRelativeTime = require('dayjs/plugin/relativeTime');
8 |
9 | const supportedLocales: Record<string, unknown> = {.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 | import dayJsRelativeTime = require('dayjs/plugin/relativeTime');
8 |
9 | const supportedLocales: Record<string, unknown> = {
at File.buildCodeFrameError (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@react-native/metro-babel-transformer/node_modules/@babel/core/lib/transformation/file/file.js:205:12)
at NodePath.buildCodeFrameError (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/path/index.js:105:21)
at PluginPass.TSImportEqualsDeclaration (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/plugin-transform-typescript/lib/index.js:397:22)
at newFn (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/visitors.js:153:14)
at NodePath._call (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/path/context.js:46:20)
at NodePath.call (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/path/context.js:36:17)
at NodePath.visit (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/path/context.js:82:31)
at TraversalContext.visitQueue (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/context.js:86:16)
at TraversalContext.visitMultiple (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/context.js:61:17)
at TraversalContext.visit (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/context.js:107:19)
at traverseNode (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
at NodePath.visit (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/path/context.js:88:52)
at TraversalContext.visitQueue (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/context.js:86:16)
at TraversalContext.visitSingle (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/context.js:65:19)
at TraversalContext.visit (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/context.js:109:19)
at traverseNode (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
at traverse (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@babel/traverse/lib/index.js:49:34)
at transformFile (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@react-native/metro-babel-transformer/node_modules/@babel/core/lib/transformation/index.js:81:29)
at transformFile.next (<anonymous>)
at run (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@react-native/metro-babel-transformer/node_modules/@babel/core/lib/transformation/index.js:24:12)
at run.next (<anonymous>)
at /home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@react-native/metro-babel-transformer/node_modules/@babel/core/lib/transform-ast.js:23:41
at Generator.next (<anonymous>)
at evaluateSync (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/gensync/index.js:251:28)
at sync (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/gensync/index.js:89:14)
at stopHiding - secret - don't use this - v1 (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@react-native/metro-babel-transformer/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:46:12)
at transformFromAstSync (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@react-native/metro-babel-transformer/node_modules/@babel/core/lib/transform-ast.js:44:83)
at Object.transform (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/@react-native/metro-babel-transformer/src/index.js:217:7)
at transformJSWithBabel (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/metro-transform-worker/src/index.js:285:45)
at Object.transform (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/metro-transform-worker/src/index.js:408:18)
at transformFile (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/metro/src/DeltaBundler/Worker.flow.js:54:36)
at Object.transform (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/metro/src/DeltaBundler/Worker.flow.js:30:10)
at execFunction (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/jest-worker/build/workers/processChild.js:149:17)
at execHelper (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/jest-worker/build/workers/processChild.js:137:5)
at execMethod (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/jest-worker/build/workers/processChild.js:140:5)
at process.messageListener (/home/runner/work/joplin/joplin/packages/app-mobile/node_modules/jest-worker/build/workers/processChild.js:44:7)
at process.emit (node:events:517:28)
at emit (node:internal/child_process:944:14)
> Task :app:createBundleReleaseJsAndAssets FAILED
if (!d.isValid()) return 'Invalid Date'; | ||
if (!d.isValid()) return 'Invalid date'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to this test failure:
➤ YN0000: [@joplin/lib]: FAIL services/noteList/renderViewProps.test.js
➤ YN0000: [@joplin/lib]: ● renderViewProps › should handle invalid view props
➤ YN0000: [@joplin/lib]:
➤ YN0000: [@joplin/lib]: expect(received).toEqual(expected) // deep equality
➤ YN0000: [@joplin/lib]:
➤ YN0000: [@joplin/lib]: - Expected - 1
➤ YN0000: [@joplin/lib]: + Received + 1
➤ YN0000: [@joplin/lib]:
➤ YN0000: [@joplin/lib]: Object {
➤ YN0000: [@joplin/lib]: "note": Object {
➤ YN0000: [@joplin/lib]: "tags": 123,
➤ YN0000: [@joplin/lib]: - "user_updated_time": "Invalid date",
➤ YN0000: [@joplin/lib]: + "user_updated_time": "Invalid Date",
➤ YN0000: [@joplin/lib]: },
➤ YN0000: [@joplin/lib]: }
➤ YN0000: [@joplin/lib]:
➤ YN0000: [@joplin/lib]: 50 | Logger.globalLogger.enabled = true;
➤ YN0000: [@joplin/lib]: 51 |
➤ YN0000: [@joplin/lib]: > 52 | expect(view).toEqual({
➤ YN0000: [@joplin/lib]: | ^
➤ YN0000: [@joplin/lib]: 53 | note: {
➤ YN0000: [@joplin/lib]: 54 | user_updated_time: 'Invalid date',
➤ YN0000: [@joplin/lib]: 55 | tags: 123,
➤ YN0000: [@joplin/lib]:
➤ YN0000: [@joplin/lib]: at toEqual (services/noteList/renderViewProps.test.ts:52:16)
➤ YN0000: [@joplin/lib]: at fulfilled (services/noteList/renderViewProps.test.js:12:24)
➤ YN0000: [@joplin/lib]:
Thanks for fixing all this! Strange that the imports were working fine for me but not on CI, and it seems other people too have this problem. Somehow the same syntax works on Joplin Server |
See the review comments below for an explanation of the changes made in this PR.