Skip to content

Commit

Permalink
Merge pull request #244 from cellajs/development
Browse files Browse the repository at this point in the history
fix about menu on mobile
  • Loading branch information
flipvh authored Oct 22, 2024
2 parents 49b39e5 + 9b0a4a7 commit b8d226c
Show file tree
Hide file tree
Showing 13 changed files with 2,730 additions and 2,277 deletions.
2 changes: 2 additions & 0 deletions backend/emails/components/email-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Button, Section } from 'jsx-email';
export const EmailButton = ({ ButtonText, href }: { ButtonText: string; href: string }) => (
<Section style={{ textAlign: 'center', marginBottom: '2rem', marginTop: '2rem' }}>
<Button
height={40}
width={200}
style={{
textAlign: 'center',
background: '#000',
Expand Down
40 changes: 20 additions & 20 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"@cellajs/imado": "^0.1.3",
"@cellajs/permission-manager": "^0.1.0",
"@commander-js/extra-typings": "^12.1.0",
"@electric-sql/pglite": "^0.2.10",
"@hono/node-server": "^1.13.1",
"@electric-sql/pglite": "^0.2.12",
"@hono/node-server": "^1.13.2",
"@hono/sentry": "^1.2.0",
"@hono/zod-openapi": "0.16.0",
"@logtail/node": "^0.5.0",
"@hono/zod-openapi": "0.16.4",
"@logtail/node": "^0.5.2",
"@lucia-auth/adapter-drizzle": "^1.1.0",
"@lucia-auth/adapter-postgresql": "^3.1.2",
"@novu/node": "^2.0.1",
Expand All @@ -49,34 +49,34 @@
"@oslojs/crypto": "^1.0.1",
"@oslojs/encoding": "^1.1.0",
"@oslojs/webauthn": "^1.0.0",
"@paddle/paddle-node-sdk": "^1.7.0",
"@scalar/hono-api-reference": "^0.5.150",
"@sendgrid/mail": "^8.1.3",
"@sentry/cli": "^2.36.6",
"@paddle/paddle-node-sdk": "^1.9.1",
"@scalar/hono-api-reference": "^0.5.156",
"@sendgrid/mail": "^8.1.4",
"@sentry/cli": "^2.37.0",
"@t3-oss/env-core": "^0.11.1",
"arctic": "^1.9.2",
"arctic": "^2.0.1",
"config": "workspace:*",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.33.0",
"drizzle-orm": "^0.35.2",
"drizzle-zod": "^0.5.1",
"enforce-unique": "^1.3.0",
"hono": "4.6.3",
"i18next": "^23.15.1",
"hono": "4.6.5",
"i18next": "^23.16.2",
"isbot": "^5.1.17",
"jsonwebtoken": "^9.0.2",
"jsx-email": "^1.12.1",
"jsx-email": "^2.0.11",
"locales": "workspace:*",
"lucia": "^3.2.0",
"lucia": "^3.2.2",
"nanoid": "^5.0.7",
"node-cron": "^3.0.3",
"oslo": "^1.2.1",
"pg": "^8.13.0",
"postgres": "^3.4.4",
"prom-client": "^15.1.3",
"rate-limiter-flexible": "^5.0.3",
"rate-limiter-flexible": "^5.0.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^15.0.2",
"react-i18next": "^15.0.3",
"slugify": "^1.6.6",
"ua-parser-js": "^1.0.39",
"zod": "^3.23.8"
Expand All @@ -85,21 +85,21 @@
"@babel/preset-typescript": "^7.25.7",
"@faker-js/faker": "^9.0.3",
"@types/jsonwebtoken": "^9.0.7",
"@types/node": "^22.7.4",
"@types/node": "^22.7.7",
"@types/node-cron": "^3.0.11",
"@types/papaparse": "^5.3.14",
"@types/papaparse": "^5.3.15",
"@types/pg": "^8.11.10",
"@types/react": "^18.3.11",
"@types/ua-parser-js": "^0.7.39",
"chalk": "^5.3.0",
"commander": "^12.1.0",
"drizzle-kit": "^0.24.2",
"drizzle-kit": "^0.26.2",
"hanji": "^0.0.5",
"jszip": "^3.10.1",
"papaparse": "^5.4.1",
"tsup": "^8.3.0",
"tsx": "^4.19.1",
"typescript": "^5.6.2"
"typescript": "^5.6.3"
},
"babel": {
"presets": ["@babel/preset-typescript"]
Expand Down
8 changes: 5 additions & 3 deletions backend/src/db/lucia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import { env } from '../../env';
import { type SessionModel, sessionsTable } from './schema/sessions';
import { type UnsafeUserModel, usersTable } from './schema/users';

export const githubAuth = new GitHub(env.GITHUB_CLIENT_ID || '', env.GITHUB_CLIENT_SECRET || '', {
redirectURI: config.backendAuthUrl + authRoutesConfig.githubSignInCallback.path,
});
export const githubAuth = new GitHub(
env.GITHUB_CLIENT_ID || '',
env.GITHUB_CLIENT_SECRET || '',
config.backendAuthUrl + authRoutesConfig.githubSignInCallback.path,
);

export const googleAuth = new Google(
env.GOOGLE_CLIENT_ID || '',
Expand Down
6 changes: 3 additions & 3 deletions backend/src/modules/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ import authRoutesConfig from './routes';

export const supportedOauthProviders = ['github', 'google', 'microsoft'] as const;
// Scopes for OAuth providers
const githubScopes = { scopes: ['user:email'] };
const googleScopes = { scopes: ['profile', 'email'] };
const microsoftScopes = { scopes: ['profile', 'email'] };
const githubScopes = ['user:email'];
const googleScopes = ['profile', 'email'];
const microsoftScopes = ['profile', 'email'];

function isOAuthEnabled(provider: EnabledOauthProviderOptions): boolean {
const enabledStrategies: readonly string[] = config.enabledAuthenticationStrategies;
Expand Down
4 changes: 2 additions & 2 deletions cli/sync-cella/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export const command = new Command(NAME)
if (typeof name === 'string') {
name = name.trim()
}
if (!['diverged', 'merge-upstream'].includes(name)) {
throw new InvalidArgumentError(`Invalid sync-service: ${name}, supported: "diverged", "merge-upstream"`)
if (!['diverged', 'pull-upstream', 'push-upstream'].includes(name)) {
throw new InvalidArgumentError(`Invalid sync-service: ${name}, supported: "diverged", "pull-upstream", "push-upstream"`)
}
syncService = name
})
Expand Down
102 changes: 65 additions & 37 deletions cli/sync-cella/src/index.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
#!/usr/bin/env node

import { resolve } from 'node:path'
import { existsSync } from 'node:fs'
import { resolve } from 'node:path';
import { existsSync } from 'node:fs';

import { input, confirm, select } from '@inquirer/prompts';
import fileSelector from 'inquirer-file-selector'
import fileSelector from 'inquirer-file-selector';

import { cli } from './cli.js'
import { CELLA_TITLE, DEFAULT_CONFIG_FILE, DEFAULT_DIVERGED_FILE, DEFAULT_UPSTREAM_BRANCH } from './constants.js'
import { cli } from './cli.js';
import { CELLA_TITLE, DEFAULT_CONFIG_FILE, DEFAULT_DIVERGED_FILE, DEFAULT_UPSTREAM_BRANCH } from './constants.js';

import { extractValues } from './utils/config-file.js'
import { runGitCommand } from './utils/run-git-command.js'
import { extractValues } from './utils/config-file.js';
import { runGitCommand } from './utils/run-git-command.js';

import { diverged } from './diverged.js'
import { mergeUpstream } from './merge-upstream.js'
import { diverged } from './diverged.js';
import { pullUpstream } from './pull-upstream.js';
import { pushUpstream } from './push-upstream.js';

async function main() {
console.info(CELLA_TITLE);

const targetFolder = process.cwd()
const targetFolder = process.cwd();

// Ask for sync service if not provided
if (!cli.syncService) {
cli.syncService = await select({
message: 'Select the sync service you want to use:',
choices: [
{ name: 'Diverged files', value: 'diverged' },
{ name: 'Merge upstream', value: 'merge-upstream' },
{ name: 'Pull from upstream', value: 'pull-upstream' },
{ name: 'Push to upstream', value: 'push-upstream' },
{ name: 'Cancel', value: 'cancel' },
],
})
});

if (cli.syncService === 'cancel') {
process.exit(1)
process.exit(1);
}
}

// Ask for the config file and extract the values
const { problems, selectedFile, divergedFile, ignoreFile, ignoreList, upstreamBranch } = await askForConfigFile(cli.configFile)
const { problems, selectedFile, divergedFile, ignoreFile, ignoreList, upstreamBranch } = await askForConfigFile(cli.configFile);

if (problems) {
console.error('Invalid config file: ' + problems[0]);
Expand All @@ -47,7 +47,7 @@ async function main() {
if (selectedFile) {
cli.configFile = selectedFile;
}

if (divergedFile) {
cli.divergedFile = divergedFile;
}
Expand All @@ -69,46 +69,74 @@ async function main() {
cli.upstreamBranch = await input({
message: 'Enter the name of the upstream branch:',
default: DEFAULT_UPSTREAM_BRANCH,
})
});
}

// Ask for the diverged file if not provided
if (!cli.divergedFile) {
cli.divergedFile = await input({
message: 'Enter the path for the diverged file:',
default: DEFAULT_DIVERGED_FILE,
})
});
}

// Check if the current branch is provided, and ask if user wants to proceed
if (!cli.localBranch) {
cli.localBranch = await runGitCommand({ targetFolder, command: 'rev-parse --abbrev-ref HEAD' })
cli.localBranch = await runGitCommand({ targetFolder, command: 'rev-parse --abbrev-ref HEAD' });

const proceed = await confirm({
message: `You are currently on branch "${cli.localBranch}". Do you want to proceed?`,
default: true,
})
});

if (!proceed) {
process.exit(1)
process.exit(1);
}
}

// Ask for the PR branch name with a default value
const defaultPrBranchName = `pr-branch-${Date.now()}`;

if (cli.syncService === 'push-upstream') {
cli.prBranchName = await input({
message: 'Enter the PR branch name:',
default: defaultPrBranchName,
validate: (input) => input.length > 0 || 'PR branch name cannot be empty.',
});

const changeBranchName = await confirm({
message: `The default PR branch is "${cli.prBranchName}". Do you want to change it?`,
default: false,
});

if (changeBranchName) {
cli.prBranchName = await input({
message: 'Enter your custom PR branch name:',
default: cli.prBranchName,
});
}
};

// Run the selected sync service and pass the options
const options = {
divergedFile: cli.divergedFile,
ignoreFile: cli.ignoreFile,
ignoreList: cli.ignoreList,
upstreamBranch: cli.upstreamBranch,
localBranch: cli.localBranch,
prBranchName: cli.prBranchName, // Pass the PR branch name to the options
};

if (cli.syncService === 'diverged') {
return await diverged(options);
}

if (cli.syncService === 'merge-upstream') {
return await mergeUpstream(options);
if (cli.syncService === 'pull-upstream') {
return await pullUpstream(options);
}

if (cli.syncService === 'push-upstream') {
return await pushUpstream(options);
}
}

Expand All @@ -127,9 +155,9 @@ async function askForConfigFile(configFile) {
useDefaultConfig = await confirm({
message: `Do you want to use "${defaultConfigFile}" as your config file?`,
default: true,
})
});
}

// If user wants to use default config file, set it
if (useDefaultConfig) {
selectedFile = defaultConfigFile;
Expand All @@ -140,8 +168,8 @@ async function askForConfigFile(configFile) {
const useFileSelector = await confirm({
message: 'Do you want to use the file selector?',
default: true,
})
});

// If user wants to use the file selector, ask for the file
if (useFileSelector) {
selectedFile = await fileSelector({
Expand All @@ -154,18 +182,18 @@ async function askForConfigFile(configFile) {
message: 'Enter the path to the config file:',
default: DEFAULT_CONFIG_FILE,
validate: (file) => {
const configFile = resolve(file)
const configFile = resolve(file);

if (!file) {
return 'Config file is required.'
return 'Config file is required.';
}

if (!existsSync(configFile)) {
return `Config file: "${configFile}" not found.`
return `Config file: "${configFile}" not found.`;
}
return true;
},
})
});
}
}

Expand All @@ -178,10 +206,10 @@ async function askForConfigFile(configFile) {
return await askForConfigFile();
}

return { selectedFile, divergedFile, ignoreFile, ignoreList, upstreamBranch };
return { selectedFile, divergedFile, ignoreFile, ignoreList, upstreamBranch };
} else {
return await askForConfigFile();
return await askForConfigFile();
}
}

main().catch(console.error)
main().catch(console.error);
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fetchUpstream } from './fetch-upstream.js'
import { runGitCommand } from './utils/run-git-command.js'
import { extractIgnorePatterns, applyIgnorePatterns } from './utils/ignore-patterns.js'

export async function mergeUpstream({
export async function pullFork({
ignoreFile,
ignoreList,
upstreamBranch,
Expand Down
Loading

0 comments on commit b8d226c

Please sign in to comment.