0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor: add official connectors in dist (#2768)

This commit is contained in:
Gao Sun 2022-12-30 10:42:34 +08:00 committed by GitHub
parent 43de6258d1
commit 77bad4b1e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -81,9 +81,10 @@ jobs:
run: | run: |
npm run cli init -- -p ../logto --db postgres://postgres:postgres@localhost:5432/postgres --no-oc --du ../logto.tar.gz npm run cli init -- -p ../logto --db postgres://postgres:postgres@localhost:5432/postgres --no-oc --du ../logto.tar.gz
- name: Add mock connectors - name: Check and add mock connectors
working-directory: tests working-directory: tests
run: | run: |
npm run cli connector list -- -p ../logto | grep OFFICIAL
npm run cli connector add @logto/connector-mock-sms @logto/connector-mock-email @logto/connector-mock-standard-email @logto/connector-mock-social -- -p ../logto npm run cli connector add @logto/connector-mock-sms @logto/connector-mock-email @logto/connector-mock-standard-email @logto/connector-mock-social -- -p ../logto
- name: Run Logto - name: Run Logto

View file

@ -18,6 +18,9 @@ packages/**/*.config.js packages/**/*.config.ts packages/**/tsconfig*.json \
! -path '**/node_modules/**' \ ! -path '**/node_modules/**' \
-prune -exec rm -rf {} + -prune -exec rm -rf {} +
# Add official connectors
pnpm cli connector add --official -p .
echo Tar echo Tar
cd .. cd ..
tar -czf /tmp/logto.tar.gz logto tar -czf /tmp/logto.tar.gz logto

View file

@ -4,7 +4,7 @@ import fs from 'fs/promises';
import path from 'path'; import path from 'path';
import { promisify } from 'util'; import { promisify } from 'util';
import { assert, conditionalString } from '@silverhand/essentials'; import { assert, conditionalString, trySafe } from '@silverhand/essentials';
import chalk from 'chalk'; import chalk from 'chalk';
import { got } from 'got'; import { got } from 'got';
import inquirer from 'inquirer'; import inquirer from 'inquirer';
@ -105,8 +105,13 @@ export const isOfficialConnector = (packageName: string) =>
export const getConnectorPackagesFrom = async (instancePath?: string) => { export const getConnectorPackagesFrom = async (instancePath?: string) => {
const directory = getConnectorDirectory(await inquireInstancePath(instancePath)); const directory = getConnectorDirectory(await inquireInstancePath(instancePath));
const packages = await trySafe(getConnectorPackagesFromDirectory(directory));
return getConnectorPackagesFromDirectory(directory); if (!packages || packages.length === 0) {
throw new Error('No connector found');
}
return packages;
}; };
export const addConnectors = async (instancePath: string, packageNames: string[]) => { export const addConnectors = async (instancePath: string, packageNames: string[]) => {