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

Added publish and version bump workflow for core package #1722

Merged

Conversation

RasmusKjeldgaard
Copy link
Collaborator

@RasmusKjeldgaard RasmusKjeldgaard commented Aug 27, 2021

Which issue does this PR close?

This PR closes #1630

What is the new behavior?

With the addition of a new core package in our monorepo, the publish workflow has been changed to accomodate patching/updating the version of both npm packages depending on what part of the library changed.

If there are changes to the core library, we first bump the version of that package. The designsystem package now depends on the core package, and therefore, we need to update the version of the core dependency in the designsystem package.
After this, the designsystem package itself is published, now referencing the newest core version.

If there are changes only to the designsystem folder, publishing happens as before.

Does this PR introduce a breaking change?

  • Yes
  • No

Are there any additional context?

Checklist:

The following tasks should be carried out in sequence in order to follow the process of contributing correctly.

Review

  • Do a self-review.
  • Request that the changes are code-reviewed
    [ ] Request that the changes are UX reviewed (only necessary if your PR introduces visual changes)

When the pull request has been approved it will be automatically merged to master via automerge.

In order to be able to use scss files such as global styles in a project
via '@kirbydesign/core/scss' the folder is copied to the root of
the package. This can be handled by the stencil compiler, so as a
trade off, it will be done every time the project is built.
Therefore, the folder has also been added to .gitignore.
@github-actions github-actions bot temporarily deployed to pr-1630-publish-core-to-npm August 27, 2021 12:42 Inactive
@github-actions github-actions bot temporarily deployed to pr-1630-publish-core-to-npm August 27, 2021 12:50 Inactive
@RasmusKjeldgaard RasmusKjeldgaard force-pushed the enhancement/1630-publish-core-to-npm branch from 21a83a8 to 1be99b5 Compare August 30, 2021 05:30
@github-actions github-actions bot temporarily deployed to pr-1630-publish-core-to-npm August 30, 2021 05:37 Inactive
@github-actions github-actions bot temporarily deployed to pr-1630-publish-core-to-npm September 3, 2021 09:45 Inactive
@github-actions github-actions bot temporarily deployed to pr-1630-publish-core-to-npm September 3, 2021 09:52 Inactive
@github-actions github-actions bot temporarily deployed to pr-1630-publish-core-to-npm September 3, 2021 09:53 Inactive
@RasmusKjeldgaard RasmusKjeldgaard marked this pull request as ready for review September 3, 2021 09:53
@github-actions github-actions bot temporarily deployed to pr-1630-publish-core-to-npm September 8, 2021 07:01 Inactive
@github-actions github-actions bot temporarily deployed to pr-1630-publish-core-to-npm September 20, 2021 12:44 Inactive
Copy link
Contributor

@MadsBuchmann MadsBuchmann left a comment

Choose a reason for hiding this comment

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

Looking pretty darn good - I got a few suggestions and questions.

But other than than good job :D

@RasmusKjeldgaard
Copy link
Collaborator Author

Explanation of 'Version bump core and update core dependency version in designsystem' step in publish workflow:

Due to a bug in NPM, we cannot use the npm version patch for nested packages like our core package, where package.json is located under libs/core/.
Therefore we first manually patch the version, and get the package version output from that command (without the 'v').
This variable we use to update the core package dependency in @kirbydesign/designsystem's package.json.
At last, we manually create a patch commit.

@github-actions github-actions bot temporarily deployed to pr-1630-publish-core-to-npm September 27, 2021 19:22 Inactive
@RasmusKjeldgaard RasmusKjeldgaard force-pushed the enhancement/1630-publish-core-to-npm branch from d383b7a to 22359e9 Compare September 28, 2021 05:35
@MadsBuchmann
Copy link
Contributor

Hacking Beavis

@RasmusKjeldgaard RasmusKjeldgaard merged commit af1bb00 into enhancement/web-components Sep 28, 2021
@RasmusKjeldgaard RasmusKjeldgaard deleted the enhancement/1630-publish-core-to-npm branch September 28, 2021 07:42
RasmusKjeldgaard added a commit that referenced this pull request Nov 1, 2021
* stencil scaffold

* mocks

* Update mock-components.ts

* First spike

* with gitignore

* deleted old badge

* Update mock-components.ts

* removed ref to old badge

* Update mock-components.ts

* trying to get test to work

* Update mock-components.ts

* Update mock-components.ts

* built new core

* Update mock-components.ts

* cleanup config

* Update mock-components.ts

* test experiments

* Update mock-components.ts

* exclude specs in tsconfig

* Update mock-components.ts

* link core

* Update mock-components.ts

* Update mock-components.ts

* Fixed e-2-e tests

* bump node version in ci

* node version on ci

* Update mock-components.ts

* try to fix ci build

* Update mock-components.ts

* removed autogenerated files

* Update mock-components.ts

* more ci

* updated prettier ignore

* fun with ts config WIP

* Update mock-components.ts

* removed tsconfig tightening (seperate issue)

* Update mock-components.ts

* Moved styling to core

* Update mock-components.ts

* Update mock-components.ts

* Update package-lock.json

* Update mock-components.ts

* try adding symlink

* Update mock-components.ts

* yet another attempt

* Update mock-components.ts

* readded stencil deps

* adjust imports

* brought styling up to date

* 🔥 Remove toolversions file

* ✅  Refactor test to support querying shadow root

* 🎨  Move core .gitignore to existing .gitignore

* 🔧 Clean up prettierignore paths

* 🚨 Add unmodified autogenerated proxies file

* 🔧  Remove compiler settings to make stencil build

* ⬆️  Update jest and puppeteer types

* 🚨 Make badge import in module specific

* ➕ Add babel dev dependency to fix cookbook compile

* 🔧 Add core lib tests to pre push hook

* 🔥 Remove editorconfig

* 🔥 Remove autogenerated e2e test

* 🔨 Use watchall on default core test script

* 🔧 Remove unused json docs output target

* 🔨 Add single run build script for pre-push hook

* ⏪ Revert unrelated changes to form field showcase

* 🔥 Move global styles to core

* 💄 Reference new util file for all cookbook examples

* 💡 Add TODO comment to old utils file

* ✅  Fix badge name in spec describe

* 🚚  Move typography spec and remove base scss folder

* 🚚  Add '.component' to filenames to indicate their scope

* 💄 Restore scss to make git recognize moved file

* 💄 Reintroduce badge web comp styling

* Generate Angular mocks for new web-components (#1677)

* 🔨  Handle barrel file type assertions during mock generation

* 🔨 Generate class decoration from asserted type

* 🔨 Simplify if-else with ternary operator

* 🔨 Generate custom-elements json doc

* 🔧 Rename generated custom elements file

* 🔨 Use custom elements json for mock generation

* ✨ Add MockBadgeComponent

* 🔨 Build core before transpiling tools so custom elements files are available

* 🔨 Generate mocks on changes to core lib

* 🎨  Simplify custom elements component traversing code

* 🔨 Change inputpaths to object and describe in comments

* 🔨 Rename proxies file

* ♻️ Split typesInFile functionality to own function

* ♻️ Reduce responsibility of getExportedTypes

* ♻️ Replace use of 'asserted' with 'alias'

* ♻️ Simplify use of aliasmap when traversing components

* 🔥 Remove mock files after component file rename

* ♻️ Make aliasmap internal to mapping func and return as tuple

* ♻️  Rename mapAndRemoveAliases -> separateTypesFromAliases

* ♻️ Pass aliasMap for providers to reduce optional chaining

* ♻️  Rename type and alias related functions

Co-authored-by: RasmusKjeldgaard <rkk@bankdata.dk>

* ✅  Import Ionic module through TestHelper in badge spec

* 💄 Reference core styles via core package

* ♻️ Move custom elements init to function for reuse

* 🚚 Move design token, color and string helpers to core

The rest of the helpers are still placed under the angular project.
These are to be moved when components using each helper is moved to core

* 💄 Reference core styles from angular component scss

* 💄 Reference core styles from cookbook

* 🎨  Create barrel files to support new helpers in core

* 📦  Update tests to use core helpers

* 📦  Update components to use core helpers

* ➕ Update package lock to match package.json

* 💄 Change cookbook utils imports to core module

* 💚  Run build step after extracting scss variables

* 💚 Transpile mock script after custom elm docs gen

When transpiling the mock script, the build command for stencil
components needs to be run first, so custom-elements.json is available.

The rest of the transpilation needs to happen before build, so we can
extract scss variables (.styles.ts files) and use them in components.

* 💚 Fix build by explicitly referencing core helpers

* ✨ Use helper for animations to keep .styles.ts internal

Before, we referenced the .styles.ts directly but now that file is moved
out of the source files of the angular project. Therefore we need to
provide the styles through the DesignTokenHelper.

* 📦  Use core helpers in new chart component

* 🔧Add combined test step for testing both packages

* 🔧 Remove unreachable code flag as it is deault

* Revert "🔧Add combined test step for testing both packages"

This reverts commit 01fe812.

* 🔧 Add combined test step for testing both packages

* ➖ Remove puppeteer dependency

* ♻️ Add themeColor prop to badge

A prop is now used directly within the badge component, instead
of being added via a directive, to support setting themeColor outside
of Angular projects.

Badge does not use the colorBrightness logic added via the directive
for anything and therefore this change should be safe.

* 🔨 Add '/' to generate-mock core path for consistency

* 💄 Reference core util scss file for layout recipe

* 🔥 Remove unused ColorHelper reference

* ➕ Use npm-run-all to build and serve in parallel

* 🎨 Add whitespace for readability

* Reference BadgeComponent directly in lib index.ts to mitigate UMD compilation bug (#1773)

* 🚧  Temporarily fix UMD compilation bug

By not asserting the type of KirbyBadge to be BadgeComponent, the
UMD-compilation bug in DRB is mitigated. For now, the badge component
is exported as KirbyBadge, but this will most likely cause problems
with mock generation, as consumers expect the component to be named
MockBadgeComponent, not MockKirbyBadge

* Revert "🚧  Temporarily fix UMD compilation bug"

This reverts commit 5010a30.

* 🐛  Move BadgeComponent export one level up

This change is needed to avoid an UMD compilation bug in consumer code.
Previously, when compiling the UMD bundle provided by Kirby, consumers
would experience a 'RangeError: Maximum call stack size exceeded'.

We are still investigating the actual cause of this, but this simple change
mitigates the issue.

* 🚨 Change spec import to match new export location

* 🎨 Add comment to explain change

* Added publish and version bump workflow for core package (#1722)

* 🔨  Copy core scss to angular package on publish

* 🔧 Copy scss folder to root of core package

In order to be able to use scss files such as global styles in a project
via '@kirbydesign/core/scss' the folder is copied to the root of
the package. This can be handled by the stencil compiler, so as a
trade off, it will be done every time the project is built.
Therefore, the folder has also been added to .gitignore.

* 🔧 Allow package to be published, and edit description

* 🚧  Add Github Actions workflow for core publish

* 🚧  Fix workflow error

* 🔥 Remove temporary test script

* 👷 Modify publish script to handle both packages

* 👷 Add back node setup and caching

* 👷 Change name of publish step

* ⬆️  Bump core version dependency in designsystem

* 🔨 Build core before creating local npm package

* ♻️ Refactor publish to match existing implementation

* 🎨 Improve naming and formatting of publish workflow

* ✨ Add zLayer designTokenHelper function

* ♻️ Update scss utils path to new core structure

* Add small badge component (#1812)

* ✨ Introduce 'size' input property

* ♻️ Redo 'badgeContent' getter

* 💄 Add styling for badge with size = sm

* ♻️ Move and rename getClassList & getClassMap

* ✅ Update test to include 'md' class

* 🏷️ Create 'BadgeSize' type

* ✅ Add tests for small badge

* ♻️ Move 'BadgeSize' to separate file

* 📝 Split up badge examples

* 📝 Add text to the badge documentation

* 💄 Add cards around badge examples

* 💄 Add examples 'h2' heading

* Revert "Merge branch 'master' into enhancement/498-small-badge"

This reverts commit e38106e, reversing
changes made to 4790158.

* Revert "Revert "Merge branch 'master' into enhancement/498-small-badge""

This reverts commit 414d0a4.

* ✅ Fill in missing 'should have md class' test

* 📝 Add css custom properties table

* ✏️ Change "inlines" to "inline"

* 📝 Remove 'but can be used to indicate status' part

* 📝 Have 'number' paragraph sound more like guidelines

* 📝 Add attachment example

* ✏️ Change kirby-badge-zindex to kirby-badge-z-index

* 📝 Make proper spacing in popout & add elevation

* 🐛 Fix elevation not displaying

* 📝 Add section regarding elevation on white badges

* 🔥 Remove accidentally added double import of utils

* 💄 Have grey background extend all the way to bottom

* 🐛 Fix wrong link & add icon

* 💄 Use 'kirby-external-icon' & move link to own line

* Add icon option to badge in segmented control item (#1774)

* ✨ Add slotted badge to segmented control

* Revert "✨ Add slotted badge to segmented control"

This reverts commit fb91c8e.

* ✨ Add badge with icon to segment control

* ♻️  Make use of exposed badge custom properties

* 📝  Document icon badge in segmented control

* 📝  Update badge description in documentation

* 🐛 Make sure both icon and content does not render

Icon now takes precedence over content if both are present,
instead of rendering both elements.

* 💄 Revert unintentional change to badge elevation

* ✅  Add badge tests to segmented control

* 📝  Move SegmentedControl badge doc to own section

* 💄 Added proper external link styling to gh link

* 💄 Make link standalone to fit link guidelines

* ✅  Change wording of test

* 💡 More concise comment for publish workflow

* 💡 Fix gitignore designsystem file comment

* 🔧 Clean up gitignore paths

* 🎨 Update prettier config and run prettier

* ⬆️  Bump version to match actual version on npm

* 💄 Set default z-index for badge to auto

* 💄 Use size token for badge size and border radius

* 🔥 Remove test file - was just for experimenting

* 🚚  Move print styles to core

* 🚚  Rename appInitializer and dont export function

* 🔧 Remove umdModuleID from ng-package

It is redundant, as ng-packagr will infer this on its own

* 💄 Create z-index variable for badge in avatar

* 💄 Use segmentBadge correctly so it evaluates

* 🚨 reference customElementsInitializer correctly

* 🎨 Add imports to same line

Co-authored-by: Mads Buchmann Frederiksen <mbf@prochimp.dk>

* 🎨 Make imports one line

Co-authored-by: Mads Buchmann Frederiksen <mbf@prochimp.dk>

* 🔥 Remove inlineSourceMap

* 🔧 Update package.json description

* ♻️ Rename libDir reference to angularLibDir

* 💚 Add back export of appInitialize

We use it as a provider in KirbyModule and therefore it needs
to be exported

* 🎨  Add whitespace to imports (tslint)

* 🔖 Bumping version to 0.0.8 (core)

Co-authored-by: Rasmus Kjeldgaard <rkk@bankdata.dk>
Co-authored-by: Mads Buchmann Frederiksen <mbf@prochimp.dk>
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.

2 participants