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

APP-2280 Add @viamrobotics/prime-core package #282

Merged
merged 5 commits into from
Jul 26, 2023

Conversation

ethanlook
Copy link
Contributor

@ethanlook ethanlook commented Jul 25, 2023

This adds a new @viamrobotics/prime-core package to PRIME. The package is a SvelteKit component library.

Change log

  • npm create svelte@latest core
    • Use "component library" option
  • Add Badge component
    • Add Badge tests using Vitest
    • Use Badge component in dev environment (not published)
  • Update GitHub Workflow to run all checks, builds, and tests
  • Update GitHub Workflow to publish NPM package

Testing

  • Added Badge tests
  • Dry run npm publish - please check that the package is structured as expected

Review requests

Please try to pull down the branch and see if you can use the component in your own local work. Instructions are in the README.

@ethanlook ethanlook force-pushed the APP-2280-core branch 3 times, most recently from c14f644 to db4aff5 Compare July 26, 2023 13:40
@ethanlook ethanlook marked this pull request as ready for review July 26, 2023 13:45
Copy link
Member

@mcous mcous left a comment

Choose a reason for hiding this comment

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

Looks fantastic to me! Got some random package management nits and thoughts, but otherwise LGTM!

(Except for that publishConfig comment, which is needed or else the first publish will fail)

.github/workflows/ci.yml Outdated Show resolved Hide resolved
packages/core/.prettierrc.cjs Outdated Show resolved Hide resolved
with:
name: npm-core-dist
path: packages/core/dist
- name: Publish @viamrobotics/prime-core 🚀
Copy link
Member

Choose a reason for hiding this comment

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

For followup work, it may be worth switching from JS-DevTools/npm-publish to pnpm publish --recursive. This would let us publish everything in one go (if a package's version is not yet published) with some added niceties, like copying a root LICENSE file into all published packages

packages/core/.eslintignore Outdated Show resolved Hide resolved
packages/core/.eslintignore Outdated Show resolved Hide resolved
packages/core/package.json Outdated Show resolved Hide resolved
packages/core/package.json Show resolved Hide resolved
packages/core/package.json Show resolved Hide resolved
plugins: [sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}'],
globals: true,
Copy link
Member

Choose a reason for hiding this comment

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

Rather than setting globals: true, we can set up a vitest.setup.ts file to install @testing-library/jest-dom and configure the testing-library reset. I softly prefer it to globals mode which feels to me like a silly holdover from pre-module times

packages/core/src/lib/badge.spec.ts Outdated Show resolved Hide resolved
Copy link
Member

@DTCurrie DTCurrie left a comment

Choose a reason for hiding this comment

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

@ethanlook ethanlook force-pushed the APP-2280-core branch 4 times, most recently from abbbbc8 to 5da9b0f Compare July 26, 2023 20:29
@ethanlook ethanlook force-pushed the APP-2280-core branch 2 times, most recently from 510412e to 0ad645d Compare July 26, 2023 20:39
Copy link
Member

@mcous mcous left a comment

Choose a reason for hiding this comment

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

LGTM, might be a little (unharmful) weirdness remaining in the legacy ESLint config because of course there is it's ESLint

with:
node-version: 18
- name: Download npm artifacts
node-version: 16
Copy link
Member

Choose a reason for hiding this comment

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

Node 16 is EOL'ing in a few months; was this change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope - copy pasta

@@ -8,7 +10,10 @@ module.exports = {
parserOptions: {
tsConfigRootDir: __dirname,
Copy link
Member

Choose a reason for hiding this comment

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

Is this casing correct?

Suggested change
tsConfigRootDir: __dirname,
tsconfigRootDir: __dirname,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was not! Great catch.

Comment on lines +14 to +15
path.join(__dirname, './tsconfig.json'),
path.join(__dirname, './playground/tsconfig.json'),
Copy link
Member

Choose a reason for hiding this comment

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

These path.join's shouldn't be required; might be related to casing comment above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately the casing did not affect the need for the path.joins. Leaving as-is.

@@ -67,6 +63,7 @@
"@typescript-eslint/parser": "^5.59.0",
"@viamrobotics/eslint-config": "^0.0.4",
"@viamrobotics/prettier-config": "^0.0.1",
"@viamrobotics/prime-core": "workspace:../core",
Copy link
Member

Choose a reason for hiding this comment

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

Oh duh, hadn't considered that we'd added a workspace dependency. This makes our usage of pnpm publish -r required rather than "nice to have" (to replace workspace deps with the actual versions).

Glad you took care of that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just added this dependency so we could share the theme across packages, but we didn't do that when you first reviewed. It's much better now anyways!

@ethanlook ethanlook merged commit 5a9fe30 into viamrobotics:main Jul 26, 2023
5 checks passed
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.

4 participants