{"id":19141007,"url":"https://github.com/vladimirmikulic/parcel-plugin-gas","last_synced_at":"2025-05-06T23:18:13.536Z","repository":{"id":57318972,"uuid":"285924201","full_name":"VladimirMikulic/parcel-plugin-gas","owner":"VladimirMikulic","description":"🌀 Parcel plugin that enables Google App Script bundling.","archived":false,"fork":false,"pushed_at":"2021-08-29T21:17:12.000Z","size":331,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-06T23:18:07.867Z","etag":null,"topics":["bundle-adjustment","google-apps-script","javascript","parcel","parcel-plugin","web"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VladimirMikulic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-07T21:30:30.000Z","updated_at":"2025-04-10T14:55:14.000Z","dependencies_parsed_at":"2022-08-25T20:41:21.700Z","dependency_job_id":null,"html_url":"https://github.com/VladimirMikulic/parcel-plugin-gas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VladimirMikulic%2Fparcel-plugin-gas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VladimirMikulic%2Fparcel-plugin-gas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VladimirMikulic%2Fparcel-plugin-gas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VladimirMikulic%2Fparcel-plugin-gas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VladimirMikulic","download_url":"https://codeload.github.com/VladimirMikulic/parcel-plugin-gas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782835,"owners_count":21803410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundle-adjustment","google-apps-script","javascript","parcel","parcel-plugin","web"],"created_at":"2024-11-09T07:19:45.911Z","updated_at":"2025-05-06T23:18:13.520Z","avatar_url":"https://github.com/VladimirMikulic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# parcel-plugin-gas\n\n![Version](https://img.shields.io/npm/v/parcel-plugin-gas)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#)\n[![Twitter: VladoDev](https://img.shields.io/twitter/follow/VladoDev.svg?style=social)](https://twitter.com/VladoDev)\n\n\u003e 🌀 Parcel plugin that enables Google App Script bundling.\n\n_This is the plugin for Parcel v1. The plugin for the second version can be found [here](https://github.com/VladimirMikulic/parcel-optimizer-gas)._\n\n## :package: Installation\n\n```shell\n# Installs the plugin and saves it as a development dependency\nnpm i parcel-plugin-gas -D\n```\n\n## :cloud: Usage\n\nThis plugin modifies the Parcel bundle to be Google App Script compatible.\nParcel uses process called uglifying when generating your production build.\nUglifying is the process of converting long function/variable names into shorter versions\ni.e. `onInstall` becomes `j`. This is a problem since Google's runtime expects explicit\n`onInstall` method to be available in global scope. This applies to other methods as well.\nThat's why default Parcel bundle doesn't work on Google's runtime environment.\n\nBy attaching methods to the `GAS` entity in source code, you prevent uglifying and with a bit of the plugin's magic your code works on Google's runtime environment.\n\n### 🏠 Single file\n\n**index.js**\n\n```js\n// Runs when user installs extension\nGAS.onInstall = e =\u003e {\n  onOpen();\n};\n\n// Runs as soon as user opens a document\nGAS.onOpen = e =\u003e {\n  DocumentApp.getUi() // Or SlidesApp or FormApp.\n    .createMenu('My Add-on')\n    .addItem('Open', 'showSidebar')\n    .addToUi();\n};\n```\n\n### 💫 Multiple files\n\nGoogle App Script runtime environment differs from normal JS environment that you are\nused to in your Browser or Node.js. There are simply no modules. Everything is loaded in one\nglobal scope/namespace.\n\n**index.js**\n\n```js\nrequire('./my-module');\n\n// Runs when user installs extension\nGAS.onInstall = e =\u003e {\n  customFunction();\n};\n```\n\n**my-module.js**\n\n```js\nGAS.customFunction = () =\u003e {\n  console.log('Hello from Google App Script!');\n};\n```\n\n### 🚀 Build\n\n`parcel build index.js` -\u003e produces bundle which you can manually upload to your Google App Script project or push it from CLI with [clasp](https://developers.google.com/apps-script/guides/clasp).\n\n## :sparkles: Run tests\n\nThe plugin uses [Jest](https://jestjs.io/) for running tests.\n\nJest will execute all `.test.js` files in the `test` folder.\n\n```sh\nnpm test\n```\n\n## :man: Author\n\n**Vladimir Mikulic**\n\n- Twitter: [@VladoDev](https://twitter.com/VladoDev)\n- Github: [@VladimirMikulic](https://github.com/VladimirMikulic)\n- LinkedIn: [@vladimirmikulic](https://www.linkedin.com/in/vladimir-mikulic/)\n\n## :handshake: Contributing\n\nContributions, issues and feature requests are welcome!\n\n## :pencil: License\n\nThis project is licensed under [MIT](https://opensource.org/licenses/MIT) license.\n\n## :man_astronaut: Show your support\n\nGive a ⭐️ if this project helped you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladimirmikulic%2Fparcel-plugin-gas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvladimirmikulic%2Fparcel-plugin-gas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladimirmikulic%2Fparcel-plugin-gas/lists"}