Skip to content

Commit

Permalink
Setup components (#8)
Browse files Browse the repository at this point in the history
* Setup components as monorepo

* Setup components boilerplate

* Add missing config files

* Install website-components into website

* Remove srcDir
  • Loading branch information
rijkvanzanten authored Jun 20, 2023
1 parent 0b5a5b2 commit a8b5d7a
Show file tree
Hide file tree
Showing 20 changed files with 2,193 additions and 220 deletions.
7 changes: 7 additions & 0 deletions components/histoire.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { HstVue } from '@histoire/plugin-vue';
import { defineConfig } from 'histoire';

export default defineConfig({
plugins: [HstVue()],
setupFile: './histoire.setup.ts',
});
14 changes: 14 additions & 0 deletions components/histoire.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineSetupVue3 } from '@histoire/plugin-vue';
import { createI18n } from 'vue-i18n';
import { createMemoryHistory, createRouter } from 'vue-router';

export const setupVue3 = defineSetupVue3(({ app }) => {
app.use(
createRouter({
history: createMemoryHistory(),
routes: [{ path: '/:catchAll(.*)', name: 'all', component: { render: () => null } }],
})
);

app.use(createI18n({}));
});
53 changes: 53 additions & 0 deletions components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "@directus/website-components",
"version": "0.0.1",
"description": "Self-Referential Responsive Components",
"homepage": "https://directus.io",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/directus/website.git",
"directory": "components"
},
"license": "MIT",
"author": "Rijk van Zanten <[email protected]>",
"type": "module",
"exports": {
".": "./dist/index.js",
"./package.json": "./package.json"
},
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"build": "vite build",
"dev": "vite",
"test": "vitest --watch=false",
"story:dev": "histoire dev",
"story:build": "histoire build",
"story:preview": "histoire preview",
"typecheck": "vue-tsc --noEmit"
},
"devDependencies": {
"@directus/tsconfig": "0.0.7",
"@histoire/plugin-vue": "0.16.1",
"@histoire/shared": "0.16.1",
"@rollup/plugin-node-resolve": "15.0.2",
"@vitejs/plugin-vue": "4.2.3",
"@vitest/coverage-c8": "0.31.1",
"histoire": "0.16.1",
"rollup-plugin-node-externals": "6.1.1",
"typescript": "5.0.4",
"vite": "4.3.7",
"vite-plugin-dts": "2.3.0",
"vitest": "0.31.1",
"vue-tsc": "1.8.0"
},
"dependencies": {
"pinia": "2.1.1",
"vue": "3.3.4",
"vue-i18n": "9.2.2",
"vue-router": "4.2.0"
}
}
9 changes: 9 additions & 0 deletions components/src/base-grid/base-grid.story.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script setup lang="ts">
import BaseGrid from './base-grid.vue';
</script>

<template>
<Story>
<BaseGrid />
</Story>
</template>
3 changes: 3 additions & 0 deletions components/src/base-grid/base-grid.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<div>Grid!</div>
</template>
1 change: 1 addition & 0 deletions components/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as BaseGrid } from './base-grid/base-grid.vue';
5 changes: 5 additions & 0 deletions components/src/shims.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module '*.vue' {
import type { DefineComponent } from 'vue';
const component: DefineComponent<object, object, any>;
export default component;
}
7 changes: 7 additions & 0 deletions components/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "@directus/tsconfig/node18-esm.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"]
}
16 changes: 16 additions & 0 deletions components/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import vue from '@vitejs/plugin-vue';
import { resolve } from 'node:path';
import { nodeExternals } from 'rollup-plugin-node-externals';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';

export default defineConfig({
plugins: [{ ...nodeExternals(), enforce: 'pre' }, vue(), dts()],
build: {
lib: {
entry: resolve(__dirname, 'src/index.ts'),
fileName: 'index',
formats: ['es'],
},
},
});
16 changes: 3 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
{
"name": "@directus/website",
"name": "website-monorepo",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"lint": "eslint .",
"typecheck": "nuxt typecheck",
"typecheck": "pnpm run --recursive typecheck",
"format": "prettier --write \"**/*.{md,y?(a)ml,json,vue}\""
},
"devDependencies": {
"@nuxt/devtools": "latest",
"@types/node": "20.2.5",
"@typescript-eslint/eslint-plugin": "5.59.9",
"@typescript-eslint/parser": "5.59.9",
"eslint": "8.42.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-vue": "9.14.1",
"nuxt": "3.5.2",
"prettier": "2.8.8",
"typescript": "5.1.3",
"vue-tsc": "1.8.0"
"prettier": "2.8.8"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
Loading

0 comments on commit a8b5d7a

Please sign in to comment.