mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-17 19:26:23 +00:00
feat(ci): update ci
feat(ci): update ci
This commit is contained in:
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
packages/docs/*
|
||||||
@@ -10,5 +10,9 @@ module.exports = {
|
|||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaVersion: 'latest',
|
ecmaVersion: 'latest',
|
||||||
},
|
},
|
||||||
rules: {},
|
rules: {
|
||||||
|
'no-unsafe-negation': 'off',
|
||||||
|
'no-prototype-builtins': 'off',
|
||||||
|
'no-useless-escape': 'off',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
167
.github/workflows/ci.yml
vendored
167
.github/workflows/ci.yml
vendored
@@ -1,27 +1,168 @@
|
|||||||
name: Bot CI Test
|
name: BotWhatsapp CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [dev]
|
branches:
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
############ BUILD PACKAGE ############
|
||||||
|
build-package:
|
||||||
|
name: Build Package
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [16.x]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: 16.x
|
||||||
|
cache: 'yarn'
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
|
||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
|
|
||||||
- name: Install NPM Dependencies
|
- name: Install NPM Dependencies
|
||||||
run: yarn install --immutable --network-timeout 300000
|
run: yarn install --immutable --network-timeout 300000
|
||||||
- name: Test
|
|
||||||
|
- name: Build Package
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Test Package
|
||||||
|
run: yarn test
|
||||||
|
|
||||||
|
- name: Upload @bot-whatsapp/bot
|
||||||
|
uses: actions/upload-artifact@master
|
||||||
|
with:
|
||||||
|
name: dist-dev-bot
|
||||||
|
path: packages/bot/lib/
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload @bot-whatsapp/cli
|
||||||
|
uses: actions/upload-artifact@master
|
||||||
|
with:
|
||||||
|
name: dist-dev-cli
|
||||||
|
path: packages/cli/lib/
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload @bot-whatsapp/create-bot-whatsapp
|
||||||
|
uses: actions/upload-artifact@master
|
||||||
|
with:
|
||||||
|
name: dist-dev-create-bot-whatsapp
|
||||||
|
path: packages/create-bot-whatsapp/lib/
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload @bot-whatsapp/database
|
||||||
|
uses: actions/upload-artifact@master
|
||||||
|
with:
|
||||||
|
name: dist-dev-database
|
||||||
|
path: packages/database/lib/
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Upload @bot-whatsapp/database
|
||||||
|
uses: actions/upload-artifact@master
|
||||||
|
with:
|
||||||
|
name: dist-dev-provider
|
||||||
|
path: packages/provider/lib/
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Build Eslint rules
|
||||||
|
run: yarn lint:fix
|
||||||
|
|
||||||
|
############ RELEASE ############
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
needs:
|
||||||
|
- build-package
|
||||||
|
- test-unit
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@v2.2.4
|
||||||
|
with:
|
||||||
|
version: 7
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16.x
|
||||||
|
cache: 'pnpm'
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
|
||||||
|
- run: corepack enable
|
||||||
|
|
||||||
|
- name: Download Build Artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
|
||||||
|
- name: Print Distribution Artifacts
|
||||||
|
run: tree builderio-qwik-distribution/
|
||||||
|
|
||||||
|
- name: Print Create Qwik CLI Artifacts
|
||||||
|
run: tree dist-dev-create-qwik/
|
||||||
|
|
||||||
|
- name: Move Distribution Artifacts
|
||||||
|
run: |
|
||||||
|
mkdir -p packages/qwik/dist/
|
||||||
|
mv builderio-qwik-distribution/* packages/qwik/dist/
|
||||||
|
mkdir -p packages/create-qwik/dist/
|
||||||
|
mv dist-dev-create-qwik/* packages/create-qwik/dist/
|
||||||
|
mkdir -p packages/eslint-plugin-qwik/dist/
|
||||||
|
mv dist-dev-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
|
||||||
|
|
||||||
|
- name: Install NPM Dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Dry-Run Publish @builder.io/qwik
|
||||||
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
|
run: pnpm tsm scripts/index.ts --set-dist-tag="${{ github.event.inputs.disttag }}" --release --dry-run
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
- name: Publish @builder.io/qwik
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
|
run: pnpm tsm scripts/index.ts --set-dist-tag="${{ github.event.inputs.disttag }}" --release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
- name: Save artifacts
|
||||||
|
if: ${{ needs.changes.outputs.fullbuild == 'true' && github.event_name == 'push' }}
|
||||||
|
env:
|
||||||
|
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
|
||||||
|
run: pnpm run qwik-save-artifacts
|
||||||
|
|
||||||
|
############ UNIT TEST ############
|
||||||
|
test-unit:
|
||||||
|
name: Unit Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- build-package
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
- name: Unit Tests
|
||||||
run: yarn test
|
run: yarn test
|
||||||
|
|||||||
26
.github/workflows/relases.yml
vendored
26
.github/workflows/relases.yml
vendored
@@ -1,26 +0,0 @@
|
|||||||
name: Bot Relases
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [released, published]
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [16.x]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
- run: corepack enable
|
|
||||||
- name: Install NPM Dependencies
|
|
||||||
run: yarn install --immutable --network-timeout 300000
|
|
||||||
- name: Test
|
|
||||||
run: yarn test
|
|
||||||
- name: Build
|
|
||||||
run: yarn build
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -20,6 +20,7 @@ coverage/
|
|||||||
log
|
log
|
||||||
log/*
|
log/*
|
||||||
*.log
|
*.log
|
||||||
|
*.tgz
|
||||||
lib
|
lib
|
||||||
tmp/
|
tmp/
|
||||||
.yarn/*
|
.yarn/*
|
||||||
|
|||||||
@@ -80,6 +80,7 @@
|
|||||||
"rollup": "^3.2.3",
|
"rollup": "^3.2.3",
|
||||||
"rollup-plugin-cleanup": "^3.2.1",
|
"rollup-plugin-cleanup": "^3.2.1",
|
||||||
"rollup-plugin-copy": "^3.4.0",
|
"rollup-plugin-copy": "^3.4.0",
|
||||||
|
"semver": "^7.3.8",
|
||||||
"standard-version": "^9.5.0",
|
"standard-version": "^9.5.0",
|
||||||
"uvu": "^0.5.6"
|
"uvu": "^0.5.6"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/bot",
|
"name": "@bot-whatsapp/bot",
|
||||||
"version": "0.0.1",
|
"version": "0.0.4-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/bundle.bot.cjs",
|
"main": "./lib/bundle.bot.cjs",
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"bot:rollup": "node ../../node_modules/.bin/rollup index.js --config ./rollup-cli.config.js",
|
"bot:rollup": "node ../../node_modules/.bin/rollup index.js --config ./rollup-cli.config.js",
|
||||||
"format:check": "prettier --check .",
|
"format:check": "prettier --check .",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ProviderClass extends EventEmitter {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sendMessage = async (userId, message, sendMessage) => {
|
sendMessage = async (userId, message) => {
|
||||||
if (NODE_ENV !== 'production')
|
if (NODE_ENV !== 'production')
|
||||||
console.log('[sendMessage]', { userId, message })
|
console.log('[sendMessage]', { userId, message })
|
||||||
return message
|
return message
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/cli",
|
"name": "@bot-whatsapp/cli",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cross-spawn": "^7.0.3",
|
"cross-spawn": "^7.0.3",
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "create-bot-whatsapp",
|
"name": "create-bot-whatsapp",
|
||||||
"version": "0.0.1",
|
"version": "0.0.9-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/bin/bundle.create.cjs",
|
"main": "./lib/bin/bundle.create.cjs",
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bot-whatsapp/cli": "*"
|
"@bot-whatsapp/cli": "*"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/database",
|
"name": "@bot-whatsapp/database",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2-alpha.0",
|
||||||
"description": "Esto es el conector a mysql, pg, mongo",
|
"description": "Esto es el conector a mysql, pg, mongo",
|
||||||
"main": "./lib/mock/index.cjs",
|
"main": "./lib/mock/index.cjs",
|
||||||
"private": true,
|
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { cloudflarePagesAdaptor } from '@builder.io/qwik-city/adaptors/cloudflare-pages/vite';
|
import { cloudflarePagesAdaptor } from '@builder.io/qwik-city/adaptors/cloudflare-pages/vite'
|
||||||
import { extendConfig } from '@builder.io/qwik-city/vite';
|
import { extendConfig } from '@builder.io/qwik-city/vite'
|
||||||
import baseConfig from '../../vite.config';
|
import baseConfig from '../../vite.config'
|
||||||
|
|
||||||
export default extendConfig(baseConfig, () => {
|
export default extendConfig(baseConfig, () => {
|
||||||
return {
|
return {
|
||||||
build: {
|
build: {
|
||||||
ssr: true,
|
ssr: true,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: ['src/entry.cloudflare-pages.tsx', '@qwik-city-plan'],
|
input: ['src/entry.cloudflare-pages.tsx', '@qwik-city-plan'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
cloudflarePagesAdaptor({
|
cloudflarePagesAdaptor({
|
||||||
staticGenerate: true,
|
staticGenerate: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
// Cloudflare Pages Functions
|
// Cloudflare Pages Functions
|
||||||
// https://developers.cloudflare.com/pages/platform/functions/
|
// https://developers.cloudflare.com/pages/platform/functions/
|
||||||
export { onRequest } from '../server/entry.cloudflare-pages';
|
export { onRequest } from '../server/entry.cloudflare-pages'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: {
|
plugins: {
|
||||||
tailwindcss: {},
|
tailwindcss: {},
|
||||||
autoprefixer: {},
|
autoprefixer: {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/web-manifest-combined.json",
|
"$schema": "https://json.schemastore.org/web-manifest-combined.json",
|
||||||
"name": "qwik-project-name",
|
"name": "qwik-project-name",
|
||||||
"short_name": "Welcome to Qwik",
|
"short_name": "Welcome to Qwik",
|
||||||
"start_url": ".",
|
"start_url": ".",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#fff",
|
"background_color": "#fff",
|
||||||
"description": "A Qwik project app."
|
"description": "A Qwik project app."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
nav.breadcrumbs {
|
nav.breadcrumbs {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.breadcrumbs > span {
|
nav.breadcrumbs > span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 5px 0;
|
padding: 5px 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.breadcrumbs > span a {
|
nav.breadcrumbs > span a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.breadcrumbs > span::after {
|
nav.breadcrumbs > span::after {
|
||||||
content: '>';
|
content: '>';
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.breadcrumbs > span:last-child::after {
|
nav.breadcrumbs > span:last-child::after {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,74 +1,77 @@
|
|||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city';
|
import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city'
|
||||||
import styles from './breadcrumbs.css?inline';
|
import styles from './breadcrumbs.css?inline'
|
||||||
|
|
||||||
export const Breadcrumbs = component$(() => {
|
export const Breadcrumbs = component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
const { menu } = useContent();
|
const { menu } = useContent()
|
||||||
const loc = useLocation();
|
const loc = useLocation()
|
||||||
|
|
||||||
const breadcrumbs = createBreadcrumbs(menu, loc.pathname);
|
const breadcrumbs = createBreadcrumbs(menu, loc.pathname)
|
||||||
if (breadcrumbs.length === 0) {
|
if (breadcrumbs.length === 0) {
|
||||||
return null;
|
return null
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<nav class="breadcrumbs">
|
|
||||||
{breadcrumbs.map((b) => (
|
|
||||||
<span>{b.href ? <a href={b.href}>{b.text}</a> : b.text}</span>
|
|
||||||
))}
|
|
||||||
</nav>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
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 (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 (
|
||||||
|
<nav class="breadcrumbs">
|
||||||
|
{breadcrumbs.map((b) => (
|
||||||
|
<span>{b.href ? <a href={b.href}>{b.text}</a> : b.text}</span>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
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 (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 []
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ContentBreadcrumb {
|
interface ContentBreadcrumb {
|
||||||
text: string;
|
text: string
|
||||||
href?: string;
|
href?: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
footer {
|
footer {
|
||||||
border-top: 0.5px solid #ddd;
|
border-top: 0.5px solid #ddd;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a {
|
footer a {
|
||||||
color: #9e9e9e;
|
color: #9e9e9e;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer ul {
|
footer ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer li {
|
footer li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,40 @@
|
|||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import styles from './footer.css?inline';
|
import styles from './footer.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer>
|
<footer>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="/docs">Docs</a>
|
<a href="/docs">Docs</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/about-us">About Us</a>
|
<a href="/about-us">About Us</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://qwik.builder.io/">Qwik</a>
|
<a href="https://qwik.builder.io/">Qwik</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://twitter.com/QwikDev">Twitter</a>
|
<a href="https://twitter.com/QwikDev">Twitter</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/BuilderIO/qwik">GitHub</a>
|
<a href="https://github.com/BuilderIO/qwik">GitHub</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://qwik.builder.io/chat">Chat</a>
|
<a href="https://qwik.builder.io/chat">Chat</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div>
|
<div>
|
||||||
<a href="https://www.builder.io/" target="_blank" class="builder">
|
<a
|
||||||
Made with ♡ by Builder.io
|
href="https://www.builder.io/"
|
||||||
</a>
|
target="_blank"
|
||||||
</div>
|
class="builder"
|
||||||
</footer>
|
>
|
||||||
);
|
Made with ♡ by Builder.io
|
||||||
});
|
</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
header {
|
header {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 11;
|
z-index: 11;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(130px, auto) 1fr;
|
grid-template-columns: minmax(130px, auto) 1fr;
|
||||||
gap: 30px;
|
gap: 30px;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
header a.logo {
|
header a.logo {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
header a {
|
header a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
header nav {
|
header nav {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
header nav a {
|
header nav a {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 5px 15px;
|
padding: 5px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
header nav a:hover {
|
header nav a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,32 @@
|
|||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import { useLocation } from '@builder.io/qwik-city';
|
import { useLocation } from '@builder.io/qwik-city'
|
||||||
import { QwikLogo } from '../icons/qwik';
|
import { QwikLogo } from '../icons/qwik'
|
||||||
import styles from './header.css?inline';
|
import styles from './header.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header>
|
<header>
|
||||||
<a class="logo" href="/">
|
<a class="logo" href="/">
|
||||||
<QwikLogo />
|
<QwikLogo />
|
||||||
</a>
|
</a>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/docs" class={{ active: pathname.startsWith('/docs') }}>
|
<a
|
||||||
Docs
|
href="/docs"
|
||||||
</a>
|
class={{ active: pathname.startsWith('/docs') }}
|
||||||
<a href="/about-us" class={{ active: pathname.startsWith('/about-us') }}>
|
>
|
||||||
About Us
|
Docs
|
||||||
</a>
|
</a>
|
||||||
</nav>
|
<a
|
||||||
</header>
|
href="/about-us"
|
||||||
);
|
class={{ active: pathname.startsWith('/about-us') }}
|
||||||
});
|
>
|
||||||
|
About Us
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
export const QwikLogo = () => (
|
export const QwikLogo = () => (
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 167 53">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 167 53">
|
||||||
<path
|
<path
|
||||||
fill="#000"
|
fill="#000"
|
||||||
d="M81.95 46.59h-6.4V35.4a12.25 12.25 0 0 1-7.06 2.17c-3.47 0-6.06-.94-7.67-2.92-1.6-1.96-2.42-5.45-2.42-10.43 0-5.1.95-8.62 2.87-10.67 1.96-2.08 5.1-3.09 9.43-3.09 4.1 0 7.82.57 11.25 1.67V46.6Zm-6.4-30.31a16.6 16.6 0 0 0-4.85-.66c-2.17 0-3.73.56-4.6 1.7-.85 1.17-1.32 3.38-1.32 6.65 0 3.08.41 5.14 1.26 6.26.86 1.1 2.33 1.67 4.5 1.67 2.84 0 5.01-1.17 5.01-2.62v-13Zm15.58-5.14c2.27 6.3 4.2 12.6 5.86 18.95 2.22-6.5 4.1-12.8 5.55-18.95h5.61a187.5 187.5 0 0 1 5.3 18.95c2.52-6.9 4.5-13.21 5.95-18.95h6.31a285.68 285.68 0 0 1-8.92 25.76h-7.53c-.86-4.6-2.22-10.14-4.04-16.75a151.51 151.51 0 0 1-4.89 16.75H92.8a287.88 287.88 0 0 0-8.17-25.76h6.5Zm41.7-3.58c-2.83 0-3.63-.7-3.63-3.59 0-2.57.82-3.18 3.63-3.18 2.83 0 3.63.6 3.63 3.18 0 2.89-.8 3.59-3.63 3.59Zm-3.18 3.58h6.4V36.9h-6.4V11.14Zm36.65 0c-4.54 6.46-7.72 10.39-9.49 11.8 1.46.95 5.36 5.95 10.2 13.98h-7.38c-6.02-9.13-8.89-13.07-10.3-13.67v13.67h-6.4V0h6.4v23.23c1.45-1.06 4.63-5.1 9.54-12.09h7.43Z"
|
d="M81.95 46.59h-6.4V35.4a12.25 12.25 0 0 1-7.06 2.17c-3.47 0-6.06-.94-7.67-2.92-1.6-1.96-2.42-5.45-2.42-10.43 0-5.1.95-8.62 2.87-10.67 1.96-2.08 5.1-3.09 9.43-3.09 4.1 0 7.82.57 11.25 1.67V46.6Zm-6.4-30.31a16.6 16.6 0 0 0-4.85-.66c-2.17 0-3.73.56-4.6 1.7-.85 1.17-1.32 3.38-1.32 6.65 0 3.08.41 5.14 1.26 6.26.86 1.1 2.33 1.67 4.5 1.67 2.84 0 5.01-1.17 5.01-2.62v-13Zm15.58-5.14c2.27 6.3 4.2 12.6 5.86 18.95 2.22-6.5 4.1-12.8 5.55-18.95h5.61a187.5 187.5 0 0 1 5.3 18.95c2.52-6.9 4.5-13.21 5.95-18.95h6.31a285.68 285.68 0 0 1-8.92 25.76h-7.53c-.86-4.6-2.22-10.14-4.04-16.75a151.51 151.51 0 0 1-4.89 16.75H92.8a287.88 287.88 0 0 0-8.17-25.76h6.5Zm41.7-3.58c-2.83 0-3.63-.7-3.63-3.59 0-2.57.82-3.18 3.63-3.18 2.83 0 3.63.6 3.63 3.18 0 2.89-.8 3.59-3.63 3.59Zm-3.18 3.58h6.4V36.9h-6.4V11.14Zm36.65 0c-4.54 6.46-7.72 10.39-9.49 11.8 1.46.95 5.36 5.95 10.2 13.98h-7.38c-6.02-9.13-8.89-13.07-10.3-13.67v13.67h-6.4V0h6.4v23.23c1.45-1.06 4.63-5.1 9.54-12.09h7.43Z"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
fill="#18B6F6"
|
fill="#18B6F6"
|
||||||
d="M40.97 52.54 32.1 43.7l-.14.02v-.1l-18.9-18.66 4.66-4.5-2.74-15.7L2 20.87a7.14 7.14 0 0 0-1.03 8.52l8.11 13.45a6.81 6.81 0 0 0 5.92 3.3l4.02-.05 21.96 6.46Z"
|
d="M40.97 52.54 32.1 43.7l-.14.02v-.1l-18.9-18.66 4.66-4.5-2.74-15.7L2 20.87a7.14 7.14 0 0 0-1.03 8.52l8.11 13.45a6.81 6.81 0 0 0 5.92 3.3l4.02-.05 21.96 6.46Z"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
fill="#AC7EF4"
|
fill="#AC7EF4"
|
||||||
d="m45.82 20.54-1.78-3.3-.93-1.68-.37-.66-.04.04-4.9-8.47a6.85 6.85 0 0 0-5.99-3.43l-4.28.12-12.8.04a6.85 6.85 0 0 0-5.85 3.37L1.1 21.99 15 4.73l18.24 20.04L30 28.04l1.94 15.68.02-.04v.04h-.04l.04.04 1.51 1.47 7.36 7.19c.3.29.81-.06.6-.43l-4.54-8.93 7.91-14.63.26-.3a6.73 6.73 0 0 0 .76-7.6Z"
|
d="m45.82 20.54-1.78-3.3-.93-1.68-.37-.66-.04.04-4.9-8.47a6.85 6.85 0 0 0-5.99-3.43l-4.28.12-12.8.04a6.85 6.85 0 0 0-5.85 3.37L1.1 21.99 15 4.73l18.24 20.04L30 28.04l1.94 15.68.02-.04v.04h-.04l.04.04 1.51 1.47 7.36 7.19c.3.29.81-.06.6-.43l-4.54-8.93 7.91-14.63.26-.3a6.73 6.73 0 0 0 .76-7.6Z"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
fill="#fff"
|
fill="#fff"
|
||||||
d="M33.3 24.69 15.02 4.75l2.6 15.62-4.66 4.51L31.91 43.7l-1.7-15.62 3.1-3.4Z"
|
d="M33.3 24.69 15.02 4.75l2.6 15.62-4.66 4.51L31.91 43.7l-1.7-15.62 3.1-3.4Z"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
);
|
)
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
.menu {
|
.menu {
|
||||||
background: #eee;
|
background: #eee;
|
||||||
padding: 20px 10px;
|
padding: 20px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu h5 {
|
.menu h5 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu ul {
|
.menu ul {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
margin: 5px 0 25px 0;
|
margin: 5px 0 25px 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,37 @@
|
|||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import { useContent, Link, useLocation } from '@builder.io/qwik-city';
|
import { useContent, Link, useLocation } from '@builder.io/qwik-city'
|
||||||
import styles from './menu.css?inline';
|
import styles from './menu.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
const { menu } = useContent();
|
const { menu } = useContent()
|
||||||
const loc = useLocation();
|
const loc = useLocation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside class="menu">
|
<aside class="menu">
|
||||||
{menu
|
{menu
|
||||||
? menu.items?.map((item) => (
|
? menu.items?.map((item) => (
|
||||||
<>
|
<>
|
||||||
<h5>{item.text}</h5>
|
<h5>{item.text}</h5>
|
||||||
<ul>
|
<ul>
|
||||||
{item.items?.map((item) => (
|
{item.items?.map((item) => (
|
||||||
<li>
|
<li>
|
||||||
<Link
|
<Link
|
||||||
href={item.href}
|
href={item.href}
|
||||||
class={{
|
class={{
|
||||||
'is-active': loc.pathname === item.href,
|
'is-active':
|
||||||
}}
|
loc.pathname === item.href,
|
||||||
>
|
}}
|
||||||
{item.text}
|
>
|
||||||
</Link>
|
{item.text}
|
||||||
</li>
|
</Link>
|
||||||
))}
|
</li>
|
||||||
</ul>
|
))}
|
||||||
</>
|
</ul>
|
||||||
))
|
</>
|
||||||
: null}
|
))
|
||||||
</aside>
|
: null}
|
||||||
);
|
</aside>
|
||||||
});
|
)
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
.on-this-page {
|
.on-this-page {
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page h6 {
|
.on-this-page h6 {
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page ul {
|
.on-this-page ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0 0 20px 0;
|
padding: 0 0 20px 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page a {
|
.on-this-page a {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
border: 0 solid #ddd;
|
border: 0 solid #ddd;
|
||||||
border-left-width: 2px;
|
border-left-width: 2px;
|
||||||
padding: 4px 2px 4px 8px;
|
padding: 4px 2px 4px 8px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page a.indent {
|
.on-this-page a.indent {
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page a:hover {
|
.on-this-page a:hover {
|
||||||
border-color: var(--theme-accent);
|
border-color: var(--theme-accent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +1,63 @@
|
|||||||
import { useContent, useLocation } from '@builder.io/qwik-city';
|
import { useContent, useLocation } from '@builder.io/qwik-city'
|
||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import styles from './on-this-page.css?inline';
|
import styles from './on-this-page.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
const { headings } = useContent();
|
const { headings } = useContent()
|
||||||
const contentHeadings = headings?.filter((h) => h.level === 2 || h.level === 3) || [];
|
const contentHeadings =
|
||||||
|
headings?.filter((h) => h.level === 2 || h.level === 3) || []
|
||||||
|
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation()
|
||||||
const editUrl = `#update-your-edit-url-for-${pathname}`;
|
const editUrl = `#update-your-edit-url-for-${pathname}`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside class="on-this-page">
|
<aside class="on-this-page">
|
||||||
{contentHeadings.length > 0 ? (
|
{contentHeadings.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
<h6>On This Page</h6>
|
<h6>On This Page</h6>
|
||||||
<ul>
|
<ul>
|
||||||
{contentHeadings.map((h) => (
|
{contentHeadings.map((h) => (
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href={`#${h.id}`}
|
href={`#${h.id}`}
|
||||||
class={{
|
class={{
|
||||||
block: true,
|
block: true,
|
||||||
indent: h.level > 2,
|
indent: h.level > 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{h.text}
|
{h.text}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<h6>More</h6>
|
<h6>More</h6>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href={editUrl} target="_blank">
|
<a href={editUrl} target="_blank">
|
||||||
Edit this page
|
Edit this page
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://qwik.builder.io/chat" target="_blank">
|
<a href="https://qwik.builder.io/chat" target="_blank">
|
||||||
Join our community
|
Join our community
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/BuilderIO/qwik" target="_blank">
|
<a href="https://github.com/BuilderIO/qwik" target="_blank">
|
||||||
GitHub
|
GitHub
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://twitter.com/QwikDev" target="_blank">
|
<a href="https://twitter.com/QwikDev" target="_blank">
|
||||||
@QwikDev
|
@QwikDev
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,32 +1,35 @@
|
|||||||
import { component$ } from '@builder.io/qwik';
|
import { component$ } from '@builder.io/qwik'
|
||||||
import { useDocumentHead, useLocation } from '@builder.io/qwik-city';
|
import { useDocumentHead, useLocation } from '@builder.io/qwik-city'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The RouterHead component is placed inside of the document `<head>` element.
|
* The RouterHead component is placed inside of the document `<head>` element.
|
||||||
*/
|
*/
|
||||||
export const RouterHead = component$(() => {
|
export const RouterHead = component$(() => {
|
||||||
const head = useDocumentHead();
|
const head = useDocumentHead()
|
||||||
const loc = useLocation();
|
const loc = useLocation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<title>{head.title}</title>
|
<title>{head.title}</title>
|
||||||
|
|
||||||
<link rel="canonical" href={loc.href} />
|
<link rel="canonical" href={loc.href} />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0"
|
||||||
|
/>
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
|
|
||||||
{head.meta.map((m) => (
|
{head.meta.map((m) => (
|
||||||
<meta {...m} />
|
<meta {...m} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{head.links.map((l) => (
|
{head.links.map((l) => (
|
||||||
<link {...l} />
|
<link {...l} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{head.styles.map((s) => (
|
{head.styles.map((s) => (
|
||||||
<style {...s.props} dangerouslySetInnerHTML={s.style} />
|
<style {...s.props} dangerouslySetInnerHTML={s.style} />
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
* - https://qwik.builder.io/qwikcity/adaptors/cloudflare-pages/
|
* - https://qwik.builder.io/qwikcity/adaptors/cloudflare-pages/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { createQwikCity } from '@builder.io/qwik-city/middleware/cloudflare-pages';
|
import { createQwikCity } from '@builder.io/qwik-city/middleware/cloudflare-pages'
|
||||||
import qwikCityPlan from '@qwik-city-plan';
|
import qwikCityPlan from '@qwik-city-plan'
|
||||||
import render from './entry.ssr';
|
import render from './entry.ssr'
|
||||||
|
|
||||||
const onRequest = createQwikCity({ render, qwikCityPlan });
|
const onRequest = createQwikCity({ render, qwikCityPlan })
|
||||||
|
|
||||||
export { onRequest };
|
export { onRequest }
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
* - More code is transferred to the browser than in SSR mode.
|
* - More code is transferred to the browser than in SSR mode.
|
||||||
* - Optimizer/Serialization/Deserialization code is not exercised!
|
* - Optimizer/Serialization/Deserialization code is not exercised!
|
||||||
*/
|
*/
|
||||||
import { render, RenderOptions } from '@builder.io/qwik';
|
import { render, RenderOptions } from '@builder.io/qwik'
|
||||||
import Root from './root';
|
import Root from './root'
|
||||||
|
|
||||||
export default function (opts: RenderOptions) {
|
export default function (opts: RenderOptions) {
|
||||||
return render(document, <Root />, opts);
|
return render(document, <Root />, opts)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
* - https://vitejs.dev/config/preview-options.html#preview-options
|
* - https://vitejs.dev/config/preview-options.html#preview-options
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { createQwikCity } from '@builder.io/qwik-city/middleware/node';
|
import { createQwikCity } from '@builder.io/qwik-city/middleware/node'
|
||||||
import render from './entry.ssr';
|
import render from './entry.ssr'
|
||||||
import qwikCityPlan from '@qwik-city-plan';
|
import qwikCityPlan from '@qwik-city-plan'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default export is the QwikCity adaptor used by Vite preview.
|
* The default export is the QwikCity adaptor used by Vite preview.
|
||||||
*/
|
*/
|
||||||
export default createQwikCity({ render, qwikCityPlan });
|
export default createQwikCity({ render, qwikCityPlan })
|
||||||
|
|||||||
@@ -10,18 +10,18 @@
|
|||||||
* - npm run build
|
* - npm run build
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
|
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server'
|
||||||
import { manifest } from '@qwik-client-manifest';
|
import { manifest } from '@qwik-client-manifest'
|
||||||
import Root from './root';
|
import Root from './root'
|
||||||
|
|
||||||
export default function (opts: RenderToStreamOptions) {
|
export default function (opts: RenderToStreamOptions) {
|
||||||
return renderToStream(<Root />, {
|
return renderToStream(<Root />, {
|
||||||
manifest,
|
manifest,
|
||||||
...opts,
|
...opts,
|
||||||
// Use container attributes to set attributes on the html tag.
|
// Use container attributes to set attributes on the html tag.
|
||||||
containerAttributes: {
|
containerAttributes: {
|
||||||
lang: 'en-us',
|
lang: 'en-us',
|
||||||
...opts.containerAttributes,
|
...opts.containerAttributes,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,66 +1,67 @@
|
|||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--user-font-scale: 1rem - 16px;
|
--user-font-scale: 1rem - 16px;
|
||||||
--max-width: calc(100% - 1rem);
|
--max-width: calc(100% - 1rem);
|
||||||
|
|
||||||
--font-body: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif,
|
--font-body: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI,
|
||||||
Apple Color Emoji, Segoe UI Emoji;
|
Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
|
||||||
--font-mono: 'IBM Plex Mono', Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console',
|
--font-mono: 'IBM Plex Mono', Consolas, 'Andale Mono WT', 'Andale Mono',
|
||||||
'Lucida Sans Typewriter', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Liberation Mono',
|
'Lucida Console', 'Lucida Sans Typewriter', 'DejaVu Sans Mono',
|
||||||
'Nimbus Mono L', Monaco, 'Courier New', Courier, monospace;
|
'Bitstream Vera Sans Mono', 'Liberation Mono', 'Nimbus Mono L', Monaco,
|
||||||
|
'Courier New', Courier, monospace;
|
||||||
|
|
||||||
color-scheme: light;
|
color-scheme: light;
|
||||||
--theme-accent: #006ce9;
|
--theme-accent: #006ce9;
|
||||||
--theme-text: #181818;
|
--theme-text: #181818;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 50em) {
|
@media (min-width: 50em) {
|
||||||
:root {
|
:root {
|
||||||
--max-width: 46em;
|
--max-width: 46em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
font-family: var(--font-body);
|
font-family: var(--font-body);
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-size: clamp(0.9rem, 0.75rem + 0.375vw + var(--user-font-scale), 1rem);
|
font-size: clamp(0.9rem, 0.75rem + 0.375vw + var(--user-font-scale), 1rem);
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
max-width: 100vw;
|
max-width: 100vw;
|
||||||
background: var(--theme-bg);
|
background: var(--theme-bg);
|
||||||
color: var(--theme-text);
|
color: var(--theme-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
max-width: 960px;
|
max-width: 960px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: var(--theme-accent);
|
color: var(--theme-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
code,
|
code,
|
||||||
kbd,
|
kbd,
|
||||||
samp,
|
samp,
|
||||||
pre {
|
pre {
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
background-color: rgb(224, 224, 224);
|
background-color: rgb(224, 224, 224);
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
border-bottom: 2px solid #bfbfbf;
|
border-bottom: 2px solid #bfbfbf;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,30 @@
|
|||||||
import { component$ } from '@builder.io/qwik';
|
import { component$ } from '@builder.io/qwik'
|
||||||
import { QwikCityProvider, RouterOutlet, ServiceWorkerRegister } from '@builder.io/qwik-city';
|
import {
|
||||||
import { RouterHead } from './components/router-head/router-head';
|
QwikCityProvider,
|
||||||
|
RouterOutlet,
|
||||||
|
ServiceWorkerRegister,
|
||||||
|
} from '@builder.io/qwik-city'
|
||||||
|
import { RouterHead } from './components/router-head/router-head'
|
||||||
|
|
||||||
import './global.css';
|
import './global.css'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
/*
|
/*
|
||||||
* The root of a QwikCity site always start with the <QwikCityProvider> component,
|
* The root of a QwikCity site always start with the <QwikCityProvider> component,
|
||||||
* immediately followed by the document's <head> and <body>.
|
* immediately followed by the document's <head> and <body>.
|
||||||
*
|
*
|
||||||
* Dont remove the `<head>` and `<body>` elements.
|
* Dont remove the `<head>` and `<body>` elements.
|
||||||
*/
|
*/
|
||||||
return (
|
return (
|
||||||
<QwikCityProvider>
|
<QwikCityProvider>
|
||||||
<head>
|
<head>
|
||||||
<meta charSet="utf-8" />
|
<meta charSet="utf-8" />
|
||||||
<RouterHead />
|
<RouterHead />
|
||||||
</head>
|
</head>
|
||||||
<body lang="en">
|
<body lang="en">
|
||||||
<RouterOutlet />
|
<RouterOutlet />
|
||||||
<ServiceWorkerRegister />
|
<ServiceWorkerRegister />
|
||||||
</body>
|
</body>
|
||||||
</QwikCityProvider>
|
</QwikCityProvider>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
.docs {
|
.docs {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 210px auto 190px;
|
grid-template-columns: 210px auto 190px;
|
||||||
grid-template-areas: 'menu article on-this-page';
|
grid-template-areas: 'menu article on-this-page';
|
||||||
gap: 40px;
|
gap: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docs h1 {
|
.docs h1 {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docs .menu {
|
.docs .menu {
|
||||||
grid-area: menu;
|
grid-area: menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docs article {
|
.docs article {
|
||||||
grid-area: article;
|
grid-area: article;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docs .on-this-page {
|
.docs .on-this-page {
|
||||||
grid-area: on-this-page;
|
grid-area: on-this-page;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
import { component$, Slot, useStyles$ } from '@builder.io/qwik';
|
import { component$, Slot, useStyles$ } from '@builder.io/qwik'
|
||||||
import type { DocumentHead } from '@builder.io/qwik-city';
|
import type { DocumentHead } from '@builder.io/qwik-city'
|
||||||
import Menu from '~/components/menu/menu';
|
import Menu from '~/components/menu/menu'
|
||||||
import OnThisPage from '~/components/on-this-page/on-this-page';
|
import OnThisPage from '~/components/on-this-page/on-this-page'
|
||||||
import styles from './docs.css?inline';
|
import styles from './docs.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="docs">
|
<div class="docs">
|
||||||
<Menu />
|
<Menu />
|
||||||
<article>
|
<article>
|
||||||
<Slot />
|
<Slot />
|
||||||
</article>
|
</article>
|
||||||
<OnThisPage />
|
<OnThisPage />
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|
||||||
export const head: DocumentHead = ({ head }) => {
|
export const head: DocumentHead = ({ head }) => {
|
||||||
return {
|
return {
|
||||||
title: `${head.title} - Documentation`,
|
title: `${head.title} - Documentation`,
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { component$, Slot } from '@builder.io/qwik';
|
import { component$, Slot } from '@builder.io/qwik'
|
||||||
import Footer from '~/components/footer/footer';
|
import Footer from '~/components/footer/footer'
|
||||||
import Header from '~/components/header/header';
|
import Header from '~/components/header/header'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header />
|
<Header />
|
||||||
<main>
|
<main>
|
||||||
<Slot />
|
<Slot />
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
<Footer />
|
||||||
</>
|
</>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
* Qwik uses a service worker to speed up your site and reduce latency, ie, not used in the traditional way of offline.
|
* Qwik uses a service worker to speed up your site and reduce latency, ie, not used in the traditional way of offline.
|
||||||
* You can also use this file to add more functionality that runs in the service worker.
|
* You can also use this file to add more functionality that runs in the service worker.
|
||||||
*/
|
*/
|
||||||
import { setupServiceWorker } from '@builder.io/qwik-city/service-worker';
|
import { setupServiceWorker } from '@builder.io/qwik-city/service-worker'
|
||||||
|
|
||||||
setupServiceWorker();
|
setupServiceWorker()
|
||||||
|
|
||||||
addEventListener('install', () => self.skipWaiting());
|
addEventListener('install', () => self.skipWaiting())
|
||||||
|
|
||||||
addEventListener('activate', () => self.clients.claim());
|
addEventListener('activate', () => self.clients.claim())
|
||||||
|
|
||||||
declare const self: ServiceWorkerGlobalScope;
|
declare const self: ServiceWorkerGlobalScope
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
/** @type {import('tailwindcss').Config} */
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
|
||||||
const defaultTheme = require("tailwindcss/defaultTheme");
|
const defaultTheme = require('tailwindcss/defaultTheme')
|
||||||
const colors = require("tailwindcss/colors");
|
const colors = require('tailwindcss/colors')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
content: ["./src/**/*.{js,ts,jsx,tsx,mdx}"],
|
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
colors: {
|
colors: {
|
||||||
primary: colors.purple,
|
primary: colors.purple,
|
||||||
secondary: colors.sky,
|
secondary: colors.sky,
|
||||||
},
|
},
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
sans: ["'Inter'", ...defaultTheme.fontFamily.sans],
|
sans: ["'Inter'", ...defaultTheme.fontFamily.sans],
|
||||||
},
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
plugins: [],
|
||||||
plugins: [],
|
darkMode: 'class',
|
||||||
darkMode: "class",
|
}
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite'
|
||||||
import { qwikVite } from '@builder.io/qwik/optimizer';
|
import { qwikVite } from '@builder.io/qwik/optimizer'
|
||||||
import { qwikCity } from '@builder.io/qwik-city/vite';
|
import { qwikCity } from '@builder.io/qwik-city/vite'
|
||||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||||
|
|
||||||
export default defineConfig(() => {
|
export default defineConfig(() => {
|
||||||
return {
|
return {
|
||||||
plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
|
plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
|
||||||
preview: {
|
preview: {
|
||||||
headers: {
|
headers: {
|
||||||
'Cache-Control': 'public, max-age=600',
|
'Cache-Control': 'public, max-age=600',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/provider",
|
"name": "@bot-whatsapp/provider",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2-alpha.0",
|
||||||
"description": "Esto es el conector a Twilio, Meta, etc...",
|
"description": "Esto es el conector a Twilio, Meta, etc...",
|
||||||
"main": "./lib/mock/index.cjs",
|
"main": "./lib/mock/index.cjs",
|
||||||
"private": true,
|
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class TwilioProvider extends ProviderClass {
|
|||||||
* @param {*} buttons []
|
* @param {*} buttons []
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
sendButtons = async (number, message, buttons = []) => {
|
sendButtons = async () => {
|
||||||
console.log(``)
|
console.log(``)
|
||||||
console.log(
|
console.log(
|
||||||
`[NOTA]: Actualmente enviar botons con Twilio esta en desarrollo`
|
`[NOTA]: Actualmente enviar botons con Twilio esta en desarrollo`
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
const {
|
const { Client, LocalAuth, MessageMedia, Buttons } = require('whatsapp-web.js')
|
||||||
Client,
|
|
||||||
LocalAuth,
|
|
||||||
MessageMedia,
|
|
||||||
Buttons,
|
|
||||||
List,
|
|
||||||
} = require('whatsapp-web.js')
|
|
||||||
const { ProviderClass } = require('@bot-whatsapp/bot')
|
const { ProviderClass } = require('@bot-whatsapp/bot')
|
||||||
const { Console } = require('console')
|
const { Console } = require('console')
|
||||||
const { createWriteStream, existsSync } = require('fs')
|
const { createWriteStream } = require('fs')
|
||||||
const {
|
const {
|
||||||
cleanNumber,
|
cleanNumber,
|
||||||
generateImage,
|
generateImage,
|
||||||
@@ -134,19 +128,19 @@ class WebWhatsappProvider extends ProviderClass {
|
|||||||
* @param {*} buttons []
|
* @param {*} buttons []
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
sendList = async (number, message, listInput = []) => {
|
// sendList = async (number, message, listInput = []) => {
|
||||||
let sections = [
|
// let sections = [
|
||||||
{
|
// {
|
||||||
title: 'sectionTitle',
|
// title: 'sectionTitle',
|
||||||
rows: [
|
// rows: [
|
||||||
{ title: 'ListItem1', description: 'desc' },
|
// { title: 'ListItem1', description: 'desc' },
|
||||||
{ title: 'ListItem2' },
|
// { title: 'ListItem2' },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
]
|
// ]
|
||||||
let list = new List('List body', 'btnText', sections, 'Title', 'footer')
|
// let list = new List('List body', 'btnText', sections, 'Title', 'footer')
|
||||||
return this.vendor.sendMessage(number, list)
|
// return this.vendor.sendMessage(number, list)
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enviar un mensaje solo texto
|
* Enviar un mensaje solo texto
|
||||||
|
|||||||
@@ -1,33 +1,106 @@
|
|||||||
const { writeFile, readFileSync } = require('fs')
|
const { writeFile, readFileSync } = require('fs')
|
||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
const PATH_PACKAGES = join(__dirname, '..', `packages`)
|
const { execFile } = require('node:child_process')
|
||||||
|
const process = require('node:process')
|
||||||
|
const util = require('node:util')
|
||||||
|
|
||||||
|
const OS_ENVIROMENT_WIN = process.platform.includes('win32')
|
||||||
|
const semver = require('semver')
|
||||||
|
|
||||||
|
const NPM_COMMAND = OS_ENVIROMENT_WIN ? 'npm.cmd' : 'npm'
|
||||||
const [PKG_ARG, PKG_ARG_VERSION] = process.argv.slice(2) || [null]
|
const [PKG_ARG, PKG_ARG_VERSION] = process.argv.slice(2) || [null]
|
||||||
|
const PATH_PACKAGES = join(__dirname, '..', `packages`)
|
||||||
|
|
||||||
|
const cmd = util.promisify(execFile)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actualizar ramdon version de package
|
* Leer package json
|
||||||
* @param {*} packageName
|
* @param {*} packageName
|
||||||
|
* @returns
|
||||||
*/
|
*/
|
||||||
const updateVersion = (packageName = null, number = null) => {
|
const readPackage = (packageName = null) => {
|
||||||
if (!packageName) throw new Error(`PATH_ERROR_PACKAGE: ${packageName}`)
|
|
||||||
const pkgJson = join(PATH_PACKAGES, packageName, 'package.json')
|
const pkgJson = join(PATH_PACKAGES, packageName, 'package.json')
|
||||||
const rawFile = readFileSync(pkgJson, 'utf-8')
|
const rawFile = readFileSync(pkgJson, 'utf-8')
|
||||||
|
|
||||||
if (!rawFile) throw new Error(`ERROR_FILE_READ`)
|
if (!rawFile) throw new Error(`ERROR_FILE_READ`)
|
||||||
let pkgJsonObject = JSON.parse(rawFile)
|
|
||||||
const build = !number ? Date.now() : number
|
return JSON.parse(rawFile)
|
||||||
let [versionNumber] = pkgJsonObject.version.split('-')
|
}
|
||||||
pkgJsonObject.version = !number ? `${versionNumber}-${build}` : `${number}`
|
|
||||||
pkgJsonObject = JSON.stringify(pkgJsonObject)
|
/**
|
||||||
writeFile(pkgJson, pkgJsonObject, (err) => {
|
* Actualizar package json
|
||||||
if (err) throw err
|
* @param {*} packageName
|
||||||
|
* @param {*} newPkgJson
|
||||||
|
*/
|
||||||
|
const updatePackage = (packageName = null, newPkgJson) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName, 'package.json')
|
||||||
|
if (!Object.keys(newPkgJson).length) throw new Error(`ERROR_FILE_READ`)
|
||||||
|
writeFile(pkgJson, newPkgJson, (err) => {
|
||||||
|
if (err) reject(err)
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actualizar version
|
||||||
|
* @param {*} packageName
|
||||||
|
*/
|
||||||
|
const updateVersion = async (packageName = null, number = null) => {
|
||||||
|
if (!packageName) throw new Error(`PATH_ERROR_PACKAGE: ${packageName}`)
|
||||||
|
|
||||||
|
const pkgJsonObject = readPackage(packageName)
|
||||||
|
const { version } = pkgJsonObject
|
||||||
|
const newVersion = !number
|
||||||
|
? semver.inc(version, 'prepatch', 'alpha')
|
||||||
|
: `${number}`
|
||||||
|
|
||||||
|
if (!semver.valid(newVersion))
|
||||||
|
throw new Error(`VERSION_ERROR: ${newVersion}`)
|
||||||
|
|
||||||
|
const newPkgJson = JSON.stringify(
|
||||||
|
{ ...pkgJsonObject, version: newVersion },
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
await updatePackage(packageName, newPkgJson)
|
||||||
|
return { version: newVersion }
|
||||||
|
}
|
||||||
|
|
||||||
|
const packRelease = async (packageName) => {
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
|
const { stdout } = await cmd(NPM_COMMAND, ['pack'], {
|
||||||
|
stdio: 'inherit',
|
||||||
|
cwd: pkgJson,
|
||||||
|
})
|
||||||
|
return stdout
|
||||||
|
}
|
||||||
|
|
||||||
|
const publishRelease = async (packageName, latest = false) => {
|
||||||
|
const args = !latest ? ['--tag', 'dev'] : ['--access', 'public']
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
|
const { stdout } = await cmd(NPM_COMMAND, ['publish'].concat(args), {
|
||||||
|
stdio: 'inherit',
|
||||||
|
cwd: pkgJson,
|
||||||
|
})
|
||||||
|
console.log(stdout)
|
||||||
|
return stdout
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recibe los argumentos entrantes
|
* Recibe los argumentos entrantes
|
||||||
*/
|
*/
|
||||||
if (PKG_ARG) {
|
|
||||||
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
const main = async () => {
|
||||||
const pkgNumber = PKG_ARG_VERSION ? PKG_ARG_VERSION.split('=').at(1) : null
|
if (PKG_ARG) {
|
||||||
updateVersion(pkgName, pkgNumber)
|
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
||||||
|
const pkgNumber = PKG_ARG_VERSION
|
||||||
|
? PKG_ARG_VERSION.split('=').at(1)
|
||||||
|
: null
|
||||||
|
await updateVersion(pkgName, pkgNumber)
|
||||||
|
await packRelease(pkgName)
|
||||||
|
await publishRelease(pkgName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
|||||||
@@ -964,6 +964,7 @@ __metadata:
|
|||||||
cross-env: ^7.0.3
|
cross-env: ^7.0.3
|
||||||
eslint: ^8.26.0
|
eslint: ^8.26.0
|
||||||
eslint-config-prettier: ^8.5.0
|
eslint-config-prettier: ^8.5.0
|
||||||
|
execa: ^6.1.0
|
||||||
fs-extra: ^11.1.0
|
fs-extra: ^11.1.0
|
||||||
git-cz: ^4.9.0
|
git-cz: ^4.9.0
|
||||||
husky: ^8.0.2
|
husky: ^8.0.2
|
||||||
@@ -975,6 +976,7 @@ __metadata:
|
|||||||
rollup: ^3.2.3
|
rollup: ^3.2.3
|
||||||
rollup-plugin-cleanup: ^3.2.1
|
rollup-plugin-cleanup: ^3.2.1
|
||||||
rollup-plugin-copy: ^3.4.0
|
rollup-plugin-copy: ^3.4.0
|
||||||
|
semver: ^7.3.8
|
||||||
standard-version: ^9.5.0
|
standard-version: ^9.5.0
|
||||||
uvu: ^0.5.6
|
uvu: ^0.5.6
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
@@ -7637,7 +7639,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7":
|
"semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8":
|
||||||
version: 7.3.8
|
version: 7.3.8
|
||||||
resolution: "semver@npm:7.3.8"
|
resolution: "semver@npm:7.3.8"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user