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

Update to ember-source 5.1 types (and other fixes) #256

Merged
merged 13 commits into from
Jul 27, 2023

Conversation

leepfrog
Copy link

  • global.d.ts: Change global type defintions to import ember-source/types and ember-cli-fastboot
  • package.json: Remove @types/ember*
  • package.json: Update @embroider/addon-dev to 3.2.0
  • package.json: Replace babel-eslint with @babel/eslint-parser to address deprecation warning
  • package.json: Add @simple-dom/document to import types
  • package.json: Add ember-source to import types
  • helpers/page-title.ts: Refactor object to Owner for constructor()
  • services/page-title.ts: Add guards for potential undefined variables
  • services/page-title.ts: Update import to address ember deprecation
  • tsconfig.json: Add support for experimental decorators (ie @service)

…ypes and ember-cli-fastboot

- package.json: Remove @types/ember*
- package.json: Update @embroider/addon-dev to 3.2.0
- package.json: Replace babel-eslint with @babel/eslint-parser to address deprecation warning
- package.json: Add @simple-dom/document to import types
- package.json: Add ember-source to import types
- helpers/page-title.ts: Refactor `object` to `Owner` for `constructor()`
- services/page-title.ts: Add guards for potential undefined variables
- services/page-title.ts: Update import to address ember deprecation
- tsconfig.json: Add support for experimental decorators (ie `@service`)
@knownasilya
Copy link
Contributor

Looks like an install error, I think we can update to node 16 here esp since new addons start at node 16

@leepfrog
Copy link
Author

I think this has another outdated dependency or configuration issue 👀 :

$ 
> yarn install
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
success Already up-to-date.
$ cd addon && yarn build
yarn run v1.22.19
$ rollup --config
(!) You have passed an unrecognized option
Unknown output options: experimentalMinChunkSize. Allowed options: amd, assetFileNames, banner, chunkFileNames, compact, dir, dynamicImportFunction, entryFileNames, esModule, exports, extend, externalLiveBindings, file, footer, format, freeze, generatedCode, globals, hoistTransitiveImports, indent, inlineDynamicImports, interop, intro, manualChunks, minifyInternalExports, name, namespaceToStringTag, noConflict, outro, paths, plugins, preferConst, preserveModules, preserveModulesRoot, sanitizeFileName, sourcemap, sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, sourcemapPathTransform, strict, systemNullSetters, validate

 → dist...
[!] (plugin Typescript) TypeError: nodes is not iterable
TypeError: nodes is not iterable
    at visitNodes (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:27715:26)
    at forEachChildInTypeAliasDeclaration (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:28408:98)
    at Object.forEachChild (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:27801:37)
    at fixupParentReferences (ember-cli/ember-page-title/node_modules/ts-clone-node/src/clone-node/util/set-parents.ts:8:13)
    at setParents (ember-cli/ember-page-title/node_modules/ts-clone-node/src/clone-node/util/set-parents.ts:31:2)
    at executePreserveNode (ember-cli/ember-page-title/node_modules/ts-clone-node/src/clone-node/clone-node.ts:333:2)
    at Module.preserveNode (ember-cli/ember-page-title/node_modules/ts-clone-node/src/clone-node/clone-node.ts:265:2)
    at preserveMeta (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/transformer/declaration-bundler/util/clone-node-with-meta.ts:17:9)
    at visitTypeAliasDeclaration (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/transformer/declaration-bundler/transformers/ensure-no-export-modifier-transformer/visitor/visit-type-alias-declaration.ts:9:9)
    at visitNode (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/transformer/declaration-bundler/transformers/ensure-no-export-modifier-transformer/visitor/visit-node.ts:27:10)
    at Object.continuation (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/transformer/declaration-bundler/transformers/ensure-no-export-modifier-transformer/ensure-no-export-modifier-transformer.ts:32:4)
    at ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/transformer/declaration-bundler/transformers/ensure-no-export-modifier-transformer/ensure-no-export-modifier-transformer.ts:39:68
    at visitArrayWorker (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:85983:51)
    at visitNodes2 (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:85954:21)
    at visitLexicalEnvironment (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:86010:18)
    at visitEachChildOfSourceFile (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:87199:13)
    at Object.visitEachChild (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:86171:35)
    at ensureNoExportModifierTransformer (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/transformer/declaration-bundler/transformers/ensure-no-export-modifier-transformer/ensure-no-export-modifier-transformer.ts:39:14)
    at applyTransformers (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/transformer/declaration-bundler/util/apply-transformers.ts:12:31)
    at ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/transformer/declaration-bundler/transformers/source-file-bundler/source-file-bundler.ts:119:32
    at transformation (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:109610:16)
    at transformRoot (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:109633:73)
    at transformNodes (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:109618:72)
    at emitDeclarationFileOrBundle (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:110256:36)
    at emitSourceFileOrBundle (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:110143:7)
    at forEachEmittedFile (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:109886:24)
    at emitFiles (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:110114:5)
    at emitWorker (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:117550:26)
    at ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:117535:53
    at runWithCancellationToken (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:117624:16)
    at Object.emit (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:117535:22)
    at emitNextAffectedFile (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:121249:36)
    at Object.emit (ember-cli/ember-page-title/node_modules/typescript/lib/typescript.js:121370:39)
    at runEmit (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/compiler-host/compiler-host.ts:111:6)
    at CompilerHost.emit (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/compiler-host/compiler-host.ts:124:3)
    at bundleDeclarationsForChunk (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/emit/declaration/bundle-declarations-for-chunk.ts:14:34)
    at emitDeclarations (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/service/emit/declaration/emit-declarations.ts:174:24)
    at Object.generateBundle (ember-cli/ember-page-title/node_modules/rollup-plugin-ts/src/plugin/typescript-plugin.ts:573:5)
    at ember-cli/ember-page-title/node_modules/rollup/dist/shared/rollup.js:22879:40

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

- package.json: add `--bundleConfigAsCjs` to `rollup`
- rollup.config.js: rename to rollup.config.mjs (as instructed from warning message)

Renamed rollup.config.js to rollup.config.mjs
- Updated rollup package to latest version
- Added `--bundle
@leepfrog
Copy link
Author

Ok, I think this is going to work now? 🤞

@knownasilya
Copy link
Contributor

@leepfrog running..

@leepfrog
Copy link
Author

leepfrog commented Jul 23, 2023

Ah, tests are failing because the test-app is older ember.

either can:

  • update test app to be newer (currently 3.28lts — basically dropping older ember support)
  • revert the change of the import path for getOwner (incurring future technical debt due to deprecation) and continue to use older import location

lemme know which is preferred and I can make the changes!

@knownasilya
Copy link
Contributor

Lets update the test app

@leepfrog
Copy link
Author

I got stuck on a different issue. I'm getting an error when the PageTitleService attempts to inject the Router Service (in its constructor):

Error: Assertion Failed: Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.

I started a thread on discord #help to see if I can get a hand on this.

… call

- test-app/config/ember-try: remove support for ember 3 & ember 4 lts versions
- test-app/package.json: update ember-source and ember-resolver versions
@leepfrog
Copy link
Author

Removed support for ember-3/ember-4 in the test-app and fixed a bug in the PageTitleService.

All of the tests are now running locally for me, so.. maybe this time it'll work? :)

- Fix ember-source version
- Change `Owner` import to type import
@leepfrog
Copy link
Author

There's a build error when using CI=true -- going to look into that and hopefully that'll be the last thing!

@knownasilya
Copy link
Contributor

Running test, lets see what happens

@leepfrog
Copy link
Author

leepfrog commented Jul 27, 2023

There were enough small options / configuration changes that it made sense to just regenerate the test-app from the new blueprint and move over the tests. So.. did that.

I also locally spun up into an ubuntu docker image and ran with the same CI=true yarn test:ember -- this works now!

- test-app/tests: refactor to use strictEqual instead of equal
- test-app/package.json: remove unused dependencies
@leepfrog
Copy link
Author

I didn't realize the CI was also running on my local fork 😅 -- but I was able to use it to get all of the steps green! Should be good to re-run now.

@knownasilya knownasilya merged commit 48c4daa into ember-cli:typescript Jul 27, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants