13 Commits

Author SHA1 Message Date
someone 00a1e954e4 Update sync manifest 2026-04-24 22:40:05 +00:00
someone 63fb07be30 Sync src/GiteaSync.gs 2026-04-24 22:40:03 +00:00
someone 5bed026e6d Sync src/WorkflowTest.gs 2026-04-24 22:40:02 +00:00
someone a641a8b9cd Sync src/WorkflowHooks.gs 2026-04-24 22:40:00 +00:00
someone 8781fa1047 Sync src/GiteaClient.gs 2026-04-24 22:39:59 +00:00
someone 0da147694d Sync src/VikunjaClient.gs 2026-04-24 22:39:58 +00:00
someone 7695ad623d Sync src/WorkflowConfig.gs 2026-04-24 22:39:56 +00:00
someone bc04ac144e Sync src/Readme.gs 2026-04-24 22:39:55 +00:00
someone 0f06c4fcf4 Sync src/scripts.html 2026-04-24 22:39:54 +00:00
someone c202e207c9 Sync src/styles.html 2026-04-24 22:39:52 +00:00
someone af530ed2e5 Sync src/Index.html 2026-04-24 22:39:50 +00:00
someone 9569033dc1 Sync src/Code.gs 2026-04-24 22:39:48 +00:00
someone fbfeff2b27 Sync appsscript.json 2026-04-24 22:39:45 +00:00
12 changed files with 11 additions and 32 deletions
View File
+2 -18
View File
@@ -30,29 +30,15 @@ function buildSyncBranchName(featureCode) {
function mapAppsScriptFileToRepoPath(file) { function mapAppsScriptFileToRepoPath(file) {
if (!file || !file.name || !file.type) return null; if (!file || !file.name || !file.type) return null;
if (file.name === 'appsscript' && file.type === 'JSON') { if (file.name === 'appsscript' && file.type === 'JSON') {
return 'appsscript.json'; return 'appsscript.json';
} }
const appFiles = ['Code', 'Index', 'styles', 'scripts'];
const docsFiles = ['Readme'];
let prefix = 'workflow/';
if (appFiles.includes(file.name)) {
prefix = 'app/';
} else if (docsFiles.includes(file.name)) {
prefix = 'docs/';
}
if (file.type === 'SERVER_JS') { if (file.type === 'SERVER_JS') {
return prefix + file.name + '.gs'; return 'src/' + file.name + '.gs';
} }
if (file.type === 'HTML') { if (file.type === 'HTML') {
return prefix + file.name + '.html'; return 'src/' + file.name + '.html';
} }
Logger.log('Unknown file type for mapping: ' + file.name + ' (' + file.type + ')');
return null; return null;
} }
@@ -387,7 +373,6 @@ function runManualSyncToGitea() {
console.log('=== Sync Summary ==='); console.log('=== Sync Summary ===');
console.log('Branch Sync: ' + res.branch); console.log('Branch Sync: ' + res.branch);
console.log('Files: ' + res.summary.created + ' created, ' + res.summary.updated + ' updated, ' + res.summary.errors + ' errors.'); console.log('Files: ' + res.summary.created + ' created, ' + res.summary.updated + ' updated, ' + res.summary.errors + ' errors.');
console.log('Catatan: File baru akan menggunakan path app/, docs/, dan workflow/. File lama dengan folder src/ mungkin masih tertinggal di repositori (Gitea) dan harus dihapus secara manual.');
if (res.pullRequest) { if (res.pullRequest) {
console.log('Pull Request Status: ' + (res.pullRequest.existed ? 'Existing' : 'Created')); console.log('Pull Request Status: ' + (res.pullRequest.existed ? 'Existing' : 'Created'));
console.log('Pull Request URL: ' + res.pullRequest.url); console.log('Pull Request URL: ' + res.pullRequest.url);
@@ -399,4 +384,3 @@ function runManualSyncToGitea() {
} }
return res; return res;
} }
View File
View File
@@ -472,11 +472,9 @@ function testGiteaPathMapping() {
const testCases = [ const testCases = [
{ input: { name: 'appsscript', type: 'JSON' }, expected: 'appsscript.json' }, { input: { name: 'appsscript', type: 'JSON' }, expected: 'appsscript.json' },
{ input: { name: 'Code', type: 'SERVER_JS' }, expected: 'app/Code.gs' }, { input: { name: 'Code', type: 'SERVER_JS' }, expected: 'src/Code.gs' },
{ input: { name: 'Index', type: 'HTML' }, expected: 'app/Index.html' }, { input: { name: 'Index', type: 'HTML' }, expected: 'src/Index.html' },
{ input: { name: 'styles', type: 'HTML' }, expected: 'app/styles.html' }, { input: { name: 'styles', type: 'HTML' }, expected: 'src/styles.html' },
{ input: { name: 'Readme', type: 'SERVER_JS' }, expected: 'docs/Readme.gs' },
{ input: { name: 'WorkflowConfig', type: 'SERVER_JS' }, expected: 'workflow/WorkflowConfig.gs' },
{ input: { name: 'Unknown', type: 'OTHER' }, expected: null } { input: { name: 'Unknown', type: 'OTHER' }, expected: null }
]; ];
@@ -556,7 +554,7 @@ function testPrepareGitSyncPayload() {
{ name: 'Code', type: 'SERVER_JS', source: 'function test() {}' }, { name: 'Code', type: 'SERVER_JS', source: 'function test() {}' },
{ name: 'Index', type: 'HTML', source: '<html></html>' }, { name: 'Index', type: 'HTML', source: '<html></html>' },
{ name: 'InvalidFile', type: 'UNKNOWN', source: 'junk' }, { name: 'InvalidFile', type: 'UNKNOWN', source: 'junk' },
{ name: 'MissingSource', type: 'SERVER_JS' }, { name: 'MissingSource', type: 'SERVER_JS' }, // valid file type mapping, missing source resolves to empty string
null null
]; ];
@@ -568,14 +566,13 @@ function testPrepareGitSyncPayload() {
assertEqual_('Valid files mapped correctly', payload.files.length, 4); assertEqual_('Valid files mapped correctly', payload.files.length, 4);
assertEqual_('JSON mapped to appsscript.json', payload.files[0].repoPath, 'appsscript.json'); assertEqual_('JSON mapped to appsscript.json', payload.files[0].repoPath, 'appsscript.json');
assertEqual_('SERVER_JS mapped to app/Code.gs', payload.files[1].repoPath, 'app/Code.gs'); assertEqual_('SERVER_JS mapped to src/Code.gs', payload.files[1].repoPath, 'src/Code.gs');
assertEqual_('HTML mapped to app/Index.html', payload.files[2].repoPath, 'app/Index.html'); assertEqual_('HTML mapped to src/Index.html', payload.files[2].repoPath, 'src/Index.html');
assertEqual_('SERVER_JS missing source mapped to workflow/MissingSource.gs', payload.files[3].repoPath, 'workflow/MissingSource.gs'); assertEqual_('SERVER_JS missing source mapped to src/MissingSource.gs', payload.files[3].repoPath, 'src/MissingSource.gs');
console.log('--- Test Passed: Prepare Git Sync Payload ---'); console.log('--- Test Passed: Prepare Git Sync Payload ---');
} }
function testGiteaSyncHelpers() { function testGiteaSyncHelpers() {
console.log('--- Starting Test: Gitea Sync Helpers ---'); console.log('--- Starting Test: Gitea Sync Helpers ---');
@@ -615,7 +612,7 @@ function testSyncSummaryFormat() {
updated: 1, updated: 1,
errors: 0, errors: 0,
details: [ details: [
{ file: "app/Code.gs", ok: true, message: "" }, { file: "src/Code.gs", ok: true, message: "" },
{ file: "appsscript.json", ok: true, message: "" }, { file: "appsscript.json", ok: true, message: "" },
{ file: "sync-manifest.json", ok: true, message: "" } { file: "sync-manifest.json", ok: true, message: "" }
] ]
@@ -640,8 +637,6 @@ function testSyncSummaryFormat() {
console.log('--- Test Passed: Sync Summary Format ---'); console.log('--- Test Passed: Sync Summary Format ---');
} }
function testGetAppsScriptProjectContentErrorFormat() { function testGetAppsScriptProjectContentErrorFormat() {
console.log('--- Starting Test: Get Apps Script Project Content Error Format ---'); console.log('--- Starting Test: Get Apps Script Project Content Error Format ---');
View File
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"featureCode": "manual", "featureCode": "manual",
"syncDate": "2026-04-24T23:45:06.978Z", "syncDate": "2026-04-24T22:40:04.295Z",
"filesSynced": 12 "filesSynced": 12
} }