Skip to content

Commit 08619fe

Browse files
committed
refactor: split utils package & split hyperscript- & vue-components
1 parent 15fa4a1 commit 08619fe

Some content is hidden

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

85 files changed

+978
-728
lines changed

examples/utils/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
},
2424
"homepage": "https://github.com/Tada5hi/vue-layout#readme",
2525
"dependencies": {
26+
"@vue-layout/core": "^0.0.0",
2627
"@vue-layout/utils": "^2.0.0-alpha.11",
2728
"@vuelidate/core": "^2.0.0-alpha.44",
2829
"@vuelidate/validators": "^2.0.0-alpha.31",

examples/utils/src/main.ts

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1+
/*
2+
* Copyright (c) 2022.
3+
* Author Peter Placzek (tada5hi)
4+
* For the full copyright and license information,
5+
* view the LICENSE file that was distributed with this source code.
6+
*/
7+
8+
import { Preset } from '@vue-layout/core';
9+
import { setConfig } from '@vue-layout/utils';
110
import { createApp } from 'vue';
2-
import Utils, { Config, Preset } from '@vue-layout/utils';
311

412
import App from './App.vue';
513

614
import 'bootstrap/dist/css/bootstrap.min.css';
715
import 'font-awesome/css/font-awesome.min.css';
816

9-
const config : Partial<Config> = {
17+
setConfig({
1018
preset: {
1119
[Preset.BOOTSTRAP]: true,
1220
[Preset.FONT_AWESOME]: true,
1321
},
14-
component: {
15-
formInput: {
16-
label: {
17-
preset: {
18-
[Preset.BOOTSTRAP_V5]: false,
19-
},
20-
},
21-
},
22-
},
23-
};
22+
});
2423

2524
createApp(App)
26-
.use(Utils, config)
2725
.mount('#app');

examples/utils/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"module": "ESNext",
66
"paths": {
77
"@/*": ["./examples/utils/src/*"],
8+
"@vue-layout/core": ["./packages/core/src"],
89
"@vue-layout/utils": ["./packages/utils/src"]
910
}
1011
},

package-lock.json

+43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
},
5555
"scripts": {
5656
"bootstrap": "lerna bootstrap",
57-
"clean": "lerna run clean",
57+
"commit": "npx git-cz",
5858
"build": "lerna run build",
5959
"test": "lerna run test",
6060
"pub": "npm run build && lerna publish",

packages/core/babel.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const devPresets = ['@vue/babel-preset-app'];
2+
const buildPresets = [
3+
'@babel/preset-env',
4+
'@babel/preset-typescript',
5+
];
6+
module.exports = {
7+
presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets),
8+
};

packages/core/package.json

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "@vue-layout/core",
3+
"version": "0.0.0",
4+
"description": "",
5+
"main": "dist/index.cjs.js",
6+
"browser": "dist/index.browser.js",
7+
"module": "dist/index.esm.js",
8+
"unpkg": "dist/index.iife.js",
9+
"types": "dist/types/index.d.ts",
10+
"files": [
11+
"dist/*"
12+
],
13+
"keywords": [],
14+
"author": {
15+
"name": "Peter Placzek",
16+
"email": "contact@tada5hi.net",
17+
"url": "https://tada5hi.net"
18+
},
19+
"repository": {
20+
"type": "git",
21+
"url": "https://github.com/tada5hi/vue-layout.git",
22+
"directory": "packages/core"
23+
},
24+
"sideEffects": false,
25+
"scripts": {
26+
"prebuild": "rimraf ./dist",
27+
"build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json",
28+
"build:js": "rollup -c",
29+
"build": "cross-env NODE_ENV=production npm run build:js && npm run build:types",
30+
"lint": "eslint --ext .ts ./src/",
31+
"lint:fix": "npm run lint -- --fix"
32+
},
33+
"devDependencies": {
34+
"@babel/core": "^7.19.1",
35+
"@babel/preset-env": "^7.19.1",
36+
"@babel/preset-typescript": "^7.18.6",
37+
"@rollup/plugin-alias": "^3.1.9",
38+
"@rollup/plugin-babel": "^5.3.1",
39+
"@rollup/plugin-commonjs": "^22.0.2",
40+
"@rollup/plugin-node-resolve": "^14.1.0",
41+
"@rollup/plugin-replace": "^4.0.0",
42+
"rollup": "^2.79.1",
43+
"rollup-plugin-terser": "^7.0.2",
44+
"vue": "^3.2.39"
45+
},
46+
"peerDependencies": {
47+
"vue": "^3.x"
48+
},
49+
"engines": {
50+
"node": ">=16"
51+
},
52+
"publishConfig": {
53+
"access": "public"
54+
}
55+
}

packages/core/rollup.config.js

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* Copyright (c) 2022-2022.
3+
* Author Peter Placzek (tada5hi)
4+
* For the full copyright and license information,
5+
* view the LICENSE file that was distributed with this source code.
6+
*/
7+
8+
import commonjs from '@rollup/plugin-commonjs';
9+
import resolve from '@rollup/plugin-node-resolve';
10+
import babel from '@rollup/plugin-babel';
11+
import { terser } from 'rollup-plugin-terser';
12+
import pkg from './package.json';
13+
14+
const extensions = [
15+
'.js', '.jsx', '.ts', '.tsx',
16+
];
17+
18+
const name = 'Smob';
19+
20+
export default [
21+
{
22+
input: './src/index.ts',
23+
24+
// Specify here external modules which you don't want to include in your bundle (for instance: 'lodash', 'moment' etc.)
25+
// https://rollupjs.org/guide/en/#external
26+
external: [],
27+
28+
plugins: [
29+
// Allows node_modules resolution
30+
resolve({ extensions }),
31+
32+
// Allow bundling cjs modules. Rollup doesn't understand cjs
33+
commonjs(),
34+
35+
// Compile TypeScript/JavaScript files
36+
babel({
37+
extensions,
38+
babelHelpers: 'bundled',
39+
include: [
40+
'src/**/*',
41+
],
42+
}),
43+
terser({
44+
output: {
45+
ecma: 5,
46+
},
47+
}),
48+
],
49+
output: [
50+
{
51+
file: pkg.main,
52+
format: 'cjs',
53+
}, {
54+
file: pkg.module,
55+
format: 'esm',
56+
},
57+
],
58+
},
59+
{
60+
input: './src/index.ts',
61+
62+
// Specify here external modules which you don't want to include in your bundle (for instance: 'lodash', 'moment' etc.)
63+
// https://rollupjs.org/guide/en/#external
64+
external: [],
65+
66+
plugins: [
67+
// Allows node_modules resolution
68+
resolve({ extensions }),
69+
70+
// Allow bundling cjs modules. Rollup doesn't understand cjs
71+
commonjs(),
72+
73+
// Compile TypeScript/JavaScript files
74+
babel({
75+
extensions,
76+
babelHelpers: 'bundled',
77+
include: [
78+
'src/**/*',
79+
],
80+
}),
81+
terser({
82+
output: {
83+
ecma: 5,
84+
},
85+
}),
86+
],
87+
output: [
88+
{
89+
file: pkg.browser,
90+
format: 'esm',
91+
},
92+
{
93+
file: pkg.unpkg,
94+
format: 'iife',
95+
name,
96+
97+
// https://rollupjs.org/guide/en/#outputglobals
98+
globals: {
99+
100+
},
101+
},
102+
],
103+
},
104+
];
File renamed without changes.
File renamed without changes.

packages/core/src/index.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (c) 2022.
3+
* Author Peter Placzek (tada5hi)
4+
* For the full copyright and license information,
5+
* view the LICENSE file that was distributed with this source code.
6+
*/
7+
8+
export * from './constants';
9+
export * from './di';
10+
export * from './options';
11+
export * from './utils';
12+
export * from './type';
File renamed without changes.
File renamed without changes.

packages/utils/src/options/merge.ts packages/core/src/options/merge.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
import { VNodeProps, mergeProps } from 'vue';
99
import {
10-
isVNodeClassOption, isVNodeListenerOption, isVNodeOption, isVNodePropsOption, isVNodeStyleOption,
10+
isVNodeClassOption,
11+
isVNodeListenerOption,
12+
isVNodeOption,
13+
isVNodePropsOption,
14+
isVNodeStyleOption,
1115
} from './utils';
1216

1317
function isObject(item: any): item is Record<string, any> {
File renamed without changes.

packages/utils/src/options/type.ts packages/core/src/options/type.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
* view the LICENSE file that was distributed with this source code.
66
*/
77

8-
import { MakeOptional } from '../type';
8+
import { MakeOptional, ToMaybeRef } from '../type';
9+
10+
export type OptionsInput<T,
11+
R extends keyof T = never,
12+
P extends keyof T = never,
13+
MR extends keyof T = never,
14+
> = Pick<T, R> &
15+
Partial<Pick<T, P>> &
16+
ToMaybeRef<Pick<T, MR>> &
17+
Partial<ToMaybeRef<Pick<T, Exclude<keyof T, R | P | MR>>>>;
918

1019
export type PresetOption<V> = {
1120
value: V,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/core/tsconfig.build.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"extends": "../../tsconfig.build.json",
3+
4+
"compilerOptions": {
5+
"outDir": "./dist",
6+
"importHelpers": true,
7+
"allowSyntheticDefaultImports": true,
8+
"sourceMap": false,
9+
"jsx": "preserve",
10+
11+
"declaration": true,
12+
"declarationDir": "dist/types",
13+
"skipLibCheck": true
14+
},
15+
"exclude": [
16+
"node_modules",
17+
"dist"
18+
],
19+
"include": [
20+
"src/**/*.ts"
21+
]
22+
}

packages/core/tsconfig.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"lib": [
5+
"ESNext"
6+
],
7+
"strict": true,
8+
9+
"importHelpers": true,
10+
"allowSyntheticDefaultImports": true,
11+
"sourceMap": false,
12+
"module": "ESNext",
13+
"jsx": "preserve",
14+
15+
"skipLibCheck": true
16+
}
17+
}

0 commit comments

Comments
 (0)