Skip to content
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

Chore mitosis update #2349

Merged
merged 9 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 1 addition & 6 deletions .github/workflows/02-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ jobs:
- name: 🚋 Get working directory
id: workingDirectory
shell: bash
run: |
if [[ ${{ matrix.framework }} == "vue" ]]; then
echo "dir=vue/vue3" >> $GITHUB_OUTPUT
else
echo "dir=${{ matrix.framework }}" >> $GITHUB_OUTPUT
fi
run: echo "dir=${{ matrix.framework }}" >> $GITHUB_OUTPUT

- name: 👩‍🔬 Test with Playwright 🎭
working-directory: ./output/${{ steps.workingDirectory.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ designers, and content authors build, maintain, and scale best of class digital
| [components](https://github.com/db-ui/mono/tree/main/packages/components) | CSS/SCSS styles for components | [![@db-ui/components on Npmjs](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.github.com%2Frepos%2Fdb-ui%2Fmono%2Freleases%2Flatest&query=%24.tag_name&label=npm&color=ed1c24 "npm version")](https://npmjs.com/package/@db-ui/components "DB UI – on NPM") |
| [ngx-components](https://github.com/db-ui/mono/tree/main/output/angular) | Native Angular components | [![@db-ui/ngx-components on Npmjs](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.github.com%2Frepos%2Fdb-ui%2Fmono%2Freleases%2Flatest&query=%24.tag_name&label=npm&color=ed1c24 "npm version")](https://npmjs.com/package/@db-ui/ngx-components "DB UI – on NPM") |
| [react-components](https://github.com/db-ui/mono/tree/main/output/react) | Native React components | [![@db-ui/react-components on Npmjs](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.github.com%2Frepos%2Fdb-ui%2Fmono%2Freleases%2Flatest&query=%24.tag_name&label=npm&color=ed1c24 "npm version")](https://npmjs.com/package/@db-ui/react-components "DB UI – on NPM") |
| [v-components](https://github.com/db-ui/mono/tree/main/output/vue/vue3) | Native Vue components | [![@db-ui/v-components on Npmjs](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.github.com%2Frepos%2Fdb-ui%2Fmono%2Freleases%2Flatest&query=%24.tag_name&label=npm&color=ed1c24 "npm version")](https://npmjs.com/package/@db-ui/v-components "DB UI – on NPM") |
| [v-components](https://github.com/db-ui/mono/tree/main/output/vue) | Native Vue 3 components | [![@db-ui/v-components on Npmjs](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.github.com%2Frepos%2Fdb-ui%2Fmono%2Freleases%2Flatest&query=%24.tag_name&label=npm&color=ed1c24 "npm version")](https://npmjs.com/package/@db-ui/v-components "DB UI – on NPM") |

## How to use

Expand Down
14 changes: 14 additions & 0 deletions docs/migration/alpha-beta.md
nmerget marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,17 @@
| 🔄 changed `db-card` elevation | We replaced the box-shadow elevation with bg-level | 1. `props.elevation` ➡ `props.elevationLevel` (1,2,3) <br/>2. `props.variant` ➡ `props.behaviour` <br/>3. Removed card-image |
| 🆕 valid/invalid message form-components | We add additional messages for `required` form-components like `DBInput` etc. | Use `validMessage="XXX"` and `invalidMessage="XXX"` to display the required information for form-components. Otherwise you will see a default message with a `TODO: ...` |
| 🔄 changed `db-link` variant | We renamed the variants for the link | `primary` ➡ `brand` |

### React

`slot` prefix was removed for all components containing another child element, for example:

```tsx
<DBHeader slotBrand={...
```

becomes

```tsx
<DBHeader brand={...
```
6 changes: 3 additions & 3 deletions e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ services:
- "./../showcases:/e2e/showcases"
- "./../output/react/playwright:/e2e/output/react/playwright"
- "./../output/react/src:/e2e/output/react/src"
- "./../output/vue/vue3/src:/e2e/output/vue/vue3/src"
- "./../output/vue/src:/e2e/output/vue/src"
- type: bind
source: ./package.json
target: /e2e/package.json
- type: bind
source: ./../output/react/playwright.config.ts
target: /e2e/output/react/playwright.config.ts
- type: bind
source: ./../output/vue/vue3/playwright.config.ts
target: /e2e/output/vue/vue3/playwright.config.ts
source: ./../output/vue/playwright.config.ts
target: /e2e/output/vue/playwright.config.ts
3 changes: 1 addition & 2 deletions e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"workspaces": [
"showcases/*",
"packages/*",
"output/*",
"output/vue/vue3"
"output/*"
],
"scripts": {
"regenerate": "npm-run-all -p regenerate:*",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
130 changes: 11 additions & 119 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"workspaces": [
"packages/*",
"output/*",
"output/vue/vue3",
"showcases/*",
"docs",
"scripts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ to: "<%= showcases ? `../../showcases/vue-showcase/src/components/${name}/${h.ch
<script setup lang="ts">
import DefaultComponent from "../DefaultComponent.vue";
import defaultComponentVariants from "../../../../shared/<%= name %>.json";
import { DB<%= h.changeCase.pascal(name) %> } from "../../../../../output/vue/vue3/src";
import { DB<%= h.changeCase.pascal(name) %> } from "../../../../../output/vue/src";
</script>

<template>
Expand Down
4 changes: 2 additions & 2 deletions packages/components/mitosis-vue.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = {
files: 'src/**',
targets: ['vue3'],
targets: ['vue'],
dest: '../../output/tmp',
options: {
vue3: {
vue: {
typescript: true
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/components/mitosis.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
files: 'src/**',
targets: ['angular', 'vue3', 'webcomponent', 'react'],
targets: ['angular', 'vue', 'webcomponent', 'react'],
dest: '../../output',
options: {
react: {
Expand All @@ -10,7 +10,7 @@ module.exports = {
typescript: true,
standalone: true
},
vue3: {
vue: {
typescript: true
},
webcomponent: {
Expand Down
6 changes: 3 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build:mitosis": "mitosis build",
"compile:angular": "mitosis build -c mitosis-angular.config.js && node -e \"require('./scripts/post-build/angular.js')(true)\" && npm run build-components:directives && cpr ../../output/tmp/angular/src ../../output/angular/src -o",
"compile:react": "mitosis build -c mitosis-react.config.js && node -e \"require('./scripts/post-build/react.js')(true)\" && cpr ../../output/tmp/react/src ../../output/react/src -o",
"compile:vue": "mitosis build -c mitosis-vue.config.js && node -e \"require('./scripts/post-build/vue.js')(true)\" && cpr ../../output/tmp/vue/vue3/src ../../output/vue/vue3/src -o",
"compile:vue": "mitosis build -c mitosis-vue.config.js && node -e \"require('./scripts/post-build/vue.js')(true)\" && cpr ../../output/tmp/vue/src ../../output/vue/src -o",
"copy-assets": "cpr ../foundations/assets build/assets -o",
"copy-output": "npm-run-all copy:*",
"copy:outputs": "cpr build ../../build-outputs/components/build -o",
Expand All @@ -48,8 +48,8 @@
},
"devDependencies": {
"@builder.io/eslint-plugin-mitosis": "^0.0.15",
"@builder.io/mitosis": "^0.0.147",
"@builder.io/mitosis-cli": "^0.0.100",
"@builder.io/mitosis": "^0.1.7",
"@builder.io/mitosis-cli": "^0.1.7",
"@react-docgen/cli": "^2.0.3",
"cpr": "3.0.1",
"cssnano": "^6.1.0",
Expand Down
16 changes: 3 additions & 13 deletions packages/components/scripts/post-build/copy-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,26 @@ module.exports = () => {
for (const framework of Frameworks) {
// TODO: Add other frameworks after Playwright supports them in component tests
if (framework === 'react' || framework === 'vue') {
const resolvedFramework =
framework === 'vue' ? `vue/vue3` : framework;
if (
Fse.pathExistsSync(
`./src/components/${name}/${name}.spec.tsx`
)
) {
Fse.copySync(
`./src/components/${name}/${name}.spec.tsx`,
`../../output/${resolvedFramework}/src/components/${name}/${name}.spec.tsx`
`../../output/${framework}/src/components/${name}/${name}.spec.tsx`
);
}
Fse.copySync(
`./test/playwright/boilerplate`,
`../../output/${resolvedFramework}/playwright`,
`../../output/${framework}/playwright`,
{ overwrite: true }
);
Fse.copySync(
`./test/playwright/config.ts`,
`../../output/${resolvedFramework}/playwright.config.ts`,
`../../output/${framework}/playwright.config.ts`,
{ overwrite: true }
);

if (framework === 'vue') {
Replace({
files: `../../output/${resolvedFramework}/playwright.config.ts`,
from: './../../__snapshots__',
to: './../../../__snapshots__'
});
}
}
}
}
Expand Down
Loading
Loading