Skip to content

Commit

Permalink
feat: add lerna
Browse files Browse the repository at this point in the history
  • Loading branch information
andresz1 committed Feb 7, 2023
1 parent ce23432 commit 4a0c74c
Show file tree
Hide file tree
Showing 30 changed files with 24,750 additions and 8,917 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ node_modules
dist
dist-ssr
*.local
storybook-static

# Editor directories and files
.vscode/*
Expand Down
3 changes: 1 addition & 2 deletions .storybook/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ module.exports = {
},
stories: [
"../documentation/**/*.mdx",
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)",
"../packages/**/*.stories.@(mdx|ts|tsx)"
],
addons: [
"@storybook/addon-links",
Expand Down
33 changes: 33 additions & 0 deletions config/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import react from '@vitejs/plugin-react'
import path from 'path'
import { terser } from 'rollup-plugin-terser'
import dts from 'vite-plugin-dts'

const pkg = require(path.resolve(__dirname, '../package.json'))

const deps = Object.keys(pkg.dependencies || {})
const devDeps = Object.keys(pkg.devDependencies || {})

export default {
build: {
target: 'es2015',
lib: {
entry: 'src/index.ts',
formats: ['es', 'cjs'],
fileName: 'index',
},
rollupOptions: {
external: [...deps, ...devDeps],
plugins: [terser()],
},
},
plugins: [
dts({
/** To avoid bundling types into a package/components folder inside of dist */
entryRoot: './src',
}),
react({
jsxRuntime: 'classic',
}),
],
}
19 changes: 19 additions & 0 deletions config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import merge from 'deepmerge'
import component from './component'

export function getComponentConfiguration(name: string, options = {}) {
return getConfiguration(component, options, name)
}

function getConfiguration(configuration: Record<string, unknown>, options = {}, name?: string) {
const result = merge.all(
[
configuration,
name ? { build: { lib: { name } } } : {},
options
],
{}
)

return result
}
19 changes: 19 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "independent",
"command": {
"publish": {
"conventionalCommits": true,
"message": "chore: Release packages [skip ci]"
},
"version": {
"conventionalCommits": true
}
},
"ignoreChanges": [
"**/CHANGELOG.md",
"**/node_modules/**",
"**/*.md"
]
}
Loading

0 comments on commit 4a0c74c

Please sign in to comment.