Skip to content

feat: convert project to monorepo, setup changesets #127

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

Merged
merged 27 commits into from
Dec 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fa98a08
chore: add initial monorepo scripts
web-padawan Dec 18, 2021
fce75e6
chore: split fixtures to own packages
web-padawan Dec 18, 2021
1a88b15
chore: convert project to monorepo
web-padawan Dec 31, 2021
cc5a455
chore: format contributors fields
web-padawan Dec 31, 2021
52764c8
chore: setup chanegsets, enter pre-release
web-padawan Dec 31, 2021
26cbcdf
fix: use correct imports and HTML tags
web-padawan Dec 31, 2021
2373a1a
chore: try using full paths in imports
web-padawan Dec 31, 2021
d7fe4aa
chore: update tsconfig.json files
web-padawan Dec 31, 2021
2708f25
chore: remove web-component-analyzer
web-padawan Dec 31, 2021
8f9e916
chore: update repository and files fields
web-padawan Dec 31, 2021
3849b05
chore: format package.json with Prettier
web-padawan Dec 31, 2021
d4105a8
chore: cleanup root level package.json
web-padawan Dec 31, 2021
961b1ea
chore: update size-limit script config
web-padawan Dec 31, 2021
93970d7
chore: publish custom-elements.json files
web-padawan Dec 31, 2021
f6391eb
chore: move fixtures to single package
web-padawan Dec 31, 2021
15a135d
chore: add README.md for all packages
web-padawan Dec 31, 2021
69e8cc6
chore: fix Prettier scripts globs
web-padawan Dec 31, 2021
02ff591
docs: use new component package names
web-padawan Dec 31, 2021
ddca8f9
chore: add changesets release workflow
web-padawan Dec 31, 2021
e986d86
chore: update package.json description
web-padawan Dec 31, 2021
4f92cea
chore: only keep one CEM JSON file
web-padawan Dec 31, 2021
acfaf46
chore: set changesets access public
web-padawan Dec 31, 2021
93b59cf
chore: format changesets config
web-padawan Dec 31, 2021
0ab0f67
chore: remove unnecessary patch-package
web-padawan Dec 31, 2021
4fe59d9
fix: cleanup duplicate common utils
web-padawan Dec 31, 2021
4614003
refactor: align and sort imports
web-padawan Dec 31, 2021
b26407c
refactor: simplify getSlotContent usage
web-padawan Dec 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": ["@api-viewer-fixtures/lit"]
}
13 changes: 13 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"mode": "pre",
"tag": "pre",
"initialVersions": {
"@api-viewer/common": "1.0.0-pre.0",
"@api-viewer/demo": "1.0.0-pre.0",
"@api-viewer/docs": "1.0.0-pre.0",
"@api-viewer/tabs": "1.0.0-pre.0",
"api-viewer-element": "1.0.0-pre.0",
"@api-viewer-fixtures/lit": "0.0.0"
},
"changesets": []
}
9 changes: 9 additions & 0 deletions .changeset/rich-berries-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@api-viewer/common': patch
'@api-viewer/demo': patch
'@api-viewer/docs': patch
'@api-viewer/tabs': patch
'api-viewer-element': patch
---

Convert api-viewer-element to monorepo
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
},
{
"files": ["scripts/*.js"],
"rules": {
"import/no-extraneous-dependencies": "off",
"no-console": "off",
"no-restricted-syntax": "off"
}
}
]
}
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
# Prevents changesets action from creating a PR on forks
if: github.repository == 'open-wc/api-viewer-element'
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'yarn'

- name: Install Dependencies
run: yarn --frozen-lockfile

- name: Build packages
run: yarn build

- name: Analyze
run: yarn analyze

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
node_modules
/lib
/fixtures/*/lib
/packages/*/lib
/**/*.tsbuildinfo
/dist
/custom-elements.json
custom-elements.json
!/docs/assets/custom-elements.json
docs/_merged_data/
docs/_merged_assets/
docs/_merged_includes/
Expand Down
24 changes: 12 additions & 12 deletions docs/assets/custom-elements.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"modules": [
{
"kind": "javascript-module",
"path": "src/fixtures/expansion-panel.ts",
"path": "src/expansion-panel.ts",
"declarations": [
{
"kind": "class",
Expand Down Expand Up @@ -257,22 +257,22 @@
"name": "ExpansionPanel",
"declaration": {
"name": "ExpansionPanel",
"module": "src/fixtures/expansion-panel.ts"
"module": "src/expansion-panel.ts"
}
},
{
"kind": "custom-element-definition",
"name": "expansion-panel",
"declaration": {
"name": "ExpansionPanel",
"module": "src/fixtures/expansion-panel.ts"
"module": "src/expansion-panel.ts"
}
}
]
},
{
"kind": "javascript-module",
"path": "src/fixtures/fancy-accordion.ts",
"path": "src/fancy-accordion.ts",
"declarations": [
{
"kind": "class",
Expand Down Expand Up @@ -424,22 +424,22 @@
"name": "FancyAccordion",
"declaration": {
"name": "FancyAccordion",
"module": "src/fixtures/fancy-accordion.ts"
"module": "src/fancy-accordion.ts"
}
},
{
"kind": "custom-element-definition",
"name": "fancy-accordion",
"declaration": {
"name": "FancyAccordion",
"module": "src/fixtures/fancy-accordion.ts"
"module": "src/fancy-accordion.ts"
}
}
]
},
{
"kind": "javascript-module",
"path": "src/fixtures/intl-currency.ts",
"path": "src/intl-currency.ts",
"declarations": [
{
"kind": "class",
Expand Down Expand Up @@ -520,22 +520,22 @@
"name": "IntlCurrency",
"declaration": {
"name": "IntlCurrency",
"module": "src/fixtures/intl-currency.ts"
"module": "src/intl-currency.ts"
}
},
{
"kind": "custom-element-definition",
"name": "intl-currency",
"declaration": {
"name": "IntlCurrency",
"module": "src/fixtures/intl-currency.ts"
"module": "src/intl-currency.ts"
}
}
]
},
{
"kind": "javascript-module",
"path": "src/fixtures/progress-bar.ts",
"path": "src/progress-bar.ts",
"declarations": [
{
"kind": "class",
Expand Down Expand Up @@ -745,15 +745,15 @@
"name": "ProgressBar",
"declaration": {
"name": "ProgressBar",
"module": "src/fixtures/progress-bar.ts"
"module": "src/progress-bar.ts"
}
},
{
"kind": "custom-element-definition",
"name": "progress-bar",
"declaration": {
"name": "ProgressBar",
"module": "src/fixtures/progress-bar.ts"
"module": "src/progress-bar.ts"
}
}
]
Expand Down
24 changes: 15 additions & 9 deletions docs/docs/api/elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import 'api-viewer-element';
A custom element that only provides API docs (no live playground):

```js
import 'api-viewer-element/lib/api-docs.js';
import '@api-viewer/docs';
```

### `<api-demo>` element

A custom element that only provides live playground (no API docs):

```js
import 'api-viewer-element/lib/api-demo.js';
import '@api-viewer/demo';
```

Note: the default entrypoint shares most of the code with both `<api-docs>` and `<api-demo>`.
Expand All @@ -54,8 +54,8 @@ If you don't need [`<template>` support](../templates/) in the live demo, feel f
API documentation does not use templates.

```js
import { ApiViewerBase } from 'api-viewer-element/lib/api-viewer-base.js';
import { setTemplates } from 'api-viewer-element/lib/lib/utils.js';
import { ApiViewerBase } from 'api-viewer-element/lib/base.js';
import { setTemplates } from '@api-viewer/common/lib/templates.js';
import { css } from 'lit';

class CustomViewer extends ApiViewerBase {
Expand All @@ -71,7 +71,10 @@ class CustomViewer extends ApiViewerBase {
}

setTemplates(templates) {
setTemplates(this._id, templates || Array.from(this.querySelectorAll('template')));
setTemplates(
this._id,
templates || Array.from(this.querySelectorAll('template'))
);
}
}

Expand All @@ -83,7 +86,7 @@ customElements.define('custom-viewer', CustomViewer);
A class that you can use to create your own version of `<api-docs>`.

```js
import { ApiDocsBase } from 'api-viewer-element/lib/api-docs-base.js';
import { ApiDocsBase } from '@api-viewer/docs/lib/base.js';
import { css } from 'lit';

class CustomDocs extends ApiDocsBase {
Expand All @@ -102,8 +105,8 @@ customElements.define('custom-docs', CustomDocs);
A class that you can use to create your own version of `<api-demo>`.

```js
import { ApiDemoBase } from 'api-viewer-element/lib/api-demo-base.js';
import { setTemplates } from 'api-viewer-element/lib/lib/utils.js';
import { ApiDemoBase } from '@api-viewer/demo/lib/base.js';
import { setTemplates } from '@api-viewer/common/lib/templates.js';
import { css } from 'lit';

class CustomDemo extends ApiDemoBase {
Expand All @@ -119,7 +122,10 @@ class CustomDemo extends ApiDemoBase {
}

setTemplates(templates) {
setTemplates(this._id, templates || Array.from(this.querySelectorAll('template')));
setTemplates(
this._id,
templates || Array.from(this.querySelectorAll('template'))
);
}
}

Expand Down
10 changes: 5 additions & 5 deletions docs/docs/examples/api-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

```js script
import { html } from '@mdjs/mdjs-preview';
import '../../../lib/api-demo.js';
import '../../../lib/fixtures/expansion-panel.js';
import '../../../lib/fixtures/fancy-accordion.js';
import '../../../lib/fixtures/intl-currency.js';
import '../../../lib/fixtures/progress-bar.js';
import '../../../packages/api-demo/lib/api-demo.js';
import '../../../fixtures/lit/lib/expansion-panel.js';
import '../../../fixtures/lit/lib/fancy-accordion.js';
import '../../../fixtures/lit/lib/intl-currency.js';
import '../../../fixtures/lit/lib/progress-bar.js';
```

```html preview-story
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/examples/api-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

```js script
import { html } from '@mdjs/mdjs-preview';
import '../../../lib/api-docs.js';
import '../../../packages/api-docs/lib/api-docs.js';
```

```html preview-story
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/examples/api-viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

```js script
import { html } from '@mdjs/mdjs-preview';
import '../../../lib/api-viewer.js';
import '../../../lib/fixtures/expansion-panel.js';
import '../../../lib/fixtures/fancy-accordion.js';
import '../../../lib/fixtures/intl-currency.js';
import '../../../lib/fixtures/progress-bar.js';
import '../../../packages/api-viewer/lib/api-viewer.js';
import '../../../fixtures/lit/lib/expansion-panel.js';
import '../../../fixtures/lit/lib/fancy-accordion.js';
import '../../../fixtures/lit/lib/intl-currency.js';
import '../../../fixtures/lit/lib/progress-bar.js';
```

```html preview-story
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/examples/theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

```js script
import { html } from '@mdjs/mdjs-preview';
import '../../../lib/api-viewer.js';
import '../../../lib/fixtures/expansion-panel.js';
import '../../../lib/fixtures/fancy-accordion.js';
import '../../../lib/fixtures/intl-currency.js';
import '../../../lib/fixtures/progress-bar.js';
import '../../../packages/api-viewer/lib/api-viewer.js';
import '../../../fixtures/lit/lib/expansion-panel.js';
import '../../../fixtures/lit/lib/fancy-accordion.js';
import '../../../fixtures/lit/lib/intl-currency.js';
import '../../../fixtures/lit/lib/progress-bar.js';
```

```html preview-story
Expand Down
13 changes: 13 additions & 0 deletions fixtures/lit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@api-viewer-fixtures/lit",
"version": "0.0.0",
"private": true,
"scripts": {
"analyze": "cem analyze --litelement --globs 'src/*.ts'"
},
"dependencies": {
"lit": "^2.0.0",
"tslib": "^2.3.1"
},
"customElements": "custom-elements.json"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions fixtures/lit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Don't edit this file directly. It is generated by /scripts/update-package-configs.ts

{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "ESNext",
"outDir": "./lib",
"rootDir": "./src",
"composite": true
},
"references": [],
"include": [
"src"
],
"exclude": [
"lib"
]
}
Loading