diff --git a/.github/workflows/chat-widget.yml b/.github/workflows/chat-widget.yml index 011f941..a542c17 100644 --- a/.github/workflows/chat-widget.yml +++ b/.github/workflows/chat-widget.yml @@ -4,6 +4,17 @@ on: push: branches: main pull_request: + workflow_dispatch: + inputs: + version: + required: true + type: choice + description: Increment ChatWidget NPM version + default: 'patch' + options: + - patch + - minor + - major jobs: build: @@ -19,10 +30,6 @@ jobs: uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b with: node-version-file: '.nvmrc' - - # TODO: NPM login instead of auth token? - # - name: Authenticate with private NPM package - # run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc - name: Install dependencies run: npm ci @@ -41,3 +48,11 @@ jobs: - name: E2E - Run automation suite run: npm run e2e:run + + - name: Authenticate with private NPM package + # if: ${{ github.event_name == 'workflow_dispatch' }} + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + + - name: NPM Publish ChatWidget + # if: ${{ github.event_name == 'workflow_dispatch' }} + run: npm run lerna publish bump patch --yes diff --git a/storybook/.storybook/main.ts b/storybook/.storybook/main.ts index e2d6622..5245fa3 100644 --- a/storybook/.storybook/main.ts +++ b/storybook/.storybook/main.ts @@ -24,5 +24,16 @@ const config: StorybookConfig = { docsMode: true, defaultName: "Documentation", }, + async viteFinal(config) { + const { mergeConfig } = await import('vite'); + + return mergeConfig(config, { + server: { + fs: { + allow: ['../'] + } + } + }); + }, }; export default config; diff --git a/storybook/package-lock.json b/storybook/package-lock.json index 3743f74..8628125 100644 --- a/storybook/package-lock.json +++ b/storybook/package-lock.json @@ -7,8 +7,11 @@ "": { "name": "@vortexwest/storybook", "version": "0.1.0", + "workspaces": [ + "../packages/*" + ], "dependencies": { - "@vortexwest/chat-widget-ui": "^0.1.11", + "@vortexwest/chat-widget-ui": "^0.1.0", "storybook": "^8.1.10" }, "devDependencies": { @@ -27,6 +30,79 @@ "vite": "^5.2.0" } }, + "../packages/react": { + "version": "0.1.15", + "license": "ISC", + "dependencies": { + "@vortexwest/chat-widget-ui": "^0.1.15" + }, + "devDependencies": { + "@babel/preset-env": "^7.24.8", + "@babel/preset-react": "^7.24.7", + "@babel/preset-typescript": "^7.24.7", + "@testing-library/dom": "^10.4.0", + "@testing-library/jest-dom": "^6.4.7", + "@testing-library/react": "^16.0.0", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@typescript-eslint/eslint-plugin": "^7.17.0", + "@typescript-eslint/parser": "^7.17.0", + "babel-jest": "^29.7.0", + "eslint": "^8.57.0", + "eslint-plugin-react": "^7.34.1", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "typescript": "^5.5.4" + } + }, + "../packages/sdk": { + "version": "0.1.15", + "license": "ISC", + "dependencies": { + "socket.io-client": "^4.7.5", + "uuid": "^10.0.0" + }, + "devDependencies": { + "@types/jest": "^29.5.12", + "@typescript-eslint/eslint-plugin": "^7.17.0", + "@typescript-eslint/parser": "^7.17.0", + "eslint": "^8.57.0", + "globals": "^15.3.0", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "ts-jest": "^29.1.4", + "typescript-eslint": "^7.11.0" + } + }, + "../packages/ui": { + "version": "0.1.15", + "dependencies": { + "@vortexwest/chat-widget-sdk": "^0.1.15", + "uuid": "^10.0.0" + }, + "devDependencies": { + "@babel/plugin-syntax-decorators": "^7.24.7", + "@babel/preset-env": "^7.24.8", + "@babel/preset-typescript": "^7.24.7", + "@stencil-community/eslint-plugin": "^0.7.2", + "@stencil/core": "^4.21.0", + "@stencil/react-output-target": "^0.7.1", + "@stencil/sass": "^3.0.12", + "@stencil/store": "^2.0.16", + "@types/jest": "^29.5.12", + "@types/node": "^20.14.12", + "@typescript-eslint/parser": "^6.0.0", + "babel-jest": "^29.7.0", + "hast-util-to-html": "^9.0.1", + "jest": "^29.7.0", + "jest-cli": "^29.7.0", + "puppeteer": "^22.12.0", + "svg-parser": "^2.0.4", + "svgo": "^3.2.0" + } + }, "node_modules/@adobe/css-tools": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.0.tgz", @@ -2659,11 +2735,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@socket.io/component-emitter": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", - "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==" - }, "node_modules/@storybook/addon-actions": { "version": "8.2.8", "resolved": "https://registry.npmjs.org/@storybook/addon-actions/-/addon-actions-8.2.8.tgz", @@ -3894,47 +3965,17 @@ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true }, - "node_modules/@vortexwest/chat-widget-sdk": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@vortexwest/chat-widget-sdk/-/chat-widget-sdk-0.1.6.tgz", - "integrity": "sha512-P+q+IfaYQcmwNwCJXfi2DqzhHSeHil19LFWIl0xHvkTELv+l97kcePtWydo7iowqODno/hbebdFYdB53ac/d1Q==", - "dependencies": { - "socket.io-client": "^4.7.5", - "uuid": "^10.0.0" - } + "node_modules/@vortexwest/chat-widget-react": { + "resolved": "../packages/react", + "link": true }, - "node_modules/@vortexwest/chat-widget-sdk/node_modules/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" - } + "node_modules/@vortexwest/chat-widget-sdk": { + "resolved": "../packages/sdk", + "link": true }, "node_modules/@vortexwest/chat-widget-ui": { - "version": "0.1.11", - "resolved": "https://registry.npmjs.org/@vortexwest/chat-widget-ui/-/chat-widget-ui-0.1.11.tgz", - "integrity": "sha512-vTrTrzuVtcCBvwlZ325cIolF2GRooNLTpxVwwmLt1QaKfJtFPQ6jYeoeZmicIsDw4ouKlYQijGkelr+FFVQsTQ==", - "dependencies": { - "@vortexwest/chat-widget-sdk": "^0.1.6", - "uuid": "^10.0.0" - } - }, - "node_modules/@vortexwest/chat-widget-ui/node_modules/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" - } + "resolved": "../packages/ui", + "link": true }, "node_modules/@yarnpkg/fslib": { "version": "2.10.3", @@ -4826,26 +4867,6 @@ "node": ">= 0.8" } }, - "node_modules/engine.io-client": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.4.tgz", - "integrity": "sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==", - "dependencies": { - "@socket.io/component-emitter": "~3.1.0", - "debug": "~4.3.1", - "engine.io-parser": "~5.2.1", - "ws": "~8.17.1", - "xmlhttprequest-ssl": "~2.0.0" - } - }, - "node_modules/engine.io-parser": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz", - "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/envinfo": { "version": "7.13.0", "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.13.0.tgz", @@ -8185,32 +8206,6 @@ "node": ">=8" } }, - "node_modules/socket.io-client": { - "version": "4.7.5", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.5.tgz", - "integrity": "sha512-sJ/tqHOCe7Z50JCBCXrsY3I2k03iOiUe+tj1OmKeD2lXPiGH/RUCdTZFoqVyN7l1MnpIzPrGtLcijffmeouNlQ==", - "dependencies": { - "@socket.io/component-emitter": "~3.1.0", - "debug": "~4.3.2", - "engine.io-client": "~6.5.2", - "socket.io-parser": "~4.2.4" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/socket.io-parser": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", - "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", - "dependencies": { - "@socket.io/component-emitter": "~3.1.0", - "debug": "~4.3.1" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -9095,14 +9090,6 @@ } } }, - "node_modules/xmlhttprequest-ssl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", - "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", diff --git a/storybook/package.json b/storybook/package.json index ed16c8f..a794c70 100644 --- a/storybook/package.json +++ b/storybook/package.json @@ -2,6 +2,9 @@ "name": "@vortexwest/storybook", "version": "0.1.0", "private": true, + "workspaces": [ + "../packages/*" + ], "type": "module", "scripts": { "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",