This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add arc locally | |
```bash | |
npm init -f | |
npm i @architect/architect | |
``` | |
edit `package.json` with a startup script | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ | |
"use strict"; | |
/** | |
* The runtime has a single beforeExit function which is stored in the global | |
* object with a symbol key. | |
* The symbol is not exported. | |
* The process.beforeExit listener is setup in index.js along with all other | |
* top-level process event listeners. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* fixes begin/data for architect 6.x apps | |
*/ | |
module.exports = function beginDataMacro(arc, cfn) { | |
if (!cfn.Resources.DataTable) { | |
// adds a dynamodb table for begin/data if @tables is missing 'data' | |
// adds a CRUD policy to Role for data table | |
} | |
let lambdas = Object.keys(cfn.Resources).filter(function isLambda(Name) { | |
let resource = cfn.Resources[Name] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup a workspace | |
mkdir testarc6 | |
cd testarc6 | |
npm init -f | |
npm i @architect/[email protected] | |
# generate a hello world function | |
npx arc init | |
# modify .arc file @aws with a bucket property for deploying |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/vim/vim.git | |
cd vim/src | |
./configure --enable-multibyte --enable-terminal --enable-gui=no --without-x | |
make | |
sudo make install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH=~/.npm-global/bin:$PATH | |
export AWS_REGION=us-east-1 | |
export AWS_PROFILE=smallwins | |
DGREY="\[\e[0;32m\]" | |
ENDCOLOR="\[\e[0m\]" | |
PS1="$DGREY#! $ENDCOLOR" | |
# allow vi nav on esc | |
set -o vi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let tiny = require('tiny-json-http') | |
module.exports = async function slack(code) { | |
// trade the code for an access token | |
let result = await tiny.get({ | |
url: `https://slack.com/api/oauth.access`, | |
data: { | |
client_id: process.env.SLACK_CLIENT_ID, | |
client_secret: process.env.SLACK_CLIENT_SECRET, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let next = require('../../front/.next/serverless/pages/index.js') | |
exports.handler = async function http(req) { | |
req.url = req.path | |
let res = {end(){},setHeader(){}} | |
return {type:'text/html; charset=utf8', body: next.render(req,res).html} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax region arcAppSection start=/\v\@app/ skip=/\v\\./ end="\v\@=" | |
syntax region arcHtmlSection start=/\v\@http/ skip=/\v\\./ end="\v\@=" | |
syntax region arcJsonSection start=/\v\@queues/ skip=/\v\\./ end="\v\@=" | |
syntax region arcJsonSection start=/\v\@static/ skip=/\v\\./ end="\v\@=" | |
syntax region arcJsonSection start=/\v\@domain/ skip=/\v\\./ end="\v\@=" | |
syntax region arcJsonSection start=/\v\@aws/ skip=/\v\\./ end="\v\@=" | |
syntax region arcEventsSection start=/\v\@events/ skip=/\v\\./ end="\v\@=" | |
syntax region arcTablesSection start=/\v\@tables/ skip=/\v\\./ end="\v\@=" | |
syntax region arcIndexesSection start=/\v\@indexes/ skip=/\v\\./ end="\v\@=" | |
syntax region arcScheduledSection start=/\v\@scheduled/ skip=/\v\\./ end="\v\@=" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import data from '@architect/data' | |
import App from '@architect/shared/app' | |
import render from 'preact-to-string' | |
import {h} from 'preact' | |
/** | |
* ssr preact from a lambda | |
* if, instead of index.js, you have index.jsx OR index.tsx arc will automatically transpile the code | |
*/ | |
export async function handler(req) { |