diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..c6f157ae4 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +packages/docs/* \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index ec92cad7b..ebab55120 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,5 +10,9 @@ module.exports = { parserOptions: { ecmaVersion: 'latest', }, - rules: {}, + rules: { + 'no-unsafe-negation': 'off', + 'no-prototype-builtins': 'off', + 'no-useless-escape': 'off', + }, } diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..8150a1ab5 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,9 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: leifermendez +open_collective: bot-whatsapp +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +custom: https://www.buymeacoffee.com/leifermendez diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3db9343f1..aa055600e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,26 +1,58 @@ -name: Test / Coverage +name: BotWhatsapp Build-Test on: - push: - branches: [dev] pull_request: - branches: [main] + branches: + - dev jobs: - build: + ############ BUILD PACKAGE ############ + build-package: + name: Build Package runs-on: ubuntu-latest + needs: + - test-unit + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'yarn' + registry-url: https://registry.npmjs.org/ + + - run: corepack enable + + - name: Install NPM Dependencies + run: yarn install --immutable --network-timeout 300000 - strategy: - matrix: - node-version: [16.x] + - name: Build Package + run: yarn build + - name: Build Eslint rules + run: yarn lint:fix + + ############ UNIT TEST ############ + test-unit: + name: Unit Tests + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm run build --if-present - - run: npm run test.unit - - run: npm run test.coverage + node-version: 16.x + cache: 'yarn' + registry-url: https://registry.npmjs.org/ + + - run: corepack enable + + - name: Install NPM Dependencies + run: yarn install --immutable --network-timeout 300000 + + - name: Unit Tests + run: yarn test diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index b62b053a0..f732834c8 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -1,11 +1,10 @@ name: Add contributors on: - schedule: - - cron: '20 20 * * *' - push: - branches: [dev] pull_request: - branches: [main, dev] + branches: + - dev + - main + types: [closed] jobs: contrib-readme-job: diff --git a/.github/workflows/releases-dev.yml b/.github/workflows/releases-dev.yml new file mode 100644 index 000000000..143d2a3f4 --- /dev/null +++ b/.github/workflows/releases-dev.yml @@ -0,0 +1,56 @@ +name: BotWhatsapp Releases(DEV) + +on: + push: + branches: + - next-release + +jobs: + ############ RELEASE ############ + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + persist-credentials: false + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'yarn' + registry-url: https://registry.npmjs.org/ + + - run: corepack enable + + - name: Install NPM Dependencies + run: yarn install --immutable --network-timeout 300000 + + - name: Build Package + run: yarn build + + - name: Release @bot-whatsapp/bot + run: yarn node ./scripts/release.js --name=bot --version= --token="${{ secrets.NPM_TOKEN }}" + + - name: Release @bot-whatsapp/cli + run: yarn node ./scripts/release.js --name=cli --version= --token="${{ secrets.NPM_TOKEN }}" + + - name: Release @bot-whatsapp/create-bot-whatsapp + run: yarn node ./scripts/release.js --name=create-bot-whatsapp --version= --token="${{ secrets.NPM_TOKEN }}" + + - name: Release @bot-whatsapp/database + run: yarn node ./scripts/release.js --name=database --version= --token="${{ secrets.NPM_TOKEN }}" + + - name: Release @bot-whatsapp/provider + run: yarn node ./scripts/release.js --name=provider --version= --token="${{ secrets.NPM_TOKEN }}" + + - name: Commit Versioning & Push changes + uses: actions-js/push@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + message: 'ci(version): :zap: automatic - "${date}" updated versions every packages' + branch: 'dev' diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml new file mode 100644 index 000000000..157e620e8 --- /dev/null +++ b/.github/workflows/releases.yml @@ -0,0 +1,60 @@ +name: BotWhatsapp Releases(Prod) + +on: + push: + tags: + - 'v*.*.*' + +jobs: + ############ RELEASE ############ + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + persist-credentials: false + fetch-depth: 0 + + - name: Set output + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: 'yarn' + registry-url: https://registry.npmjs.org/ + + - run: corepack enable + + - name: Install NPM Dependencies + run: yarn install --immutable --network-timeout 300000 + + - name: Build Package + run: yarn build + + - name: Release @bot-whatsapp/bot + run: yarn node ./scripts/release.js --name=bot --version="${{ steps.vars.outputs.tag }}" --token="${{ secrets.NPM_TOKEN }}" + + - name: Release @bot-whatsapp/cli + run: yarn node ./scripts/release.js --name=cli --version="${{ steps.vars.outputs.tag }}" --token="${{ secrets.NPM_TOKEN }}" + + - name: Release @bot-whatsapp/create-bot-whatsapp + run: yarn node ./scripts/release.js --name=create-bot-whatsapp --version="${{ steps.vars.outputs.tag }}" --token="${{ secrets.NPM_TOKEN }}" + + - name: Release @bot-whatsapp/database + run: yarn node ./scripts/release.js --name=database --version="${{ steps.vars.outputs.tag }}" --token="${{ secrets.NPM_TOKEN }}" + + - name: Release @bot-whatsapp/provider + run: yarn node ./scripts/release.js --name=provider --version="${{ steps.vars.outputs.tag }}" --token="${{ secrets.NPM_TOKEN }}" + + - name: Commit Versioning & Push changes + uses: actions-js/push@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + message: 'ci(version): :zap: automatic - "${date}" updated versions every packages' + branch: 'dev' diff --git a/.gitignore b/.gitignore index d5e4adefb..be22be945 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ /node_modules +/packages/*/starters /packages/*/node_modules /packages/*/dist /packages/*/docs/dist +/packages/provider/src/venom/tokens session.json chats/* !chats/.gitkeep @@ -20,6 +22,7 @@ coverage/ log log/* *.log +*.tgz lib tmp/ .yarn/* @@ -27,6 +30,9 @@ tmp/ !.yarn/plugins/@yarnpkg/plugin-postinstall.cjs .fleet/ example-app*/ +base-*/ +!starters/apps/base-*/ qr.svg package-lock.json -yarn-error.log \ No newline at end of file +yarn-error.log +.npmrc \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 4f7ce3d2a..547ec21b6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,5 @@ packages/**/lib -packages/docs +packages/docs/*.json **/.git **/.svn **/.hg diff --git a/.vscode/settings.json b/.vscode/settings.json index ee40dd0c3..ffa60fd9e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,6 +5,9 @@ "cli", "bot", "provider", - "adapter" + "adapter", + "ci", + "starters", + "conflict" ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index f68044f74..9fd0fa56c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,231 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.1.2](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.1...v0.1.2) (2022-12-12) + + +### Bug Fixes + +* **cli:** :art: starters ([79e2318](https://github.com/leifermendez/bot-whatsapp/commit/79e231825613f33bfec2ae8e93139f885c199c7a)) +* **cli:** :art: starters ([87ba43a](https://github.com/leifermendez/bot-whatsapp/commit/87ba43a5535be0893a7701a3b6a085ee5d29e7c5)) +* fix dependencias ([61d0324](https://github.com/leifermendez/bot-whatsapp/commit/61d032426119341187a470035d49b8b252ca46cd)) + +### [0.1.1](https://github.com/leifermendez/bot-whatsapp/compare/v0.3.0...v0.1.1) (2022-12-12) + +## 0.3.0 (2022-12-12) + + +### ⚠ BREAKING CHANGES + +* 🧨 NO + +### Features + +* (🎸) add onClick prop to component ([4ae3898](https://github.com/leifermendez/bot-whatsapp/commit/4ae389846d38c133f6bb2129ae373eed39d9d08d)) +* **adapter:** added adapter mysql ([717a7dc](https://github.com/leifermendez/bot-whatsapp/commit/717a7dc95fbc107ec6f55387aff606c47144baa4)) +* **adapter:** implementation of json file adapter ([5e1a373](https://github.com/leifermendez/bot-whatsapp/commit/5e1a3737303c843095984f6357564ea18458362f)) +* **adapter:** mysql adapter ([8d73c86](https://github.com/leifermendez/bot-whatsapp/commit/8d73c86946d07aa80e5b375b62b84a88b2892e03)) +* **adapter:** sql is added to create the table ([4b7de0f](https://github.com/leifermendez/bot-whatsapp/commit/4b7de0f6901524fa2c09271c3a99c364e6b3c260)) +* **bot:** :fire: improvement provider handler ([4154cc2](https://github.com/leifermendez/bot-whatsapp/commit/4154cc223091a46d3203d3a378cd42f61749a5fa)) +* **bot:** :zap: add send image function ([ce8a96b](https://github.com/leifermendez/bot-whatsapp/commit/ce8a96b958ff814c65d8fb4dbd5eaed5cc83a1ed)) +* **ci:** :art: add releases ([b115dc3](https://github.com/leifermendez/bot-whatsapp/commit/b115dc3654996f049837bfb6b5d039a2313df0ad)) +* **ci:** :art: relases script ([2e906bc](https://github.com/leifermendez/bot-whatsapp/commit/2e906bce79f7d854d437334e1d0c2cd270b0bbc6)) +* **ci:** update ci ([e5a9db7](https://github.com/leifermendez/bot-whatsapp/commit/e5a9db7e12340c4f5baa66e8b20585b63daa3bcf)) +* **cli:** create-starter ([3977987](https://github.com/leifermendez/bot-whatsapp/commit/397798790ef5857ca758b0df8384c6a4bfacc181)) +* **provider:** :fire: add twilii (weoking) ([4350dff](https://github.com/leifermendez/bot-whatsapp/commit/4350dff22a7de69ba6d35ecbdd67e59b810bd46f)) +* **provider:** added twilio provider ([8dd3be9](https://github.com/leifermendez/bot-whatsapp/commit/8dd3be909b36717f6b54e141a5f48d2722d4855c)) +* **release:** added ([1988948](https://github.com/leifermendez/bot-whatsapp/commit/1988948c30d922beb7b83faab96d1d59cf7f5f90)) +* **release:** added ([f4ad704](https://github.com/leifermendez/bot-whatsapp/commit/f4ad7040abf619635480c30babd6f1159c7af85a)) + + +### Bug Fixes + +* **adapter:** conflict resolution ([4b307ef](https://github.com/leifermendez/bot-whatsapp/commit/4b307efe79c738a5c4e04ff1c07ca247d827593c)) +* **adapter:** corrections are made to the adapter ([afa6771](https://github.com/leifermendez/bot-whatsapp/commit/afa677190392d48715930ebe2b1e15c7619d730f)) +* **bot:** :zap: added delay promises ([73caf09](https://github.com/leifermendez/bot-whatsapp/commit/73caf090ba9013132e5dcb7761a10939dc9ac300)) +* **bot:** :zap: fix sensitive case ([24ac9fb](https://github.com/leifermendez/bot-whatsapp/commit/24ac9fbf48f80eeb521a36bc938af3a70dd82303)) +* **bot:** :zap: flow improvement + add utils ([a7b19d9](https://github.com/leifermendez/bot-whatsapp/commit/a7b19d9bff5ea66ff888555c3df37ae0e20b612a)) +* **bot:** update ([49698bf](https://github.com/leifermendez/bot-whatsapp/commit/49698bfda9d2a53f7b1a7e1724a796698601fbaa)) +* **ci:** :zap: balance version ([ec46cfd](https://github.com/leifermendez/bot-whatsapp/commit/ec46cfdd657c08c8e90261613f00cfc080f1e1d6)) +* **ci:** :zap: github action ([b827a0a](https://github.com/leifermendez/bot-whatsapp/commit/b827a0ab225b89bb8117c82628db0679c09b4102)) +* **ci:** :zap: github action ([4142ca4](https://github.com/leifermendez/bot-whatsapp/commit/4142ca4fd552e7005f3b1397a76b90a2e574d19d)) +* **ci:** :zap: github action ([091544a](https://github.com/leifermendez/bot-whatsapp/commit/091544ac3fac0c16925e856e1aec64bcad0ecf6d)) +* **ci:** :zap: github action ([2ce342a](https://github.com/leifermendez/bot-whatsapp/commit/2ce342a0cb15019d5084ca06dc30e342b030ea10)) +* **ci:** :zap: github action ([7817793](https://github.com/leifermendez/bot-whatsapp/commit/781779328f93ef8b0e6e0f85c6cd05ae782112fb)) +* **ci:** :zap: github action ([dfced8c](https://github.com/leifermendez/bot-whatsapp/commit/dfced8c594e9175c81e837af359631ba055b7e1a)) +* **ci:** :zap: github action ([aaa4ce8](https://github.com/leifermendez/bot-whatsapp/commit/aaa4ce837229fd51e274de3d91e1d9d615ac69fd)) +* **ci:** :zap: github action ([9ddf144](https://github.com/leifermendez/bot-whatsapp/commit/9ddf144244cd6877e7d26f576387814459f2befb)) +* **ci:** :zap: github action ([b465de5](https://github.com/leifermendez/bot-whatsapp/commit/b465de55a0e511213d1a7760a74efa102172c85e)) +* **ci:** :zap: github action ([cf1dc6f](https://github.com/leifermendez/bot-whatsapp/commit/cf1dc6fac810545e5a2b63f31f71322f37329e38)) +* **ci:** :zap: github action ([8d897f8](https://github.com/leifermendez/bot-whatsapp/commit/8d897f824e27a55ca011163092a813a7e8f426af)) +* **ci:** ci ([f55cfae](https://github.com/leifermendez/bot-whatsapp/commit/f55cfae6e4ccc1df949212999406680020d27f9c)) +* **ci:** ci ([671c5b3](https://github.com/leifermendez/bot-whatsapp/commit/671c5b37f33360e8cb754625b8dd6e83bce9014d)) +* **cli:** :bug: path ([32212fb](https://github.com/leifermendez/bot-whatsapp/commit/32212fb52d206bf6f8d753a86d9ce40aa0db2a5d)) +* **cli:** :fire: create script - templates ([2319db3](https://github.com/leifermendez/bot-whatsapp/commit/2319db3009501fe57ae21e60ad286eb68c46f4fd)) +* **cli:** :fire: create script - templates ([9cb98b5](https://github.com/leifermendez/bot-whatsapp/commit/9cb98b5e73fca3c3f5e70a8497badc31e494b943)) +* **cli:** :fire: create script - templates ([2999e0e](https://github.com/leifermendez/bot-whatsapp/commit/2999e0e753f31a8b9e6d7c117e78cdb5656e203a)) +* **cli:** :fire: create script - templates ([af716b7](https://github.com/leifermendez/bot-whatsapp/commit/af716b75372899877a81b528b58278376166d0ad)) +* **cli:** :fire: create script - templates ([c6999c8](https://github.com/leifermendez/bot-whatsapp/commit/c6999c84931083a87b5717db58003be68244707e)) +* **cli:** :fire: create script - templates ([d4b49a9](https://github.com/leifermendez/bot-whatsapp/commit/d4b49a9bd7085070f0c5964d2903f10b71bde0b3)) +* **cli:** :fire: create script - templates ([eebc3c9](https://github.com/leifermendez/bot-whatsapp/commit/eebc3c980638d88f11a0d93b8344f3ff345c7ee5)) +* **cli:** :zap: clean eslinter ([bfb69d9](https://github.com/leifermendez/bot-whatsapp/commit/bfb69d9a9574a757ae02748b6c5f5afa3eac68e6)) +* **cli:** :zap: clean eslinter ([15f6972](https://github.com/leifermendez/bot-whatsapp/commit/15f697225775a0f0e0a440cd980f7fb8f51a1056)) +* **cli:** :zap: create-starter ([d3b8310](https://github.com/leifermendez/bot-whatsapp/commit/d3b8310180d2ad813733b1d18f2c32d7d947740a)) +* **cli:** :zap: update cli copy ([7797c2b](https://github.com/leifermendez/bot-whatsapp/commit/7797c2b46133697e2a591adab2b67e66b34a1cfe)) +* **fix:** fix ([6483545](https://github.com/leifermendez/bot-whatsapp/commit/648354500b123f20044f5ac2e8a26b15f16d1b8d)) +* **fix:** fix ([28c0480](https://github.com/leifermendez/bot-whatsapp/commit/28c0480b8bfa6b24394095f57c36ef89c9aeb566)) +* **linter:** update linter and commitlint ([70a94ab](https://github.com/leifermendez/bot-whatsapp/commit/70a94ab2c6f8e4122780c77bc3a621944883e621)) +* pre-copy fix ([08e2552](https://github.com/leifermendez/bot-whatsapp/commit/08e2552907c48cfeaac843457a18bf2032e6f8aa)) +* pre-copy fix ([6617107](https://github.com/leifermendez/bot-whatsapp/commit/6617107ab824215c449e26eae6c2bb327ecfc092)) +* **starter:** pre-copy fix ([929e74c](https://github.com/leifermendez/bot-whatsapp/commit/929e74c84b667ec13cb5490b3b951cb8df15ebd1)) + + +* (💍) Is justa test! ([37d04e9](https://github.com/leifermendez/bot-whatsapp/commit/37d04e9e89d3f01fdc367654ba60fb11ab2614c4)) + +### [0.2.1](https://github.com/leifermendez/bot-whatsapp/compare/v0.2.0...v0.2.1) (2022-12-12) + +## 0.2.0 (2022-12-12) + + +### ⚠ BREAKING CHANGES + +* 🧨 NO + +### Features + +* (🎸) add onClick prop to component ([4ae3898](https://github.com/leifermendez/bot-whatsapp/commit/4ae389846d38c133f6bb2129ae373eed39d9d08d)) +* **adapter:** added adapter mysql ([717a7dc](https://github.com/leifermendez/bot-whatsapp/commit/717a7dc95fbc107ec6f55387aff606c47144baa4)) +* **adapter:** implementation of json file adapter ([5e1a373](https://github.com/leifermendez/bot-whatsapp/commit/5e1a3737303c843095984f6357564ea18458362f)) +* **adapter:** mysql adapter ([8d73c86](https://github.com/leifermendez/bot-whatsapp/commit/8d73c86946d07aa80e5b375b62b84a88b2892e03)) +* **adapter:** sql is added to create the table ([4b7de0f](https://github.com/leifermendez/bot-whatsapp/commit/4b7de0f6901524fa2c09271c3a99c364e6b3c260)) +* **bot:** :fire: improvement provider handler ([4154cc2](https://github.com/leifermendez/bot-whatsapp/commit/4154cc223091a46d3203d3a378cd42f61749a5fa)) +* **bot:** :zap: add send image function ([ce8a96b](https://github.com/leifermendez/bot-whatsapp/commit/ce8a96b958ff814c65d8fb4dbd5eaed5cc83a1ed)) +* **ci:** :art: add releases ([b115dc3](https://github.com/leifermendez/bot-whatsapp/commit/b115dc3654996f049837bfb6b5d039a2313df0ad)) +* **ci:** :art: relases script ([2e906bc](https://github.com/leifermendez/bot-whatsapp/commit/2e906bce79f7d854d437334e1d0c2cd270b0bbc6)) +* **ci:** update ci ([e5a9db7](https://github.com/leifermendez/bot-whatsapp/commit/e5a9db7e12340c4f5baa66e8b20585b63daa3bcf)) +* **cli:** create-starter ([3977987](https://github.com/leifermendez/bot-whatsapp/commit/397798790ef5857ca758b0df8384c6a4bfacc181)) +* **provider:** :fire: add twilii (weoking) ([4350dff](https://github.com/leifermendez/bot-whatsapp/commit/4350dff22a7de69ba6d35ecbdd67e59b810bd46f)) +* **provider:** added twilio provider ([8dd3be9](https://github.com/leifermendez/bot-whatsapp/commit/8dd3be909b36717f6b54e141a5f48d2722d4855c)) +* **release:** added ([1988948](https://github.com/leifermendez/bot-whatsapp/commit/1988948c30d922beb7b83faab96d1d59cf7f5f90)) +* **release:** added ([f4ad704](https://github.com/leifermendez/bot-whatsapp/commit/f4ad7040abf619635480c30babd6f1159c7af85a)) + + +### Bug Fixes + +* **adapter:** conflict resolution ([4b307ef](https://github.com/leifermendez/bot-whatsapp/commit/4b307efe79c738a5c4e04ff1c07ca247d827593c)) +* **adapter:** corrections are made to the adapter ([afa6771](https://github.com/leifermendez/bot-whatsapp/commit/afa677190392d48715930ebe2b1e15c7619d730f)) +* **bot:** :zap: added delay promises ([73caf09](https://github.com/leifermendez/bot-whatsapp/commit/73caf090ba9013132e5dcb7761a10939dc9ac300)) +* **bot:** :zap: fix sensitive case ([24ac9fb](https://github.com/leifermendez/bot-whatsapp/commit/24ac9fbf48f80eeb521a36bc938af3a70dd82303)) +* **bot:** :zap: flow improvement + add utils ([a7b19d9](https://github.com/leifermendez/bot-whatsapp/commit/a7b19d9bff5ea66ff888555c3df37ae0e20b612a)) +* **bot:** update ([49698bf](https://github.com/leifermendez/bot-whatsapp/commit/49698bfda9d2a53f7b1a7e1724a796698601fbaa)) +* **ci:** :zap: balance version ([ec46cfd](https://github.com/leifermendez/bot-whatsapp/commit/ec46cfdd657c08c8e90261613f00cfc080f1e1d6)) +* **ci:** :zap: github action ([b827a0a](https://github.com/leifermendez/bot-whatsapp/commit/b827a0ab225b89bb8117c82628db0679c09b4102)) +* **ci:** :zap: github action ([4142ca4](https://github.com/leifermendez/bot-whatsapp/commit/4142ca4fd552e7005f3b1397a76b90a2e574d19d)) +* **ci:** :zap: github action ([091544a](https://github.com/leifermendez/bot-whatsapp/commit/091544ac3fac0c16925e856e1aec64bcad0ecf6d)) +* **ci:** :zap: github action ([2ce342a](https://github.com/leifermendez/bot-whatsapp/commit/2ce342a0cb15019d5084ca06dc30e342b030ea10)) +* **ci:** :zap: github action ([7817793](https://github.com/leifermendez/bot-whatsapp/commit/781779328f93ef8b0e6e0f85c6cd05ae782112fb)) +* **ci:** :zap: github action ([dfced8c](https://github.com/leifermendez/bot-whatsapp/commit/dfced8c594e9175c81e837af359631ba055b7e1a)) +* **ci:** :zap: github action ([aaa4ce8](https://github.com/leifermendez/bot-whatsapp/commit/aaa4ce837229fd51e274de3d91e1d9d615ac69fd)) +* **ci:** :zap: github action ([9ddf144](https://github.com/leifermendez/bot-whatsapp/commit/9ddf144244cd6877e7d26f576387814459f2befb)) +* **ci:** :zap: github action ([b465de5](https://github.com/leifermendez/bot-whatsapp/commit/b465de55a0e511213d1a7760a74efa102172c85e)) +* **ci:** :zap: github action ([cf1dc6f](https://github.com/leifermendez/bot-whatsapp/commit/cf1dc6fac810545e5a2b63f31f71322f37329e38)) +* **ci:** :zap: github action ([8d897f8](https://github.com/leifermendez/bot-whatsapp/commit/8d897f824e27a55ca011163092a813a7e8f426af)) +* **ci:** ci ([f55cfae](https://github.com/leifermendez/bot-whatsapp/commit/f55cfae6e4ccc1df949212999406680020d27f9c)) +* **ci:** ci ([671c5b3](https://github.com/leifermendez/bot-whatsapp/commit/671c5b37f33360e8cb754625b8dd6e83bce9014d)) +* **cli:** :bug: path ([32212fb](https://github.com/leifermendez/bot-whatsapp/commit/32212fb52d206bf6f8d753a86d9ce40aa0db2a5d)) +* **cli:** :fire: create script - templates ([2319db3](https://github.com/leifermendez/bot-whatsapp/commit/2319db3009501fe57ae21e60ad286eb68c46f4fd)) +* **cli:** :fire: create script - templates ([9cb98b5](https://github.com/leifermendez/bot-whatsapp/commit/9cb98b5e73fca3c3f5e70a8497badc31e494b943)) +* **cli:** :fire: create script - templates ([2999e0e](https://github.com/leifermendez/bot-whatsapp/commit/2999e0e753f31a8b9e6d7c117e78cdb5656e203a)) +* **cli:** :fire: create script - templates ([af716b7](https://github.com/leifermendez/bot-whatsapp/commit/af716b75372899877a81b528b58278376166d0ad)) +* **cli:** :fire: create script - templates ([c6999c8](https://github.com/leifermendez/bot-whatsapp/commit/c6999c84931083a87b5717db58003be68244707e)) +* **cli:** :fire: create script - templates ([d4b49a9](https://github.com/leifermendez/bot-whatsapp/commit/d4b49a9bd7085070f0c5964d2903f10b71bde0b3)) +* **cli:** :fire: create script - templates ([eebc3c9](https://github.com/leifermendez/bot-whatsapp/commit/eebc3c980638d88f11a0d93b8344f3ff345c7ee5)) +* **cli:** :zap: clean eslinter ([bfb69d9](https://github.com/leifermendez/bot-whatsapp/commit/bfb69d9a9574a757ae02748b6c5f5afa3eac68e6)) +* **cli:** :zap: clean eslinter ([15f6972](https://github.com/leifermendez/bot-whatsapp/commit/15f697225775a0f0e0a440cd980f7fb8f51a1056)) +* **cli:** :zap: create-starter ([d3b8310](https://github.com/leifermendez/bot-whatsapp/commit/d3b8310180d2ad813733b1d18f2c32d7d947740a)) +* **cli:** :zap: update cli copy ([7797c2b](https://github.com/leifermendez/bot-whatsapp/commit/7797c2b46133697e2a591adab2b67e66b34a1cfe)) +* **fix:** fix ([6483545](https://github.com/leifermendez/bot-whatsapp/commit/648354500b123f20044f5ac2e8a26b15f16d1b8d)) +* **fix:** fix ([28c0480](https://github.com/leifermendez/bot-whatsapp/commit/28c0480b8bfa6b24394095f57c36ef89c9aeb566)) +* **linter:** update linter and commitlint ([70a94ab](https://github.com/leifermendez/bot-whatsapp/commit/70a94ab2c6f8e4122780c77bc3a621944883e621)) +* pre-copy fix ([08e2552](https://github.com/leifermendez/bot-whatsapp/commit/08e2552907c48cfeaac843457a18bf2032e6f8aa)) +* pre-copy fix ([6617107](https://github.com/leifermendez/bot-whatsapp/commit/6617107ab824215c449e26eae6c2bb327ecfc092)) +* **starter:** pre-copy fix ([929e74c](https://github.com/leifermendez/bot-whatsapp/commit/929e74c84b667ec13cb5490b3b951cb8df15ebd1)) + + +* (💍) Is justa test! ([37d04e9](https://github.com/leifermendez/bot-whatsapp/commit/37d04e9e89d3f01fdc367654ba60fb11ab2614c4)) + +### [0.0.3](https://github.com/leifermendez/bot-whatsapp/compare/v0.2.0...v0.0.3) (2022-12-12) + +## 0.2.0 (2022-12-12) + + +### ⚠ BREAKING CHANGES + +* 🧨 NO + +### Features + +* (🎸) add onClick prop to component ([4ae3898](https://github.com/leifermendez/bot-whatsapp/commit/4ae389846d38c133f6bb2129ae373eed39d9d08d)) +* **adapter:** added adapter mysql ([717a7dc](https://github.com/leifermendez/bot-whatsapp/commit/717a7dc95fbc107ec6f55387aff606c47144baa4)) +* **adapter:** implementation of json file adapter ([5e1a373](https://github.com/leifermendez/bot-whatsapp/commit/5e1a3737303c843095984f6357564ea18458362f)) +* **adapter:** mysql adapter ([8d73c86](https://github.com/leifermendez/bot-whatsapp/commit/8d73c86946d07aa80e5b375b62b84a88b2892e03)) +* **adapter:** sql is added to create the table ([4b7de0f](https://github.com/leifermendez/bot-whatsapp/commit/4b7de0f6901524fa2c09271c3a99c364e6b3c260)) +* **bot:** :fire: improvement provider handler ([4154cc2](https://github.com/leifermendez/bot-whatsapp/commit/4154cc223091a46d3203d3a378cd42f61749a5fa)) +* **bot:** :zap: add send image function ([ce8a96b](https://github.com/leifermendez/bot-whatsapp/commit/ce8a96b958ff814c65d8fb4dbd5eaed5cc83a1ed)) +* **ci:** :art: add releases ([b115dc3](https://github.com/leifermendez/bot-whatsapp/commit/b115dc3654996f049837bfb6b5d039a2313df0ad)) +* **ci:** :art: relases script ([2e906bc](https://github.com/leifermendez/bot-whatsapp/commit/2e906bce79f7d854d437334e1d0c2cd270b0bbc6)) +* **ci:** update ci ([e5a9db7](https://github.com/leifermendez/bot-whatsapp/commit/e5a9db7e12340c4f5baa66e8b20585b63daa3bcf)) +* **cli:** create-starter ([3977987](https://github.com/leifermendez/bot-whatsapp/commit/397798790ef5857ca758b0df8384c6a4bfacc181)) +* **provider:** :fire: add twilii (weoking) ([4350dff](https://github.com/leifermendez/bot-whatsapp/commit/4350dff22a7de69ba6d35ecbdd67e59b810bd46f)) +* **provider:** added twilio provider ([8dd3be9](https://github.com/leifermendez/bot-whatsapp/commit/8dd3be909b36717f6b54e141a5f48d2722d4855c)) +* **release:** added ([1988948](https://github.com/leifermendez/bot-whatsapp/commit/1988948c30d922beb7b83faab96d1d59cf7f5f90)) +* **release:** added ([f4ad704](https://github.com/leifermendez/bot-whatsapp/commit/f4ad7040abf619635480c30babd6f1159c7af85a)) + + +### Bug Fixes + +* **adapter:** conflict resolution ([4b307ef](https://github.com/leifermendez/bot-whatsapp/commit/4b307efe79c738a5c4e04ff1c07ca247d827593c)) +* **adapter:** corrections are made to the adapter ([afa6771](https://github.com/leifermendez/bot-whatsapp/commit/afa677190392d48715930ebe2b1e15c7619d730f)) +* **bot:** :zap: added delay promises ([73caf09](https://github.com/leifermendez/bot-whatsapp/commit/73caf090ba9013132e5dcb7761a10939dc9ac300)) +* **bot:** :zap: fix sensitive case ([24ac9fb](https://github.com/leifermendez/bot-whatsapp/commit/24ac9fbf48f80eeb521a36bc938af3a70dd82303)) +* **bot:** :zap: flow improvement + add utils ([a7b19d9](https://github.com/leifermendez/bot-whatsapp/commit/a7b19d9bff5ea66ff888555c3df37ae0e20b612a)) +* **bot:** update ([49698bf](https://github.com/leifermendez/bot-whatsapp/commit/49698bfda9d2a53f7b1a7e1724a796698601fbaa)) +* **ci:** :zap: balance version ([ec46cfd](https://github.com/leifermendez/bot-whatsapp/commit/ec46cfdd657c08c8e90261613f00cfc080f1e1d6)) +* **ci:** :zap: github action ([b827a0a](https://github.com/leifermendez/bot-whatsapp/commit/b827a0ab225b89bb8117c82628db0679c09b4102)) +* **ci:** :zap: github action ([4142ca4](https://github.com/leifermendez/bot-whatsapp/commit/4142ca4fd552e7005f3b1397a76b90a2e574d19d)) +* **ci:** :zap: github action ([091544a](https://github.com/leifermendez/bot-whatsapp/commit/091544ac3fac0c16925e856e1aec64bcad0ecf6d)) +* **ci:** :zap: github action ([2ce342a](https://github.com/leifermendez/bot-whatsapp/commit/2ce342a0cb15019d5084ca06dc30e342b030ea10)) +* **ci:** :zap: github action ([7817793](https://github.com/leifermendez/bot-whatsapp/commit/781779328f93ef8b0e6e0f85c6cd05ae782112fb)) +* **ci:** :zap: github action ([dfced8c](https://github.com/leifermendez/bot-whatsapp/commit/dfced8c594e9175c81e837af359631ba055b7e1a)) +* **ci:** :zap: github action ([aaa4ce8](https://github.com/leifermendez/bot-whatsapp/commit/aaa4ce837229fd51e274de3d91e1d9d615ac69fd)) +* **ci:** :zap: github action ([9ddf144](https://github.com/leifermendez/bot-whatsapp/commit/9ddf144244cd6877e7d26f576387814459f2befb)) +* **ci:** :zap: github action ([b465de5](https://github.com/leifermendez/bot-whatsapp/commit/b465de55a0e511213d1a7760a74efa102172c85e)) +* **ci:** :zap: github action ([cf1dc6f](https://github.com/leifermendez/bot-whatsapp/commit/cf1dc6fac810545e5a2b63f31f71322f37329e38)) +* **ci:** :zap: github action ([8d897f8](https://github.com/leifermendez/bot-whatsapp/commit/8d897f824e27a55ca011163092a813a7e8f426af)) +* **ci:** ci ([f55cfae](https://github.com/leifermendez/bot-whatsapp/commit/f55cfae6e4ccc1df949212999406680020d27f9c)) +* **ci:** ci ([671c5b3](https://github.com/leifermendez/bot-whatsapp/commit/671c5b37f33360e8cb754625b8dd6e83bce9014d)) +* **cli:** :bug: path ([32212fb](https://github.com/leifermendez/bot-whatsapp/commit/32212fb52d206bf6f8d753a86d9ce40aa0db2a5d)) +* **cli:** :fire: create script - templates ([2319db3](https://github.com/leifermendez/bot-whatsapp/commit/2319db3009501fe57ae21e60ad286eb68c46f4fd)) +* **cli:** :fire: create script - templates ([9cb98b5](https://github.com/leifermendez/bot-whatsapp/commit/9cb98b5e73fca3c3f5e70a8497badc31e494b943)) +* **cli:** :fire: create script - templates ([2999e0e](https://github.com/leifermendez/bot-whatsapp/commit/2999e0e753f31a8b9e6d7c117e78cdb5656e203a)) +* **cli:** :fire: create script - templates ([af716b7](https://github.com/leifermendez/bot-whatsapp/commit/af716b75372899877a81b528b58278376166d0ad)) +* **cli:** :fire: create script - templates ([c6999c8](https://github.com/leifermendez/bot-whatsapp/commit/c6999c84931083a87b5717db58003be68244707e)) +* **cli:** :fire: create script - templates ([d4b49a9](https://github.com/leifermendez/bot-whatsapp/commit/d4b49a9bd7085070f0c5964d2903f10b71bde0b3)) +* **cli:** :fire: create script - templates ([eebc3c9](https://github.com/leifermendez/bot-whatsapp/commit/eebc3c980638d88f11a0d93b8344f3ff345c7ee5)) +* **cli:** :zap: clean eslinter ([bfb69d9](https://github.com/leifermendez/bot-whatsapp/commit/bfb69d9a9574a757ae02748b6c5f5afa3eac68e6)) +* **cli:** :zap: clean eslinter ([15f6972](https://github.com/leifermendez/bot-whatsapp/commit/15f697225775a0f0e0a440cd980f7fb8f51a1056)) +* **cli:** :zap: create-starter ([d3b8310](https://github.com/leifermendez/bot-whatsapp/commit/d3b8310180d2ad813733b1d18f2c32d7d947740a)) +* **cli:** :zap: update cli copy ([7797c2b](https://github.com/leifermendez/bot-whatsapp/commit/7797c2b46133697e2a591adab2b67e66b34a1cfe)) +* **fix:** fix ([6483545](https://github.com/leifermendez/bot-whatsapp/commit/648354500b123f20044f5ac2e8a26b15f16d1b8d)) +* **fix:** fix ([28c0480](https://github.com/leifermendez/bot-whatsapp/commit/28c0480b8bfa6b24394095f57c36ef89c9aeb566)) +* **linter:** update linter and commitlint ([70a94ab](https://github.com/leifermendez/bot-whatsapp/commit/70a94ab2c6f8e4122780c77bc3a621944883e621)) +* pre-copy fix ([08e2552](https://github.com/leifermendez/bot-whatsapp/commit/08e2552907c48cfeaac843457a18bf2032e6f8aa)) +* pre-copy fix ([6617107](https://github.com/leifermendez/bot-whatsapp/commit/6617107ab824215c449e26eae6c2bb327ecfc092)) +* **starter:** pre-copy fix ([929e74c](https://github.com/leifermendez/bot-whatsapp/commit/929e74c84b667ec13cb5490b3b951cb8df15ebd1)) + + +* (💍) Is justa test! ([37d04e9](https://github.com/leifermendez/bot-whatsapp/commit/37d04e9e89d3f01fdc367654ba60fb11ab2614c4)) + ## 0.2.0-alpha.0 (2022-12-01) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 29c9fdf62..4b1954d44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,10 +4,10 @@ __Requerimientos:__ - Node v16 o superior __[descargar node](https://nodejs.org/es/download/)__ -- __[Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)__ como gestor de paquetes. En el link conseguiras las intrucciones para instalar yarn. -- __[VSCode](https://code.visualstudio.com/download)__ (recomendado): Editor de codigo con plugins -- __[Conventional Commits](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits&ssr=false#overview)__ (plugin-vscode) este plugin te ayudara a crear commit semantico. -- Se usara la rama __dev__ *(https://github.com/leifermendez/bot-whatsapp/tree/dev)* como rama principal hasta que se haga oficialmente el lanzamiento de la V2 +- __[Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)__ como gestor de paquetes. En el link conseguirás las intrucciones para instalar yarn. +- __[VSCode](https://code.visualstudio.com/download)__ (recomendado): Editor de código con plugins. +- __[Conventional Commits](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits&ssr=false#overview)__ (plugin-vscode) este plugin te ayudará a crear commit semántico. +- Se usará la rama __dev__ *(https://github.com/leifermendez/bot-whatsapp/tree/dev)* como rama principal hasta que se haga oficialmente el lanzamiento de la V2. ### 🚀 Iniciando @@ -22,14 +22,14 @@ yarn install ``` __Compilar (build)__ -Para compilar la aplicación es necesario ejecutar, eso te genera dentro de packages del monorepo un directorio `lib` +Para compilar la aplicación es necesario ejecutar este comando, el cual genera un directorio `lib` dentro de los paquetes del monorepo. ``` yarn build ``` __Example-app__ -Se ejecuta el CLI (Command Line Interface) para ayudarte a crear un app-bot de ejemplo +Se ejecuta el CLI (Command Line Interface) para ayudarte a crear un app-bot de ejemplo. ``` yarn run cli ``` @@ -42,15 +42,16 @@ npm run pre-copy npm start ``` -__Commit y Push__ -El proyecto tiene implementado __[husky](https://typicode.github.io/husky/#/)__ es una herramienta que dispara unas acciones al momento de hacer commit y hacer push +### __Commit y Push__ -__commit:__ Los commit son semanticos esto quiere decir que deben cumplir un standar al momento de escribirlos ejemplo ` feat(adapter): new adapter myqsl ` puede ver más info sobre esto __[aquí](https://github.com/conventional-changelog/commitlint/#what-is-commitlint)__ +El proyecto tiene implementado __[husky](https://typicode.github.io/husky/#/)__, es una herramienta que dispara unas acciones al momento de hacer commit y hacer push. -__push:__ Cada push ejecutar `yarn run test` el cual ejecuta los test internos que tienen que cumplir con __95% de cobertura__. +__commit:__ Los commit son semánticos, esto quiere decir que deben cumplir un standar al momento de escribirlos ejemplo: ` feat(adapter): new adapter myqsl ` puede ver más info sobre esto __[aquí](https://github.com/conventional-changelog/commitlint/#what-is-commitlint)__ +__push:__ Cada push ejecutar `yarn run test` el cual realiza los test internos que tienen que cumplir con __95% de cobertura__. -> Documento en constaten actualización.... + +> Documento en constante actualización.... ------ - [Discord](https://link.codigoencasa.com/DISCORD) diff --git a/README.md b/README.md index 1285f5ff9..a75b6bef5 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ -------- 🦊 Documentación: [https://bot-whatsapp.pages.dev/](https://bot-whatsapp.pages.dev/) Video como hacer PR: https://youtu.be/Lxt8Acob6aU - -- [ ] Evitar dependencias + +🚀 __Roadmap:__ [https://github.com/users/leifermendez/projects/4/views/1](https://github.com/users/leifermendez/projects/4/views/1) **Comunidad** @@ -12,17 +12,24 @@ Video como hacer PR: https://youtu.be/Lxt8Acob6aU + -
- - vicente1992 + + leifermendez
- Manuel Vicente Ortiz + Leifer Mendez
- - leifermendez + + aurik3
- Leifer Mendez + Null +
+
+ + vicente1992 +
+ Manuel Vicente Ortiz
@@ -39,13 +46,6 @@ Video como hacer PR: https://youtu.be/Lxt8Acob6aU Null - - aurik3 -
- Null -
-
jzvi12 diff --git a/core.class.log b/core.class.log deleted file mode 100644 index 5961e96ce..000000000 --- a/core.class.log +++ /dev/null @@ -1,3 +0,0 @@ -[handleMsg]: { from: 'XXXXXX', body: 'hola', hasMedia: false } -[handleMsg]: { from: 'XXXXXX', body: 'hola', hasMedia: false } -[handleMsg]: { from: 'XXXXXX', body: 'hola', hasMedia: false } diff --git a/package.json b/package.json index 951532069..8a8ebe0d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bot-whatsapp/root", - "version": "0.2.0-alpha.0", + "version": "0.1.2", "description": "Bot de wahtsapp open source para MVP o pequeños negocios", "main": "app.js", "private": true, @@ -11,12 +11,13 @@ "bot:rollup": "rollup --config ./packages/bot/rollup-bot.config.js", "provider:rollup": "rollup --config ./packages/provider/rollup-provider.config.js ", "database:rollup": "rollup --config ./packages/database/rollup-database.config.js", + "create-bot-whatsapp:rollup": "rollup --config ./packages/create-bot-whatsapp/rollup-create.config.js", "format:check": "prettier --check ./packages", "format:write": "prettier --write ./packages", "fmt.staged": "pretty-quick --staged", "lint:check": "eslint ./packages", "lint:fix": "eslint --fix ./packages", - "build": "yarn run cli:rollup && yarn run bot:rollup && yarn run provider:rollup && yarn run database:rollup", + "build": "yarn run cli:rollup && yarn run bot:rollup && yarn run provider:rollup && yarn run database:rollup && yarn run create-bot-whatsapp:rollup", "copy.lib": "node ./scripts/move.js", "test.unit": "node ./node_modules/uvu/bin.js packages test", "test.coverage": "node ./node_modules/c8/bin/c8.js npm run test.unit", @@ -28,7 +29,7 @@ "prepare": "npx husky install", "preinstall": "npx only-allow yarn", "postinstall": "npx prettier --write .", - "release": "standard-version" + "release": "standard-version -- --prerelease" }, "workspaces": [ "packages/create-bot-whatsapp", @@ -80,6 +81,7 @@ "rollup": "^3.2.3", "rollup-plugin-cleanup": "^3.2.1", "rollup-plugin-copy": "^3.4.0", + "semver": "^7.3.8", "standard-version": "^9.5.0", "uvu": "^0.5.6" }, diff --git a/packages/bot/core/core.class.js b/packages/bot/core/core.class.js index f7726c8e1..e04bd1387 100644 --- a/packages/bot/core/core.class.js +++ b/packages/bot/core/core.class.js @@ -34,16 +34,16 @@ class CoreClass { listenerBusEvents = () => [ { event: 'preinit', - func: () => printer('Iniciando provider espere...'), + func: () => printer('Iniciando proveedor, espere...'), }, { event: 'require_action', - func: ({ instructions, title = '⚡⚡ ACCION REQUERIDA ⚡⚡' }) => + func: ({ instructions, title = '⚡⚡ ACCIÓN REQUERIDA ⚡⚡' }) => printer(instructions, title), }, { event: 'ready', - func: () => printer('Provider conectado y listo'), + func: () => printer('Proveedor conectado y listo'), }, { event: 'auth_failure', diff --git a/packages/bot/package.json b/packages/bot/package.json index f6affeed2..ebd2d4bba 100644 --- a/packages/bot/package.json +++ b/packages/bot/package.json @@ -1,9 +1,8 @@ { "name": "@bot-whatsapp/bot", - "version": "0.0.1", + "version": "0.0.22-alpha.0", "description": "", "main": "./lib/bundle.bot.cjs", - "private": true, "scripts": { "bot:rollup": "node ../../node_modules/.bin/rollup index.js --config ./rollup-cli.config.js", "format:check": "prettier --check .", diff --git a/packages/bot/provider/provider.class.js b/packages/bot/provider/provider.class.js index 5fc4bb8c0..212f0428f 100644 --- a/packages/bot/provider/provider.class.js +++ b/packages/bot/provider/provider.class.js @@ -19,7 +19,7 @@ class ProviderClass extends EventEmitter { * */ - sendMessage = async (userId, message, sendMessage) => { + sendMessage = async (userId, message) => { if (NODE_ENV !== 'production') console.log('[sendMessage]', { userId, message }) return message diff --git a/packages/cli/check/index.js b/packages/cli/check/index.js index ec4f235a5..73d5924bb 100644 --- a/packages/cli/check/index.js +++ b/packages/cli/check/index.js @@ -12,20 +12,20 @@ const checkNodeVersion = () => { ) process.exit(1) } - console.log(green(`Node.js combatible ${version}`)) + console.log(green(`Node.js compatible ${version}`)) console.log(``) } const checkOs = () => { - console.log(bgCyan('🙂 Revisando tu Sistema Operativo')) + console.log(bgCyan('🙂 Revisando tu sistema operativo')) const os = process.platform if (!os.includes('win32')) { const messages = [ `El sistema operativo actual (${os}) posiblemente requiera`, - `una confiuración adicional referente al puppeter`, + `una configuración adicional referente al puppeteer`, ``, `Recuerda pasar por el WIKI`, - `🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalaci%C3%B3n`, + `🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalación`, ``, ] diff --git a/packages/cli/create-app/index.js b/packages/cli/create-app/index.js index e76624018..3890e7efe 100644 --- a/packages/cli/create-app/index.js +++ b/packages/cli/create-app/index.js @@ -12,9 +12,13 @@ const copyFiles = async (from, to) => { } } -const copyBaseApp = async () => { - const BASEP_APP_PATH_FROM = `${process.cwd()}/starters/apps/base` - const BASEP_APP_PATH_TO = `${process.cwd()}/example-app-base` +/** + * Copiar directorio con archivos + * @param {*} templateName + */ +const copyBaseApp = async (fromDir = process.cwd(), toDir = process.cwd()) => { + const BASEP_APP_PATH_FROM = `${fromDir}` + const BASEP_APP_PATH_TO = `${toDir}` await copyFiles(BASEP_APP_PATH_FROM, BASEP_APP_PATH_TO) } diff --git a/packages/cli/install/tool.js b/packages/cli/install/tool.js index 6ec176c33..8095cd08a 100644 --- a/packages/cli/install/tool.js +++ b/packages/cli/install/tool.js @@ -14,7 +14,7 @@ const getPkgManage = async () => { } const installDeps = (pkgManager, packageList) => { - const errorMessage = `Ocurrio un error instalando ${packageList}` + const errorMessage = `Ocurrió un error instalando ${packageList}` let childProcess = [] const installSingle = (pkgInstall) => () => { diff --git a/packages/cli/interactive/index.js b/packages/cli/interactive/index.js index a251ea783..7da0029cb 100644 --- a/packages/cli/interactive/index.js +++ b/packages/cli/interactive/index.js @@ -1,54 +1,59 @@ const prompts = require('prompts') -const { yellow, red } = require('kleur') -const { installAll } = require('../install') -const { cleanSession } = require('../clean') +const { yellow, red, cyan, bgMagenta } = require('kleur') const { copyBaseApp } = require('../create-app') +const { join } = require('path') +const { existsSync } = require('fs') const { checkNodeVersion, checkOs } = require('../check') -const { jsonConfig } = require('../configuration') + +const bannerDone = () => { + console.log(``) + console.log( + cyan( + [ + `[Agradecimientos]: Este es un proyecto OpenSource, si tienes intenciones de colaborar puedes hacerlo:`, + `[😉] Comprando un cafe https://www.buymeacoffee.com/leifermendez`, + `[⭐] Dar estrella https://github.com/leifermendez/bot-whatsapp`, + `[🚀] Realizando mejoras en el codigo`, + ].join('\n') + ) + ) + console.log(``) +} const startInteractive = async () => { const questions = [ { type: 'text', - name: 'exampeOpt', - message: - 'Quieres crear una app de ejemplo "example-app-example"? (Y/n)', - }, - // { - // type: 'text', - // name: 'dependencies', - // message: - // 'Quieres actualizar las librerias "whatsapp-web.js"? (Y/n)', - // }, - { - type: 'text', - name: 'cleanTmp', - message: 'Quieres limpiar la session del bot? (Y/n)', + name: 'outDir', + message: 'Quieres crear un bot? (Y/n)', }, { type: 'multiselect', name: 'providerWs', - message: 'Proveedor de Whatsapp', + message: '¿Cuál proveedor de whatsapp quieres utilizar?', choices: [ - { title: 'whatsapp-web.js', value: 'whatsapp-web.js' }, + { title: 'whatsapp-web.js (gratis)', value: 'wweb' }, + { title: 'Twilio', value: 'twilio' }, + { title: 'Venom (gratis)', value: 'venom' }, + { title: 'Baileys (gratis)', value: 'bailey' }, { title: 'API Oficial (Meta)', value: 'meta', disabled: true }, - { title: 'Twilio', value: 'twilio', disabled: true }, ], max: 1, - hint: 'Espacio para selecionar', + hint: 'Espacio para seleccionar', instructions: '↑/↓', }, { type: 'multiselect', name: 'providerDb', - message: 'Cual base de datos quieres usar', + message: '¿Cuál base de datos quieres utilizar?', choices: [ - { title: 'JSONFile', value: 'json' }, - { title: 'MySQL', value: 'mysql', disabled: true }, - { title: 'Mongo', value: 'mongo', disabled: true }, + { title: 'Memory', value: 'memory' }, + { title: 'Mongo', value: 'mongo' }, + { title: 'MySQL', value: 'mysql' }, + { title: 'Json', value: 'json', disabled: true }, ], max: 1, - hint: 'Espacio para selecionar', + hint: 'Espacio para seleccionar', instructions: '↑/↓', }, ] @@ -57,90 +62,78 @@ const startInteractive = async () => { checkNodeVersion() checkOs() const onCancel = () => { - console.log('Proceso cancelado!') + console.log('¡Proceso cancelado!') return true } const response = await prompts(questions, { onCancel }) - const { - dependencies = '', - cleanTmp = '', - exampeOpt = '', - providerDb = [], - providerWs = [], - } = response - /** - * Question - * @returns - */ - const installOrUdpateDep = async () => { - const answer = dependencies.toLowerCase() || 'n' - if (answer.includes('n')) return true + const { outDir = '', providerDb = [], providerWs = [] } = response - if (answer.includes('y')) { - await installAll() - return true - } - } + const createApp = async (templateName = null) => { + if (!templateName) + throw new Error('TEMPLATE_NAME_INVALID: ', templateName) - /** - * Question - * @returns - */ - const cleanAllSession = async () => { - const answer = cleanTmp.toLowerCase() || 'n' - if (answer.includes('n')) return true + const possiblesPath = [ + join(__dirname, '..', '..', 'starters', 'apps', templateName), + join(__dirname, '..', 'starters', 'apps', templateName), + join(__dirname, 'starters', 'apps', templateName), + ] - if (answer.includes('y')) { - await cleanSession() - return true - } - } - - const createApp = async () => { - const answer = exampeOpt.toLowerCase() || 'n' + const answer = outDir.toLowerCase() || 'n' if (answer.includes('n')) return true if (answer.includes('y')) { - await copyBaseApp() - return true + const indexOfPath = possiblesPath.find((a) => existsSync(a)) + await copyBaseApp(indexOfPath, join(process.cwd(), templateName)) + console.log(``) + console.log(bgMagenta(`⚡⚡⚡INSTRUCCIONES⚡⚡⚡`)) + console.log(yellow(`cd ${templateName}`)) + console.log(yellow(`npm install`)) + console.log(yellow(`npm start`)) + console.log(``) + + return outDir } } + /** + * Selccionar Provider (meta, twilio, etc...) + * @returns + */ const vendorProvider = async () => { + const [answer] = providerWs if (!providerWs.length) { console.log( red( - `Debes de seleccionar una WS Provider. Tecla [Space] para seleccionar` + `Debes seleccionar un proveedor de whatsapp. Tecla [Space] para seleccionar` ) ) process.exit(1) } - console.log(yellow(`'Deberia crer una carpeta en root/provider'`)) - return true + return answer } + /** + * Selecionar adaptador de base de datos + * @returns + */ const dbProvider = async () => { - const answer = providerDb + const [answer] = providerDb if (!providerDb.length) { console.log( red( - `Debes de seleccionar una DB Provider. Tecla [Space] para seleccionar` + `Debes seleccionar un proveedor de base de datos. Tecla [Space] para seleccionar` ) ) process.exit(1) } - if (answer === 'json') { - console.log('Deberia crer una carpeta en root/data') - return 1 - } + return answer } - await createApp() - await installOrUdpateDep() - await cleanAllSession() - await vendorProvider() - await dbProvider() - await jsonConfig() + const providerAdapter = await vendorProvider() + const dbAdapter = await dbProvider() + const NAME_DIR = ['base', providerAdapter, dbAdapter].join('-') + await createApp(NAME_DIR) + bannerDone() } module.exports = { startInteractive } diff --git a/packages/cli/package.json b/packages/cli/package.json index fd9b7f7e5..603044614 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,9 +1,8 @@ { "name": "@bot-whatsapp/cli", - "version": "0.0.1", + "version": "0.0.29-alpha.0", "description": "", "main": "index.js", - "private": true, "devDependencies": { "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", @@ -11,6 +10,7 @@ "kleur": "^4.1.5" }, "files": [ + "./starters/", "./lib/cli/bundle.cli.cjs" ], "bin": { diff --git a/packages/cli/rollup-cli.config.js b/packages/cli/rollup-cli.config.js index a28c560fc..597071b4a 100644 --- a/packages/cli/rollup-cli.config.js +++ b/packages/cli/rollup-cli.config.js @@ -1,5 +1,6 @@ const banner = require('../../config/banner.rollup.json') const commonjs = require('@rollup/plugin-commonjs') +const copy = require('rollup-plugin-copy') const { nodeResolve } = require('@rollup/plugin-node-resolve') const { join } = require('path') @@ -12,5 +13,11 @@ module.exports = { file: PATH, format: 'cjs', }, - plugins: [commonjs(), nodeResolve()], + plugins: [ + copy({ + targets: [{ src: 'starters/*', dest: join(__dirname, 'starters') }], + }), + commonjs(), + nodeResolve(), + ], } diff --git a/packages/create-bot-whatsapp/bin/create.js b/packages/create-bot-whatsapp/bin/create.js old mode 100644 new mode 100755 index 546eca2f7..500df31db --- a/packages/create-bot-whatsapp/bin/create.js +++ b/packages/create-bot-whatsapp/bin/create.js @@ -1,3 +1,3 @@ #!/usr/bin/env node -const main = require('../lib/bin/bundle.create.cjs') +const main = require('../lib/bundle.create-bot-whatsapp.cjs') main() diff --git a/packages/create-bot-whatsapp/index.js b/packages/create-bot-whatsapp/index.js index 7df7d03d4..21a1e4411 100644 --- a/packages/create-bot-whatsapp/index.js +++ b/packages/create-bot-whatsapp/index.js @@ -1,12 +1,10 @@ +const { startInteractive } = require('../cli') /** - * Main function + * Voy a llamar directo a CLI + * Temporalmente luego mejoro esta + * parte + * @returns */ -const main = () => { - console.clear() - console.log(``) - console.log(`[PostInstall]: Este es el main function.`) - console.log(`[PostInstall]: 👌 Aqui podrias instalar cosas`) - console.log(``) -} +const main = () => startInteractive() module.exports = main diff --git a/packages/create-bot-whatsapp/package.json b/packages/create-bot-whatsapp/package.json index 65926f861..5de6a2b45 100644 --- a/packages/create-bot-whatsapp/package.json +++ b/packages/create-bot-whatsapp/package.json @@ -1,13 +1,15 @@ { "name": "create-bot-whatsapp", - "version": "0.0.1", + "version": "0.0.40-alpha.0", "description": "", - "main": "./lib/bin/bundle.create.cjs", - "private": true, + "main": "./lib/bundle.create-bot-whatsapp.cjs", + "files": [ + "./starters/", + "./bin/create.js", + "./lib/bundle.create-bot-whatsapp.cjs" + ], + "bin": "./bin/create.js", "dependencies": { "@bot-whatsapp/cli": "*" - }, - "bin": { - "bot": "./lib/bin/bundle.create.cjs" } } diff --git a/packages/create-bot-whatsapp/rollup-create.config.js b/packages/create-bot-whatsapp/rollup-create.config.js index 54f93f154..cc5eb34a7 100644 --- a/packages/create-bot-whatsapp/rollup-create.config.js +++ b/packages/create-bot-whatsapp/rollup-create.config.js @@ -1,9 +1,10 @@ const banner = require('../../config/banner.rollup.json') const commonjs = require('@rollup/plugin-commonjs') +const copy = require('rollup-plugin-copy') const { nodeResolve } = require('@rollup/plugin-node-resolve') const { join } = require('path') -const PATH = join(__dirname, 'lib', 'bin', 'bundle.create.cjs') +const PATH = join(__dirname, 'lib', 'bundle.create-bot-whatsapp.cjs') module.exports = { input: join(__dirname, 'index.js'), @@ -12,5 +13,11 @@ module.exports = { file: PATH, format: 'cjs', }, - plugins: [commonjs(), nodeResolve()], + plugins: [ + copy({ + targets: [{ src: 'starters/*', dest: join(__dirname, 'starters') }], + }), + commonjs(), + nodeResolve(), + ], } diff --git a/packages/database/package.json b/packages/database/package.json index 9ffa4d3a2..571d809d3 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -1,20 +1,24 @@ { "name": "@bot-whatsapp/database", - "version": "0.0.1", + "version": "0.0.21-alpha.0", "description": "Esto es el conector a mysql, pg, mongo", "main": "./lib/mock/index.cjs", - "private": true, "keywords": [], "author": "", "license": "ISC", + "files": [ + "./lib/" + ], "dependencies": { "dotenv": "^16.0.3", "mongodb": "^4.11.0", - "mysql2": "^2.3.3" + "mysql2": "^2.3.3", + "stormdb": "^0.6.0" }, "exports": { "./mock": "./lib/mock/index.cjs", "./mongo": "./lib/mongo/index.cjs", + "./json-file": "./lib/json-file/index.cjs", "./mysql": "./lib/mysql/index.cjs" } } diff --git a/packages/database/rollup-database.config.js b/packages/database/rollup-database.config.js index 0f88d13d4..1eecdbae2 100644 --- a/packages/database/rollup-database.config.js +++ b/packages/database/rollup-database.config.js @@ -30,4 +30,12 @@ module.exports = [ }, plugins: [commonjs()], }, + { + input: join(__dirname, 'src', 'json-file', 'index.js'), + output: { + banner: banner['banner.output'].join(''), + file: join(__dirname, 'lib', 'json-file', 'index.cjs'), + }, + plugins: [commonjs()], + }, ] diff --git a/packages/database/src/json-file/index.js b/packages/database/src/json-file/index.js new file mode 100644 index 000000000..af53df8e8 --- /dev/null +++ b/packages/database/src/json-file/index.js @@ -0,0 +1,48 @@ +const path = require('path') +const StormDB = require('stormdb') +const engine = new StormDB.localFileEngine( + path.join(process.cwd(), './db.stormdb') +) + +class JsonFileAdapter { + db + listHistory = [] + + constructor() { + this.init().then() + } + + init() { + return new Promise((resolve) => { + this.db = new StormDB(engine) + this.db.default({ history: [] }) + resolve(this.db) + }) + } + + getPrevByNumber = async (from) => { + const response = await this.db.get('history') + const { history } = response.state + + if (!history.length) { + return null + } + + const result = history.filter((res) => res.from === from).pop() + + return { + ...result, + } + } + + save = async (ctx) => { + await this.db + .get('history') + .push({ ...ctx }) + .save() + console.log('Guardado en DB...', ctx) + this.listHistory.push(ctx) + } +} + +module.exports = JsonFileAdapter diff --git a/packages/docs/adaptors/cloudflare-pages/vite.config.ts b/packages/docs/adaptors/cloudflare-pages/vite.config.ts index b03956f14..dc2bfde77 100644 --- a/packages/docs/adaptors/cloudflare-pages/vite.config.ts +++ b/packages/docs/adaptors/cloudflare-pages/vite.config.ts @@ -1,19 +1,19 @@ -import { cloudflarePagesAdaptor } from '@builder.io/qwik-city/adaptors/cloudflare-pages/vite'; -import { extendConfig } from '@builder.io/qwik-city/vite'; -import baseConfig from '../../vite.config'; +import { cloudflarePagesAdaptor } from '@builder.io/qwik-city/adaptors/cloudflare-pages/vite' +import { extendConfig } from '@builder.io/qwik-city/vite' +import baseConfig from '../../vite.config' export default extendConfig(baseConfig, () => { - return { - build: { - ssr: true, - rollupOptions: { - input: ['src/entry.cloudflare-pages.tsx', '@qwik-city-plan'], - }, - }, - plugins: [ - cloudflarePagesAdaptor({ - staticGenerate: true, - }), - ], - }; -}); + return { + build: { + ssr: true, + rollupOptions: { + input: ['src/entry.cloudflare-pages.tsx', '@qwik-city-plan'], + }, + }, + plugins: [ + cloudflarePagesAdaptor({ + staticGenerate: true, + }), + ], + } +}) diff --git a/packages/docs/functions/[[path]].ts b/packages/docs/functions/[[path]].ts index 66013ad05..ce9a1291f 100644 --- a/packages/docs/functions/[[path]].ts +++ b/packages/docs/functions/[[path]].ts @@ -2,4 +2,4 @@ // Cloudflare Pages Functions // https://developers.cloudflare.com/pages/platform/functions/ -export { onRequest } from '../server/entry.cloudflare-pages'; +export { onRequest } from '../server/entry.cloudflare-pages' diff --git a/packages/docs/package.json b/packages/docs/package.json index 7a94d1768..c5955ac54 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -1,44 +1,44 @@ { - "name": "bot-whatsapp-docs", - "version": "0.0.1", - "description": "Basic start point to build a docs site with Qwik", - "engines": { - "node": ">=15.0.0" - }, - "private": true, - "scripts": { - "build": "qwik build", - "build.client": "vite build", - "build.preview": "vite build --ssr src/entry.preview.tsx", - "build.server": "vite build -c adaptors/cloudflare-pages/vite.config.ts", - "build.types": "tsc --incremental --noEmit", - "deploy": "wrangler pages dev ./dist", - "dev": "vite --mode ssr", - "dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force", - "fmt": "prettier --write .", - "fmt.check": "prettier --check .", - "lint": "eslint \"src/**/*.ts*\"", - "preview": "qwik build preview && vite preview --open", - "start": "vite --open --mode ssr", - "qwik": "qwik" - }, - "devDependencies": { - "@builder.io/qwik": "0.14.1", - "@builder.io/qwik-city": "0.0.127", - "@types/eslint": "8.4.10", - "@types/node": "latest", - "@typescript-eslint/eslint-plugin": "5.43.0", - "@typescript-eslint/parser": "5.43.0", - "autoprefixer": "10.4.11", - "eslint": "8.28.0", - "eslint-plugin-qwik": "0.14.1", - "node-fetch": "3.3.0", - "postcss": "^8.4.16", - "prettier": "2.7.1", - "tailwindcss": "^3.1.8", - "typescript": "4.9.3", - "vite": "3.2.4", - "vite-tsconfig-paths": "3.5.0", - "wrangler": "latest" - } + "name": "bot-whatsapp-docs", + "version": "0.0.1", + "description": "Basic start point to build a docs site with Qwik", + "engines": { + "node": ">=15.0.0" + }, + "private": true, + "scripts": { + "build": "qwik build", + "build.client": "vite build", + "build.preview": "vite build --ssr src/entry.preview.tsx", + "build.server": "vite build -c adaptors/cloudflare-pages/vite.config.ts", + "build.types": "tsc --incremental --noEmit", + "deploy": "wrangler pages dev ./dist", + "dev": "vite --mode ssr", + "dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force", + "fmt": "prettier --write .", + "fmt.check": "prettier --check .", + "lint": "eslint \"src/**/*.ts*\"", + "preview": "qwik build preview && vite preview --open", + "start": "vite --open --mode ssr", + "qwik": "qwik" + }, + "devDependencies": { + "@builder.io/qwik": "0.14.1", + "@builder.io/qwik-city": "0.0.127", + "@types/eslint": "8.4.10", + "@types/node": "latest", + "@typescript-eslint/eslint-plugin": "5.43.0", + "@typescript-eslint/parser": "5.43.0", + "autoprefixer": "10.4.11", + "eslint": "8.28.0", + "eslint-plugin-qwik": "0.14.1", + "node-fetch": "3.3.0", + "postcss": "^8.4.16", + "prettier": "2.7.1", + "tailwindcss": "^3.1.8", + "typescript": "4.9.3", + "vite": "3.2.4", + "vite-tsconfig-paths": "3.5.0", + "wrangler": "latest" + } } diff --git a/packages/docs/postcss.config.js b/packages/docs/postcss.config.js index 33ad091d2..fef1b2256 100644 --- a/packages/docs/postcss.config.js +++ b/packages/docs/postcss.config.js @@ -1,6 +1,6 @@ module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, } diff --git a/packages/docs/public/manifest.json b/packages/docs/public/manifest.json index c18e75f72..44825fa8c 100644 --- a/packages/docs/public/manifest.json +++ b/packages/docs/public/manifest.json @@ -1,9 +1,9 @@ { - "$schema": "https://json.schemastore.org/web-manifest-combined.json", - "name": "qwik-project-name", - "short_name": "Welcome to Qwik", - "start_url": ".", - "display": "standalone", - "background_color": "#fff", - "description": "A Qwik project app." + "$schema": "https://json.schemastore.org/web-manifest-combined.json", + "name": "qwik-project-name", + "short_name": "Welcome to Qwik", + "start_url": ".", + "display": "standalone", + "background_color": "#fff", + "description": "A Qwik project app." } diff --git a/packages/docs/src/components/breadcrumbs/breadcrumbs.css b/packages/docs/src/components/breadcrumbs/breadcrumbs.css index c278f5180..46263912c 100644 --- a/packages/docs/src/components/breadcrumbs/breadcrumbs.css +++ b/packages/docs/src/components/breadcrumbs/breadcrumbs.css @@ -1,25 +1,25 @@ nav.breadcrumbs { - padding: 5px; - border-bottom: 1px solid #ddd; + padding: 5px; + border-bottom: 1px solid #ddd; } nav.breadcrumbs > span { - display: inline-block; - padding: 5px 0; - font-size: 12px; + display: inline-block; + padding: 5px 0; + font-size: 12px; } nav.breadcrumbs > span a { - text-decoration: none; - color: inherit; + text-decoration: none; + color: inherit; } nav.breadcrumbs > span::after { - content: '>'; - padding: 0 5px; - opacity: 0.4; + content: '>'; + padding: 0 5px; + opacity: 0.4; } nav.breadcrumbs > span:last-child::after { - display: none; + display: none; } diff --git a/packages/docs/src/components/breadcrumbs/breadcrumbs.tsx b/packages/docs/src/components/breadcrumbs/breadcrumbs.tsx index 36de82fd5..03954f0cf 100644 --- a/packages/docs/src/components/breadcrumbs/breadcrumbs.tsx +++ b/packages/docs/src/components/breadcrumbs/breadcrumbs.tsx @@ -1,74 +1,77 @@ -import { component$, useStyles$ } from '@builder.io/qwik'; -import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city'; -import styles from './breadcrumbs.css?inline'; +import { component$, useStyles$ } from '@builder.io/qwik' +import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city' +import styles from './breadcrumbs.css?inline' export const Breadcrumbs = component$(() => { - useStyles$(styles); + useStyles$(styles) - const { menu } = useContent(); - const loc = useLocation(); + const { menu } = useContent() + const loc = useLocation() - const breadcrumbs = createBreadcrumbs(menu, loc.pathname); - if (breadcrumbs.length === 0) { - return null; - } + const breadcrumbs = createBreadcrumbs(menu, loc.pathname) + if (breadcrumbs.length === 0) { + return null + } - return ( - - ); -}); + return ( + + ) +}) -export function createBreadcrumbs(menu: ContentMenu | undefined, pathname: string) { - if (menu?.items) { - for (const indexA of menu.items) { - const breadcrumbA: ContentBreadcrumb = { - text: indexA.text, - }; - if (typeof indexA.href === 'string') { - breadcrumbA.href = indexA.href; - } - if (indexA.href === pathname) { - return [breadcrumbA]; - } +export function createBreadcrumbs( + menu: ContentMenu | undefined, + pathname: string +) { + if (menu?.items) { + for (const indexA of menu.items) { + const breadcrumbA: ContentBreadcrumb = { + text: indexA.text, + } + if (typeof indexA.href === 'string') { + breadcrumbA.href = indexA.href + } + if (indexA.href === pathname) { + return [breadcrumbA] + } - if (indexA.items) { - for (const indexB of indexA.items) { - const breadcrumbB: ContentBreadcrumb = { - text: indexB.text, - }; - if (typeof indexB.href === 'string') { - breadcrumbB.href = indexB.href; - } - if (indexB.href === pathname) { - return [breadcrumbA, breadcrumbB]; - } + if (indexA.items) { + for (const indexB of indexA.items) { + const breadcrumbB: ContentBreadcrumb = { + text: indexB.text, + } + if (typeof indexB.href === 'string') { + breadcrumbB.href = indexB.href + } + if (indexB.href === pathname) { + return [breadcrumbA, breadcrumbB] + } - if (indexB.items) { - for (const indexC of indexB.items) { - const breadcrumbC: ContentBreadcrumb = { - text: indexC.text, - }; - if (typeof indexC.href === 'string') { - breadcrumbC.href = indexC.href; - } - if (indexC.href === pathname) { - return [breadcrumbA, breadcrumbB, breadcrumbC]; - } + if (indexB.items) { + for (const indexC of indexB.items) { + const breadcrumbC: ContentBreadcrumb = { + text: indexC.text, + } + if (typeof indexC.href === 'string') { + breadcrumbC.href = indexC.href + } + if (indexC.href === pathname) { + return [breadcrumbA, breadcrumbB, breadcrumbC] + } + } + } + } } - } } - } } - } - return []; + return [] } interface ContentBreadcrumb { - text: string; - href?: string; + text: string + href?: string } diff --git a/packages/docs/src/components/footer/footer.css b/packages/docs/src/components/footer/footer.css index 2e037e823..662fc223c 100644 --- a/packages/docs/src/components/footer/footer.css +++ b/packages/docs/src/components/footer/footer.css @@ -1,22 +1,22 @@ footer { - border-top: 0.5px solid #ddd; - margin-top: 40px; - padding: 20px; - text-align: center; + border-top: 0.5px solid #ddd; + margin-top: 40px; + padding: 20px; + text-align: center; } footer a { - color: #9e9e9e; - font-size: 12px; + color: #9e9e9e; + font-size: 12px; } footer ul { - list-style: none; - margin: 0; - padding: 0; + list-style: none; + margin: 0; + padding: 0; } footer li { - display: inline-block; - padding: 6px 12px; + display: inline-block; + padding: 6px 12px; } diff --git a/packages/docs/src/components/footer/footer.tsx b/packages/docs/src/components/footer/footer.tsx index ce84ac154..c4634f783 100644 --- a/packages/docs/src/components/footer/footer.tsx +++ b/packages/docs/src/components/footer/footer.tsx @@ -1,36 +1,40 @@ -import { component$, useStyles$ } from '@builder.io/qwik'; -import styles from './footer.css?inline'; +import { component$, useStyles$ } from '@builder.io/qwik' +import styles from './footer.css?inline' export default component$(() => { - useStyles$(styles); + useStyles$(styles) - return ( - - ); -}); + return ( + + ) +}) diff --git a/packages/docs/src/components/header/header.css b/packages/docs/src/components/header/header.css index fe3a1f692..d2fd58208 100644 --- a/packages/docs/src/components/header/header.css +++ b/packages/docs/src/components/header/header.css @@ -1,34 +1,34 @@ header { - position: sticky; - top: 0; - z-index: 11; - display: grid; - grid-template-columns: minmax(130px, auto) 1fr; - gap: 30px; - height: 80px; - width: 100%; - padding: 10px; - background-color: white; - overflow: hidden; + position: sticky; + top: 0; + z-index: 11; + display: grid; + grid-template-columns: minmax(130px, auto) 1fr; + gap: 30px; + height: 80px; + width: 100%; + padding: 10px; + background-color: white; + overflow: hidden; } header a.logo { - display: block; + display: block; } header a { - text-decoration: none; + text-decoration: none; } header nav { - text-align: right; + text-align: right; } header nav a { - display: inline-block; - padding: 5px 15px; + display: inline-block; + padding: 5px 15px; } header nav a:hover { - text-decoration: underline; + text-decoration: underline; } diff --git a/packages/docs/src/components/header/header.tsx b/packages/docs/src/components/header/header.tsx index a4c37989a..f151fe30e 100644 --- a/packages/docs/src/components/header/header.tsx +++ b/packages/docs/src/components/header/header.tsx @@ -1,26 +1,32 @@ -import { component$, useStyles$ } from '@builder.io/qwik'; -import { useLocation } from '@builder.io/qwik-city'; -import { QwikLogo } from '../icons/qwik'; -import styles from './header.css?inline'; +import { component$, useStyles$ } from '@builder.io/qwik' +import { useLocation } from '@builder.io/qwik-city' +import { QwikLogo } from '../icons/qwik' +import styles from './header.css?inline' export default component$(() => { - useStyles$(styles); + useStyles$(styles) - const { pathname } = useLocation(); + const { pathname } = useLocation() - return ( -
- - -
- ); -}); + return ( +
+ + +
+ ) +}) diff --git a/packages/docs/src/components/icons/qwik.tsx b/packages/docs/src/components/icons/qwik.tsx index 984eb6644..76416103a 100644 --- a/packages/docs/src/components/icons/qwik.tsx +++ b/packages/docs/src/components/icons/qwik.tsx @@ -1,20 +1,20 @@ export const QwikLogo = () => ( - - - - - - -); + + + + + + +) diff --git a/packages/docs/src/components/menu/menu.css b/packages/docs/src/components/menu/menu.css index 6b786ae65..ffb745c30 100644 --- a/packages/docs/src/components/menu/menu.css +++ b/packages/docs/src/components/menu/menu.css @@ -1,13 +1,13 @@ .menu { - background: #eee; - padding: 20px 10px; + background: #eee; + padding: 20px 10px; } .menu h5 { - margin: 0; + margin: 0; } .menu ul { - padding-left: 20px; - margin: 5px 0 25px 0; + padding-left: 20px; + margin: 5px 0 25px 0; } diff --git a/packages/docs/src/components/menu/menu.tsx b/packages/docs/src/components/menu/menu.tsx index 8ced9e0e5..3ccd57e8c 100644 --- a/packages/docs/src/components/menu/menu.tsx +++ b/packages/docs/src/components/menu/menu.tsx @@ -1,36 +1,37 @@ -import { component$, useStyles$ } from '@builder.io/qwik'; -import { useContent, Link, useLocation } from '@builder.io/qwik-city'; -import styles from './menu.css?inline'; +import { component$, useStyles$ } from '@builder.io/qwik' +import { useContent, Link, useLocation } from '@builder.io/qwik-city' +import styles from './menu.css?inline' export default component$(() => { - useStyles$(styles); + useStyles$(styles) - const { menu } = useContent(); - const loc = useLocation(); + const { menu } = useContent() + const loc = useLocation() - return ( - - ); -}); + return ( + + ) +}) diff --git a/packages/docs/src/components/on-this-page/on-this-page.css b/packages/docs/src/components/on-this-page/on-this-page.css index e54fe02e8..4d1f6104a 100644 --- a/packages/docs/src/components/on-this-page/on-this-page.css +++ b/packages/docs/src/components/on-this-page/on-this-page.css @@ -1,33 +1,33 @@ .on-this-page { - padding-bottom: 20px; - font-size: 0.9em; + padding-bottom: 20px; + font-size: 0.9em; } .on-this-page h6 { - margin: 10px 0; - font-weight: bold; - text-transform: uppercase; + margin: 10px 0; + font-weight: bold; + text-transform: uppercase; } .on-this-page ul { - margin: 0; - padding: 0 0 20px 0; - list-style: none; + margin: 0; + padding: 0 0 20px 0; + list-style: none; } .on-this-page a { - position: relative; - display: block; - border: 0 solid #ddd; - border-left-width: 2px; - padding: 4px 2px 4px 8px; - text-decoration: none; + position: relative; + display: block; + border: 0 solid #ddd; + border-left-width: 2px; + padding: 4px 2px 4px 8px; + text-decoration: none; } .on-this-page a.indent { - padding-left: 30px; + padding-left: 30px; } .on-this-page a:hover { - border-color: var(--theme-accent); + border-color: var(--theme-accent); } diff --git a/packages/docs/src/components/on-this-page/on-this-page.tsx b/packages/docs/src/components/on-this-page/on-this-page.tsx index 8c8e13720..520017c6d 100644 --- a/packages/docs/src/components/on-this-page/on-this-page.tsx +++ b/packages/docs/src/components/on-this-page/on-this-page.tsx @@ -1,62 +1,63 @@ -import { useContent, useLocation } from '@builder.io/qwik-city'; -import { component$, useStyles$ } from '@builder.io/qwik'; -import styles from './on-this-page.css?inline'; +import { useContent, useLocation } from '@builder.io/qwik-city' +import { component$, useStyles$ } from '@builder.io/qwik' +import styles from './on-this-page.css?inline' export default component$(() => { - useStyles$(styles); + useStyles$(styles) - const { headings } = useContent(); - const contentHeadings = headings?.filter((h) => h.level === 2 || h.level === 3) || []; + const { headings } = useContent() + const contentHeadings = + headings?.filter((h) => h.level === 2 || h.level === 3) || [] - const { pathname } = useLocation(); - const editUrl = `#update-your-edit-url-for-${pathname}`; + const { pathname } = useLocation() + const editUrl = `#update-your-edit-url-for-${pathname}` - return ( - + ) +}) diff --git a/packages/docs/src/components/router-head/router-head.tsx b/packages/docs/src/components/router-head/router-head.tsx index 9e7070348..3a3e0b4e3 100644 --- a/packages/docs/src/components/router-head/router-head.tsx +++ b/packages/docs/src/components/router-head/router-head.tsx @@ -1,32 +1,35 @@ -import { component$ } from '@builder.io/qwik'; -import { useDocumentHead, useLocation } from '@builder.io/qwik-city'; +import { component$ } from '@builder.io/qwik' +import { useDocumentHead, useLocation } from '@builder.io/qwik-city' /** * The RouterHead component is placed inside of the document `` element. */ export const RouterHead = component$(() => { - const head = useDocumentHead(); - const loc = useLocation(); + const head = useDocumentHead() + const loc = useLocation() - return ( - <> - {head.title} + return ( + <> + {head.title} - - - + + + - {head.meta.map((m) => ( - - ))} + {head.meta.map((m) => ( + + ))} - {head.links.map((l) => ( - - ))} + {head.links.map((l) => ( + + ))} - {head.styles.map((s) => ( -