Skip to content

Commit 2d8b7fd

Browse files
GarthDBkarstens
andauthored
Monorepo (#231)
* feat: add prettier config and test npm script * fix: remove obsolete npm scripts for prettier * fix: run prettier on packages/contrast-color/** * fix: remove package-lock.json * replaced yarn with pnpm everywhere * make nodeJS version flexible * fix: add husky pre-commit for git hook * refactor: move lint-staged to pnpm script * fix: added husky commitlint workflow * chore: added changeset config * fix: added pre-commit husky script * fix: replace npx with pnpm in node scripts * ci: added simple github workflow to running tests * refactor: moved scripts to moon tasks to make it easy to test in CI * chore: update moon config to use Node v20.11 * test: fix test input for contrast-colors * chore: update copyright * ci: added release automation --------- Co-authored-by: Frank Karstens <[email protected]>
1 parent 8b225cb commit 2d8b7fd

File tree

283 files changed

+19056
-45406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

283 files changed

+19056
-45406
lines changed

.changeset/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/proud-lies-bathe.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@adobe/leonardo-contrast-colors": patch
3+
---
4+
5+
* Migrated from Lerna to Moon for monorepo management.
6+
* Setting up Changeset for release management
7+
* Setting up automated releases on NPM
8+
* Migrate from Jest to Ava for better module support

.github/ISSUE_TEMPLATE/---bug--npm-packages--.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,32 @@ about: Report a problem with the @leonardo-contrast-colors module
44
title: ''
55
labels: bug
66
assignees: ''
7-
87
---
98

109
## Description
11-
<!-- Describe the problem you're having -->
1210

11+
<!-- Describe the problem you're having -->
1312

1413
## Steps to reproduce
15-
<!-- Include code examples or error messages if you have them -->
1614

15+
<!-- Include code examples or error messages if you have them -->
1716

1817
## Expected behavior
19-
<!-- Describe what you expected to happen -->
2018

19+
<!-- Describe what you expected to happen -->
2120

2221
## Screenshots
22+
2323
<!-- If applicable, add screenshots to help explain the problem -->
2424

2525
## Leonardo package and version
26-
<!--ie: **@leonardo-contrast-colors version:** 2.13.0 -->
2726

27+
<!--ie: **@leonardo-contrast-colors version:** 2.13.0 -->
2828

2929
## Environment
30-
- **Browser(s) and OS(s):** <!-- Chrome 75.0.3770.142 on Win 10 -->
30+
31+
- **Browser(s) and OS(s):** <!-- Chrome 75.0.3770.142 on Win 10 -->
3132

3233
## Additional context
34+
3335
<!-- Provide any additional information that might help us debug the issue -->

.github/ISSUE_TEMPLATE/--bug-web-tool.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@ about: Report a problem with the Leonardo web interface
44
title: ''
55
labels: UI, bug
66
assignees: ''
7-
87
---
98

109
## Description
11-
<!-- Describe the problem you're having -->
1210

11+
<!-- Describe the problem you're having -->
1312

1413
## Steps to reproduce
1514

1615
1. Go to http://leonardocolor.io/
1716
2. Click on ...
1817
3. Observe ...
1918

20-
2119
## Expected behavior
22-
<!-- Describe what you expected to happen -->
2320

21+
<!-- Describe what you expected to happen -->
2422

2523
## Screenshots
26-
<!-- If applicable, add screenshots to help explain the problem -->
2724

25+
<!-- If applicable, add screenshots to help explain the problem -->
2826

2927
## Environment
30-
- **Browser(s) and OS(s):** <!-- Chrome 75.0.3770.142 on Win 10 -->
28+
29+
- **Browser(s) and OS(s):** <!-- Chrome 75.0.3770.142 on Win 10 -->
3130

3231
## Additional context
32+
3333
<!-- Provide any additional information that might help us debug the issue -->
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
2-
name: "✨ Feature request [npm packages]"
2+
name: '✨ Feature request [npm packages]'
33
about: Suggest a new feature for the Leonardo npm modules
44
title: ''
55
labels: enhancement, npm packages
66
assignees: ''
7-
87
---
98

109
## Description
11-
<!-- Describe your suggested feature in detail -->
1210

11+
<!-- Describe your suggested feature in detail -->
1312

1413
## Why do you need this feature?
15-
<!-- Tell us what this solves or why this is important to your use case -->
1614

15+
<!-- Tell us what this solves or why this is important to your use case -->
1716

1817
## Leonardo package and version
19-
<!--ie: **@leonardo-contrast-colors version:** 2.13.0 -->
2018

19+
<!--ie: **@leonardo-contrast-colors version:** 2.13.0 -->
2120

2221
## Additional context
22+
2323
<!-- Add any other context, workarounds, or screenshots about your request -->
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
2-
name: "✨ Feature request [Web Tool]"
2+
name: '✨ Feature request [Web Tool]'
33
about: Suggest a new feature for the Leonardo web interface
44
title: ''
55
labels: UI, enhancement
66
assignees: ''
7-
87
---
98

109
## Description
11-
<!-- Describe your suggested feature in detail -->
1210

11+
<!-- Describe your suggested feature in detail -->
1312

1413
## Why do you need this feature?
15-
<!-- Tell us what this solves or why this is important to your use case -->
1614

15+
<!-- Tell us what this solves or why this is important to your use case -->
1716

1817
## Additional context
18+
1919
<!-- Add any other context, workarounds, or screenshots about your request -->

.github/PULL_REQUEST_TEMPLATE.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
<!-- Summarize your changes in the Title field -->
22

33
## Description
4+
45
<!--
56
Note: Before sending a pull request, make sure there's an issue for what you're changing
67
- Search for issues: https://github.com/adobe/leonardo/issues
78
- If there's no issue, file it: https://github.com/adobe/leonardo/issues/new/choose
89
-->
910
<!-- Describe what you changed and link to the relevant issue(s) -->
1011

11-
1212
## Motivation
13-
<!-- How do your changes support this project's goals? -->
1413

14+
<!-- How do your changes support this project's goals? -->
1515

1616
## Screenshots
17-
<!-- If applicable, add screenshots to show what you changed -->
1817

18+
<!-- If applicable, add screenshots to show what you changed -->
1919

2020
## To-do list
21+
2122
<!-- Put an "x" to indicate you've done each of the following -->
23+
2224
- [ ] I have read the [CONTRIBUTING document](/.github/CONTRIBUTING.md).
2325
<!-- If this pull request isn't ready, add any remaining tasks here -->
2426
- [ ] This pull request is ready to merge.

.github/workflows/ci.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
on: pull_request
3+
jobs:
4+
ci:
5+
name: CI
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
with:
10+
fetch-depth: 0
11+
- uses: moonrepo/setup-toolchain@v0
12+
with:
13+
auto-install: true
14+
- run: moon ci
15+
- uses: 'moonrepo/run-report-action@v1'
16+
if: success() || failure()
17+
with:
18+
access-token: ${{ secrets.MOON_GH_TOKEN }}

.github/workflows/release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
permissions:
4+
id-token: write
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- beta
11+
12+
concurrency: ${{ github.workflow }}-${{ github.ref }}
13+
14+
jobs:
15+
release:
16+
name: Release
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- uses: moonrepo/setup-toolchain@v0
23+
with:
24+
auto-install: true
25+
- run: moon run :build --query "projectSource~packages/*"
26+
- name: Publish
27+
id: changesets
28+
uses: changesets/action@v1
29+
with:
30+
commit: 'chore: release'
31+
# This expects you to have a script called release which does a build for your packages and calls changeset publish
32+
publish: pnpm release
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
35+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
dist/
22
node_modules/
33
npm-debug.log*
4-
yarn-debug.log*
5-
yarn-error.log*
64
.nyc_output/
75
.cache/
8-
.DS_Store
6+
.DS_Store
7+
# moon
8+
.moon/cache
9+
.moon/docker
10+
.parcel-cache
11+
12+
# husky
13+
.husky/_

.gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "packages/contrast-colors/SAPC-APCA"]
22
path = packages/contrast-colors/SAPC-APCA
33
url = [email protected]:Myndex/SAPC-APCA.git
4-
[submodule "packages/ui/src/c3"]
5-
path = packages/ui/src/c3
4+
[submodule "docs/ui/src/c3"]
5+
path = docs/ui/src/c3
66
url = [email protected]:StanfordHCI/c3.git

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
pnpm --no-install commitlint --edit ""

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
pnpm run pre-commit

.lintstagedrc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"docs/**/*.{js,jsx,ts,tsx,json,yml,yaml,md}": ["prettier --write"],
3+
"packages/**/*.{js,jsx,ts,tsx,json,yml,yaml,md}": ["prettier --write"]
4+
}

.moon/toolchain.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# https://moonrepo.dev/docs/config/toolchain
2+
$schema: 'https://moonrepo.dev/schemas/toolchain.json'
3+
4+
# Extend and inherit an external configuration file. Must be a valid HTTPS URL or file system path.
5+
# extends: './shared/toolchain.yml'
6+
7+
# Configures Node.js within the toolchain. moon manages its own version of Node.js
8+
# instead of relying on a version found on the host machine. This ensures deterministic
9+
# and reproducible builds across any machine.
10+
node:
11+
# The version to use. Must be a semantic version that includes major, minor, and patch.
12+
# We suggest using the latest active LTS version: https://nodejs.org/en/about/releases
13+
version: '20.11'
14+
15+
# The package manager to use when managing dependencies.
16+
# Accepts "npm" (default), "pnpm", or "yarn".
17+
packageManager: 'pnpm'
18+
19+
# The version of the package manager (above) to use.
20+
pnpm:
21+
version: '8.15.4'
22+
23+
# Add `node.version` as a constraint in the root `package.json` `engines`.
24+
addEnginesConstraint: true
25+
26+
# Dedupe dependencies after the lockfile has changed.
27+
dedupeOnLockfileChange: true
28+
29+
# Version format to use when syncing dependencies within the project's `package.json`.
30+
# dependencyVersionFormat: 'workspace'
31+
32+
# Infer and automatically create moon tasks from `package.json` scripts, per project.
33+
# BEWARE: Tasks and scripts are not 1:1 in functionality, so please refer to the documentation.
34+
inferTasksFromScripts: true
35+
36+
# Sync a project's `dependsOn` as dependencies within the project's `package.json`.
37+
syncProjectWorkspaceDependencies: true
38+
39+
# Sync `node.version` to a 3rd-party version manager's config file.
40+
# Accepts "nodenv" (.node-version), "nvm" (.nvmrc), or none.
41+
# syncVersionManagerConfig: 'nvm'

.moon/workspace.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# https://moonrepo.dev/docs/config/workspace
2+
$schema: "https://moonrepo.dev/schemas/workspace.json"
3+
4+
# Require a specific version of moon while running commands, otherwise fail.
5+
# versionConstraint: '>=1.0.0'
6+
7+
# Extend and inherit an external configuration file. Must be a valid HTTPS URL or file system path.
8+
# extends: './shared/workspace.yml'
9+
10+
# REQUIRED: A map of all projects found within the workspace, or a list or file system globs.
11+
# When using a map, each entry requires a unique project ID as the map key, and a file system
12+
# path to the project folder as the map value. File paths are relative from the workspace root,
13+
# and cannot reference projects located outside the workspace boundary.
14+
projects:
15+
- "docs/*"
16+
- "packages/*"
17+
18+
# Configures the version control system to utilize within the workspace. A VCS
19+
# is required for determining touched (added, modified, etc) files, calculating file hashes,
20+
# computing affected files, and much more.
21+
vcs:
22+
# The client to use when managing the repository.
23+
# Accepts "git". Defaults to "git".
24+
manager: "git"
25+
26+
# The default branch (master/main/trunk) in the repository for comparing the
27+
# local branch against. For git, this is is typically "master" or "main",
28+
# and must include the remote prefix (before /).
29+
defaultBranch: "monorepo"

.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
*.min.js
3+
*.map
4+
*.snap

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tabWidth": 2,
3+
"printWidth": 256,
4+
"singleQuote": true,
5+
"bracketSpacing": false,
6+
"trailingComma": "none"
7+
}

0 commit comments

Comments
 (0)