diff --git a/.eslintignore b/.eslintignore index a293be1..d7c3d05 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,2 @@ node_modules packages/headless-stepper/dist -packages/headless-stepper/components/dist diff --git a/package.json b/package.json index b13e972..b177f46 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,7 @@ "prebuild": "cp -r ./README.md ./packages/headless-stepper", "build:lib-fast": "npm run prebuild && pnpm exec tsup --config packages/headless-stepper/tsup.config.ts", "build:lib": "npm run prebuild && pnpm exec tsup --config packages/headless-stepper/tsup.config.ts --dts-resolve", - "build:components": "pnpm exec tsup --config packages/headless-stepper/components/tsup.config.ts --dts-resolve", - "build:components-fast": "pnpm exec tsup --config packages/headless-stepper/components/tsup.config.ts", - "build:all": "pnpm run build:lib && pnpm run build:components", + "build:all": "pnpm run build:lib", "nx": "nx", "publish:prod": "npm run build:all && cd ./packages/headless-stepper && npm publish", "publish:dev": "npm run build:all && cd ./packages/headless-stepper && npm publish --tag next", @@ -109,4 +107,4 @@ "nx": { "includedScripts": [] } -} +} \ No newline at end of file diff --git a/packages/headless-stepper/components/index.ts b/packages/headless-stepper/components/index.ts deleted file mode 100644 index eef565f..0000000 --- a/packages/headless-stepper/components/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './src/components'; diff --git a/packages/headless-stepper/components/node_modules/headless-stepper b/packages/headless-stepper/components/node_modules/headless-stepper deleted file mode 120000 index c25bddb..0000000 --- a/packages/headless-stepper/components/node_modules/headless-stepper +++ /dev/null @@ -1 +0,0 @@ -../.. \ No newline at end of file diff --git a/packages/headless-stepper/components/package.json b/packages/headless-stepper/components/package.json deleted file mode 100644 index e6d3f1f..0000000 --- a/packages/headless-stepper/components/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "headless-stepper/components", - "version": "1.0.0", - "main": "./dist/index.js", - "module": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "files": [ - "dist" - ], - "peerDependencies": { - "headless-stepper": "latest" - }, - "private": true -} diff --git a/packages/headless-stepper/components/scripts/post-build.sh b/packages/headless-stepper/components/scripts/post-build.sh deleted file mode 100755 index 0a3ee8d..0000000 --- a/packages/headless-stepper/components/scripts/post-build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -# Update the components index to use the client version of the components. -sed -i '1,1s/^/"use client"; /' ./packages/headless-stepper/components/dist/index.mjs -sed -i '1,1s/^/"use client"; /' ./packages/headless-stepper/components/dist/index.js diff --git a/packages/headless-stepper/components/tsup.config.ts b/packages/headless-stepper/components/tsup.config.ts deleted file mode 100644 index 391177f..0000000 --- a/packages/headless-stepper/components/tsup.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { defineConfig } from 'tsup'; -import path from 'path'; - -const entry = path.join(__dirname, 'index.ts'); - -export default defineConfig({ - name: 'headless-stepper-components', - entry: [entry], - outDir: path.join(__dirname, 'dist'), - sourcemap: true, - dts: true, - format: ['esm', 'cjs'], - external: ['react', 'react-dom'], - clean: true, - tsconfig: path.join(__dirname, '../tsconfig.lib.json'), - // onSuccess: path.join(__dirname, 'scripts', 'post-build.sh'), -}); diff --git a/packages/headless-stepper/package.json b/packages/headless-stepper/package.json index ca3f902..9410fcb 100644 --- a/packages/headless-stepper/package.json +++ b/packages/headless-stepper/package.json @@ -1,7 +1,7 @@ { "name": "headless-stepper", "description": "Production ready React hook to create awesome stepper components. Effortless to use, easy to customize.", - "version": "1.10.0-beta.1", + "version": "1.10.0-beta.3", "main": "./dist/index.js", "module": "./dist/index.mjs", "types": "./dist/index.d.ts", @@ -49,13 +49,13 @@ "default": "./dist/index.mjs" }, "./components": { - "types": "./components/dist/index.d.ts", + "types": "./dist/components.d.ts", "import": { - "types": "./components/dist/index.d.ts", - "default": "./components/dist/index.mjs" + "types": "./dist/components.d.ts", + "default": "./dist/components.mjs" }, - "module": "./components/dist/index.mjs", - "default": "./components/dist/index.mjs" + "module": "./dist/components.mjs", + "default": "./dist/components.mjs" } }, "sideEffects": false diff --git a/packages/headless-stepper/components/src/components/Step.tsx b/packages/headless-stepper/src/lib/components/Step.tsx similarity index 90% rename from packages/headless-stepper/components/src/components/Step.tsx rename to packages/headless-stepper/src/lib/components/Step.tsx index f6941ae..1310199 100644 --- a/packages/headless-stepper/components/src/components/Step.tsx +++ b/packages/headless-stepper/src/lib/components/Step.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import type { PolymorphicComponentType, Steps } from 'headless-stepper'; +import type { PolymorphicComponentType, Steps } from '../types'; export type StepComponentProps = React.PropsWithChildren< React.HTMLAttributes<HTMLElement> & diff --git a/packages/headless-stepper/components/src/components/Stepper.test.tsx b/packages/headless-stepper/src/lib/components/Stepper.test.tsx similarity index 100% rename from packages/headless-stepper/components/src/components/Stepper.test.tsx rename to packages/headless-stepper/src/lib/components/Stepper.test.tsx diff --git a/packages/headless-stepper/components/src/components/Stepper.tsx b/packages/headless-stepper/src/lib/components/Stepper.tsx similarity index 93% rename from packages/headless-stepper/components/src/components/Stepper.tsx rename to packages/headless-stepper/src/lib/components/Stepper.tsx index 860f325..e6c0ee1 100644 --- a/packages/headless-stepper/components/src/components/Stepper.tsx +++ b/packages/headless-stepper/src/lib/components/Stepper.tsx @@ -1,10 +1,8 @@ import React from 'react'; import StepperContext from '../context'; -import { useIsomorphicId, useStepper } from 'headless-stepper'; -import type { - PolymorphicComponentType, - StepperOrientation, -} from 'headless-stepper'; +import { useStepper } from '../hooks/useStepper'; +import { useIsomorphicId } from '../hooks/useId'; +import type { PolymorphicComponentType, StepperOrientation } from '../types'; import type { StepComponentProps } from './Step'; export type StepperComponentProps = React.PropsWithChildren< diff --git a/packages/headless-stepper/components/src/components/examples/StepperComponent.stories.tsx b/packages/headless-stepper/src/lib/components/examples/StepperComponent.stories.tsx similarity index 100% rename from packages/headless-stepper/components/src/components/examples/StepperComponent.stories.tsx rename to packages/headless-stepper/src/lib/components/examples/StepperComponent.stories.tsx diff --git a/packages/headless-stepper/components/src/components/examples/StepperComponent.tsx b/packages/headless-stepper/src/lib/components/examples/StepperComponent.tsx similarity index 87% rename from packages/headless-stepper/components/src/components/examples/StepperComponent.tsx rename to packages/headless-stepper/src/lib/components/examples/StepperComponent.tsx index 861d070..66f7417 100644 --- a/packages/headless-stepper/components/src/components/examples/StepperComponent.tsx +++ b/packages/headless-stepper/src/lib/components/examples/StepperComponent.tsx @@ -1,4 +1,4 @@ -import { Stepper, Step, StepComponentProps } from '../'; +import { Stepper, Step, StepComponentProps } from '..'; const StepperComponent = () => { return ( diff --git a/packages/headless-stepper/components/src/components/index.ts b/packages/headless-stepper/src/lib/components/index.ts similarity index 100% rename from packages/headless-stepper/components/src/components/index.ts rename to packages/headless-stepper/src/lib/components/index.ts diff --git a/packages/headless-stepper/components/src/context/index.tsx b/packages/headless-stepper/src/lib/context/index.tsx similarity index 79% rename from packages/headless-stepper/components/src/context/index.tsx rename to packages/headless-stepper/src/lib/context/index.tsx index 24ff5df..7768a33 100644 --- a/packages/headless-stepper/components/src/context/index.tsx +++ b/packages/headless-stepper/src/lib/context/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import type { UseStepper } from 'headless-stepper'; +import type { UseStepper } from '../hooks/useStepper'; /** * Context for the stepper. diff --git a/packages/headless-stepper/src/lib/examples/StepperComponent.tsx b/packages/headless-stepper/src/lib/examples/StepperComponent.tsx index 6429d49..d286bab 100644 --- a/packages/headless-stepper/src/lib/examples/StepperComponent.tsx +++ b/packages/headless-stepper/src/lib/examples/StepperComponent.tsx @@ -1,5 +1,5 @@ // eslint-disable-next-line @nx/enforce-module-boundaries -import { Stepper, Step } from '../../../components/src/components'; +import { Stepper, Step } from '../components'; const StepperComponent = () => { return ( diff --git a/packages/headless-stepper/tsup.config.ts b/packages/headless-stepper/tsup.config.ts index 628fd57..7f90096 100644 --- a/packages/headless-stepper/tsup.config.ts +++ b/packages/headless-stepper/tsup.config.ts @@ -1,11 +1,14 @@ import { defineConfig } from 'tsup'; import path from 'path'; -const p = path.join(__dirname, 'src'); +const p = path.join(__dirname); export default defineConfig({ name: 'headless-stepper', - entry: [`${p}/index.ts`], + entry: { + index: `${p}/src/index.ts`, + components: `${p}/src/lib/components/index.ts`, + }, outDir: path.join(__dirname, 'dist'), sourcemap: true, dts: true,