Skip to content

Commit

Permalink
ci: consistent formatting across packages (#8534)
Browse files Browse the repository at this point in the history
## Summary

- Add linting npm scripts to additional packages.
- Run `prettier` before `markdownlint` in `lint:md` npm scripts, because
`prettier` was overriding some styling.
- Switch italics/bold style to asterisk instead of underscore, because
`prettier` and `conventional-changelog` both use astericks. The
formatting was getting out of sync in the changelog during next releases
(see link below for an example). This would result in unrelated diffs in
PRs.
- Lint code.


https://github.com/Esri/calcite-design-system/blob/c9aabd27c815a309a2756971e38c5903161bbb7b/packages/calcite-components-react/CHANGELOG.md?plain=1#L46-L55
  • Loading branch information
benelan authored Jan 2, 2024
1 parent c9aabd2 commit f8cc193
Show file tree
Hide file tree
Showing 127 changed files with 644 additions and 632 deletions.
4 changes: 2 additions & 2 deletions .markdownlintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"code-fence-style": { "style": "backtick" },
"heading-style": { "style": "atx" },
"no-duplicate-heading": { "siblings_only": true },
"emphasis-style": { "style": "underscore" },
"strong-style": { "style": "underscore" },
"emphasis-style": { "style": "asterisk" },
"strong-style": { "style": "asterisk" },
"ul-style": { "style": "dash" }
}
4 changes: 2 additions & 2 deletions documentation/monorepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Make the following changes and submit a PR:
1. In [`release-please-config.json`](https://github.com/Esri/calcite-design-system/blob/main/release-please-config.json) under the `packages` field, add the new package's path as well as any package-specific configurations. The only required field is the package's name, taken from the `name` field in its `package.json`.
1. If the new package needs to be linked to Calcite Component's version, add its name to the `LINKED_VERSIONS_TRACKING_PACKAGES` array in [`support/syncLinkedPackageVersions.ts`](https://github.com/Esri/calcite-design-system/blob/main/support/syncLinkedPackageVersions.ts).
1. Potentially rename the new package's NPM scripts so they match the pipeline names in `turbo.json` (build, test, clean, etc.). Note: having all of the NPM scripts that are specified in `turbo.json` is not required.
1. If present and when possible, the `test` NPM script should _not_ build first. Turbo will make sure the `build` script runs first and will cache the results.
1. If present and when possible, the `test` NPM script should *not* build first. Turbo will make sure the `build` script runs first and will cache the results.
1. Potentially rename directories for consistency with the other packages:

- `src/` - source code
Expand Down Expand Up @@ -147,7 +147,7 @@ The release CI consists of three GitHub Actions and three scripts.

`next` releases happen in the `deploy-next.yml` GitHub Action, which runs on pushes to `main`. The Action runs the `isNextDeployable.ts` script to determine whether any fixes, feats, or breaking changes were installed since the most recent [git tag](#git-tags) (aka release). If there are deployable changes, Lerna versions the relevant packages and generates the new changelog entries.

The `syncLinkedPackageVersions.ts` executes after Lerna versions the packages. The script makes sure CCR's (and potentially other packages in the future) semver version isn't greater or less than CC's version. CCR's version is bumped to CC's version if it is behind. If CCR's version is greater, `next` releases __for all packages__ will be blocked until CC's version catches up.
The `syncLinkedPackageVersions.ts` executes after Lerna versions the packages. The script makes sure CCR's (and potentially other packages in the future) semver version isn't greater or less than CC's version. CCR's version is bumped to CC's version if it is behind. If CCR's version is greater, `next` releases **for all packages** will be blocked until CC's version catches up.

After versioning, a commit is created, which is tagged for each released package. [Lerna publishes to NPM in topological order](https://github.com/lerna/lerna/tree/main/libs/commands/publish#lifecycle-scripts), which ensures local dependencies are published before the packages that depend on them. Lastly, the commit and tags are pushed to `main`.

Expand Down
4 changes: 2 additions & 2 deletions documentation/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The `latest` release process is mostly automated, but a few manual steps are req
2. Make sure all of the workflows for the [most recent commit on `main`](https://github.com/Esri/calcite-design-system/commits/main) are completed.
1. If time is short, you can cancel the `Build` workflow, which releases `next` and deploys storybook. We just want to make sure it doesn't deploy the `next` version after `latest` is released. If the most recent commit is a next release (titled `chore: release next`) then you can definitely cancel the `Build` workflow since it will be intentionally cancelled by the CI anyway.
3. Review the PR created by `release-please` (titled `chore: release main`) to make sure the changelog(s) and package versioning looks correct.
1. There should be a commit on the PR's branch named `docs: remove prerelease changelog entries` that occurred __after__ the most recent commit on `main`.
1. There should be a commit on the PR's branch named `docs: remove prerelease changelog entries` that occurred **after** the most recent commit on `main`.
4. Add the `skip visual snapshots` label. <!-- TODO: automate this in the release-please config -->
5. Make sure the rest of the PR checks are passing.
6. Approve and install the PR once all checks are passing. You will need to use Admin privilege to override the 6 approval rule [added above](#prevent-merging-pull-requests).
Expand Down Expand Up @@ -67,7 +67,7 @@ npm run publish:next
npm run util:push-tags
```

__IMPORTANT:__ If you need to change anything after running `version:next` (e.g., a changelog entry), make sure to amend the previous commit and recreate all of the tags using the new SHA (or `HEAD`) before continuing. For example:
**IMPORTANT:** If you need to change anything after running `version:next` (e.g., a changelog entry), make sure to amend the previous commit and recreate all of the tags using the new SHA (or `HEAD`) before continuing. For example:

```sh
# manual changelog entry updates were required after versioning...
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"scripts": {
"build": "turbo run build --log-order=stream",
"clean": "turbo run clean --log-order=stream && rimraf node_modules",
"lint": "turbo run lint --log-order=stream",
"lint": "concurrently \"npm:lint:*\" \"turbo run lint --log-order=stream\"",
"lint:md": "prettier --write \"**/*.md\" >/dev/null && markdownlint \"{,documentation}/*.md\" --fix --dot --ignore-path .gitignore",
"lint:yml": "prettier --write \".github/**/*.yml\" >/dev/null",
"lint:json": "prettier --write \"*.json\" >/dev/null",
"publish:next": "lerna publish from-package --dist-tag next --yes",
"publish:rc": "lerna publish from-package --dist-tag rc --yes",
"publish:latest": "lerna publish from-package --yes",
Expand Down
5 changes: 4 additions & 1 deletion packages/calcite-components-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"ng": "ng",
"prepublishOnly": "./support/prepublishBuildForCorrectVersion.sh",
"build": "ng build",
"clean": "rimraf dist node_modules .turbo .angular projects/component-library/dist"
"clean": "rimraf dist node_modules .turbo .angular projects/component-library/dist",
"lint": "concurrently npm:lint:*",
"lint:json": "prettier --write \"**/*.json\" >/dev/null",
"lint:md": "prettier --write \"**/*.md\" >/dev/null && markdownlint \"**/*.md\" --fix --dot --ignore-path .gitignore --ignore-path ../../.gitignore"
},
"dependencies": {
"@angular/animations": "17.0.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Miscellaneous Chores

- __@esri/calcite-components-angular:__ Synchronize undefined versions
- **@esri/calcite-components-angular:** Synchronize undefined versions

### Dependencies

Expand All @@ -63,11 +63,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### ⚠ BREAKING CHANGES

- __deps:__ We are treating the `@stencil/core@v4` bump as a precautionary measure, particularly due to its potential impact on projects using `calcite-components` and Stencil.
- **deps:** We are treating the `@stencil/core@v4` bump as a precautionary measure, particularly due to its potential impact on projects using `calcite-components` and Stencil.

### Build System

- __deps:__ Bump Stencil to v4 ([#8108](https://github.com/Esri/calcite-design-system/issues/8108)) ([bcbb79f](https://github.com/Esri/calcite-design-system/commit/bcbb79f8c925d505bb4ee5e6a54861c5f6bb88b9))
- **deps:** Bump Stencil to v4 ([#8108](https://github.com/Esri/calcite-design-system/issues/8108)) ([bcbb79f](https://github.com/Esri/calcite-design-system/commit/bcbb79f8c925d505bb4ee5e6a54861c5f6bb88b9))

### Dependencies

Expand All @@ -79,7 +79,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Bug Fixes

- __angular:__ Publish from the dist directory ([#8151](https://github.com/Esri/calcite-design-system/issues/8151)) ([d813f14](https://github.com/Esri/calcite-design-system/commit/d813f14c3c2fc7b765ccf27166f31201d91f2ac5))
- **angular:** Publish from the dist directory ([#8151](https://github.com/Esri/calcite-design-system/issues/8151)) ([d813f14](https://github.com/Esri/calcite-design-system/commit/d813f14c3c2fc7b765ccf27166f31201d91f2ac5))

### Dependencies

Expand Down
24 changes: 12 additions & 12 deletions packages/calcite-components-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Miscellaneous Chores

- __@esri/calcite-components-react:__ Synchronize undefined versions
- **@esri/calcite-components-react:** Synchronize undefined versions

### Dependencies

Expand All @@ -63,16 +63,16 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### ⚠ BREAKING CHANGES

- __react:__ Disabled `includeImportCustomElements`. Make sure to import components from `@esri/calcite-components` in addition to the React wrappers. For example, the first code snippet in [#7185](https://github.com/Esri/calcite-design-system/issues/7185) is now required, or else the custom elements will not be defined in the browser.
- __deps:__ We are treating the `@stencil/core@v4` bump as a precautionary measure, particularly due to its potential impact on projects using `calcite-components` and Stencil.
- **react:** Disabled `includeImportCustomElements`. Make sure to import components from `@esri/calcite-components` in addition to the React wrappers. For example, the first code snippet in [#7185](https://github.com/Esri/calcite-design-system/issues/7185) is now required, or else the custom elements will not be defined in the browser.
- **deps:** We are treating the `@stencil/core@v4` bump as a precautionary measure, particularly due to its potential impact on projects using `calcite-components` and Stencil.

### Bug Fixes

- __react:__ Disable includeImportCustomElements to resolve initial render issues ([#8248](https://github.com/Esri/calcite-design-system/issues/8248)) ([0948c1a](https://github.com/Esri/calcite-design-system/commit/0948c1a187d91606ea58f59b36c680285c6001a1))
- **react:** Disable includeImportCustomElements to resolve initial render issues ([#8248](https://github.com/Esri/calcite-design-system/issues/8248)) ([0948c1a](https://github.com/Esri/calcite-design-system/commit/0948c1a187d91606ea58f59b36c680285c6001a1))

### Build System

- __deps:__ Bump Stencil to v4 ([#8108](https://github.com/Esri/calcite-design-system/issues/8108)) ([bcbb79f](https://github.com/Esri/calcite-design-system/commit/bcbb79f8c925d505bb4ee5e6a54861c5f6bb88b9))
- **deps:** Bump Stencil to v4 ([#8108](https://github.com/Esri/calcite-design-system/issues/8108)) ([bcbb79f](https://github.com/Esri/calcite-design-system/commit/bcbb79f8c925d505bb4ee5e6a54861c5f6bb88b9))

### Dependencies

Expand All @@ -92,7 +92,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Miscellaneous Chores

- __@esri/calcite-components-react:__ Synchronize undefined versions
- **@esri/calcite-components-react:** Synchronize undefined versions

### Dependencies

Expand All @@ -104,7 +104,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Miscellaneous Chores

- __@esri/calcite-components-react:__ Synchronize undefined versions
- **@esri/calcite-components-react:** Synchronize undefined versions

### Dependencies

Expand All @@ -116,7 +116,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Miscellaneous Chores

- __@esri/calcite-components-react:__ Synchronize undefined versions
- **@esri/calcite-components-react:** Synchronize undefined versions

### Dependencies

Expand All @@ -128,7 +128,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Miscellaneous Chores

- __@esri/calcite-components-react:__ Synchronize undefined versions
- **@esri/calcite-components-react:** Synchronize undefined versions

### Dependencies

Expand Down Expand Up @@ -164,7 +164,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Miscellaneous Chores

- __@esri/calcite-components-react:__ Synchronize undefined versions
- **@esri/calcite-components-react:** Synchronize undefined versions

### Dependencies

Expand All @@ -188,7 +188,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Miscellaneous Chores

- __@esri/calcite-components-react:__ Synchronize undefined versions
- **@esri/calcite-components-react:** Synchronize undefined versions

### Dependencies

Expand All @@ -212,7 +212,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Miscellaneous Chores

- __@esri/calcite-components-react:__ Synchronize undefined versions
- **@esri/calcite-components-react:** Synchronize undefined versions

### Dependencies

Expand Down
2 changes: 1 addition & 1 deletion packages/calcite-components-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ useEffect(
(_) => {
sliderEl.current.addEventListener("calciteSliderUpdate", onUpdate);
},
[sliderEl]
[sliderEl],
);
```

Expand Down
3 changes: 3 additions & 0 deletions packages/calcite-components-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"prebuild": "npm run patch:jsx-import",
"clean": "rimraf dist node_modules .turbo",
"compile": "npm run tsc",
"lint": "concurrently npm:lint:*",
"lint:json": "prettier --write \"**/*.json\" >/dev/null",
"lint:md": "prettier --write \"**/*.md\" >/dev/null && markdownlint \"**/*.md\" --fix --dot --ignore-path ../../.gitignore",
"patch:jsx-import": "tsx support/patchJSXImport.ts",
"tsc": "tsc"
},
Expand Down
Loading

0 comments on commit f8cc193

Please sign in to comment.