@soyfri/shared-library 2.0.0-beta.1 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Table/Table.js +1 -1
- package/package.json +32 -4
- package/.dockerignore +0 -8
- package/.github/workflows/publish.yml +0 -107
- package/.prettierrc +0 -3
- package/.storybook/main.ts +0 -19
- package/.storybook/preview.ts +0 -14
- package/.storybook/vitest.setup.ts +0 -9
- package/Dockerfile +0 -37
- package/build.js +0 -139
- package/chromatic.config.json +0 -5
- package/cleanDirectories.js +0 -40
- package/rollup.config.cjs +0 -87
- package/src/components/ActionMenu/ActionMenu.stories.tsx +0 -230
- package/src/components/ActionMenu/ActionMenu.tsx +0 -174
- package/src/components/ActionMenu/index.ts +0 -2
- package/src/components/AppBar/AppBar.stories.tsx +0 -272
- package/src/components/AppBar/AppBar.sx.ts +0 -32
- package/src/components/AppBar/AppBar.tsx +0 -123
- package/src/components/AppBar/AppBarBrand.tsx +0 -120
- package/src/components/AppBar/AppBarContext.ts +0 -25
- package/src/components/AppBar/AppBarMenuToggle.tsx +0 -90
- package/src/components/AppBar/AppBarUserMenu.tsx +0 -217
- package/src/components/AppBar/index.ts +0 -25
- package/src/components/Autocomplete/Autocomplete.definitions.ts +0 -477
- package/src/components/Autocomplete/Autocomplete.helpers.ts +0 -60
- package/src/components/Autocomplete/Autocomplete.stories.tsx +0 -748
- package/src/components/Autocomplete/Autocomplete.sx.ts +0 -30
- package/src/components/Autocomplete/Autocomplete.tsx +0 -361
- package/src/components/Autocomplete/Autocomplete.types.ts +0 -13
- package/src/components/Autocomplete/_parts/AutocompleteChips.tsx +0 -55
- package/src/components/Autocomplete/_parts/AutocompleteLoader.tsx +0 -17
- package/src/components/Autocomplete/_parts/AutocompleteOption.tsx +0 -31
- package/src/components/Autocomplete/index.ts +0 -12
- package/src/components/Avatar/Avatar.definitions.ts +0 -162
- package/src/components/Avatar/Avatar.stories.tsx +0 -258
- package/src/components/Avatar/Avatar.tsx +0 -206
- package/src/components/Avatar/index.ts +0 -1
- package/src/components/Button/Button.definition.ts +0 -97
- package/src/components/Button/Button.stories.tsx +0 -285
- package/src/components/Button/Button.tsx +0 -67
- package/src/components/Button/index.ts +0 -1
- package/src/components/Card/Card.definition.ts +0 -5
- package/src/components/Card/Card.stories.tsx +0 -221
- package/src/components/Card/Card.sx.ts +0 -104
- package/src/components/Card/Card.tsx +0 -200
- package/src/components/Card/index.ts +0 -9
- package/src/components/Chip/Chip.definitions.ts +0 -167
- package/src/components/Chip/Chip.stories.tsx +0 -265
- package/src/components/Chip/Chip.tsx +0 -61
- package/src/components/Chip/index.ts +0 -1
- package/src/components/Column/Column.tsx +0 -29
- package/src/components/Column/index.ts +0 -1
- package/src/components/DatePicker/DatePicker.definitions.ts +0 -228
- package/src/components/DatePicker/DatePicker.helpers.ts +0 -24
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -309
- package/src/components/DatePicker/DatePicker.sx.ts +0 -33
- package/src/components/DatePicker/DatePicker.tsx +0 -189
- package/src/components/DatePicker/DatePicker.types.ts +0 -10
- package/src/components/DatePicker/index.ts +0 -9
- package/src/components/DateRangePicker/DateRangePicker.definitions.ts +0 -191
- package/src/components/DateRangePicker/DateRangePicker.stories.tsx +0 -252
- package/src/components/DateRangePicker/DateRangePicker.tsx +0 -56
- package/src/components/DateRangePicker/index.ts +0 -1
- package/src/components/DateTimePicker/DateTimePicker.definitions.ts +0 -256
- package/src/components/DateTimePicker/DateTimePicker.helpers.ts +0 -38
- package/src/components/DateTimePicker/DateTimePicker.stories.tsx +0 -418
- package/src/components/DateTimePicker/DateTimePicker.sx.ts +0 -30
- package/src/components/DateTimePicker/DateTimePicker.tsx +0 -225
- package/src/components/DateTimePicker/DateTimePicker.types.ts +0 -10
- package/src/components/DateTimePicker/index.ts +0 -9
- package/src/components/Drawer/Drawer.stories.tsx +0 -270
- package/src/components/Drawer/Drawer.sx.ts +0 -106
- package/src/components/Drawer/Drawer.tsx +0 -214
- package/src/components/Drawer/DrawerContext.ts +0 -26
- package/src/components/Drawer/DrawerItem.tsx +0 -110
- package/src/components/Drawer/index.ts +0 -10
- package/src/components/Flyout/Flyout.stories.tsx +0 -282
- package/src/components/Flyout/Flyout.tsx +0 -122
- package/src/components/Flyout/index.ts +0 -1
- package/src/components/Gallery/Gallery.definition.tsx +0 -37
- package/src/components/Gallery/Gallery.stories.tsx +0 -82
- package/src/components/Gallery/Gallery.tsx +0 -118
- package/src/components/Gallery/GalleryLightbox.tsx +0 -170
- package/src/components/Gallery/GalleryMain.tsx +0 -84
- package/src/components/Gallery/GalleryThumbnails.tsx +0 -106
- package/src/components/Gallery/index.ts +0 -1
- package/src/components/Icon/Icon.stories.tsx +0 -121
- package/src/components/Icon/Icon.tsx +0 -175
- package/src/components/Icon/index.ts +0 -2
- package/src/components/Input/Input.definitions.ts +0 -324
- package/src/components/Input/Input.helpers.ts +0 -49
- package/src/components/Input/Input.stories.tsx +0 -499
- package/src/components/Input/Input.sx.ts +0 -42
- package/src/components/Input/Input.tsx +0 -141
- package/src/components/Input/Input.types.ts +0 -10
- package/src/components/Input/index.ts +0 -9
- package/src/components/InputGroup/InputGroup.definitions.ts +0 -158
- package/src/components/InputGroup/InputGroup.stories.tsx +0 -267
- package/src/components/InputGroup/InputGroup.tsx +0 -179
- package/src/components/InputGroup/index.ts +0 -1
- package/src/components/MenuButton/MenuButton.stories.tsx +0 -197
- package/src/components/MenuButton/MenuButton.tsx +0 -100
- package/src/components/MenuButton/index.ts +0 -1
- package/src/components/Modal/Modal.stories.tsx +0 -721
- package/src/components/Modal/Modal.tsx +0 -355
- package/src/components/Modal/ModalBody.tsx +0 -16
- package/src/components/Modal/ModalFooter.tsx +0 -71
- package/src/components/Modal/ModalHeader.tsx +0 -18
- package/src/components/Modal/index.ts +0 -6
- package/src/components/PageLoader/PageLoader.stories.tsx +0 -217
- package/src/components/PageLoader/PageLoader.tsx +0 -96
- package/src/components/PageLoader/index.ts +0 -2
- package/src/components/ScrollTopButton/ScrollTopButton.stories.tsx +0 -158
- package/src/components/ScrollTopButton/ScrollTopButton.tsx +0 -135
- package/src/components/ScrollTopButton/index.ts +0 -8
- package/src/components/ScrollTopButton/scrollToTop.ts +0 -37
- package/src/components/Select/Select.definitions.ts +0 -602
- package/src/components/Select/Select.helpers.ts +0 -71
- package/src/components/Select/Select.stories.tsx +0 -687
- package/src/components/Select/Select.sx.ts +0 -14
- package/src/components/Select/Select.tsx +0 -429
- package/src/components/Select/Select.types.ts +0 -15
- package/src/components/Select/_parts/SelectMenuItem.tsx +0 -40
- package/src/components/Select/_parts/SelectSearchHeader.tsx +0 -51
- package/src/components/Select/_parts/SelectValue.tsx +0 -96
- package/src/components/Select/index.ts +0 -14
- package/src/components/Stat/Stat.stories.tsx +0 -85
- package/src/components/Stat/Stat.tsx +0 -117
- package/src/components/Stat/index.ts +0 -2
- package/src/components/StatusMessage/StatusMessage.stories.tsx +0 -130
- package/src/components/StatusMessage/StatusMessage.tsx +0 -162
- package/src/components/StatusMessage/index.ts +0 -2
- package/src/components/Stepper/Step.tsx +0 -21
- package/src/components/Stepper/Stepper.definition.ts +0 -75
- package/src/components/Stepper/Stepper.stories.tsx +0 -122
- package/src/components/Stepper/Stepper.tsx +0 -75
- package/src/components/Stepper/index.ts +0 -2
- package/src/components/Table/EmptyTable.png +0 -0
- package/src/components/Table/Table.definition.ts +0 -580
- package/src/components/Table/Table.stories.tsx +0 -853
- package/src/components/Table/Table.tsx +0 -495
- package/src/components/Table/data.ts +0 -134
- package/src/components/Table/exportsUtils.ts +0 -195
- package/src/components/Table/index.ts +0 -3
- package/src/components/Table/types.ts +0 -34
- package/src/components/Tabs/Tab.definition.ts +0 -53
- package/src/components/Tabs/Tab.tsx +0 -19
- package/src/components/Tabs/Tabs.stories.tsx +0 -118
- package/src/components/Tabs/Tabs.tsx +0 -99
- package/src/components/Tabs/_tabUtils.tsx +0 -4
- package/src/components/Tabs/index.ts +0 -2
- package/src/components/Timeline/Timeline.definition.ts +0 -43
- package/src/components/Timeline/Timeline.stories.tsx +0 -108
- package/src/components/Timeline/Timeline.tsx +0 -49
- package/src/components/Timeline/TimelineItem.tsx +0 -31
- package/src/components/Timeline/index.ts +0 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -129
- package/src/components/Tooltip/Tooltip.tsx +0 -58
- package/src/components/Tooltip/index.ts +0 -1
- package/src/components/_shared/formField.sx.ts +0 -118
- package/src/components/_shared/resolvePreset.ts +0 -35
- package/src/hooks/ClipBoard/ClipBoard.stories.tsx +0 -168
- package/src/hooks/ClipBoard/ClipBoard.tsx +0 -131
- package/src/hooks/ClipBoard/ClipboardUnifiedDemo.tsx +0 -111
- package/src/hooks/ClipBoard/index.ts +0 -1
- package/src/hooks/Wizard/Wizard.stories.tsx +0 -301
- package/src/hooks/Wizard/WizardContext.tsx +0 -166
- package/src/hooks/Wizard/index.ts +0 -6
- package/src/hooks/Wizard/useWizard.ts +0 -13
- package/src/index.ts +0 -17
- package/src/mui.ts +0 -44
- package/src/styles.css +0 -3
- package/src/theme/componentStyles.ts +0 -47
- package/src/theme/tokens.ts +0 -43
- package/tailwind.config.js +0 -10
- package/tsconfig.json +0 -48
- package/tsup.config.js +0 -41
- package/vite.config.js +0 -132
- package/vitest.config.ts +0 -35
|
@@ -14,7 +14,7 @@ var __spreadValues = (a, b) => {
|
|
|
14
14
|
}
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
|
-
import {
|
|
17
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
18
18
|
import React__default, { Children, isValidElement, useState, useEffect } from "react";
|
|
19
19
|
import { TableContainer, Table as Table$1, TableHead, TableRow, TableCell, Checkbox, Typography, TableBody, Box, Select, MenuItem, IconButton, Button, Snackbar } from "@mui/material";
|
|
20
20
|
import MuiAlert from "@mui/material/Alert";
|
package/package.json
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyfri/shared-library",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "dist/index.cjs",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"require": "./dist/index.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./styles.css": "./dist/styles.css",
|
|
21
|
+
"./mui": {
|
|
22
|
+
"types": "./dist/mui.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./components/*": {
|
|
25
|
+
"types": "./dist/components/*/index.d.ts",
|
|
26
|
+
"import": "./dist/components/*/*.js",
|
|
27
|
+
"require": "./dist/components/*/*.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./hooks/*": {
|
|
30
|
+
"types": "./dist/hooks/*/index.d.ts",
|
|
31
|
+
"import": "./dist/hooks/*/*.js",
|
|
32
|
+
"require": "./dist/hooks/*/*.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
8
36
|
"scripts": {
|
|
9
37
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
10
38
|
"build:css": "tailwindcss -i ./src/styles.css -o ./dist/styles.css",
|
package/.dockerignore
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
name: Node.js CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ "main" ]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
|
|
11
|
-
strategy:
|
|
12
|
-
matrix:
|
|
13
|
-
node-version: [v23.6.1]
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
- name: Checkout repository
|
|
17
|
-
uses: actions/checkout@v4
|
|
18
|
-
|
|
19
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
-
uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: ${{ matrix.node-version }}
|
|
23
|
-
npm-version: '10.9.2'
|
|
24
|
-
cache: 'npm' # Se asume que package-lock.json está en el repositorio
|
|
25
|
-
|
|
26
|
-
- name: Install dependencies
|
|
27
|
-
run: npm install --frozen-lockfile # Uso de --frozen-lockfile para CI/CD
|
|
28
|
-
|
|
29
|
-
- name: Remove underscore-prefixed directories
|
|
30
|
-
run: npm run rm --if-present
|
|
31
|
-
|
|
32
|
-
- name: Build package
|
|
33
|
-
run: npm run build --if-present
|
|
34
|
-
|
|
35
|
-
- name: Dist package
|
|
36
|
-
run: npm run dist --if-present
|
|
37
|
-
|
|
38
|
-
- name: Upload build artifact
|
|
39
|
-
uses: actions/upload-artifact@v4
|
|
40
|
-
with:
|
|
41
|
-
name: dist-package
|
|
42
|
-
path: dist/ # Guarda el directorio de distribución como un artefacto
|
|
43
|
-
|
|
44
|
-
publish:
|
|
45
|
-
runs-on: ubuntu-latest
|
|
46
|
-
needs: build # 👈 Depende del trabajo de construcción
|
|
47
|
-
environment: production # 👈 Asocia este trabajo con el ambiente 'production'
|
|
48
|
-
|
|
49
|
-
steps:
|
|
50
|
-
- name: Checkout repository
|
|
51
|
-
uses: actions/checkout@v4
|
|
52
|
-
|
|
53
|
-
- name: Download build artifact
|
|
54
|
-
uses: actions/download-artifact@v4
|
|
55
|
-
with:
|
|
56
|
-
name: dist-package
|
|
57
|
-
path: dist/ # Descarga el artefacto en el directorio 'dist'
|
|
58
|
-
|
|
59
|
-
- name: Use Node.js 20.x for publishing
|
|
60
|
-
uses: actions/setup-node@v4
|
|
61
|
-
with:
|
|
62
|
-
node-version: 20.x
|
|
63
|
-
npm-version: '10.9.2'
|
|
64
|
-
registry-url: 'https://registry.npmjs.org'
|
|
65
|
-
|
|
66
|
-
- name: Publish package
|
|
67
|
-
working-directory: dist
|
|
68
|
-
run: npm publish --access public
|
|
69
|
-
env:
|
|
70
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
71
|
-
|
|
72
|
-
notify:
|
|
73
|
-
runs-on: ubuntu-latest
|
|
74
|
-
needs: publish
|
|
75
|
-
environment: production
|
|
76
|
-
|
|
77
|
-
steps:
|
|
78
|
-
- name: Checkout repository
|
|
79
|
-
uses: actions/checkout@v4
|
|
80
|
-
|
|
81
|
-
- name: Get package version
|
|
82
|
-
id: get_version
|
|
83
|
-
run: echo "PACKAGE_VERSION=$(npm pkg get version | tr -d '\"')" >> $GITHUB_ENV
|
|
84
|
-
|
|
85
|
-
- name: Get commit message and author
|
|
86
|
-
id: get_commit_info
|
|
87
|
-
run: |
|
|
88
|
-
echo "COMMIT_MESSAGE=$(git log -1 --pretty=format:%s)" >> $GITHUB_ENV
|
|
89
|
-
echo "COMMIT_AUTHOR=$(git log -1 --pretty=format:%an)" >> $GITHUB_ENV
|
|
90
|
-
|
|
91
|
-
- name: Send Discord notification (Success)
|
|
92
|
-
if: success()
|
|
93
|
-
uses: tsickert/discord-webhook@v5.3.0
|
|
94
|
-
with:
|
|
95
|
-
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
|
96
|
-
content: "✅ **Publicación Exitosa:** Nueva versión de la librería de componentes en npm.\n**Paquete:** [@soyfri/shared-library](https://www.npmjs.com/package/@soyfri/shared-library/v/${{ env.PACKAGE_VERSION }})\n**Versión:** `v${{ env.PACKAGE_VERSION }}`\n**Notas del commit:** ${{ env.COMMIT_MESSAGE }}\n**Autor:** ${{ env.COMMIT_AUTHOR }}"
|
|
97
|
-
username: "GitHub Actions"
|
|
98
|
-
avatar-url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
|
|
99
|
-
|
|
100
|
-
- name: Send Discord notification (Failure)
|
|
101
|
-
if: failure()
|
|
102
|
-
uses: tsickert/discord-webhook@v5.3.0
|
|
103
|
-
with:
|
|
104
|
-
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
|
105
|
-
content: "❌ **Publicación Fallida:** Falló la publicación de la librería de componentes en npm.\n**Commit:** ${{ env.COMMIT_MESSAGE }}\n**Autor:** ${{ env.COMMIT_AUTHOR }}"
|
|
106
|
-
username: "GitHub Actions"
|
|
107
|
-
avatar-url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
|
package/.prettierrc
DELETED
package/.storybook/main.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { StorybookConfig } from '@storybook/react-vite';
|
|
2
|
-
|
|
3
|
-
const config: StorybookConfig = {
|
|
4
|
-
"stories": [
|
|
5
|
-
"../src/**/*.mdx",
|
|
6
|
-
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx|mdx)"
|
|
7
|
-
],
|
|
8
|
-
"addons": [
|
|
9
|
-
"@storybook/addon-onboarding",
|
|
10
|
-
"@chromatic-com/storybook",
|
|
11
|
-
"@storybook/addon-vitest",
|
|
12
|
-
"@storybook/addon-docs"
|
|
13
|
-
],
|
|
14
|
-
"framework": {
|
|
15
|
-
"name": "@storybook/react-vite",
|
|
16
|
-
"options": {}
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
export default config;
|
package/.storybook/preview.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { beforeAll } from 'vitest';
|
|
2
|
-
import { setProjectAnnotations } from '@storybook/react-vite';
|
|
3
|
-
import * as projectAnnotations from './preview';
|
|
4
|
-
|
|
5
|
-
// This is an important step to apply the right configuration when testing your stories.
|
|
6
|
-
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
|
|
7
|
-
const project = setProjectAnnotations([projectAnnotations]);
|
|
8
|
-
|
|
9
|
-
beforeAll(project.beforeAll);
|
package/Dockerfile
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Use a specific Node.js version for the build environment.
|
|
2
|
-
FROM node:20-alpine AS builder
|
|
3
|
-
|
|
4
|
-
# Set the working directory in the container.
|
|
5
|
-
WORKDIR /usr/src/app
|
|
6
|
-
|
|
7
|
-
# Copy package.json and package-lock.json to leverage Docker's layer caching.
|
|
8
|
-
# This step is cached and only re-runs if package*.json files change.
|
|
9
|
-
COPY package*.json ./
|
|
10
|
-
|
|
11
|
-
# Install project dependencies.
|
|
12
|
-
RUN npm install
|
|
13
|
-
|
|
14
|
-
# Copy the rest of your application's source code.
|
|
15
|
-
COPY . .
|
|
16
|
-
|
|
17
|
-
# Run the build script to create the distribution files.
|
|
18
|
-
RUN npm run build --if-present
|
|
19
|
-
|
|
20
|
-
RUN npm run dist --if-present
|
|
21
|
-
|
|
22
|
-
# --- Final Stage: Create a lightweight image with only the build artifacts ---
|
|
23
|
-
# Use a minimal base image. 'scratch' is the smallest, 'alpine' is also a good choice.
|
|
24
|
-
FROM scratch
|
|
25
|
-
|
|
26
|
-
# Set the working directory to the root of your library.
|
|
27
|
-
WORKDIR /usr/src/app
|
|
28
|
-
|
|
29
|
-
# Copy the built files from the 'builder' stage.
|
|
30
|
-
COPY --from=builder /usr/src/app/dist ./dist
|
|
31
|
-
|
|
32
|
-
# The final image contains only the 'dist' directory.
|
|
33
|
-
# There is no need for EXPOSE or CMD as this is a component library, not a runnable application.
|
|
34
|
-
|
|
35
|
-
# You can add a LABEL to describe the image if needed.
|
|
36
|
-
LABEL maintainer="Your Name"
|
|
37
|
-
LABEL version="1.0"
|
package/build.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { readFileSync, existsSync, mkdirSync, writeFileSync, copyFileSync } from 'fs';
|
|
2
|
-
import { join, basename } from 'path';
|
|
3
|
-
import { sync } from 'glob';
|
|
4
|
-
|
|
5
|
-
const projectRoot = process.cwd();
|
|
6
|
-
const srcComponentsDir = join(projectRoot, 'src', 'components');
|
|
7
|
-
const srcHooksDir = join(projectRoot, 'src', 'hooks');
|
|
8
|
-
const distDir = join(projectRoot, 'dist');
|
|
9
|
-
const distComponentsDir = join(distDir, 'components');
|
|
10
|
-
const distHooksDir = join(distDir, 'hooks');
|
|
11
|
-
const originalPackageJsonPath = join(projectRoot, 'package.json');
|
|
12
|
-
const distPackageJsonPath = join(distDir, 'package.json');
|
|
13
|
-
const readmePath = join(projectRoot, 'README.md');
|
|
14
|
-
|
|
15
|
-
// Leer el package.json original
|
|
16
|
-
const originalPackageJson = JSON.parse(readFileSync(originalPackageJsonPath, 'utf8'));
|
|
17
|
-
|
|
18
|
-
// Inicializar el nuevo objeto exports.
|
|
19
|
-
// IMPORTANTE: el workflow publica con `working-directory: dist`, por lo que
|
|
20
|
-
// `dist/` es la RAÍZ del paquete publicado. Todos los paths acá son relativos
|
|
21
|
-
// a dist/ (es decir, sin el prefijo "./dist/").
|
|
22
|
-
const newExports = {
|
|
23
|
-
".": {
|
|
24
|
-
"types": "./index.d.ts",
|
|
25
|
-
"import": "./index.js",
|
|
26
|
-
"require": "./index.cjs"
|
|
27
|
-
},
|
|
28
|
-
"./styles.css": "./styles.css",
|
|
29
|
-
"./mui": {
|
|
30
|
-
"types": "./mui.d.ts"
|
|
31
|
-
},
|
|
32
|
-
"./package.json": "./package.json"
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Función para procesar directorios y crear entradas en exports.
|
|
36
|
-
//
|
|
37
|
-
// Nota sobre los archivos generados por vite (según `vite.config.js`):
|
|
38
|
-
// - Runtime: components/<Name>/<Name>.js y .cjs
|
|
39
|
-
// - Types barrel components/<Name>/index.d.ts (el archivo barrel de src/components/<Name>/index.ts)
|
|
40
|
-
// - Types comp.: components/<Name>/<Name>.d.ts (el archivo del componente src/components/<Name>/<Name>.tsx)
|
|
41
|
-
//
|
|
42
|
-
// Para el consumer, el import `@soyfri/shared-library/components/<Name>` debe
|
|
43
|
-
// resolver al BARREL, por lo tanto:
|
|
44
|
-
// - types → ./components/<Name>/index.d.ts (barrel types)
|
|
45
|
-
// - import → ./components/<Name>/<Name>.js (barrel runtime)
|
|
46
|
-
// - require→ ./components/<Name>/<Name>.cjs (barrel runtime)
|
|
47
|
-
const processDirectories = (sourceDir, distSubDir, exportPrefix) => {
|
|
48
|
-
if (!existsSync(sourceDir)) {
|
|
49
|
-
console.log(`Directorio no encontrado: ${sourceDir}. Saltando.`);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (!existsSync(distSubDir)) {
|
|
54
|
-
mkdirSync(distSubDir, { recursive: true });
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const moduleDirs = sync(`${sourceDir}/*/`);
|
|
58
|
-
|
|
59
|
-
console.log(`Buscando módulos en: ${sourceDir}`);
|
|
60
|
-
|
|
61
|
-
moduleDirs.forEach(moduleDirPath => {
|
|
62
|
-
const moduleName = basename(moduleDirPath);
|
|
63
|
-
|
|
64
|
-
// Saltar módulos privados (_shared, _utils, etc.) y los que no empiezan con mayúscula.
|
|
65
|
-
if (!/^[A-Z]/.test(moduleName)) {
|
|
66
|
-
console.log(` - Saltando '${moduleName}' porque no empieza con mayúscula.`);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
console.log(` - Módulo encontrado: ${moduleName}`);
|
|
71
|
-
|
|
72
|
-
// Asegurar que exista la carpeta en dist (vite ya la debería haber creado,
|
|
73
|
-
// pero esto es idempotente).
|
|
74
|
-
const distModuleFolder = join(distSubDir, moduleName);
|
|
75
|
-
if (!existsSync(distModuleFolder)) {
|
|
76
|
-
mkdirSync(distModuleFolder, { recursive: true });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const exportPath = `./${exportPrefix}/${moduleName}`;
|
|
80
|
-
newExports[exportPath] = {
|
|
81
|
-
"types": `./${exportPrefix}/${moduleName}/index.d.ts`,
|
|
82
|
-
"import": `./${exportPrefix}/${moduleName}/${moduleName}.js`,
|
|
83
|
-
"require": `./${exportPrefix}/${moduleName}/${moduleName}.cjs`
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
// Procesar componentes y hooks.
|
|
89
|
-
processDirectories(srcComponentsDir, distComponentsDir, 'components');
|
|
90
|
-
processDirectories(srcHooksDir, distHooksDir, 'hooks');
|
|
91
|
-
|
|
92
|
-
// Construir el package.json de dist/ partiendo del original, pero corrigiendo
|
|
93
|
-
// los paths de `main`, `module` y `types` para que sean flat (sin prefijo "dist/")
|
|
94
|
-
// porque dist/ ES la raíz del paquete publicado.
|
|
95
|
-
const distPackageJson = {
|
|
96
|
-
...originalPackageJson,
|
|
97
|
-
main: "./index.cjs",
|
|
98
|
-
module: "./index.js",
|
|
99
|
-
types: "./index.d.ts",
|
|
100
|
-
exports: newExports,
|
|
101
|
-
// Declarar qué archivos forman parte del tarball.
|
|
102
|
-
files: [
|
|
103
|
-
"index.js",
|
|
104
|
-
"index.cjs",
|
|
105
|
-
"index.d.ts",
|
|
106
|
-
"index.js.map",
|
|
107
|
-
"index.cjs.map",
|
|
108
|
-
"mui.d.ts",
|
|
109
|
-
"styles.css",
|
|
110
|
-
"components",
|
|
111
|
-
"hooks",
|
|
112
|
-
"theme"
|
|
113
|
-
],
|
|
114
|
-
// Side effects: el CSS tiene side effects, el resto es tree-shakeable.
|
|
115
|
-
sideEffects: ["**/*.css"]
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// Eliminar propiedades innecesarias para el paquete publicado.
|
|
119
|
-
delete distPackageJson.scripts;
|
|
120
|
-
delete distPackageJson.devDependencies;
|
|
121
|
-
delete distPackageJson.private;
|
|
122
|
-
delete distPackageJson.overrides;
|
|
123
|
-
|
|
124
|
-
if (!existsSync(distDir)) {
|
|
125
|
-
mkdirSync(distDir, { recursive: true });
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Copiar README.md a la carpeta dist.
|
|
129
|
-
if (existsSync(readmePath)) {
|
|
130
|
-
copyFileSync(readmePath, join(distDir, 'README.md'));
|
|
131
|
-
console.log('Copiando README.md a la carpeta dist.');
|
|
132
|
-
} else {
|
|
133
|
-
console.log('No se encontró README.md en la raíz del proyecto. Saltando.');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
writeFileSync(distPackageJsonPath, JSON.stringify(distPackageJson, null, 2), 'utf8');
|
|
137
|
-
|
|
138
|
-
console.log(`\n'package.json' generado exitosamente en: ${distPackageJsonPath}`);
|
|
139
|
-
console.log('Contenido de la propiedad "exports":', JSON.stringify(newExports, null, 2));
|
package/chromatic.config.json
DELETED
package/cleanDirectories.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
|
|
4
|
-
// Define the folders to be cleaned (sub-folders will be deleted)
|
|
5
|
-
const foldersToClean = ['components', 'hooks'];
|
|
6
|
-
const srcPath = join(process.cwd(), 'src');
|
|
7
|
-
|
|
8
|
-
const deleteLowercaseFolders = async () => {
|
|
9
|
-
console.log('Iniciando el proceso de eliminación de carpetas...');
|
|
10
|
-
|
|
11
|
-
for (const parentFolder of foldersToClean) {
|
|
12
|
-
const parentPath = join(srcPath, parentFolder);
|
|
13
|
-
|
|
14
|
-
if (!await fs.stat(parentPath).catch(() => false)) {
|
|
15
|
-
console.log(`Directorio padre no encontrado: ${parentPath}. Saltando.`);
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
// Leer el contenido del directorio padre y obtener información de los archivos
|
|
21
|
-
const entries = await fs.readdir(parentPath, { withFileTypes: true });
|
|
22
|
-
|
|
23
|
-
for (const entry of entries) {
|
|
24
|
-
// Check if the entry is a directory and its name starts with a lowercase letter.
|
|
25
|
-
if (entry.isDirectory() && /^[a-z]/.test(entry.name)) {
|
|
26
|
-
const folderPath = join(parentPath, entry.name);
|
|
27
|
-
await fs.rm(folderPath, { recursive: true, force: true });
|
|
28
|
-
console.log(`- Carpeta eliminada: ${folderPath}`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error(`Error al procesar el directorio ${parentPath}:`, error);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
console.log('Proceso de limpieza completado.');
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// Execute the main function
|
|
40
|
-
deleteLowercaseFolders();
|
package/rollup.config.cjs
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
const resolve = require('@rollup/plugin-node-resolve');
|
|
2
|
-
const commonjs = require('@rollup/plugin-commonjs');
|
|
3
|
-
const typescript = require('rollup-plugin-typescript2');
|
|
4
|
-
const peerDepsExternal = require('rollup-plugin-peer-deps-external');
|
|
5
|
-
const postcss = require('rollup-plugin-postcss');
|
|
6
|
-
const terser = require('@rollup/plugin-terser');
|
|
7
|
-
// const alias = require('@rollup/plugin-alias'); // 👈 Ya no necesitamos este plugin
|
|
8
|
-
const { globSync } = require('glob');
|
|
9
|
-
const path = require('path');
|
|
10
|
-
const pkg = require('./package.json');
|
|
11
|
-
const projectRootDir = path.resolve(__dirname);
|
|
12
|
-
|
|
13
|
-
const componentEntryPoints = globSync('src/components/*/index.ts').reduce((acc, file) => {
|
|
14
|
-
const componentName = path.basename(path.dirname(file));
|
|
15
|
-
acc[`components/${componentName}`] = file;
|
|
16
|
-
return acc;
|
|
17
|
-
}, {});
|
|
18
|
-
|
|
19
|
-
const mainEntry = {
|
|
20
|
-
index: 'src/index.ts',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
module.exports = {
|
|
24
|
-
input: {
|
|
25
|
-
...mainEntry,
|
|
26
|
-
...componentEntryPoints,
|
|
27
|
-
},
|
|
28
|
-
output: [
|
|
29
|
-
{
|
|
30
|
-
dir: 'dist/esm',
|
|
31
|
-
format: 'esm',
|
|
32
|
-
sourcemap: true,
|
|
33
|
-
preserveModules: true,
|
|
34
|
-
preserveModulesRoot: 'src',
|
|
35
|
-
entryFileNames: '[name].js',
|
|
36
|
-
chunkFileNames: '_chunks/chunk-[hash].js',
|
|
37
|
-
exports: 'named',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
dir: 'dist/cjs',
|
|
41
|
-
format: 'cjs',
|
|
42
|
-
sourcemap: true,
|
|
43
|
-
preserveModules: true,
|
|
44
|
-
preserveModulesRoot: 'src',
|
|
45
|
-
entryFileNames: '[name].cjs',
|
|
46
|
-
chunkFileNames: '_chunks/chunk-[hash].cjs',
|
|
47
|
-
exports: 'named',
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
plugins: [
|
|
51
|
-
peerDepsExternal(),
|
|
52
|
-
// 👈 Configura el alias dentro del plugin 'resolve'
|
|
53
|
-
resolve({
|
|
54
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
55
|
-
alias: {
|
|
56
|
-
entries: [
|
|
57
|
-
{ find: '@soyfri/shared-library', replacement: path.resolve(projectRootDir, 'src') }
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
}),
|
|
61
|
-
commonjs(),
|
|
62
|
-
typescript({
|
|
63
|
-
tsconfig: './tsconfig.json',
|
|
64
|
-
useTsconfigDeclarationDir: true,
|
|
65
|
-
}),
|
|
66
|
-
postcss({
|
|
67
|
-
config: {
|
|
68
|
-
path: './postcss.config.js',
|
|
69
|
-
},
|
|
70
|
-
extensions: ['.css'],
|
|
71
|
-
minimize: true,
|
|
72
|
-
extract: true,
|
|
73
|
-
}),
|
|
74
|
-
terser(),
|
|
75
|
-
],
|
|
76
|
-
external: [
|
|
77
|
-
'react',
|
|
78
|
-
'react-dom',
|
|
79
|
-
/@mui\/.*/,
|
|
80
|
-
/@emotion\/.*/,
|
|
81
|
-
'dayjs',
|
|
82
|
-
'react-hook-form',
|
|
83
|
-
'tailwindcss',
|
|
84
|
-
'autoprefixer',
|
|
85
|
-
'postcss',
|
|
86
|
-
],
|
|
87
|
-
};
|