@sveltejs/adapter-vercel
Advanced tools
Comparing version 0.0.2 to 0.0.3
# @sveltejs/adapter-vercel | ||
## 0.0.3 | ||
### Patch Changes | ||
- 67eaeea: Move app-utils stuff into subpackages | ||
## 0.0.2 | ||
@@ -4,0 +10,0 @@ |
35
index.js
@@ -1,23 +0,6 @@ | ||
const { copyFileSync, mkdirSync, writeFileSync, readFileSync } = require('fs'); | ||
const { resolve, join, dirname } = require('path'); | ||
const glob = require('tiny-glob/sync'); | ||
const { prerender, mkdirp } = require('@sveltejs/app-utils'); | ||
const { writeFileSync, readFileSync } = require('fs'); | ||
const { resolve, join } = require('path'); | ||
const { prerender } = require('@sveltejs/app-utils/renderer'); | ||
const { copy } = require('@sveltejs/app-utils/files'); | ||
const copy_contents = (source_directory, base_destination_directory) => { | ||
glob('**/*', { cwd: source_directory, filesOnly: true }).forEach(file => { | ||
if (file[0] == '.') { | ||
return; | ||
} | ||
copy_single(source_directory, base_destination_directory, file); | ||
}); | ||
}; | ||
const copy_single = (source_directory, base_destination_directory, file) => { | ||
const destination_file = join(base_destination_directory, file); | ||
const destination_directory = dirname(destination_file); | ||
mkdirp(destination_directory); | ||
copyFileSync(join(source_directory, file), destination_file); | ||
}; | ||
function write_manifest(manifest) { | ||
@@ -55,8 +38,8 @@ return `module.exports = { | ||
log.minor('Writing client application...'); | ||
copy_contents('static', static_directory); | ||
copy_contents(resolve(dir, 'client'), join(static_directory, '_app')); | ||
copy('static', static_directory); | ||
copy(resolve(dir, 'client'), join(static_directory, '_app')); | ||
log.minor('Building lambda...'); | ||
copy_single(resolve(__dirname, 'src'), lambda_directory, 'render.js'); | ||
copy_single(resolve(dir), server_directory, 'client.json'); | ||
copy(resolve(__dirname, 'src'), lambda_directory); | ||
copy(join(resolve(dir), 'client.json'), join(server_directory, 'client.json')); | ||
const written_manifest = write_manifest(manifest); | ||
@@ -80,3 +63,3 @@ const htmlPath = resolve('src', 'app.html'); | ||
log.minor('Writing server application...'); | ||
copy_contents(resolve(dir, 'server'), server_directory); | ||
copy(resolve(dir, 'server'), server_directory); | ||
@@ -83,0 +66,0 @@ // TODO: Merge this, rather than write it |
{ | ||
"name": "@sveltejs/adapter-vercel", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"devDependencies": { | ||
@@ -5,0 +5,0 @@ "@sveltejs/app-utils": "*" |
@@ -7,11 +7,15 @@ # adapter-vercel | ||
Experimental, and missing a lot of features and optimisations. | ||
Due to some strong opinions of the vercel deployment mechanism, we currently bung the whole server into the API directory to prevent the application appearing to be static, which isn't ideal. | ||
Due to some strong opinions of the vercel deployment mechanism: | ||
Vercel are due to make some changes to the way applications are built and deployed. Once this happens, this builder will change to that new format. | ||
* we currently bung the whole server into the API directory, which isn't ideal. | ||
* we don't currently use a build task which vercel can call. This seems to make the app a static app which isn't what we want. | ||
## Usage | ||
## Configuration | ||
Due to the constraints listed above, you need to run `npm run build` outside vercel first, and then deploy the project with `vercel`. | ||
You need to ensure that `vercel` doesn't try to build your app, and just deploys what you give it. To do that: | ||
In a future edition, this will read and modify your existing `vercel.json` or write one if absent. | ||
```sh | ||
echo 'package.json' > .vercelignore | ||
npm run build | ||
vercel | ||
``` |
const { URLSearchParams } = require('url'); | ||
const { render } = require('@sveltejs/app-utils'); | ||
const { render } = require('@sveltejs/app-utils/renderer'); | ||
const client = require('./server/client.json'); | ||
@@ -4,0 +4,0 @@ const manifest = require('./server/manifest.js'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20
6194
133