Skip to content

Instantly share code, notes, and snippets.

@ryanblock
Last active January 28, 2022 22:30
Show Gist options
  • Save ryanblock/ccb8e8f45b366a00dcb83b9ae12d834b to your computer and use it in GitHub Desktop.
Save ryanblock/ccb8e8f45b366a00dcb83b9ae12d834b to your computer and use it in GitHub Desktop.
arc 10 rc1 plugin outline
/**
* Assuming your app.arc includes:
* @plugins
* test-plugin
*
* This file would live in `src/plugins/test-plugin/index.js` or `src/plugins/test-plugin.js`
*/
// let { join } = require('path')
module.exports = {
// Setters
set: {
/**
* Pragmas
*/
// @events
events: params => {
// return {
// name: 'my-event',
// src: join('path', 'to', 'code'),
// }
},
// @queues
queues: params => {
// return {
// name: 'my-queue',
// src: join('path', 'to', 'code'),
// }
},
// @http
http: params => {
// return {
// method: 'get',
// path: '/*'
// src: join('path', 'to', 'code'),
// }
},
// @scheduled
scheduled: params => {
// return {
// name: 'my-scheduled-event',
// src: join('path', 'to', 'code'),
// rate: '1 day', // or...
// cron: '* * * * * *',
// }
},
// @tables-streams
'tables-streams': params => {
// return {
// name: 'my-table-stream',
// table: 'app-data',
// src: join('path', 'to', 'code'),
// }
},
// Custom / bare Lambdas (with event sources to be defined by `deploy.start`)
customLambdas: params => {
// return {
// name: 'my-custom-lambda',
// src: join('path', 'to', 'code'),
// }
},
/**
* Resources
*/
env: params => {
// return {
// MY_ENV_VAR: 'ok',
// ANOTHER_VAR: { objects_and_arrays_are_automatically_json_encoded: 'neat!' }
// }
},
runtimes: params => {
// return {
// name: 'runtime-name',
// type: 'transpiled',
// build: '.build',
// baseRuntime: 'nodejs14.x',
// }
},
},
// Deploy
deploy: {
start: async params => {
// Run operations prior to deployment
// Optionally return mutated cloudformation
},
services: async params => {
// return {
// 'service-name': 'value or ARN', // Register a service
// 'arbitrary-data': '...' // Add up to 4KB of arbitrary data / config as a string
// }
},
target: async params => {
/* API NOT YET ENABLED */
// Deploy to a target other than AWS (e.g. Begin, Serverless Cloud, etc.)
},
end: async params => {
/* API NOT YET ENABLED */
// Run operations after to deployment
},
},
// Sandbox
sandbox: {
start: async params => {
// Run operations upon Sandbox startup
},
watcher: async params => {
// Act on filesystem events within your project
},
end: async params => {
// Run operations upon Sandbox shutdown
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment