Skip to content

Commit 6e548dd

Browse files
authored
Turn Web Awesome into a monorepo (#1002)
* finishing touches * finishing touches * use bash * remove pro stuff * update github actions * fix head.njk
1 parent 212ca5b commit 6e548dd

File tree

1,737 files changed

+765
-9184
lines changed

Some content is hidden

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

1,737 files changed

+765
-9184
lines changed

.github/workflows/client_tests.js.yml renamed to .github/workflows/client_tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
pull_request:
1010
branches: [next]
1111

12+
1213
jobs:
1314
client_test:
1415
runs-on: ubuntu-latest
@@ -30,10 +31,17 @@ jobs:
3031
run: npm ci
3132
- name: Lint
3233
run: npm run prettier
34+
working-directory: ./packages/webawesome
35+
3336
- name: Build
3437
run: npm run build
38+
working-directory: ./packages/webawesome
39+
3540
- name: Install Playwright
3641
run: npx playwright install --with-deps
42+
working-directory: ./packages/webawesome
43+
3744
- name: Run CSR tests
3845
# FAIL_FAST to fail on first failing test.
3946
run: FAIL_FAST="true" CSR_ONLY="true" npm run test
47+
working-directory: ./packages/webawesome

.github/workflows/ssr_tests.js.yml renamed to .github/workflows/ssr_tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ jobs:
2626
cache: 'npm'
2727
- name: Install dependencies
2828
run: npm ci
29-
# Just lint here too. Save some GH Action minutes and not need to use "depends_on" or anything.
30-
- name: Lint
31-
run: npm run prettier
3229

3330
- name: Build
3431
run: npm run build
32+
working-directory: ./packages/webawesome
3533

3634
- name: Install Playwright
3735
run: npx playwright install --with-deps
36+
working-directory: ./packages/webawesome
3837

3938
- name: Run SSR tests
4039
# FAIL_FAST to fail on first failing test.
4140
run: FAIL_FAST="true" SSR_ONLY="true" npm run test
41+
working-directory: ./packages/webawesome
4242

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ _site
44
dist/
55
dist-cdn/
66
node_modules
7-
src/react
7+
packages/**/*/src/react
88
cdn/
9+
yarn.lock
10+
_bundle_
11+
/packages/webawesome-pro
12+
/packages/webawesome-app

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,30 @@ If that's not what you're trying to do, the [documentation website](https://weba
3131

3232
Components are built with [LitElement](https://lit-element.polymer-project.org/), a custom elements base class that provides an intuitive API and reactive data binding. The build is a custom script with bundling powered by [esbuild](https://esbuild.github.io/).
3333

34+
### Understanding the Web Awesome monorepo
35+
36+
Web Awesome uses [NPM workspaces](https://docs.npmjs.com/cli/v11/using-npm/workspaces) for its monorepo structure and is fairly minimal in what it provides.
37+
38+
By using a NPM workspaces and a monorepo structure, we can get consistent builds, shared configurations, and reduced duplication across repositories which reduces regressions and forces consistency across `webawesome`, `webawesome-pro`, and `webawesome-app`.
39+
40+
Generally, if you plan to only work with the free version of `webawesome` it is easiest to go to `packages/webawesome` and run all commands from there.
41+
42+
### Where do NPM dependencies go?
43+
44+
Any dependencies intended to be used across all packages (IE: `prettier`, `eslint`) that are _NOT_ used at runtime should be in the root `devDependencies` of `package.json`.
45+
46+
```bash
47+
npm install -D -w prettier
48+
```
49+
50+
Any dependencies that will be used at runtime by a package should be part of the specific package's `"dependencies"` such as `lit`. This is required because if that dependency is not in the `packages/*/package.json`, it will not be installed when used via NPM.
51+
52+
Individual packages are also free to install devDependencies as needed as long as they are specific to that package only.
53+
54+
To do install a package specific to a package, change your working directory to that package's root
55+
56+
IE: `cd packages/webawesome && npm install <package-name>`
57+
3458
### Forking the Repo
3559

3660
Start by [forking the repo](https://github.com/shoelace-style/webawesome/fork) on GitHub, then clone it locally and install dependencies.
@@ -43,9 +67,10 @@ npm install
4367

4468
### Developing
4569

46-
Once you've cloned the repo, run the following command.
70+
Once you've cloned the repo, run the following command from the respective directory within `packages/*`
4771

4872
```bash
73+
cd packages/webawesome
4974
npm start
5075
```
5176

@@ -56,6 +81,7 @@ This will spin up the dev server. After the initial build, a browser will open a
5681
To generate a production build, run the following command.
5782

5883
```bash
84+
cd packages/webawesome
5985
npm run build
6086
```
6187

@@ -66,15 +92,24 @@ You can also run `npm run build:serve` to start an [`http-server`](https://www.n
6692
To scaffold a new component, run the following command, replacing `wa-tag-name` with the desired tag name.
6793

6894
```bash
95+
cd packages/webawesome
6996
npm run create wa-tag-name
7097
```
7198

7299
This will generate a source file, a stylesheet, and a docs page for you. When you start the dev server, you'll find the new component in the "Components" section of the sidebar.
73100

101+
### Adding additional packages
102+
103+
Right now the only additional packages are in private repositories.
104+
105+
To add additional packages from other repositories, run: `git clone <url> packages/<package-name>` to clone your repo into `packages/`.
106+
107+
Make sure to run `npm install` at the root of the monorepo after adding your package!
108+
74109
### Contributing
75110

76111
Web Awesome is an open source project and contributions are encouraged! If you're interesting in contributing, please review the [contribution guidelines](CONTRIBUTING.md) first.
77112

78113
## License
79114

80-
Web Awesome is available under the terms of the MIT license.
115+
Web Awesome is available under the terms of the MIT license.

docs/docs/components/page-samples/documentation.md

Lines changed: 0 additions & 237 deletions
This file was deleted.

0 commit comments

Comments
 (0)