Skip to content

Commit

Permalink
ci: double build cc when publishing to workaround stencil types bug (#…
Browse files Browse the repository at this point in the history
…7227)

**Related Issue:** #

## Summary

Add a `prepublishOnly` npm script hook to calcite-components, which
builds and makes sure the types aren't broken. In addition to the
Stencil bug, Calcite Components also needs to be built after versioning
so that the preamble is correct. It has been [a version behind in `next`
releases](https://unpkg.com/browse/@esri/[email protected]/dist/calcite/calcite.esm.js).

ref:
https://github.com/lerna/lerna/tree/main/libs/commands/publish#lifecycle-scripts
  • Loading branch information
benelan authored Jun 27, 2023
1 parent ac2fcb7 commit edb6781
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/calcite-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"lint:scss": "stylelint --fix \"src/**/*.scss\" && prettier --write \"**/*.scss\" >/dev/null",
"lint:ts": "eslint --ext .ts,.tsx --fix . && prettier --write \"**/*.ts?(x)\" >/dev/null",
"posttest": "npm run test:prerender",
"prepublishOnly": "./support/stencilDoubleBuildTypesWorkaround.sh",
"release:docs": "npm run docs && storybook-to-ghpages --existing-output-dir=docs",
"start": "concurrently --kill-others --raw \"tsc --project ./tsconfig-demos.json --watch\" \"npm run build:watch-dev -- --serve\" \"ts-node --esm ./support/cleanOnProcessExit.ts --path ./src/demos/**/*.js \"",
"test": "stencil test --no-docs --no-build --spec --e2e",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh

# This script builds the stencil components and ensures
# the types are generated correctly as a workaround for
# https://github.com/ionic-team/stencil/issues/3239
#
# It runs in the prepublishOnly NPM script hook
# to prevent releasing with type bugs, and because
# it needs to execute after versioning so that the
# preamble in the dist source code is correct.
#
# Refs:
# https://github.com/lerna/lerna/blob/main/libs/commands/publish/README.md#lifecycle-scripts
# https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts
# https://github.com/Esri/calcite-components/pull/4303
npm run build
npm run util:test-types

0 comments on commit edb6781

Please sign in to comment.