Ensure that you have npm, git, and clasp installed by running:
npm --versiongit --versionclasp --versionClone the repository and install the necessary dependencies:
git clone https://github.com/MaksymStoianov/apps-script-template.git
cd apps-script-template
npm installAuthenticate with Google to enable project deployment:
npx clasp loginAfter logging in, link the local project to your GAS project (you can create a new one or clone an existing one):
Use these standard npm scripts to manage your development workflow:
npm run devStarts the Vite Dev Server for React frontend development.
Automatically formats the project's code using Prettier, ensuring a consistent style.
npm run formatPerforms code inspection for style errors and potential issues using ESLint.
npm run lintRuns tests using Vitest.
npm run test
# OR For more granular testing:
npm run test:unit
npm run test:integration
npm run test:e2eA complete project build for production. Note that both the frontend and backend will be compiled and ready for upload to the Google Apps Script project.
npm run build
# Alternatively, use the Development mode build:
npm run build:devnpm run build:appsscript
# Alternatively, use the Development mode build:
npm run build:appsscript:devFor hosting on a third-party resource (if full GAS upload is not required):
npm run build:webapp
# Alternatively, use the Development mode build:
npm run build:webapp:devUploads the compiled code to the Google Apps Script project using clasp push.
npm run deployThe structure clearly separates GAS backend logic from the React frontend code, ensuring a clean and maintainable codebase.
.
├── config/ # Configuration files (tsconfig, vite, storybook)
├── dist/ # Output directory for compiled build results
├── public/ # Static assets (e.g., images, locales)
├── src/
│ ├── main/
│ │ ├── resources/
│ │ │ └── appsscript.json # Manifest file
│ │ ├── appsscript/ # Backend (Google Apps Script .gs logic)
│ │ │ └── main.ts # Main Apps Script file (e.g., doGet, doPost)
│ │ └── webapp/ # Frontend
│ └── test/ # Test files
├── index.html # HTML template to render the React app
└── package.json # Project dependencies and scripts
More
- Set up CI/CD for automated deployment.
- Implement tests.
For a detailed list of changes and updates, please refer to the CHANGELOG file.
This project is licensed under the LICENSE file.