How z-me/syncprojectsekainotion works
Project Type and Purpose
• It is an integration project that connects NotionDB and Google Sheets using GAS.
• The purpose is to manage and synchronize data between these two systems. This is evidenced by the README details for production and development environments (with specific spreadsheet and GAS project IDs) and the presence of components such as “connectNotion” and “setSpreadSheet”.
Analyzing the File Structure
• The repository’s top-level files (like package.json, tsconfig.json, build.js) support the TypeScript build process and project configuration.
• The src folder contains:
• appsscript.json: This file configures the GAS project.
• main.ts: Likely the central entry point.
• components folder: Contains individual modules:
• connectNotion.ts – Manages connection to Notion.
• customFunctions.ts – Provides functions that may be available as spreadsheet custom functions.
• menu.ts – Sets up a custom menu in Google Sheets.
• setSpreadSheet.ts – Handles spreadsheet-specific operations.
• lib folder: Includes a custom fetch.ts (likely a wrapper around GAS URL fetch) and types.ts (for type definitions).
• This clearly shows an architectural pattern where responsibilities are separated by functionality in distinct modules.
Insights from the README
• The README explains how to deploy to development or production environments, including build and push scripts, highlighting the build-to-deploy pipeline.
• The “NPMスクリプト” section describes commands to format code (via prettier), build the GAS code, and deploy changes. This reinforces that the build process is a central part of the architecture.
a. Main Components:
• Build Process:
• Build.js and npm scripts that transform the TypeScript source to GAS-compatible code.
• Application Core (GAS Code):
• Main module (main.ts)
• Components:
▪ connectNotion (managing Notion DB connection)
▪ customFunctions (spreadsheet custom functions)
▪ menu (for UI integration in Google Sheets)
▪ setSpreadSheet (to interact with the spreadsheet)
• Library layer:
▪ fetch.ts (HTTP requests abstraction)
▪ types.ts (type definitions)
• External Systems:
• NotionDB (as a data source/target)
• Google Spreadsheet (GSS) which is directly interacted with via GAS.
• Deployment Environments:
• Separate Prod and Dev configurations (as shown in the README).
b. Relationships and Interactions:
• The Build Process (npm and build.js) compiles the TypeScript files (including the main file and component modules) into GAS-ready code.
• The main.ts orchestrates the different components (menu, custom functions, Notion connection, and spreadsheet operations).
• The connectNotion module will manage API calls to Notion, potentially using the fetch.ts functions from the library.
• The setSpreadSheet component is responsible for reading/writing to the Google spreadsheet.
• Custom functions provide user-accessible features inside Google Sheets.
• Menus integrate the custom functions into the Google Sheets UI.
• The project interacts externally with Notion and the Google Spreadsheet, with clear environment-specific endpoints (both for the spreadsheet and the GAS project settings).
c. Architectural Patterns and Design Principles:
• Modular design / separation of concerns: Each component (Notion connection, UI menus, spreadsheet integration) is separated into its own module.
• Clear build and deployment pipeline: Leveraging npm scripts to build, push, and deploy for different environments.
• Layered architecture: With a lib layer for utilities and types, and a higher-level components layer that encapsulates business logic.
d. Relevant Technologies/Frameworks:
• Google Apps Script as the runtime environment.
• TypeScript as the primary language.
• Prettier for code formatting.
• Notion API (implied by module functionality and the project’s description).
• Google Sheets as the front-end user interface and data store.
• Node.js (via npm scripts) for the build and deployment process.