-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/memory config #44
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
node_modules | ||
node_modules | ||
examples/*/* | ||
!examples/*/install.js |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Installing Examples | ||
|
||
Go into the directory for the example you want to see, and run: | ||
|
||
`js ./install.js` | ||
antony marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
'use strict' | ||
|
||
const replace = require('replace') | ||
const degit = require('degit') | ||
const { writeFileSync, writeFile } = require('fs') | ||
const { join } = require('path') | ||
|
||
async function clone () { | ||
const emitter = degit('sveltejs/sapper-template', { | ||
force: true | ||
}) | ||
|
||
emitter.on('info', info => { | ||
console.log(info.message) | ||
}) | ||
|
||
return emitter.clone('.') | ||
} | ||
|
||
async function patch () { | ||
replace({ | ||
regex: /polka\(\)/, | ||
replacement: 'export default polka()', | ||
thgh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
paths: [ | ||
join(__dirname, 'src', 'server.js') | ||
] | ||
}) | ||
|
||
writeFileSync( | ||
join(__dirname, 'vercel.json'), | ||
`{ | ||
"version": 2, | ||
"builds": [ | ||
{ | ||
"src": "package.json", | ||
"use": "vercel-sapper" | ||
} | ||
] | ||
}` | ||
) | ||
|
||
writeFileSync( | ||
join(__dirname, '.vercelignore'), | ||
`__sapper__ | ||
cypress | ||
node_modules` | ||
) | ||
} | ||
|
||
function info () { | ||
console.log('Example installed. Deploy with `vercel`') | ||
} | ||
|
||
clone() | ||
.then(patch) | ||
.then(info) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ exports.build = async ({ | |
|
||
// Use the system-installed version of `node` when running via `vercel dev` | ||
const runtime = meta.isDev ? 'nodejs' : nodeVersion.runtime | ||
const memory = config.memory || undefined | ||
|
||
const lambda = await createLambda({ | ||
files: { | ||
|
@@ -56,7 +57,8 @@ exports.build = async ({ | |
...applicationFiles | ||
}, | ||
handler: 'launcher.launcher', | ||
runtime: runtime | ||
runtime, | ||
...memory ? { memory } : {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not simply memory : config.memory? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we defaulting it? I need to check. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The reason I don't like this approach is that it requires manual maintenance of dependencies and such as the template is updated. It's the same reason the svelte TS template is a patch rather than yet another unmaintained fork. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What manual maintenance would be required? I think it would run the same install.js but it saves the user from having to clone this repo, running npm install, cd into the examples directory. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Who would be responsible for manually merging the original repo into this one every time it is updated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No manual merging required, check it out! #47 |
||
}).catch(e => { | ||
console.error('createLambda.error', e) | ||
console.error('createLambda.config', config) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the first step
npx degit ...vercel-sapper
orgit clone ...
or how do you see this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could probably include a git clone step before this. I'm not sure degit is required since the template does its own degit, and there isn't really any need to remove git control from the parent project.