Skip to content

Commit

Permalink
Merge pull request #98 from webzard-io/runtime
Browse files Browse the repository at this point in the history
Bundle and Publish
  • Loading branch information
tanbowensg authored Oct 27, 2021
2 parents 81f967d + c9c354e commit cf3d11a
Show file tree
Hide file tree
Showing 17 changed files with 634 additions and 62 deletions.
6 changes: 2 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand All @@ -18,10 +19,7 @@
},
"plugins": ["react", "@typescript-eslint"],
"rules": {
"indent": ["error", 2, { "flatTernaryExpressions": true, "SwitchCase": 1 }],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "single"],
"semi": ["error", "always"],
"react/prop-types": "off",
"no-case-declarations": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ node_modules

# dist
lib
dist
tsconfig.tsbuildinfo
typings

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
"prepublish": "lerna run prepublish",
"test:ci": "jest -c config/jest.ci.config.js",
"lint": "eslint packages --ext .ts --ext .tsx",
"fix-lint": "eslint --fix packages --ext .ts --ext .tsx"
"fix-lint": "eslint --fix packages --ext .ts --ext .tsx",
"release": "lerna publish"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.25.1",
"husky": "^6.0.0",
"lerna": "^4.0.0",
Expand Down
30 changes: 17 additions & 13 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
{
"name": "@meta-ui/core",
"version": "0.1.0",
"description": "meta-ui core runtime",
"author": "Yanzhen Yu <yanzhen@smartx.com>",
"version": "0.2.1",
"description": "meta-ui core",
"author": "meta-ui developers",
"homepage": "https://github.com/webzard-io/meta-ui#readme",
"license": "MIT",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib",
"test": "__tests__"
"publishConfig": {
"access": "public"
},
"files": [
"lib"
],
"repository": {
"type": "git",
"url": "git+https://github.com/webzard-io/meta-ui.git"
},
"main": "dist/index.js",
"module": "dist/esm/index.js",
"unpkg": "dist/iife/index.js",
"types": "typings/index.d.ts",
"files": [
"dist",
"typings"
],
"scripts": {
"build": "tsc -b .",
"typings": "tsc -d",
"build": "tsup src/index.ts --format cjs,esm,iife --legacy-output",
"dev": "npm run build -- --watch",
"typings": "tsc --emitDeclarationOnly --declarationDir typings",
"test": "jest",
"lint": "eslint src --ext .ts",
"prepublish": "npm run build && npm run typings"
Expand All @@ -36,6 +39,7 @@
"eslint-config-prettier": "^8.3.0",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"tsup": "^5.5.0",
"typescript": "^4.3.5"
},
"dependencies": {
Expand Down
12 changes: 6 additions & 6 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "editor",
"version": "0.0.0",
"name": "@meta-ui/editor",
"version": "0.2.4",
"description": "meta-ui editor",
"author": "Bowen Tan <bowen.tan@smartx.com>",
"author": "meta-ui developers",
"homepage": "https://github.com/webzard-io/meta-ui#readme",
"license": "MIT",
"main": "src/main.tsx",
Expand All @@ -11,7 +11,7 @@
"test": "jest"
},
"publishConfig": {
"registry": "http://192.168.26.29:7001"
"access": "public"
},
"repository": {
"type": "git",
Expand All @@ -25,8 +25,8 @@
"@chakra-ui/react": "^1.6.5",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@meta-ui/core": "^0.1.0",
"@meta-ui/runtime": "^0.0.0",
"@meta-ui/core": "^0.2.1",
"@meta-ui/runtime": "^0.2.4",
"codemirror": "^5.63.3",
"formik": "^2.2.9",
"framer-motion": "^4",
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../config/tsconfig.base.json",
"compilerOptions": {
"target": "ESNext",
"target": "ES6",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": false,
Expand All @@ -18,7 +18,7 @@
"noUnusedParameters": true,
"types": ["@emotion/react/types/css-prop"],
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"jsxImportSource": "@emotion/react"
},
"include": ["./src"]
}
35 changes: 25 additions & 10 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
{
"name": "@meta-ui/runtime",
"version": "0.0.0",
"version": "0.2.4",
"description": "meta-ui runtime",
"author": "meta-ui developers",
"homepage": "https://github.com/webzard-io/meta-ui#readme",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/webzard-io/meta-ui.git"
},
"main": "dist/index.js",
"module": "dist/esm/index.js",
"unpkg": "dist/iife/index.js",
"types": "typings/index.d.ts",
"files": [
"dist",
"typings"
],
"scripts": {
"dev": "vite",
"test": "jest",
"build": "tsc -b .",
"typings": "tsc -d",
"build": "tsup src/index.ts --format cjs,esm,iife --legacy-output --inject ./react-import.js --clean --no-splitting --sourcemap",
"typings": "tsc --emitDeclarationOnly --declarationDir typings",
"lint": "eslint src --ext .ts",
"prepublish": "npm run build && npm run typings"
},
"files": [
"lib"
],
"module": "lib/index.js",
"types": "lib/index.d.ts",
"dependencies": {
"@chakra-ui/icons": "^1.0.15",
"@chakra-ui/react": "^1.6.5",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@meta-ui/core": "^0.1.0",
"@meta-ui/core": "^0.2.1",
"@sinclair/typebox": "^0.20.5",
"@vue-reactivity/watch": "^0.1.6",
"@vue/reactivity": "^3.1.5",
"@vue/shared": "^3.2.20",
"copy-to-clipboard": "^3.3.1",
"dayjs": "^1.10.6",
"framer-motion": "^4",
Expand Down Expand Up @@ -51,6 +65,7 @@
"@vitejs/plugin-react": "^1.0.1",
"babel-jest": "^27.1.0",
"jest": "^27.1.0",
"tsup": "^5.5.0",
"typescript": "^4.3.2",
"vite": "^2.3.8"
}
Expand Down
5 changes: 5 additions & 0 deletions packages/runtime/react-import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// https://github.com/egoist/tsup/issues/390

import React from 'react';

export { React };
2 changes: 1 addition & 1 deletion packages/runtime/src/components/chakra-ui/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { css } from '@emotion/react';
import { Type, Static } from '@sinclair/typebox';
import { createComponent } from '@meta-ui/core';
import { Button, VStack } from '@chakra-ui/react';
import { watch } from '@vue-reactivity/watch';
import { watch } from '../../../utils/watchReactivity';
import { ComponentImplementation } from '../../../services/registry';
import Slot from '../../_internal/Slot';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
FormLabel,
Text,
} from '@chakra-ui/react';
import { watch } from '@vue-reactivity/watch';
import { watch } from '../../../utils/watchReactivity';
import {
FormControlContentCSS,
FormControlCSS,
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/components/core/GridLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getSlots } from '../_internal/Slot';
import { Static, Type } from '@sinclair/typebox';
import { partial } from 'lodash';

const BaseGridLayout = React.lazy(() => import('../../components/_internal/GridLayout'));
const BaseGridLayout = React.lazy(() => import('../_internal/GridLayout'));

const GridLayout: ComponentImplementation<Static<typeof PropsSchema>> = ({
slotsMap,
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/services/DebugComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { StateManager } from './stateStore';
import { ApiService } from './apiService';
import { watch } from '@vue-reactivity/watch';
import { watch } from '../utils/watchReactivity';
import copy from 'copy-to-clipboard';

export const DebugStore: React.FC<{ stateManager: StateManager }> = ({
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/src/services/ImplWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { watch } from '@vue-reactivity/watch';
import { watch } from '../utils/watchReactivity';
import { merge } from 'lodash';
import {
RuntimeApplicationComponent,
Expand Down
14 changes: 7 additions & 7 deletions packages/runtime/src/services/stateStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import { reactive } from '@vue/reactivity';
import { watch } from '@vue-reactivity/watch';
import { watch } from '../utils/watchReactivity';
import { LIST_ITEM_EXP, LIST_ITEM_INDEX_EXP } from '../constants';

dayjs.extend(relativeTime);
Expand Down Expand Up @@ -125,13 +125,13 @@ export class StateManager {
return _.mapValues(obj, (val, key) => {
return _.isArray(val)
? val.map((innerVal, idx) => {
return _.isPlainObject(innerVal)
? this.mapValuesDeep(innerVal, fn, path.concat(key, idx))
: fn({ value: innerVal, key, obj, path: path.concat(key, idx) });
})
return _.isPlainObject(innerVal)
? this.mapValuesDeep(innerVal, fn, path.concat(key, idx))
: fn({ value: innerVal, key, obj, path: path.concat(key, idx) });
})
: _.isPlainObject(val)
? this.mapValuesDeep(val, fn, path.concat(key))
: fn({ value: val, key, obj, path: path.concat(key) });
? this.mapValuesDeep(val, fn, path.concat(key))
: fn({ value: val, key, obj, path: path.concat(key) });
});
}

Expand Down
Loading

0 comments on commit cf3d11a

Please sign in to comment.