From f3e72057cec58f224603d8ffbf24a665a749a19e Mon Sep 17 00:00:00 2001 From: mlbiche Date: Thu, 13 Aug 2026 17:39:45 +0200 Subject: [PATCH 1/5] Fix a bug occurring after renaming a Scribouilli repository in GitLab Introduce a repoPath concept based on the repository name in GitHub and the repository path in GitLab --- assets/scripts/actions/current-repository.ts | 14 ++++---- assets/scripts/actions/setup.ts | 13 +++---- assets/scripts/components/Header.svelte | 20 ++++++----- .../components/screens/AfterOauthLogin.svelte | 6 ++-- .../screens/SelectCurrentSite.svelte | 15 ++++---- .../screens/intern/ListContenu.svelte | 6 ++-- assets/scripts/oauth-services-api/github.ts | 6 ++-- assets/scripts/oauth-services-api/gitlab.ts | 34 +++++++++---------- assets/scripts/oauth-services-api/index.ts | 9 ++--- .../scripts/oauth-services-api/scribouilli.ts | 17 +++++----- .../scripts/routes/atelier-list-articles.ts | 4 +-- assets/scripts/routes/urls.ts | 4 +-- assets/scripts/routes/welcome.ts | 4 +-- assets/scripts/scribouilliGitRepo.ts | 12 +++---- assets/scripts/store.ts | 10 ++++-- assets/scripts/types/git.ts | 11 +++--- 16 files changed, 97 insertions(+), 88 deletions(-) diff --git a/assets/scripts/actions/current-repository.ts b/assets/scripts/actions/current-repository.ts index 52324ec4..4a029f3e 100644 --- a/assets/scripts/actions/current-repository.ts +++ b/assets/scripts/actions/current-repository.ts @@ -38,16 +38,16 @@ export const setCurrentRepositoryFromQuerystring = async ( querystring: string, ): Promise => { const params = new URLSearchParams(querystring) - const repoName = params.get('repoName') + const repoPath = params.get('repoPath') const owner = params.get('account') const oAuthProvider = store.state.oAuthProvider let message - if (!repoName || !owner || !oAuthProvider) { - if (!repoName) { - message = `Missing parameter 'repoName' in URL` + if (!repoPath || !owner || !oAuthProvider) { + if (!repoPath) { + message = `Missing parameter 'repoPath' in URL` } else { if (!owner) { message = `Missing parameter 'account' in URL` @@ -70,7 +70,7 @@ export const setCurrentRepositoryFromQuerystring = async ( const scribouilliGitRepo = new ScribouilliGitRepo({ owner, - repoName, + repoPath, repoType: provider.type, origin: origin, gitServiceProvider: getOAuthServiceAPI(), @@ -79,8 +79,8 @@ export const setCurrentRepositoryFromQuerystring = async ( store.mutations.setCurrentRepository(scribouilliGitRepo) const gitAgent = new GitAgent({ - repoId: oAuthServiceAPI.makeRepoId(owner, repoName), - remoteURL: oAuthServiceAPI.makePublicRepositoryURL(owner, repoName), + repoId: oAuthServiceAPI.makeRepoId(owner, repoPath), + remoteURL: oAuthServiceAPI.makePublicRepositoryURL(owner, repoPath), corsProxyURL: provider.corsProxy, gitServiceProvider: oAuthServiceAPI, onMergeConflict: resolutionOptions => { diff --git a/assets/scripts/actions/setup.ts b/assets/scripts/actions/setup.ts index 3876020c..0a98932a 100644 --- a/assets/scripts/actions/setup.ts +++ b/assets/scripts/actions/setup.ts @@ -69,14 +69,14 @@ export const setupLocalRepository = async (): Promise< */ export function guessBaseURL({ owner, - repoName, + repoPath, origin, }: ScribouilliGitRepo): string { if (origin === 'https://github.com') { const publishedHostname = `${owner.toLowerCase()}.github.io` - repoName = repoName.toLowerCase() + repoPath = repoPath.toLowerCase() - return publishedHostname === repoName ? '' : `/${repoName}` + return publishedHostname === repoPath ? '' : `/${repoPath}` } else if ( origin === 'https://gitlab.com' || origin === 'https://git.scribouilli.org' @@ -114,7 +114,8 @@ export const createRepositoryForCurrentAccount = async ( throw new TypeError(`missing login in createRepositoryForCurrentAccount`) } - const escapedRepoName = repoName + // On creation, on both GitHub and GitLab, the name matches the repository path + const escapedRepoPath = repoName .normalize('NFD') .replace(/[\u0300-\u036f]/g, '') .replace(/[^\w\.-]/g, '-') // see https://stackoverflow.com/a/59082561 @@ -136,7 +137,7 @@ export const createRepositoryForCurrentAccount = async ( const scribouilliGitRepo = new ScribouilliGitRepo({ owner: owner, - repoName: escapedRepoName, + repoPath: escapedRepoPath, repoType: provider.type, origin: origin, gitServiceProvider: oAuthServiceAPI, @@ -149,7 +150,7 @@ export const createRepositoryForCurrentAccount = async ( .createDefaultRepository(scribouilliGitRepo, template) .then(({ remoteURL }) => { const gitAgent = new GitAgent({ - repoId: oAuthServiceAPI.makeRepoId(owner, escapedRepoName), + repoId: oAuthServiceAPI.makeRepoId(owner, escapedRepoPath), remoteURL: remoteURL, corsProxyURL: provider.corsProxy, onMergeConflict: ( diff --git a/assets/scripts/components/Header.svelte b/assets/scripts/components/Header.svelte index 1b982e9e..10d9f815 100644 --- a/assets/scripts/components/Header.svelte +++ b/assets/scripts/components/Header.svelte @@ -2,6 +2,8 @@ import type { BuildStatus } from '../types/git.ts' import type { ScribouilliState } from '../store.ts' import type { BackendType } from '../types/atelier.ts' + import { makeAtelierListPageURL } from '../routes/urls.ts' + import { makeAtelierListArticlesURL } from '../routes/atelier-list-articles.ts' interface Props { buildStatus: BuildStatus @@ -22,18 +24,18 @@ let publishedWebsiteURL: Promise | undefined = $derived(currentRepository?.publishedWebsiteURL) let repositoryURL: string | undefined = $derived(currentRepository?.publicRepositoryURL) let repositoryType: BackendType | undefined = $derived(currentRepository?.repoType) - let repoName: string | undefined = $derived(currentRepository?.repoName) + let repoPath: string | undefined = $derived(currentRepository?.repoPath) let account: string | undefined = $derived(currentRepository?.owner) let homeURL: string | undefined = - $derived(repoName && account - ? `/atelier-list-pages?repoName=${repoName}&account=${account}` + $derived(currentRepository + ? makeAtelierListPageURL(currentRepository) : '/') - function makeResolutionDesynchronisationURL(account: string, repoName: string): string { - return `/resolution-desynchronisation?account=${account}&repoName=${repoName}` + function makeResolutionDesynchronisationURL(account: string, repoPath: string): string { + return `/resolution-desynchronisation?account=${account}&repoPath=${repoPath}` } - let resolutionURL: string = $derived(makeResolutionDesynchronisationURL(account || '', repoName || '')); + let resolutionURL: string = $derived(makeResolutionDesynchronisationURL(account || '', repoPath || ''));
@@ -78,7 +80,7 @@
@@ -121,7 +121,7 @@ Modifier diff --git a/assets/scripts/oauth-services-api/github.ts b/assets/scripts/oauth-services-api/github.ts index 9456cba5..5aa9bb0d 100644 --- a/assets/scripts/oauth-services-api/github.ts +++ b/assets/scripts/oauth-services-api/github.ts @@ -44,7 +44,7 @@ export default class GitHubAPI implements OAuthServiceAPI { } async createDefaultRepository( - { owner, repoName, publishedWebsiteURL }: ScribouilliGitRepo, + { owner, repoPath, publishedWebsiteURL }: ScribouilliGitRepo, template: GitSiteTemplate, ) { // Generate a new repository from the theme repository @@ -58,7 +58,7 @@ export default class GitHubAPI implements OAuthServiceAPI { method: 'POST', body: JSON.stringify({ owner, - name: repoName, + name: repoPath, description: 'Mon site Scribouilli', }), }, @@ -97,7 +97,7 @@ export default class GitHubAPI implements OAuthServiceAPI { method: 'PUT', body: JSON.stringify({ owner, - repo: repoName, + repo: repoPath, names: ['site-scribouilli'], }), }) diff --git a/assets/scripts/oauth-services-api/gitlab.ts b/assets/scripts/oauth-services-api/gitlab.ts index a04a24c0..3538496e 100644 --- a/assets/scripts/oauth-services-api/gitlab.ts +++ b/assets/scripts/oauth-services-api/gitlab.ts @@ -2,6 +2,7 @@ import GitAgent from '../GitAgent.ts' import ScribouilliGitRepo from '../scribouilliGitRepo.ts' import type { BuildStatus, + GitRepository, GitSiteTemplate, OAuthServiceAPI, } from '../types/git.ts' @@ -74,17 +75,17 @@ export default class GitLabAPI implements OAuthServiceAPI { const response = await this.callAPI( `${this.apiBaseUrl}/users/${login}/projects?order_by=updated_at&sort=desc&per_page=30&visibility=public`, ) - const json = await response.json() + const json: Array = await response.json() // @ts-ignore - const repositories = json.map(repo => { - return { - id: repo.id, + const repositories = json.map( + (repo: any): GitRepository => ({ name: repo.name, + path: repo.path, owner: { login: repo.owner.username, }, - } - }) + }), + ) return await Promise.resolve(repositories) } @@ -92,7 +93,7 @@ export default class GitLabAPI implements OAuthServiceAPI { scribouilliGitRepo: ScribouilliGitRepo, { url: gitRepoUrl }: GitSiteTemplate, ) { - const { repoName } = scribouilliGitRepo + const { repoPath } = scribouilliGitRepo const response = await this.callAPI(`${this.apiBaseUrl}/projects`, { method: 'POST', @@ -102,7 +103,7 @@ export default class GitLabAPI implements OAuthServiceAPI { }, body: JSON.stringify({ import_url: gitRepoUrl, - name: repoName, + name: repoPath, // On creation, path and name are identical description: 'Mon site Scribouilli', topics: ['site-scribouilli'], visibility: 'public', @@ -135,11 +136,8 @@ export default class GitLabAPI implements OAuthServiceAPI { console.log('response', response) } - async getPagesWebsiteDeploymentStatus({ - owner, - repoName, - }: ScribouilliGitRepo) { - const urlEncodedRepoPath = encodeURIComponent(`${owner}/${repoName}`) + async getPagesWebsiteDeploymentStatus({ repoId }: ScribouilliGitRepo) { + const urlEncodedRepoPath = encodeURIComponent(repoId) const response = await this.callAPI( `${this.apiBaseUrl}/projects/${urlEncodedRepoPath}/deployments?per_page=1&order_by=updated_at&sort=desc`, @@ -168,8 +166,8 @@ export default class GitLabAPI implements OAuthServiceAPI { } } - async isRepositoryReady({ owner, repoName }: ScribouilliGitRepo) { - const urlEncodedRepoPath = encodeURIComponent(`${owner}/${repoName}`) + async isRepositoryReady({ repoId }: ScribouilliGitRepo) { + const urlEncodedRepoPath = encodeURIComponent(repoId) // This call is used only at the creation of the repository. // We assume that the git ref is `main`. @@ -183,13 +181,13 @@ export default class GitLabAPI implements OAuthServiceAPI { } } - getPublishedWebsiteURL({ repoName, owner, origin }: ScribouilliGitRepo) { + getPublishedWebsiteURL({ repoPath, owner, origin }: ScribouilliGitRepo) { if (origin === 'https://gitlab.com') { - return Promise.resolve(`https://${owner}.gitlab.io/${repoName}/`) + return Promise.resolve(`https://${owner}.gitlab.io/${repoPath}/`) } if (origin === 'https://git.scribouilli.org') { - return Promise.resolve(`https://${owner}.monpetitsite.org/${repoName}/`) + return Promise.resolve(`https://${owner}.monpetitsite.org/${repoPath}/`) } return Promise.reject('Unknown origin') diff --git a/assets/scripts/oauth-services-api/index.ts b/assets/scripts/oauth-services-api/index.ts index a109ac61..a29a9af1 100644 --- a/assets/scripts/oauth-services-api/index.ts +++ b/assets/scripts/oauth-services-api/index.ts @@ -58,8 +58,8 @@ export const getOAuthServiceAPI = (): OAuthServiceAPI => { /** * @param owner may be an individual Github user or an organisation */ -export function defaultMakeRepoId(owner: string, repoName: string): string { - return `${owner}/${repoName}` +export function defaultMakeRepoId(owner: string, repoPath: string): string { + return `${owner}/${repoPath}` } /** @@ -67,8 +67,9 @@ export function defaultMakeRepoId(owner: string, repoName: string): string { */ export function defaultMakePublicRepositoryURL( owner: string, - repoName: string, + repoPath: string, origin: string, ): string { - return `${origin}/${owner}/${repoName}` + const repoId = defaultMakeRepoId(owner, repoPath) + return `${origin}/${repoId}` } diff --git a/assets/scripts/oauth-services-api/scribouilli.ts b/assets/scripts/oauth-services-api/scribouilli.ts index 31b42bcf..5eb9d0d0 100644 --- a/assets/scripts/oauth-services-api/scribouilli.ts +++ b/assets/scripts/oauth-services-api/scribouilli.ts @@ -108,7 +108,7 @@ export default class ScribouilliBackend implements OAuthServiceAPI { scribouilliGitRepo: ScribouilliGitRepo, ): Promise { const response = await this.callAPI( - `/websites/${scribouilliGitRepo.repoName}/ready`, + `/websites/${scribouilliGitRepo.repoPath}/ready`, ) const { is_ready } = await response.json() return is_ready @@ -132,7 +132,7 @@ export default class ScribouilliBackend implements OAuthServiceAPI { } async deploy(scribouilliGitRepo: ScribouilliGitRepo): Promise { - await this.callAPI(`/websites/${scribouilliGitRepo.repoName}/deployment`, { + await this.callAPI(`/websites/${scribouilliGitRepo.repoPath}/deployment`, { method: 'POST', }) } @@ -141,7 +141,7 @@ export default class ScribouilliBackend implements OAuthServiceAPI { scribouilliGitRepo: ScribouilliGitRepo, ): Promise { const data = await this.callAPI( - `/websites/${scribouilliGitRepo.repoName}/deployment`, + `/websites/${scribouilliGitRepo.repoPath}/deployment`, ) const { status } = await data.json() return status @@ -163,17 +163,18 @@ export default class ScribouilliBackend implements OAuthServiceAPI { scribouilliGitRepo: ScribouilliGitRepo, ): Promise { const data = await this.callAPI( - `/websites/${scribouilliGitRepo.repoName}/url`, + `/websites/${scribouilliGitRepo.repoPath}/url`, ) const { url } = await data.json() return url } - makeRepoId(_owner: string, repoName: string): string { - return `websites/${repoName}` + makeRepoId(_owner: string, repoPath: string): string { + return `websites/${repoPath}` } - makePublicRepositoryURL(_owner: string, repoName: string): string { - return `${this.origin}/websites/${repoName}` + makePublicRepositoryURL(_owner: string, repoPath: string): string { + const repoId = this.makeRepoId(_owner, repoPath) + return `${this.origin}/${repoId}` } } diff --git a/assets/scripts/routes/atelier-list-articles.ts b/assets/scripts/routes/atelier-list-articles.ts index 4c594912..c58043c7 100644 --- a/assets/scripts/routes/atelier-list-articles.ts +++ b/assets/scripts/routes/atelier-list-articles.ts @@ -33,7 +33,7 @@ export default async ({ querystring }: Context) => { export function makeAtelierListArticlesURL({ owner, - repoName, + repoPath, }: ScribouilliGitRepo): string { - return `/atelier-list-articles?account=${owner}&repoName=${repoName}` + return `/atelier-list-articles?account=${owner}&repoPath=${repoPath}` } diff --git a/assets/scripts/routes/urls.ts b/assets/scripts/routes/urls.ts index 937a91c9..24905d48 100644 --- a/assets/scripts/routes/urls.ts +++ b/assets/scripts/routes/urls.ts @@ -2,7 +2,7 @@ import ScribouilliGitRepo from '../scribouilliGitRepo' export function makeAtelierListPageURL({ owner, - repoName, + repoPath, }: ScribouilliGitRepo): string { - return `/atelier-list-pages?account=${owner}&repoName=${repoName}` + return `/atelier-list-pages?account=${owner}&repoPath=${repoPath}` } diff --git a/assets/scripts/routes/welcome.ts b/assets/scripts/routes/welcome.ts index f31683c6..66d54317 100644 --- a/assets/scripts/routes/welcome.ts +++ b/assets/scripts/routes/welcome.ts @@ -16,10 +16,10 @@ export default () => { fetchCurrentUserRepositories().then(repos => { if (repos.length === 1) { - const repoName = repos[0].name + const repoPath = repos[0].path || repos[0].name // In GitHub, repository slug is defined in the name attribute. In GitLab, repository slug is defined in the path attribute and may differ from the name attribute (after renaming) const account = repos[0].owner.login - page(`/atelier-list-pages?repoName=${repoName}&account=${account}`) + page(`/atelier-list-pages?repoPath=${repoPath}&account=${account}`) } else { store.mutations.setReposForAccount({ // @ts-ignore diff --git a/assets/scripts/scribouilliGitRepo.ts b/assets/scripts/scribouilliGitRepo.ts index 0066d925..fd43c5d7 100644 --- a/assets/scripts/scribouilliGitRepo.ts +++ b/assets/scripts/scribouilliGitRepo.ts @@ -6,7 +6,7 @@ export default class ScribouilliGitRepo { public origin public publicRepositoryURL public owner - public repoName + public repoPath public repoType: BackendType public repoId public publishedWebsiteURL: Promise @@ -15,29 +15,29 @@ export default class ScribouilliGitRepo { repoId, origin, owner, - repoName, + repoPath, repoType, gitServiceProvider, }: { repoId?: string origin: string owner: string - repoName: string + repoPath: string repoType: BackendType gitServiceProvider: OAuthServiceAPI }) { this.origin = origin this.publicRepositoryURL = gitServiceProvider.makePublicRepositoryURL( owner, - repoName, + repoPath, ) this.owner = owner - this.repoName = repoName + this.repoPath = repoPath this.repoType = repoType this.repoId = repoId ? repoId - : gitServiceProvider.makeRepoId(owner, repoName) + : gitServiceProvider.makeRepoId(owner, repoPath) this.publishedWebsiteURL = new Promise(resolve => { const interval = setInterval(() => { diff --git a/assets/scripts/store.ts b/assets/scripts/store.ts index cbc4d483..8a9aadd4 100644 --- a/assets/scripts/store.ts +++ b/assets/scripts/store.ts @@ -2,7 +2,7 @@ import Store, { type BareduxStore } from 'baredux' import GitAgent from './GitAgent.ts' import ScribouilliGitRepo from './scribouilliGitRepo.ts' import type { Page, Article } from './types/atelier.ts' -import type { BuildStatus } from './types/git.ts' +import type { BuildStatus, GitRepository } from './types/git.ts' /** * Un store baredux a pour vocation de refléter notamment le modèle mental de la * personne face à Scribouilli. Le store stocke donc principalement des données (et parfois des singletons) @@ -35,7 +35,7 @@ export interface ScribouilliState { currentRepository: ScribouilliGitRepo | undefined gitAgent: GitAgent | undefined conflict: ResolutionOption[] | undefined - reposByAccount: any + reposByAccount: { [account: string]: GitRepository[] } | undefined pages?: Page[] articles?: Article[] buildStatus: BuildStatus @@ -132,8 +132,12 @@ const mutations = { setReposForAccount( state: ScribouilliState, - { login, repos }: { login: string; repos: any[] }, + { login, repos }: { login: string; repos: GitRepository[] }, ) { + if (!state.reposByAccount) { + state.reposByAccount = {} + } + state.reposByAccount[login] = repos // on place ses propres dépôts avant les dépôts des autres .sort((a, b) => { diff --git a/assets/scripts/types/git.ts b/assets/scripts/types/git.ts index e2d2dc98..c46649a2 100644 --- a/assets/scripts/types/git.ts +++ b/assets/scripts/types/git.ts @@ -3,7 +3,7 @@ import type { BackendType } from './atelier' interface ScribouilliGitRepo { repoId: string owner: string - repoName: string + repoPath: string repoType: BackendType origin: string publishedWebsiteURL: Promise @@ -37,7 +37,7 @@ export interface OAuthServiceAPI { isRepositoryReady: ( scribouilliGitRepo: ScribouilliGitRepo, ) => Promise - getCurrentUserRepositories: () => Promise + getCurrentUserRepositories: () => Promise deploy: (scribouilliGitRepo: ScribouilliGitRepo) => Promise getPagesWebsiteDeploymentStatus: ( scribouilliGitRepo: ScribouilliGitRepo, @@ -48,8 +48,8 @@ export interface OAuthServiceAPI { getPublishedWebsiteURL: ( scribouilliGitRepo: ScribouilliGitRepo, ) => Promise - makeRepoId: (owner: string, repoName: string) => string - makePublicRepositoryURL: (owner: string, repoName: string) => string + makeRepoId: (owner: string, repoPath: string) => string + makePublicRepositoryURL: (owner: string, repoPath: string) => string } interface AuthenticatedUserEmails { @@ -57,8 +57,9 @@ interface AuthenticatedUserEmails { primary: boolean } -export interface GithubRepository { +export interface GitRepository { name: string + path?: string owner: { login: string } From 7eb4b93954b6a14dd84c2cb12e16b8e27d9384f1 Mon Sep 17 00:00:00 2001 From: mlbiche Date: Thu, 13 Aug 2026 17:41:02 +0200 Subject: [PATCH 2/5] Simplify some redundant pieces of code when creating ScribouilliGitRepo objects --- assets/scripts/actions/current-repository.ts | 4 +++- assets/scripts/actions/setup.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/scripts/actions/current-repository.ts b/assets/scripts/actions/current-repository.ts index 4a029f3e..95d63187 100644 --- a/assets/scripts/actions/current-repository.ts +++ b/assets/scripts/actions/current-repository.ts @@ -78,8 +78,10 @@ export const setCurrentRepositoryFromQuerystring = async ( store.mutations.setCurrentRepository(scribouilliGitRepo) + const { repoId } = scribouilliGitRepo + const gitAgent = new GitAgent({ - repoId: oAuthServiceAPI.makeRepoId(owner, repoPath), + repoId: repoId, remoteURL: oAuthServiceAPI.makePublicRepositoryURL(owner, repoPath), corsProxyURL: provider.corsProxy, gitServiceProvider: oAuthServiceAPI, diff --git a/assets/scripts/actions/setup.ts b/assets/scripts/actions/setup.ts index 0a98932a..23f643fb 100644 --- a/assets/scripts/actions/setup.ts +++ b/assets/scripts/actions/setup.ts @@ -143,6 +143,8 @@ export const createRepositoryForCurrentAccount = async ( gitServiceProvider: oAuthServiceAPI, }) + const { repoId } = scribouilliGitRepo + store.mutations.setCurrentRepository(scribouilliGitRepo) return ( @@ -150,7 +152,7 @@ export const createRepositoryForCurrentAccount = async ( .createDefaultRepository(scribouilliGitRepo, template) .then(({ remoteURL }) => { const gitAgent = new GitAgent({ - repoId: oAuthServiceAPI.makeRepoId(owner, escapedRepoPath), + repoId, remoteURL: remoteURL, corsProxyURL: provider.corsProxy, onMergeConflict: ( From 30be28c0caa6151e49117ac245b7c8311a6ff283 Mon Sep 17 00:00:00 2001 From: mlbiche Date: Thu, 13 Aug 2026 17:41:16 +0200 Subject: [PATCH 3/5] Remove some dead code --- assets/scripts/GitAgent.ts | 2 -- assets/scripts/routes/after-oauth-login.ts | 6 ------ assets/scripts/routes/welcome.ts | 6 ------ 3 files changed, 14 deletions(-) diff --git a/assets/scripts/GitAgent.ts b/assets/scripts/GitAgent.ts index ff0319d0..fcd1fa75 100644 --- a/assets/scripts/GitAgent.ts +++ b/assets/scripts/GitAgent.ts @@ -346,8 +346,6 @@ export default class GitAgent { * * * https://isomorphic-git.org/docs/en/setConfig - * - * Alors, on doit passer le repoName */ async setAuthor( login: string, diff --git a/assets/scripts/routes/after-oauth-login.ts b/assets/scripts/routes/after-oauth-login.ts index 4baf0840..16bd4dba 100644 --- a/assets/scripts/routes/after-oauth-login.ts +++ b/assets/scripts/routes/after-oauth-login.ts @@ -70,12 +70,6 @@ export default () => { if (repos.length === 0) { page.redirect('/creer-un-nouveau-site') } else { - store.mutations.setReposForAccount({ - // @ts-ignore - login: store.state.login, - repos, - }) - page.redirect('/selectionner-un-site') } }) diff --git a/assets/scripts/routes/welcome.ts b/assets/scripts/routes/welcome.ts index 66d54317..17f0031f 100644 --- a/assets/scripts/routes/welcome.ts +++ b/assets/scripts/routes/welcome.ts @@ -21,12 +21,6 @@ export default () => { page(`/atelier-list-pages?repoPath=${repoPath}&account=${account}`) } else { - store.mutations.setReposForAccount({ - // @ts-ignore - login: store.state.login, - repos, - }) - page.redirect('/selectionner-un-site') } }) From dd894dd8f740aaf2d0e7fc3f7b9aef98aceb1283 Mon Sep 17 00:00:00 2001 From: mlbiche Date: Thu, 13 Aug 2026 17:41:46 +0200 Subject: [PATCH 4/5] Fix an error in console on page refresh due to currentProps being undefined --- assets/scripts/routeComponentLifeCycle.svelte.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/scripts/routeComponentLifeCycle.svelte.ts b/assets/scripts/routeComponentLifeCycle.svelte.ts index 66fa1689..acff6d78 100644 --- a/assets/scripts/routeComponentLifeCycle.svelte.ts +++ b/assets/scripts/routeComponentLifeCycle.svelte.ts @@ -7,7 +7,7 @@ import { Component } from 'svelte' type MapStateToPropsFunction = (state: ScribouilliState) => Record let currentComponent: Record -let currentProps: Record +let currentProps: Record = {} let currentMapStateToProps: MapStateToPropsFunction = _ => ({}) export function replaceComponent

>( From ae72e57d1141b8a79fbcc664ee93957c457a3635 Mon Sep 17 00:00:00 2001 From: mlbiche Date: Thu, 13 Aug 2026 17:42:44 +0200 Subject: [PATCH 5/5] Update documentation following pnpm introduction and adding more details for preparing forked repository --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 23062b26..22fe84f2 100644 --- a/README.md +++ b/README.md @@ -10,33 +10,31 @@ avec son contenu. - Ouvrir un terminal - Récupérer le repo `git clone git@github.com:lechappeebelle/scribouilli.git` dans le dossier qui va bien - Rentrer dans le dossier `scribouilli` -- Faire `npm install` +- Faire `npm install` (vous pouvez aussi utiliser `pnpm`) - Builder le projet avec `npm run dev` - Lancer le projet avec `npm start` dans un autre terminal - Ouvrir dans votre navigateur préféré `http://localhost:8080/` ## Développement -- Forker le repo sur votre compte -- Modifier les settings - - Donner les droits en écriture a _github action_ - - Pour déployer la branche `online` +- Forker le repo sur votre compte en prenant soin de **ne pas** copier **uniquement** la branche `principale` (pour disposer de la branche `online`) +- Modifier les paramètres (_Settings_) de votre fork + - Donner les droits en écriture à _github action_ dans **Actions > General > Workflow permissions** + - Pour déployer la branche `online` dans **Pages > Build and deployment** - Ajouter votre origine github pages (ex: `yaf.github.io`) dans [Scribouilli/toctoctoc/allowlist.csv](https://github.com/Scribouilli/toctoctoc/blob/main/allowlist.csv) Voilà à quoi ça peut ressembler : [github.com/yaf/scribouilli](https://github.com/yaf/scribouilli) Une fois les développements réalisés, vous pouvez faire une PR dans Scribouilli, en précisant votre url de développement pour que l'on puisse tester la modification. - ### Limite connue Pour le moment, il n'est pas possible de tester en local des sites hébergés sur gitlab ou scribougit (`git.scribouilli.org`) On peut le faire, mais ça demande de changer la config de toctoctoc en prod (et donc, ça casse la prod pour les sites ; une histoire de `redirect_uri`) - ### Outils de développement -Des pre-commit hooks sont installés automatiquement avec `husky`. Si jamais il sont trop contraignants, +Des pre-commit hooks peuvent être installés avec `husky` en exécutant `npm run prepare`. Si jamais il sont trop contraignants, il est possible de les ignorer avec l'option `--no-verify` de `git commit`. Vous pouvez également lancer les tests en local avec :