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

Add smoke-tests for types, build, etc #9633

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Jan 9, 2025

Description

Supersedes: #9631
Resolves: #9630

ember-data / warp-drive has enough going on it to warrant testing if new projects in various scenarios will work:

  • linting
  • type checking
  • building
  • a basic test

Unblocks:

Notes for the release

fix: tsconfig.json#compilerOptions#types can now use the package.json#exports paths, example:

"compilerOptions": {
  "types": [
      "ember-source/types",
      "ember-data/unstable-preview-types",
      "@ember-data/store/unstable-preview-types",
      "@ember-data/adapter/unstable-preview-types",
      "@ember-data/graph/unstable-preview-types",
      "@ember-data/json-api/unstable-preview-types",
      "@ember-data/legacy-compat/unstable-preview-types",
      "@ember-data/request/unstable-preview-types",
      "@ember-data/request-utils/unstable-preview-types",
      "@ember-data/model/unstable-preview-types",
      "@ember-data/serializer/unstable-preview-types",
      "@ember-data/tracking/unstable-preview-types",
      "@warp-drive/core-types/unstable-preview-types"
  ]
}

Notes for review

NPM is not as understanding when it comes to tarballs:

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: @ember-data/[email protected]
npm error Found: @ember-data/[email protected]
npm error node_modules/@ember-data/store
npm error   dev @ember-data/store@"file:./ember-data-store-5.4.0-alpha.126.tgz" from the root project
npm error   peer @ember-data/store@"*" from @ember-data/[email protected]
npm error   node_modules/@ember-data/adapter
npm error     dev @ember-data/adapter@"file:./ember-data-adapter-5.4.0-alpha.126.tgz" from the root project
npm error     @ember-data/adapter@"*" from [email protected]
npm error     node_modules/ember-data
npm error       dev ember-data@"file:./ember-data-5.4.0-alpha.126.tgz" from the root project
npm error   7 more (@ember-data/debug, @ember-data/graph, ...)
npm error
npm error Could not resolve dependency:
npm error peer @ember-data/store@"^4.12.0 || ^5.0.0" from @ember-data/[email protected]
npm error node_modules/@ember-data/rest
npm error   dev @ember-data/rest@"file:./ember-data-rest-5.4.0-alpha.126.tgz" from the root project
npm error
npm error Conflicting peer dependency: @ember-data/[email protected]
npm error node_modules/@ember-data/store
npm error   peer @ember-data/store@"^4.12.0 || ^5.0.0" from @ember-data/[email protected]
npm error   node_modules/@ember-data/rest
npm error     dev @ember-data/rest@"file:./ember-data-rest-5.4.0-alpha.126.tgz" from the root project

the install-time peer checking here isn't as important as the post-install peer checking -- we don't want npm using the versions from package.json exactly, but the versions installed the specifiers in the package.json -- kinda surprised they have this bug, tbh

if (!reuseTars) {
await deletePriorBuildArtifacts();
await deleteTars();
await $`pnpm prepare`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@runspired somethingy goofy is happening with the types.

I probably did something weird, but I'm consistently getting stuff like:

/// <reference path="./data-adapter.d.ts" />
/// <reference path="./_app_/data-adapter.d.ts" />
declare module '@ember-data/debug' {
  /// <reference path="./data-adapter.d.ts" />
  /// <reference path="./_app_/data-adapter.d.ts" />
  module '@ember-data/debug' {
    /// <reference path="./data-adapter.d.ts" />
    /// <reference path="./_app_/data-adapter.d.ts" />
    module '@ember-data/debug' {
      /// <reference path="./data-adapter.d.ts" />
      /// <reference path="./_app_/data-adapter.d.ts" />
      module '@ember-data/debug' {
        /// <reference path="./data-adapter.d.ts" />
        /// <reference path="./_app_/data-adapter.d.ts" />
        module '@ember-data/debug' {
          /// <reference path="./data-adapter.d.ts" />
          /// <reference path="./_app_/data-adapter.d.ts" />
          module '@ember-data/debug' {
            /// <reference path="./data-adapter.d.ts" />
            /// <reference path="./_app_/data-adapter.d.ts" />
            module '@ember-data/debug' {
              /// <reference path="./data-adapter.d.ts" />
              /// <reference path="./_app_/data-adapter.d.ts" />
              module '@ember-data/debug' {
                /// <reference path="./data-adapter.d.ts" />
                /// <reference path="./_app_/data-adapter.d.ts" />
                module '@ember-data/debug' {
                  /// <reference path="./data-adapter.d.ts" />
                  /// <reference path="./_app_/data-adapter.d.ts" />
                  module '@ember-data/debug' {
                    export { default } from '@ember-data/debug/data-adapter';
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
//# sourceMappingURL=index.d.ts.map

how is the build supposed to happen?
I'm doing:

  • pnpm install (in the ci workflow)
  • pnpm prepare (here)
  • generateTarballs (in buildAll)

which doesn't quite seem like the right incantations.
CI does this, which starts with a cleaner slate than I am:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh! this is caused by bad output in turbo cache

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the transformation of this output needs to either run through turbo, after prior commands have finished (so that caching has the correct non-modified output), or we need to make the declare-module wrapping idempotent (which is the direction i'm leaning)

@NullVoxPopuli NullVoxPopuli changed the base branch from main to fix-publish January 11, 2025 22:51
@NullVoxPopuli NullVoxPopuli force-pushed the smoke-test-with-non-pnpm branch from 9cc348f to 7b0eda0 Compare January 11, 2025 23:03
Base automatically changed from fix-publish to main January 14, 2025 20:12
@NullVoxPopuli NullVoxPopuli force-pushed the smoke-test-with-non-pnpm branch 2 times, most recently from fb5e4d5 to d1de3f5 Compare January 14, 2025 22:22
.npmrc Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without these changes not all node_modules directories have the right bins in node_modules -- for example, @warp-drive/ember did not have glint, and would fail to build its types

@NullVoxPopuli NullVoxPopuli force-pushed the smoke-test-with-non-pnpm branch from bf68cd4 to e134254 Compare January 15, 2025 21:35
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review January 15, 2025 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: needs triage
1 participant