Compare commits
35 Commits
@vercel/fr
...
@vercel/bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
311ef26f60 | ||
|
|
c08462a46b | ||
|
|
24b2f16afb | ||
|
|
919c667ff1 | ||
|
|
ab3f99bfea | ||
|
|
a8615d3c34 | ||
|
|
0a09a5232c | ||
|
|
f3190b7f74 | ||
|
|
cf827a8b91 | ||
|
|
bed83e829c | ||
|
|
0f0ee4e845 | ||
|
|
2d70c6c811 | ||
|
|
887309f0a5 | ||
|
|
8a7657c80b | ||
|
|
279d0bf988 | ||
|
|
d2b31d03da | ||
|
|
16acf906fc | ||
|
|
0127d17703 | ||
|
|
0bfc2a3693 | ||
|
|
b9809b140c | ||
|
|
faaccc1f9f | ||
|
|
4b61f1dd61 | ||
|
|
cdd417455f | ||
|
|
fe671f56c5 | ||
|
|
ddf9e6cf3f | ||
|
|
13b03c6abd | ||
|
|
7dd4c629ad | ||
|
|
81b3d7f5f1 | ||
|
|
3566c32209 | ||
|
|
267ca7b379 | ||
|
|
7b9d9954b8 | ||
|
|
79675db241 | ||
|
|
3ac8a3f67f | ||
|
|
2f19949133 | ||
|
|
85fd2aed7e |
@@ -1,14 +1,7 @@
|
||||
node_modules
|
||||
dist
|
||||
examples
|
||||
|
||||
# gatsby-plugin-now
|
||||
packages/gatsby-plugin-now/test/fixtures
|
||||
|
||||
# build-utils
|
||||
packages/build-utils/test/fixtures
|
||||
|
||||
# cli
|
||||
packages/cli/@types
|
||||
packages/cli/download
|
||||
packages/cli/dist
|
||||
@@ -17,24 +10,9 @@ packages/cli/test/dev/fixtures
|
||||
packages/cli/bin
|
||||
packages/cli/link
|
||||
packages/cli/src/util/dev/templates/*.ts
|
||||
|
||||
# client
|
||||
packages/client/tests/fixtures
|
||||
packages/client/lib
|
||||
|
||||
# next
|
||||
packages/next/test/fixtures
|
||||
|
||||
# node
|
||||
packages/node/src/bridge.ts
|
||||
packages/node/test/fixtures
|
||||
|
||||
# node-bridge
|
||||
packages/node-bridge/bridge.*
|
||||
|
||||
# static-build
|
||||
packages/static-build/test/fixtures
|
||||
packages/static-build/test/build-fixtures
|
||||
|
||||
# redwood
|
||||
packages/redwood/test/fixtures
|
||||
packages/node-bridge/bridge.js
|
||||
packages/node-bridge/launcher.js
|
||||
|
||||
@@ -14,7 +14,6 @@ const frameworks = (_frameworks as Framework[])
|
||||
sort: undefined,
|
||||
dependency: undefined,
|
||||
defaultRoutes: undefined,
|
||||
cachePattern: undefined,
|
||||
devCommand: undefined,
|
||||
buildCommand: undefined,
|
||||
};
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 25 KiB |
8
examples/nuxtjs/.gitignore
vendored
@@ -80,11 +80,15 @@ dist
|
||||
|
||||
# IDE / Editor
|
||||
.idea
|
||||
.editorconfig
|
||||
|
||||
# Service worker
|
||||
sw.*
|
||||
|
||||
# Mac OSX
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Vim swap files
|
||||
*.swp
|
||||
|
||||
# Vercel
|
||||
.vercel
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
README.md
|
||||
.nuxt
|
||||
node_modules
|
||||
*.log
|
||||
|
||||
@@ -8,7 +8,7 @@ Deploy your own Nuxt.js project with Vercel.
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/vercel/vercel/tree/main/examples/nuxtjs)
|
||||
|
||||
_Live Example: https://nuxtjs.now-examples.now.sh_
|
||||
_Live Example: https://nuxtjs.now-examples.vercel.app/_
|
||||
|
||||
### How We Created This Example
|
||||
|
||||
@@ -17,5 +17,3 @@ To get started with Nuxt.js deployed with Vercel, you can use the [Create-Nuxt-A
|
||||
```shell
|
||||
$ npx create-nuxt-app my-app
|
||||
```
|
||||
|
||||
> The only change made is to amend the output directory in `nuxt.config.js` to `"/public"`.
|
||||
|
||||
@@ -1,44 +1,37 @@
|
||||
export default {
|
||||
mode: 'spa',
|
||||
/*
|
||||
** Headers of the page
|
||||
*/
|
||||
// Target: https://go.nuxtjs.dev/config-target
|
||||
target: 'static',
|
||||
|
||||
// Global page headers: https://go.nuxtjs.dev/config-head
|
||||
head: {
|
||||
title: process.env.npm_package_name || '',
|
||||
title: 'nuxtjs',
|
||||
meta: [
|
||||
{ charset: 'utf-8' },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
{
|
||||
hid: 'description',
|
||||
name: 'description',
|
||||
content: process.env.npm_package_description || '',
|
||||
content: 'My astonishing Nuxt.js project',
|
||||
},
|
||||
],
|
||||
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
|
||||
},
|
||||
/*
|
||||
** Customize the progress-bar color
|
||||
*/
|
||||
loading: { color: '#fff' },
|
||||
/*
|
||||
** Global CSS
|
||||
*/
|
||||
|
||||
// Global CSS: https://go.nuxtjs.dev/config-css
|
||||
css: [],
|
||||
/*
|
||||
** Plugins to load before mounting the App
|
||||
*/
|
||||
|
||||
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
|
||||
plugins: [],
|
||||
/*
|
||||
** Nuxt.js modules
|
||||
*/
|
||||
|
||||
// Auto import components: https://go.nuxtjs.dev/config-components
|
||||
components: true,
|
||||
|
||||
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
|
||||
buildModules: [],
|
||||
|
||||
// Modules: https://go.nuxtjs.dev/config-modules
|
||||
modules: [],
|
||||
/*
|
||||
** Build configuration
|
||||
*/
|
||||
build: {
|
||||
/*
|
||||
** You can extend webpack config here
|
||||
*/
|
||||
extend(config, ctx) {},
|
||||
},
|
||||
|
||||
// Build Configuration: https://go.nuxtjs.dev/config-build
|
||||
build: {}
|
||||
};
|
||||
|
||||
@@ -10,9 +10,8 @@
|
||||
"start": "nuxt start"
|
||||
},
|
||||
"dependencies": {
|
||||
"nuxt": "^2.0.0"
|
||||
"core-js": "^3.15.0",
|
||||
"nuxt": "^2.15.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.7"
|
||||
}
|
||||
"devDependencies": {}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<a
|
||||
href="https://nuxtjs.org/"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="button--green"
|
||||
>
|
||||
Documentation
|
||||
@@ -19,6 +20,7 @@
|
||||
<a
|
||||
href="https://github.com/nuxt/nuxt.js"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="button--grey"
|
||||
>
|
||||
GitHub
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.4 KiB |
6
examples/vite/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
.vercel
|
||||
1
examples/vite/.vercelignore
Normal file
@@ -0,0 +1 @@
|
||||
README.md
|
||||
29
examples/vite/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||

|
||||
|
||||
# Vite Example
|
||||
|
||||
This directory is a brief example of a Vite/Vue.js site that can be deployed with Vercel and zero configuration.
|
||||
|
||||
While this project uses Vue.js, Vite supports many popular JS frameworks. See all the supported frameworks here: https://vitejs.dev/guide/#scaffolding-your-first-vite-project
|
||||
|
||||
## Deploy Your Own
|
||||
|
||||
Deploy your own Vite project with Vercel.
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/vercel/vercel/tree/main/examples/vite)
|
||||
|
||||
### How We Created This Example
|
||||
|
||||
To get started with Vue.js deployed with Vercel, you can use Vite (https://vitejs.dev/guide/#scaffolding-your-first-vite-project) to initialize the project:
|
||||
|
||||
```shell
|
||||
$ yarn create @vitejs/app
|
||||
```
|
||||
|
||||
### Deploying From Your Terminal
|
||||
|
||||
You can deploy your new Vite project with a single command from your terminal using [Vercel CLI](https://vercel.com/download):
|
||||
|
||||
```shell
|
||||
$ vercel
|
||||
```
|
||||
13
examples/vite/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
17
examples/vite/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "vite",
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"serve": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^1.2.4",
|
||||
"@vue/compiler-sfc": "^3.0.5",
|
||||
"vite": "^2.4.0"
|
||||
}
|
||||
}
|
||||
BIN
examples/vite/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
22
examples/vite/src/App.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<img alt="Vue logo" src="./assets/logo.png" />
|
||||
<HelloWorld msg="Hello Vue 3 + Vite" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import HelloWorld from './components/HelloWorld.vue'
|
||||
|
||||
// This starter template is using Vue 3 experimental <script setup> SFCs
|
||||
// Check out https://github.com/vuejs/rfcs/blob/script-setup-2/active-rfcs/0000-script-setup.md
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
margin-top: 60px;
|
||||
}
|
||||
</style>
|
||||
BIN
examples/vite/src/assets/logo.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
33
examples/vite/src/components/HelloWorld.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<h1>{{ msg }}</h1>
|
||||
|
||||
<p>
|
||||
<a href="https://vitejs.dev/guide/features.html" target="_blank">
|
||||
Vite Documentation
|
||||
</a>
|
||||
|
|
||||
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Documentation</a>
|
||||
</p>
|
||||
|
||||
<button type="button" @click="state.count++">count is: {{ state.count }}</button>
|
||||
<p>
|
||||
Edit
|
||||
<code>components/HelloWorld.vue</code> to test hot module replacement.
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps, reactive } from 'vue'
|
||||
|
||||
defineProps({
|
||||
msg: String
|
||||
})
|
||||
|
||||
const state = reactive({ count: 0 })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
||||
4
examples/vite/src/main.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
7
examples/vite/vite.config.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()]
|
||||
})
|
||||
395
examples/vite/yarn.lock
Normal file
@@ -0,0 +1,395 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@babel/helper-validator-identifier@^7.14.5":
|
||||
version "7.14.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz#d0f0e277c512e0c938277faa85a3968c9a44c0e8"
|
||||
integrity sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==
|
||||
|
||||
"@babel/parser@^7.12.0", "@babel/parser@^7.13.9":
|
||||
version "7.14.7"
|
||||
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.14.7.tgz#6099720c8839ca865a2637e6c85852ead0bdb595"
|
||||
integrity sha512-X67Z5y+VBJuHB/RjwECp8kSl5uYi0BvRbNeWqkaJCVh+LiTPl19WBUfG627psSgp9rSf6ojuXghQM3ha6qHHdA==
|
||||
|
||||
"@babel/types@^7.12.0", "@babel/types@^7.13.0":
|
||||
version "7.14.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.14.5.tgz#3bb997ba829a2104cedb20689c4a5b8121d383ff"
|
||||
integrity sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==
|
||||
dependencies:
|
||||
"@babel/helper-validator-identifier" "^7.14.5"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@types/estree@^0.0.48":
|
||||
version "0.0.48"
|
||||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.48.tgz#18dc8091b285df90db2f25aa7d906cfc394b7f74"
|
||||
integrity sha512-LfZwXoGUDo0C3me81HXgkBg5CTQYb6xzEl+fNmbO4JdRiSKQ8A0GD1OBBvKAIsbCUgoyAty7m99GqqMQe784ew==
|
||||
|
||||
"@vitejs/plugin-vue@^1.2.4":
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-1.2.4.tgz#a7aa6e6a31c556a8b781de730316deeecf7f56f2"
|
||||
integrity sha512-D/3H9plevPQGgQGwmV6eecvOnooLTecPR63HPffVVWPEhbfvmtYLWgznzs456NBb2DItiRTCIa1yWxvGqC+I8A==
|
||||
|
||||
"@vue/compiler-core@3.1.4":
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.1.4.tgz#a3a74cf52e8f01af386d364ac8a099cbeb260424"
|
||||
integrity sha512-TnUz+1z0y74O/A4YKAbzsdUfamyHV73MihrEfvettWpm9bQKVoZd1nEmR1cGN9LsXWlwAvVQBetBlWdOjmQO5Q==
|
||||
dependencies:
|
||||
"@babel/parser" "^7.12.0"
|
||||
"@babel/types" "^7.12.0"
|
||||
"@vue/shared" "3.1.4"
|
||||
estree-walker "^2.0.1"
|
||||
source-map "^0.6.1"
|
||||
|
||||
"@vue/compiler-dom@3.1.4":
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.1.4.tgz#bf3795e1449f32c965d38c4ea6d808ca05fdfc97"
|
||||
integrity sha512-3tG2ScHkghhUBuFwl9KgyZhrS8CPFZsO7hUDekJgIp5b1OMkROr4AvxHu6rRMl4WkyvYkvidFNBS2VfOnwa6Kw==
|
||||
dependencies:
|
||||
"@vue/compiler-core" "3.1.4"
|
||||
"@vue/shared" "3.1.4"
|
||||
|
||||
"@vue/compiler-sfc@^3.0.5":
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.1.4.tgz#93e87db950e0711339c18baa7bb7d28d3522d7bc"
|
||||
integrity sha512-4KDQg60Khy3SgnF+V/TB2NZqzmM4TyGRmzsxqG1SebGdMSecCweFDSlI/F1vDYk6dKiCHgmpoT9A1sLxswkJ0A==
|
||||
dependencies:
|
||||
"@babel/parser" "^7.13.9"
|
||||
"@babel/types" "^7.13.0"
|
||||
"@types/estree" "^0.0.48"
|
||||
"@vue/compiler-core" "3.1.4"
|
||||
"@vue/compiler-dom" "3.1.4"
|
||||
"@vue/compiler-ssr" "3.1.4"
|
||||
"@vue/shared" "3.1.4"
|
||||
consolidate "^0.16.0"
|
||||
estree-walker "^2.0.1"
|
||||
hash-sum "^2.0.0"
|
||||
lru-cache "^5.1.1"
|
||||
magic-string "^0.25.7"
|
||||
merge-source-map "^1.1.0"
|
||||
postcss "^8.1.10"
|
||||
postcss-modules "^4.0.0"
|
||||
postcss-selector-parser "^6.0.4"
|
||||
source-map "^0.6.1"
|
||||
|
||||
"@vue/compiler-ssr@3.1.4":
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.1.4.tgz#7f6eaac5b1851fc15c82c083e8179eb1216b303c"
|
||||
integrity sha512-Box8fCuCFPp0FuimIswjDkjwiSDCBkHvt/xVALyFkYCiIMWv2eR53fIjmlsnEHhcBuZ+VgRC+UanCTcKvSA1gA==
|
||||
dependencies:
|
||||
"@vue/compiler-dom" "3.1.4"
|
||||
"@vue/shared" "3.1.4"
|
||||
|
||||
"@vue/reactivity@3.1.4":
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.1.4.tgz#d926ed46fb0d48582ccf8665b062d37b5d35ba99"
|
||||
integrity sha512-YDlgii2Cr9yAoKVZFzgY4j0mYlVT73986X3e5SPp6ifqckSEoFSUWXZK2Tb53TB/9qO29BEEbspnKD3m3wAwkA==
|
||||
dependencies:
|
||||
"@vue/shared" "3.1.4"
|
||||
|
||||
"@vue/runtime-core@3.1.4":
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.1.4.tgz#3e30ae6ecbfff06df5adc9414491143191a375ba"
|
||||
integrity sha512-qmVJgJuFxfT7M4qHQ4M6KqhKC66fjuswK+aBivE8dWiZ2rtIGl9gtJGpwqwjQEcKEBTOfvvrtrwBncYArJUO8Q==
|
||||
dependencies:
|
||||
"@vue/reactivity" "3.1.4"
|
||||
"@vue/shared" "3.1.4"
|
||||
|
||||
"@vue/runtime-dom@3.1.4":
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.1.4.tgz#acfeee200d5c45fc2cbdf7058cda1498f9b45849"
|
||||
integrity sha512-vbmwgTxku1BU87Kw7r29adv0OIrDXCW0PslOPQT0O/9R5SqcXgS94Yj6zsztDjvghegenwIAPNLlDR1Auh5s+w==
|
||||
dependencies:
|
||||
"@vue/runtime-core" "3.1.4"
|
||||
"@vue/shared" "3.1.4"
|
||||
csstype "^2.6.8"
|
||||
|
||||
"@vue/shared@3.1.4":
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.1.4.tgz#c14c461ec42ea2c1556e86f60b0354341d91adc3"
|
||||
integrity sha512-6O45kZAmkLvzGLToBxEz4lR2W6kXohCtebV2UxjH9GXjd8X9AhEn68FN9eNanFtWNzvgw1hqd6HkPRVQalqf7Q==
|
||||
|
||||
big.js@^5.2.2:
|
||||
version "5.2.2"
|
||||
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
|
||||
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==
|
||||
|
||||
bluebird@^3.7.2:
|
||||
version "3.7.2"
|
||||
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
|
||||
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
|
||||
|
||||
colorette@^1.2.2:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94"
|
||||
integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==
|
||||
|
||||
consolidate@^0.16.0:
|
||||
version "0.16.0"
|
||||
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.16.0.tgz#a11864768930f2f19431660a65906668f5fbdc16"
|
||||
integrity sha512-Nhl1wzCslqXYTJVDyJCu3ODohy9OfBMB5uD2BiBTzd7w+QY0lBzafkR8y8755yMYHAaMD4NuzbAw03/xzfw+eQ==
|
||||
dependencies:
|
||||
bluebird "^3.7.2"
|
||||
|
||||
cssesc@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
|
||||
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==
|
||||
|
||||
csstype@^2.6.8:
|
||||
version "2.6.17"
|
||||
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.17.tgz#4cf30eb87e1d1a005d8b6510f95292413f6a1c0e"
|
||||
integrity sha512-u1wmTI1jJGzCJzWndZo8mk4wnPTZd1eOIYTYvuEyOQGfmDl3TrabCCfKnOC86FZwW/9djqTl933UF/cS425i9A==
|
||||
|
||||
emojis-list@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78"
|
||||
integrity sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==
|
||||
|
||||
esbuild@^0.12.8:
|
||||
version "0.12.15"
|
||||
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.15.tgz#9d99cf39aeb2188265c5983e983e236829f08af0"
|
||||
integrity sha512-72V4JNd2+48eOVCXx49xoSWHgC3/cCy96e7mbXKY+WOWghN00cCmlGnwVLRhRHorvv0dgCyuMYBZlM2xDM5OQw==
|
||||
|
||||
estree-walker@^2.0.1:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
|
||||
integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==
|
||||
|
||||
fsevents@~2.3.2:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
|
||||
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
|
||||
|
||||
function-bind@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
|
||||
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
|
||||
|
||||
generic-names@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/generic-names/-/generic-names-2.0.1.tgz#f8a378ead2ccaa7a34f0317b05554832ae41b872"
|
||||
integrity sha512-kPCHWa1m9wGG/OwQpeweTwM/PYiQLrUIxXbt/P4Nic3LbGjCP0YwrALHW1uNLKZ0LIMg+RF+XRlj2ekT9ZlZAQ==
|
||||
dependencies:
|
||||
loader-utils "^1.1.0"
|
||||
|
||||
has@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
|
||||
integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==
|
||||
dependencies:
|
||||
function-bind "^1.1.1"
|
||||
|
||||
hash-sum@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/hash-sum/-/hash-sum-2.0.0.tgz#81d01bb5de8ea4a214ad5d6ead1b523460b0b45a"
|
||||
integrity sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==
|
||||
|
||||
icss-replace-symbols@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded"
|
||||
integrity sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=
|
||||
|
||||
icss-utils@^5.0.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae"
|
||||
integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==
|
||||
|
||||
is-core-module@^2.2.0:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.4.0.tgz#8e9fc8e15027b011418026e98f0e6f4d86305cc1"
|
||||
integrity sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==
|
||||
dependencies:
|
||||
has "^1.0.3"
|
||||
|
||||
json5@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
|
||||
integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==
|
||||
dependencies:
|
||||
minimist "^1.2.0"
|
||||
|
||||
loader-utils@^1.1.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
|
||||
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
|
||||
dependencies:
|
||||
big.js "^5.2.2"
|
||||
emojis-list "^3.0.0"
|
||||
json5 "^1.0.1"
|
||||
|
||||
lodash.camelcase@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
|
||||
integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY=
|
||||
|
||||
lru-cache@^5.1.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
|
||||
integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==
|
||||
dependencies:
|
||||
yallist "^3.0.2"
|
||||
|
||||
magic-string@^0.25.7:
|
||||
version "0.25.7"
|
||||
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
|
||||
integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==
|
||||
dependencies:
|
||||
sourcemap-codec "^1.4.4"
|
||||
|
||||
merge-source-map@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.1.0.tgz#2fdde7e6020939f70906a68f2d7ae685e4c8c646"
|
||||
integrity sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==
|
||||
dependencies:
|
||||
source-map "^0.6.1"
|
||||
|
||||
minimist@^1.2.0:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
||||
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
|
||||
|
||||
nanoid@^3.1.23:
|
||||
version "3.1.23"
|
||||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.23.tgz#f744086ce7c2bc47ee0a8472574d5c78e4183a81"
|
||||
integrity sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==
|
||||
|
||||
path-parse@^1.0.6:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
|
||||
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
|
||||
|
||||
postcss-modules-extract-imports@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz#cda1f047c0ae80c97dbe28c3e76a43b88025741d"
|
||||
integrity sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==
|
||||
|
||||
postcss-modules-local-by-default@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz#ebbb54fae1598eecfdf691a02b3ff3b390a5a51c"
|
||||
integrity sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==
|
||||
dependencies:
|
||||
icss-utils "^5.0.0"
|
||||
postcss-selector-parser "^6.0.2"
|
||||
postcss-value-parser "^4.1.0"
|
||||
|
||||
postcss-modules-scope@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz#9ef3151456d3bbfa120ca44898dfca6f2fa01f06"
|
||||
integrity sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==
|
||||
dependencies:
|
||||
postcss-selector-parser "^6.0.4"
|
||||
|
||||
postcss-modules-values@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz#d7c5e7e68c3bb3c9b27cbf48ca0bb3ffb4602c9c"
|
||||
integrity sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==
|
||||
dependencies:
|
||||
icss-utils "^5.0.0"
|
||||
|
||||
postcss-modules@^4.0.0:
|
||||
version "4.1.3"
|
||||
resolved "https://registry.yarnpkg.com/postcss-modules/-/postcss-modules-4.1.3.tgz#c4c4c41d98d97d24c70e88dacfc97af5a4b3e21d"
|
||||
integrity sha512-dBT39hrXe4OAVYJe/2ZuIZ9BzYhOe7t+IhedYeQ2OxKwDpAGlkEN/fR0fGnrbx4BvgbMReRX4hCubYK9cE/pJQ==
|
||||
dependencies:
|
||||
generic-names "^2.0.1"
|
||||
icss-replace-symbols "^1.1.0"
|
||||
lodash.camelcase "^4.3.0"
|
||||
postcss-modules-extract-imports "^3.0.0"
|
||||
postcss-modules-local-by-default "^4.0.0"
|
||||
postcss-modules-scope "^3.0.0"
|
||||
postcss-modules-values "^4.0.0"
|
||||
string-hash "^1.1.1"
|
||||
|
||||
postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4:
|
||||
version "6.0.6"
|
||||
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz#2c5bba8174ac2f6981ab631a42ab0ee54af332ea"
|
||||
integrity sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==
|
||||
dependencies:
|
||||
cssesc "^3.0.0"
|
||||
util-deprecate "^1.0.2"
|
||||
|
||||
postcss-value-parser@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb"
|
||||
integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==
|
||||
|
||||
postcss@^8.1.10, postcss@^8.3.5:
|
||||
version "8.3.5"
|
||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.3.5.tgz#982216b113412bc20a86289e91eb994952a5b709"
|
||||
integrity sha512-NxTuJocUhYGsMiMFHDUkmjSKT3EdH4/WbGF6GCi1NDGk+vbcUTun4fpbOqaPtD8IIsztA2ilZm2DhYCuyN58gA==
|
||||
dependencies:
|
||||
colorette "^1.2.2"
|
||||
nanoid "^3.1.23"
|
||||
source-map-js "^0.6.2"
|
||||
|
||||
resolve@^1.20.0:
|
||||
version "1.20.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975"
|
||||
integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==
|
||||
dependencies:
|
||||
is-core-module "^2.2.0"
|
||||
path-parse "^1.0.6"
|
||||
|
||||
rollup@^2.38.5:
|
||||
version "2.52.7"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.52.7.tgz#e15a8bf734f6e4c204b7cdf33521151310250cb2"
|
||||
integrity sha512-55cSH4CCU6MaPr9TAOyrIC+7qFCHscL7tkNsm1MBfIJRRqRbCEY0mmeFn4Wg8FKsHtEH8r389Fz38r/o+kgXLg==
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
source-map-js@^0.6.2:
|
||||
version "0.6.2"
|
||||
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e"
|
||||
integrity sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==
|
||||
|
||||
source-map@^0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||
|
||||
sourcemap-codec@^1.4.4:
|
||||
version "1.4.8"
|
||||
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
|
||||
integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==
|
||||
|
||||
string-hash@^1.1.1:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b"
|
||||
integrity sha1-6Kr8CsGFW0Zmkp7X3RJ1311sgRs=
|
||||
|
||||
to-fast-properties@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
|
||||
integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=
|
||||
|
||||
util-deprecate@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
|
||||
|
||||
vite@^2.4.0:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/vite/-/vite-2.4.1.tgz#2e48b8dbfc69e4edbf7f4d1c0798d621585cb8da"
|
||||
integrity sha512-4BpKRis9uxIqPfIEcJ18LTBsamqnDFxTx45CXwagHjNltHa6PFEvf8Pe6OpgIHb0OyWT30OXOSSQvdOaX4OBiQ==
|
||||
dependencies:
|
||||
esbuild "^0.12.8"
|
||||
postcss "^8.3.5"
|
||||
resolve "^1.20.0"
|
||||
rollup "^2.38.5"
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
vue@^3.0.5:
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/vue/-/vue-3.1.4.tgz#120d6818c51eaa35d0879e5bc1cff60135bc69fd"
|
||||
integrity sha512-p8dcdyeCgmaAiZsbLyDkmOLcFGZb/jEVdCLW65V68LRCXTNX8jKsgah2F7OZ/v/Ai2V0Fb1MNO0vz/GFqsPVMA==
|
||||
dependencies:
|
||||
"@vue/compiler-dom" "3.1.4"
|
||||
"@vue/runtime-dom" "3.1.4"
|
||||
"@vue/shared" "3.1.4"
|
||||
|
||||
yallist@^3.0.2:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
|
||||
integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
|
||||
33
package.json
@@ -15,27 +15,27 @@
|
||||
"lerna": "3.16.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "2.0.0",
|
||||
"@typescript-eslint/parser": "2.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "4.28.0",
|
||||
"@typescript-eslint/parser": "4.28.0",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"async-retry": "1.2.3",
|
||||
"buffer-replace": "1.0.0",
|
||||
"cheerio": "1.0.0-rc.3",
|
||||
"eslint": "6.2.2",
|
||||
"eslint-config-prettier": "6.1.0",
|
||||
"eslint-plugin-jest": "23.8.2",
|
||||
"eslint": "7.29.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"eslint-plugin-jest": "24.3.6",
|
||||
"husky": "6.0.0",
|
||||
"json5": "2.1.1",
|
||||
"lint-staged": "9.2.5",
|
||||
"node-fetch": "2.6.1",
|
||||
"npm-package-arg": "6.1.0",
|
||||
"prettier": "2.0.5"
|
||||
"prettier": "2.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
"lerna": "lerna",
|
||||
"bootstrap": "lerna bootstrap",
|
||||
"publish-stable": "echo 'Run `yarn changelog` for instructions'",
|
||||
"publish-canary": "git pull && lerna version prerelease --preid canary --message 'Publish Canary' --exact",
|
||||
"publish-canary": "git checkout main && git pull && lerna version prerelease --preid canary --message 'Publish Canary' --exact",
|
||||
"publish-from-github": "./utils/publish.sh",
|
||||
"changelog": "node utils/changelog.js",
|
||||
"build": "node utils/run.js build all",
|
||||
@@ -79,8 +79,7 @@
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier",
|
||||
"prettier/@typescript-eslint"
|
||||
"prettier"
|
||||
],
|
||||
"env": {
|
||||
"node": true,
|
||||
@@ -89,26 +88,19 @@
|
||||
},
|
||||
"rules": {
|
||||
"require-atomic-updates": 0,
|
||||
"@typescript-eslint/ban-ts-ignore": 0,
|
||||
"@typescript-eslint/ban-ts-comment": 0,
|
||||
"@typescript-eslint/camelcase": 0,
|
||||
"@typescript-eslint/explicit-function-return-type": 0,
|
||||
"@typescript-eslint/explicit-module-boundary-types": 0,
|
||||
"@typescript-eslint/no-empty-function": 0,
|
||||
"@typescript-eslint/no-explicit-any": 0,
|
||||
"@typescript-eslint/no-non-null-assertion": 0,
|
||||
"@typescript-eslint/no-unused-vars": 2,
|
||||
"@typescript-eslint/no-use-before-define": 0,
|
||||
"@typescript-eslint/no-var-requires": 0,
|
||||
"jest/no-disabled-tests": 2,
|
||||
"jest/no-focused-tests": 2
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"**/*.js"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-var-requires": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"packages/cli/**/*"
|
||||
@@ -125,8 +117,7 @@
|
||||
"@typescript-eslint/member-delimiter-style": 0,
|
||||
"@typescript-eslint/no-empty-function": 0,
|
||||
"@typescript-eslint/no-explicit-any": 0,
|
||||
"@typescript-eslint/no-inferrable-types": 0,
|
||||
"@typescript-eslint/no-var-requires": 0
|
||||
"@typescript-eslint/no-inferrable-types": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/build-utils",
|
||||
"version": "2.11.1",
|
||||
"version": "2.11.2-canary.3",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.js",
|
||||
@@ -29,7 +29,7 @@
|
||||
"@types/node-fetch": "^2.1.6",
|
||||
"@types/semver": "6.0.0",
|
||||
"@types/yazl": "^2.4.1",
|
||||
"@vercel/frameworks": "0.4.1",
|
||||
"@vercel/frameworks": "0.4.2-canary.2",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"aggregate-error": "3.0.1",
|
||||
"async-retry": "1.2.3",
|
||||
@@ -47,7 +47,7 @@
|
||||
"node-fetch": "2.6.1",
|
||||
"semver": "6.1.1",
|
||||
"ts-jest": "24.1.0",
|
||||
"typescript": "3.9.3",
|
||||
"typescript": "4.3.4",
|
||||
"yazl": "2.4.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,6 +424,7 @@ function getApiMatches() {
|
||||
|
||||
return [
|
||||
{ src: 'api/**/*.js', use: `@vercel/node`, config },
|
||||
{ src: 'api/**/*.mjs', use: `@vercel/node`, config },
|
||||
{ src: 'api/**/*.ts', use: `@vercel/node`, config },
|
||||
{ src: 'api/**/!(*_test).go', use: `@vercel/go`, config },
|
||||
{ src: 'api/**/*.py', use: `@vercel/python`, config },
|
||||
|
||||
@@ -1346,6 +1346,25 @@ describe('Test `detectBuilders` with `featHandleMiss=true`', () => {
|
||||
expect((errorRoutes![0] as Source).status).toBe(404);
|
||||
});
|
||||
|
||||
it('api detect node mjs files', async () => {
|
||||
const files = [
|
||||
'api/index.mjs',
|
||||
'api/users.mjs',
|
||||
'api/config/staging.mjs',
|
||||
'api/config/production.mjs',
|
||||
'api/src/controllers/health.mjs',
|
||||
'api/src/controllers/user.module.mjs',
|
||||
];
|
||||
|
||||
const { builders, errorRoutes } = await detectBuilders(files, undefined, {
|
||||
featHandleMiss,
|
||||
});
|
||||
expect(builders!.length).toBe(6);
|
||||
expect(builders!.every(b => b.src!.endsWith('.mjs'))).toBe(true);
|
||||
expect(errorRoutes!.length).toBe(1);
|
||||
expect((errorRoutes![0] as Source).status).toBe(404);
|
||||
});
|
||||
|
||||
it('just public', async () => {
|
||||
const files = ['public/index.html', 'public/favicon.ico', 'README.md'];
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vercel",
|
||||
"version": "23.0.1",
|
||||
"version": "23.0.2-canary.6",
|
||||
"preferGlobal": true,
|
||||
"license": "Apache-2.0",
|
||||
"description": "The command-line interface for Vercel",
|
||||
@@ -61,11 +61,11 @@
|
||||
"node": ">= 12"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "2.11.1",
|
||||
"@vercel/go": "1.2.2",
|
||||
"@vercel/node": "1.11.1",
|
||||
"@vercel/python": "2.0.4",
|
||||
"@vercel/ruby": "1.2.6",
|
||||
"@vercel/build-utils": "2.11.2-canary.3",
|
||||
"@vercel/go": "1.2.3-canary.0",
|
||||
"@vercel/node": "1.11.2-canary.4",
|
||||
"@vercel/python": "2.0.5-canary.0",
|
||||
"@vercel/ruby": "1.2.7-canary.0",
|
||||
"update-notifier": "4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -100,7 +100,7 @@
|
||||
"@types/universal-analytics": "0.4.2",
|
||||
"@types/which": "1.3.2",
|
||||
"@types/write-json-file": "2.2.1",
|
||||
"@vercel/frameworks": "0.4.1",
|
||||
"@vercel/frameworks": "0.4.2-canary.2",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@zeit/fun": "0.11.2",
|
||||
"@zeit/source-map-support": "0.6.2",
|
||||
@@ -136,6 +136,7 @@
|
||||
"glob": "7.1.2",
|
||||
"http-proxy": "1.18.1",
|
||||
"inquirer": "7.0.4",
|
||||
"is-docker": "2.2.1",
|
||||
"is-port-reachable": "3.0.0",
|
||||
"is-url": "1.2.2",
|
||||
"jaro-winkler": "0.2.8",
|
||||
@@ -171,7 +172,7 @@
|
||||
"tree-kill": "1.2.2",
|
||||
"ts-eager": "2.0.2",
|
||||
"ts-node": "8.3.0",
|
||||
"typescript": "3.9.3",
|
||||
"typescript": "4.3.4",
|
||||
"universal-analytics": "0.4.20",
|
||||
"utility-types": "2.1.0",
|
||||
"which": "2.0.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import chalk from 'chalk';
|
||||
import logo from '../../util/output/logo';
|
||||
import { getPkgName } from '../../util/pkg-name.ts';
|
||||
import { getPkgName } from '../../util/pkg-name';
|
||||
|
||||
export const help = () => `
|
||||
${chalk.bold(`${logo} ${getPkgName()}`)} [options] <command | path>
|
||||
@@ -27,6 +27,7 @@ export const help = () => `
|
||||
|
||||
rm | remove [id] Removes a deployment
|
||||
domains [name] Manages your domain names
|
||||
projects Manages your Projects
|
||||
dns [name] Manages your DNS records
|
||||
certs [cmd] Manages your SSL certificates
|
||||
secrets [name] Manages your global Secrets, for use in Environment Variables
|
||||
@@ -92,30 +93,3 @@ export const help = () => `
|
||||
${chalk.cyan(`$ ${getPkgName()} help list`)}
|
||||
|
||||
`;
|
||||
|
||||
export const args = {
|
||||
'--force': Boolean,
|
||||
'--with-cache': Boolean,
|
||||
'--public': Boolean,
|
||||
'--no-clipboard': Boolean,
|
||||
'--env': [String],
|
||||
'--build-env': [String],
|
||||
'--meta': [String],
|
||||
// This is not an array in favor of matching
|
||||
// the config property name.
|
||||
'--regions': String,
|
||||
'--prod': Boolean,
|
||||
'--confirm': Boolean,
|
||||
'-f': '--force',
|
||||
'-p': '--public',
|
||||
'-e': '--env',
|
||||
'-b': '--build-env',
|
||||
'-C': '--no-clipboard',
|
||||
'-m': '--meta',
|
||||
'-c': '--confirm',
|
||||
|
||||
// deprecated
|
||||
'--name': String,
|
||||
'-n': '--name',
|
||||
'--target': String,
|
||||
};
|
||||
@@ -1,37 +1,62 @@
|
||||
import fs from 'fs-extra';
|
||||
import { resolve, basename } from 'path';
|
||||
import { fileNameSymbol } from '@vercel/client';
|
||||
import getScope from '../../util/get-scope.ts';
|
||||
import { VercelConfig, fileNameSymbol } from '@vercel/client';
|
||||
import code from '../../util/output/code';
|
||||
import highlight from '../../util/output/highlight';
|
||||
import { readLocalConfig } from '../../util/config/files';
|
||||
import getArgs from '../../util/get-args';
|
||||
import { handleError } from '../../util/error';
|
||||
import { help, args } from './args';
|
||||
import { help } from './args';
|
||||
import deploy from './latest';
|
||||
import Client from '../../util/client';
|
||||
|
||||
export default async client => {
|
||||
const {
|
||||
output,
|
||||
config: { currentTeam },
|
||||
} = client;
|
||||
export default async (client: Client) => {
|
||||
const { output } = client;
|
||||
|
||||
let contextName = currentTeam || 'current user';
|
||||
let argv = null;
|
||||
|
||||
try {
|
||||
argv = getArgs(client.argv.slice(2), args);
|
||||
argv = getArgs(client.argv.slice(2), {
|
||||
'--force': Boolean,
|
||||
'--with-cache': Boolean,
|
||||
'--public': Boolean,
|
||||
'--no-clipboard': Boolean,
|
||||
'--env': [String],
|
||||
'--build-env': [String],
|
||||
'--meta': [String],
|
||||
// This is not an array in favor of matching
|
||||
// the config property name.
|
||||
'--regions': String,
|
||||
'--prod': Boolean,
|
||||
'--confirm': Boolean,
|
||||
'-f': '--force',
|
||||
'-p': '--public',
|
||||
'-e': '--env',
|
||||
'-b': '--build-env',
|
||||
'-C': '--no-clipboard',
|
||||
'-m': '--meta',
|
||||
'-c': '--confirm',
|
||||
|
||||
// deprecated
|
||||
'--name': String,
|
||||
'-n': '--name',
|
||||
'--target': String,
|
||||
});
|
||||
} catch (error) {
|
||||
handleError(error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argv['--help']) {
|
||||
output.print(help());
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (argv._[0] === 'deploy') {
|
||||
argv._.shift();
|
||||
}
|
||||
|
||||
let paths = [];
|
||||
|
||||
let paths;
|
||||
if (argv._.length > 0) {
|
||||
// If path is relative: resolve
|
||||
// if path is absolute: clear up strange `/` etc
|
||||
@@ -40,20 +65,14 @@ export default async client => {
|
||||
paths = [process.cwd()];
|
||||
}
|
||||
|
||||
let { localConfig } = client;
|
||||
let localConfig: VercelConfig | null = client.localConfig;
|
||||
if (!localConfig || localConfig instanceof Error) {
|
||||
localConfig = readLocalConfig(paths[0]);
|
||||
}
|
||||
const stats = {};
|
||||
|
||||
if (argv['--help']) {
|
||||
output.print(help());
|
||||
return 2;
|
||||
}
|
||||
|
||||
for (const path of paths) {
|
||||
try {
|
||||
stats[path] = await fs.lstat(path);
|
||||
await fs.stat(path);
|
||||
} catch (err) {
|
||||
output.error(
|
||||
`The specified file or directory "${basename(path)}" does not exist.`
|
||||
@@ -62,26 +81,15 @@ export default async client => {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
({ contextName } = await getScope(client));
|
||||
} catch (err) {
|
||||
if (err.code === 'NOT_AUTHORIZED' || err.code === 'TEAM_DELETED') {
|
||||
output.error(err.message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (localConfig) {
|
||||
const { version } = localConfig;
|
||||
const file = highlight(localConfig[fileNameSymbol]);
|
||||
const file = highlight(localConfig[fileNameSymbol]!);
|
||||
const prop = code('version');
|
||||
|
||||
if (version) {
|
||||
if (typeof version === 'number') {
|
||||
if (version !== 2) {
|
||||
const two = code(2);
|
||||
const two = code(String(2));
|
||||
|
||||
output.error(
|
||||
`The value of the ${prop} property within ${file} can only be ${two}.`
|
||||
@@ -97,5 +105,5 @@ export default async client => {
|
||||
}
|
||||
}
|
||||
|
||||
return deploy(client, contextName, output, stats, localConfig, args);
|
||||
return deploy(client, paths, localConfig, argv);
|
||||
};
|
||||
@@ -3,17 +3,17 @@ import bytes from 'bytes';
|
||||
import { join } from 'path';
|
||||
import { write as copy } from 'clipboardy';
|
||||
import chalk from 'chalk';
|
||||
import { fileNameSymbol } from '@vercel/client';
|
||||
import { Dictionary, fileNameSymbol, VercelConfig } from '@vercel/client';
|
||||
import { getPrettyError } from '@vercel/build-utils';
|
||||
import { handleError } from '../../util/error';
|
||||
import getArgs from '../../util/get-args';
|
||||
import toHumanPath from '../../util/humanize-path';
|
||||
import Now from '../../util';
|
||||
import stamp from '../../util/output/stamp.ts';
|
||||
import stamp from '../../util/output/stamp';
|
||||
import createDeploy from '../../util/deploy/create-deploy';
|
||||
import getDeploymentByIdOrHost from '../../util/deploy/get-deployment-by-id-or-host';
|
||||
import parseMeta from '../../util/parse-meta';
|
||||
import code from '../../util/output/code';
|
||||
import linkStyle from '../../util/output/link';
|
||||
import param from '../../util/output/param';
|
||||
import highlight from '../../util/output/highlight';
|
||||
import {
|
||||
@@ -53,10 +53,15 @@ import validatePaths, {
|
||||
validateRootDirectory,
|
||||
} from '../../util/validate-paths';
|
||||
import { readLocalConfig } from '../../util/config/files';
|
||||
import { getCommandName } from '../../util/pkg-name.ts';
|
||||
import { getPreferredPreviewURL } from '../../util/deploy/get-preferred-preview-url.ts';
|
||||
import { getCommandName } from '../../util/pkg-name';
|
||||
import { getPreferredPreviewURL } from '../../util/deploy/get-preferred-preview-url';
|
||||
import { Output } from '../../util/output';
|
||||
import Client from '../../util/client';
|
||||
|
||||
const addProcessEnv = async (log, env) => {
|
||||
const addProcessEnv = async (
|
||||
log: (str: string) => void,
|
||||
env: typeof process.env
|
||||
) => {
|
||||
let val;
|
||||
|
||||
for (const key of Object.keys(env)) {
|
||||
@@ -85,8 +90,8 @@ const addProcessEnv = async (log, env) => {
|
||||
};
|
||||
|
||||
const printDeploymentStatus = async (
|
||||
output,
|
||||
client,
|
||||
output: Output,
|
||||
client: Client,
|
||||
{
|
||||
readyState,
|
||||
alias: aliasList,
|
||||
@@ -94,11 +99,26 @@ const printDeploymentStatus = async (
|
||||
target,
|
||||
indications,
|
||||
url: deploymentUrl,
|
||||
aliasWarning,
|
||||
}: {
|
||||
readyState: string;
|
||||
alias: string[];
|
||||
aliasError: Error;
|
||||
target: string;
|
||||
indications: any;
|
||||
url: string;
|
||||
aliasWarning?: {
|
||||
code: string;
|
||||
message: string;
|
||||
link?: string;
|
||||
action?: string;
|
||||
};
|
||||
},
|
||||
deployStamp,
|
||||
isClipboardEnabled,
|
||||
isFile
|
||||
deployStamp: () => string,
|
||||
isClipboardEnabled: boolean,
|
||||
isFile: boolean
|
||||
) => {
|
||||
indications = indications || [];
|
||||
const isProdDeployment = target === 'production';
|
||||
|
||||
if (readyState !== 'READY') {
|
||||
@@ -116,8 +136,8 @@ const printDeploymentStatus = async (
|
||||
);
|
||||
} else {
|
||||
// print preview/production url
|
||||
let previewUrl;
|
||||
let isWildcard;
|
||||
let previewUrl: string;
|
||||
let isWildcard: boolean;
|
||||
if (!isFile && Array.isArray(aliasList) && aliasList.length > 0) {
|
||||
const previewUrlInfo = await getPreferredPreviewURL(client, aliasList);
|
||||
if (previewUrlInfo) {
|
||||
@@ -136,11 +156,12 @@ const printDeploymentStatus = async (
|
||||
// copy to clipboard
|
||||
let isCopiedToClipboard = false;
|
||||
if (isClipboardEnabled && !isWildcard) {
|
||||
await copy(previewUrl)
|
||||
.then(() => {
|
||||
isCopiedToClipboard = true;
|
||||
})
|
||||
.catch(error => output.debug(`Error copying to clipboard: ${error}`));
|
||||
try {
|
||||
await copy(previewUrl);
|
||||
isCopiedToClipboard = true;
|
||||
} catch (err) {
|
||||
output.debug(`Error copyind to clipboard: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
output.print(
|
||||
@@ -155,28 +176,32 @@ const printDeploymentStatus = async (
|
||||
);
|
||||
}
|
||||
|
||||
if (indications) {
|
||||
const indent = process.stdout.isTTY ? ' ' : ''; // if using emojis
|
||||
const newline = '\n';
|
||||
for (let indication of indications) {
|
||||
const message =
|
||||
prependEmoji(chalk.dim(indication.payload), emoji(indication.type)) +
|
||||
newline;
|
||||
let link = '';
|
||||
if (indication.link)
|
||||
link =
|
||||
indent +
|
||||
chalk.dim(
|
||||
`${indication.action || 'Learn More'}: ${indication.link}`
|
||||
) +
|
||||
newline;
|
||||
output.print(message + link);
|
||||
}
|
||||
if (aliasWarning?.message) {
|
||||
indications.push({
|
||||
type: 'warning',
|
||||
payload: aliasWarning.message,
|
||||
link: aliasWarning.link,
|
||||
action: aliasWarning.action,
|
||||
});
|
||||
}
|
||||
|
||||
const newline = '\n';
|
||||
for (let indication of indications) {
|
||||
const message =
|
||||
prependEmoji(chalk.dim(indication.payload), emoji(indication.type)) +
|
||||
newline;
|
||||
let link = '';
|
||||
if (indication.link)
|
||||
link =
|
||||
chalk.dim(
|
||||
`${indication.action || 'Learn More'}: ${linkStyle(indication.link)}`
|
||||
) + newline;
|
||||
output.print(message + link);
|
||||
}
|
||||
};
|
||||
|
||||
// Converts `env` Arrays, Strings and Objects into env Objects.
|
||||
const parseEnv = env => {
|
||||
const parseEnv = (env?: string[] | Dictionary<string>) => {
|
||||
if (!env) {
|
||||
return {};
|
||||
}
|
||||
@@ -201,35 +226,25 @@ const parseEnv = env => {
|
||||
|
||||
o[key] = value;
|
||||
return o;
|
||||
}, {});
|
||||
}, {} as Dictionary<string | undefined>);
|
||||
}
|
||||
|
||||
// assume it's already an Object
|
||||
return env;
|
||||
};
|
||||
|
||||
export default async function main(
|
||||
client,
|
||||
contextName,
|
||||
output,
|
||||
stats,
|
||||
localConfig,
|
||||
args
|
||||
client: Client,
|
||||
paths: string[],
|
||||
localConfig: VercelConfig | null,
|
||||
argv: any
|
||||
) {
|
||||
let argv = null;
|
||||
|
||||
try {
|
||||
argv = getArgs(client.argv.slice(2), args);
|
||||
} catch (error) {
|
||||
handleError(error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const {
|
||||
apiUrl,
|
||||
output,
|
||||
authConfig: { token },
|
||||
} = client;
|
||||
const { log, debug, error, warn } = output;
|
||||
const paths = Object.keys(stats);
|
||||
const debugEnabled = argv['--debug'];
|
||||
|
||||
const { isTTY } = process.stdout;
|
||||
@@ -265,6 +280,7 @@ export default async function main(
|
||||
}
|
||||
|
||||
let { org, project, status } = link;
|
||||
|
||||
let newProjectName = null;
|
||||
let rootDirectory = project ? project.rootDirectory : null;
|
||||
let sourceFilesOutsideRootDirectory = true;
|
||||
@@ -340,6 +356,16 @@ export default async function main(
|
||||
}
|
||||
}
|
||||
|
||||
// At this point `org` should be populated
|
||||
if (!org) {
|
||||
throw new Error(`"org" is not defined`);
|
||||
}
|
||||
|
||||
// Set the `contextName` and `currentTeam` as specified by the
|
||||
// Project Settings, so that API calls happen with the proper scope
|
||||
const contextName = org.slug;
|
||||
client.config.currentTeam = org.type === 'team' ? org.id : undefined;
|
||||
|
||||
// if we have `sourceFilesOutsideRootDirectory` set to `true`, we use the current path
|
||||
// and upload the entire directory.
|
||||
const sourcePath =
|
||||
@@ -354,7 +380,7 @@ export default async function main(
|
||||
path,
|
||||
sourcePath,
|
||||
project
|
||||
? `To change your Project Settings, go to https://vercel.com/${org.slug}/${project.name}/settings`
|
||||
? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings`
|
||||
: ''
|
||||
)) === false
|
||||
) {
|
||||
@@ -373,7 +399,7 @@ export default async function main(
|
||||
output.print(
|
||||
`${prependEmoji(
|
||||
`The ${highlight(
|
||||
localConfig[fileNameSymbol]
|
||||
localConfig[fileNameSymbol]!
|
||||
)} file should be inside of the provided root directory.`,
|
||||
emoji('warning')
|
||||
)}\n`
|
||||
@@ -387,7 +413,7 @@ export default async function main(
|
||||
output.print(
|
||||
`${prependEmoji(
|
||||
`The ${code('name')} property in ${highlight(
|
||||
localConfig[fileNameSymbol]
|
||||
localConfig[fileNameSymbol]!
|
||||
)} is deprecated (https://vercel.link/name-prop)`,
|
||||
emoji('warning')
|
||||
)}\n`
|
||||
@@ -395,7 +421,7 @@ export default async function main(
|
||||
}
|
||||
|
||||
// build `env`
|
||||
const isObject = item =>
|
||||
const isObject = (item: any) =>
|
||||
Object.prototype.toString.call(item) === '[object Object]';
|
||||
|
||||
// This validation needs to happen on the client side because
|
||||
@@ -404,7 +430,7 @@ export default async function main(
|
||||
if (typeof localConfig.env !== 'undefined' && !isObject(localConfig.env)) {
|
||||
error(
|
||||
`The ${code('env')} property in ${highlight(
|
||||
localConfig[fileNameSymbol]
|
||||
localConfig[fileNameSymbol]!
|
||||
)} needs to be an object`
|
||||
);
|
||||
return 1;
|
||||
@@ -414,7 +440,7 @@ export default async function main(
|
||||
if (!isObject(localConfig.build)) {
|
||||
error(
|
||||
`The ${code('build')} property in ${highlight(
|
||||
localConfig[fileNameSymbol]
|
||||
localConfig[fileNameSymbol]!
|
||||
)} needs to be an object`
|
||||
);
|
||||
return 1;
|
||||
@@ -426,7 +452,7 @@ export default async function main(
|
||||
) {
|
||||
error(
|
||||
`The ${code('build.env')} property in ${highlight(
|
||||
localConfig[fileNameSymbol]
|
||||
localConfig[fileNameSymbol]!
|
||||
)} needs to be an object`
|
||||
);
|
||||
return 1;
|
||||
@@ -466,7 +492,7 @@ export default async function main(
|
||||
// build `regions`
|
||||
const regionFlag = (argv['--regions'] || '')
|
||||
.split(',')
|
||||
.map(s => s.trim())
|
||||
.map((s: string) => s.trim())
|
||||
.filter(Boolean);
|
||||
const regions = regionFlag.length > 0 ? regionFlag : localConfig.regions;
|
||||
|
||||
@@ -497,13 +523,13 @@ export default async function main(
|
||||
target = 'production';
|
||||
}
|
||||
|
||||
const currentTeam = org.type === 'team' ? org.id : undefined;
|
||||
const currentTeam = org?.type === 'team' ? org.id : undefined;
|
||||
const now = new Now({ apiUrl, token, debug: debugEnabled, currentTeam });
|
||||
let deployStamp = stamp();
|
||||
let deployment = null;
|
||||
|
||||
try {
|
||||
const createArgs = {
|
||||
const createArgs: any = {
|
||||
name: project ? project.name : newProjectName,
|
||||
env: deploymentEnv,
|
||||
build: { env: deploymentBuildEnv },
|
||||
@@ -527,7 +553,7 @@ export default async function main(
|
||||
}
|
||||
|
||||
deployment = await createDeploy(
|
||||
output,
|
||||
client,
|
||||
now,
|
||||
contextName,
|
||||
[sourcePath],
|
||||
@@ -537,18 +563,15 @@ export default async function main(
|
||||
path
|
||||
);
|
||||
|
||||
if (
|
||||
deployment instanceof Error &&
|
||||
deployment.code === 'missing_project_settings'
|
||||
) {
|
||||
if (deployment.code === 'missing_project_settings') {
|
||||
let { projectSettings, framework } = deployment;
|
||||
|
||||
if (rootDirectory) {
|
||||
projectSettings.rootDirectory = rootDirectory;
|
||||
}
|
||||
|
||||
if (typeof sourceFilesOutsideRootDirectory !== 'undefined') {
|
||||
projectSettings.sourceFilesOutsideRootDirectory = sourceFilesOutsideRootDirectory;
|
||||
projectSettings.sourceFilesOutsideRootDirectory =
|
||||
sourceFilesOutsideRootDirectory;
|
||||
}
|
||||
|
||||
const settings = await editProjectSettings(
|
||||
@@ -563,7 +586,7 @@ export default async function main(
|
||||
deployStamp = stamp();
|
||||
createArgs.deployStamp = deployStamp;
|
||||
deployment = await createDeploy(
|
||||
output,
|
||||
client,
|
||||
now,
|
||||
contextName,
|
||||
[sourcePath],
|
||||
@@ -575,7 +598,7 @@ export default async function main(
|
||||
}
|
||||
|
||||
if (deployment instanceof NotDomainOwner) {
|
||||
output.error(deployment);
|
||||
output.error(deployment.message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -583,7 +606,7 @@ export default async function main(
|
||||
output.error(
|
||||
deployment.message ||
|
||||
'An unexpected error occurred while deploying your project',
|
||||
null,
|
||||
undefined,
|
||||
'https://vercel.link/help',
|
||||
'Contact Support'
|
||||
);
|
||||
@@ -596,7 +619,7 @@ export default async function main(
|
||||
}
|
||||
|
||||
const deploymentResponse = await getDeploymentByIdOrHost(
|
||||
now,
|
||||
client,
|
||||
contextName,
|
||||
deployment.id,
|
||||
'v10'
|
||||
@@ -676,12 +699,7 @@ export default async function main(
|
||||
output.error(err.message || 'Build failed');
|
||||
output.error(
|
||||
`Check your logs at https://${now.url}/_logs or run ${getCommandName(
|
||||
`logs ${now.url}`,
|
||||
{
|
||||
// Backticks are interpreted as part of the URL, causing CMD+Click
|
||||
// behavior to fail in editors like VSCode.
|
||||
backticks: false,
|
||||
}
|
||||
`logs ${now.url}`
|
||||
)}`
|
||||
);
|
||||
|
||||
@@ -715,7 +733,11 @@ export default async function main(
|
||||
);
|
||||
}
|
||||
|
||||
function handleCreateDeployError(output, error, localConfig) {
|
||||
function handleCreateDeployError(
|
||||
output: Output,
|
||||
error: Error,
|
||||
localConfig: VercelConfig
|
||||
) {
|
||||
if (error instanceof InvalidDomain) {
|
||||
output.error(`The domain ${error.meta.domain} is not valid`);
|
||||
return 1;
|
||||
@@ -108,8 +108,5 @@ export default async function dev(
|
||||
systemEnvValues,
|
||||
});
|
||||
|
||||
process.once('SIGINT', () => devServer.stop());
|
||||
process.once('SIGTERM', () => devServer.stop());
|
||||
|
||||
await devServer.start(...listen);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import getDomainPrice from '../../util/domains/get-domain-price';
|
||||
import { getCommandName } from '../../util/pkg-name';
|
||||
import { getDomainConfig } from '../../util/domains/get-domain-config';
|
||||
import code from '../../util/output/code';
|
||||
import wait from '../../util/output/wait';
|
||||
import { getDomainRegistrar } from '../../util/domains/get-domain-registrar';
|
||||
|
||||
type Options = {};
|
||||
@@ -59,7 +58,7 @@ export default async function inspect(
|
||||
|
||||
output.debug(`Fetching domain info`);
|
||||
|
||||
const cancelWait = wait(
|
||||
output.spinner(
|
||||
`Fetching Domain ${domainName} under ${chalk.bold(contextName)}`
|
||||
);
|
||||
|
||||
@@ -68,9 +67,6 @@ export default async function inspect(
|
||||
client,
|
||||
contextName,
|
||||
domainName,
|
||||
cancelWait,
|
||||
}).finally(() => {
|
||||
cancelWait();
|
||||
});
|
||||
|
||||
if (typeof information === 'number') {
|
||||
@@ -207,13 +203,11 @@ async function fetchInformation({
|
||||
client,
|
||||
contextName,
|
||||
domainName,
|
||||
cancelWait,
|
||||
}: {
|
||||
output: Output;
|
||||
client: Client;
|
||||
contextName: string;
|
||||
domainName: string;
|
||||
cancelWait: () => void;
|
||||
}) {
|
||||
const [domain, renewalPrice] = await Promise.all([
|
||||
getDomainByName(client, contextName, domainName, { ignoreWait: true }),
|
||||
@@ -223,13 +217,11 @@ async function fetchInformation({
|
||||
]);
|
||||
|
||||
if (domain instanceof DomainNotFound) {
|
||||
cancelWait();
|
||||
output.prettyError(domain);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (domain instanceof DomainPermissionDenied) {
|
||||
cancelWait();
|
||||
output.prettyError(domain);
|
||||
output.log(`Run ${getCommandName(`domains ls`)} to see your domains.`);
|
||||
return 1;
|
||||
@@ -238,7 +230,6 @@ async function fetchInformation({
|
||||
const projects = await findProjectsForDomain(client, domainName);
|
||||
|
||||
if (projects instanceof Error) {
|
||||
cancelWait();
|
||||
output.prettyError(projects);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import ms from 'ms';
|
||||
import chalk from 'chalk';
|
||||
import plural from 'pluralize';
|
||||
|
||||
import wait from '../../util/output/wait';
|
||||
import Client from '../../util/client';
|
||||
import getDomains from '../../util/domains/get-domains';
|
||||
import getScope from '../../util/get-scope';
|
||||
@@ -55,14 +54,9 @@ export default async function ls(
|
||||
return 1;
|
||||
}
|
||||
|
||||
const cancelWait = wait(`Fetching Domains under ${chalk.bold(contextName)}`);
|
||||
output.spinner(`Fetching Domains under ${chalk.bold(contextName)}`);
|
||||
|
||||
const { domains, pagination } = await getDomains(
|
||||
client,
|
||||
nextTimestamp
|
||||
).finally(() => {
|
||||
cancelWait();
|
||||
});
|
||||
const { domains, pagination } = await getDomains(client, nextTimestamp);
|
||||
|
||||
output.log(
|
||||
`${plural('Domain', domains.length, true)} found under ${chalk.bold(
|
||||
|
||||
@@ -5,13 +5,17 @@ import getArgs from '../util/get-args';
|
||||
import handleError from '../util/handle-error';
|
||||
import logo from '../util/output/logo';
|
||||
import prompt from '../util/login/prompt';
|
||||
import doSsoLogin from '../util/login/sso';
|
||||
import doSamlLogin from '../util/login/saml';
|
||||
import doEmailLogin from '../util/login/email';
|
||||
import doGithubLogin from '../util/login/github';
|
||||
import doGitlabLogin from '../util/login/gitlab';
|
||||
import doBitbucketLogin from '../util/login/bitbucket';
|
||||
import { prependEmoji, emoji } from '../util/emoji';
|
||||
import { getCommandName, getPkgName } from '../util/pkg-name';
|
||||
import getGlobalPathConfig from '../util/config/global-path';
|
||||
import { writeToAuthConfigFile, writeToConfigFile } from '../util/config/files';
|
||||
import Client from '../util/client';
|
||||
import { LoginResult } from '../util/login/types';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
@@ -40,6 +44,10 @@ const help = () => {
|
||||
${chalk.gray('–')} Log in using a specific team "slug" for SAML Single Sign-On
|
||||
|
||||
${chalk.cyan(`$ ${getPkgName()} login acme`)}
|
||||
|
||||
${chalk.gray('–')} Log in using GitHub in "out-of-band" mode
|
||||
|
||||
${chalk.cyan(`$ ${getPkgName()} login --github --oob`)}
|
||||
`);
|
||||
};
|
||||
|
||||
@@ -48,7 +56,12 @@ export default async function login(client: Client): Promise<number> {
|
||||
const { output } = client;
|
||||
|
||||
try {
|
||||
argv = getArgs(client.argv.slice(2));
|
||||
argv = getArgs(client.argv.slice(2), {
|
||||
'--oob': Boolean,
|
||||
'--github': Boolean,
|
||||
'--gitlab': Boolean,
|
||||
'--bitbucket': Boolean,
|
||||
});
|
||||
} catch (err) {
|
||||
handleError(err);
|
||||
return 1;
|
||||
@@ -66,18 +79,24 @@ export default async function login(client: Client): Promise<number> {
|
||||
|
||||
const input = argv._[1];
|
||||
|
||||
let result: number | string = 1;
|
||||
let result: LoginResult = 1;
|
||||
|
||||
if (input) {
|
||||
// Email or Team slug was provided via command line
|
||||
if (validateEmail(input)) {
|
||||
result = await doEmailLogin(client, input);
|
||||
} else {
|
||||
result = await doSsoLogin(client, input);
|
||||
result = await doSamlLogin(client, input, argv['--oob']);
|
||||
}
|
||||
} else if (argv['--github']) {
|
||||
result = await doGithubLogin(client, argv['--oob']);
|
||||
} else if (argv['--gitlab']) {
|
||||
result = await doGitlabLogin(client, argv['--oob']);
|
||||
} else if (argv['--bitbucket']) {
|
||||
result = await doBitbucketLogin(client, argv['--oob']);
|
||||
} else {
|
||||
// Interactive mode
|
||||
result = await prompt(client);
|
||||
result = await prompt(client, undefined, argv['--oob']);
|
||||
}
|
||||
|
||||
// The login function failed, so it returned an exit code
|
||||
@@ -85,12 +104,20 @@ export default async function login(client: Client): Promise<number> {
|
||||
return result;
|
||||
}
|
||||
|
||||
// If the token was upgraded (not a new login), then don't modify
|
||||
// the current scope.
|
||||
if (!client.authConfig.token) {
|
||||
if (result.teamId) {
|
||||
// SSO login, so set the current scope to the appropriate Team
|
||||
client.config.currentTeam = result.teamId;
|
||||
} else {
|
||||
delete client.config.currentTeam;
|
||||
}
|
||||
}
|
||||
|
||||
// When `result` is a string it's the user's authentication token.
|
||||
// It needs to be saved to the configuration file.
|
||||
client.authConfig.token = result;
|
||||
|
||||
// New user, so we can't keep the team
|
||||
delete client.config.currentTeam;
|
||||
client.authConfig.token = result.token;
|
||||
|
||||
writeToAuthConfigFile(client.authConfig);
|
||||
writeToConfigFile(client.config);
|
||||
|
||||
@@ -243,7 +243,7 @@ function printLogShort(log: any) {
|
||||
|
||||
const date = new Date(log.created).toISOString();
|
||||
|
||||
data.split('\n').forEach((line, i) => {
|
||||
data.split('\n').forEach(line => {
|
||||
if (
|
||||
line.includes('START RequestId:') ||
|
||||
line.includes('END RequestId:') ||
|
||||
@@ -260,18 +260,9 @@ function printLogShort(log: any) {
|
||||
}
|
||||
}
|
||||
|
||||
if (i === 0) {
|
||||
console.log(
|
||||
`${chalk.dim(date)} ${line.replace('[now-builder-debug] ', '')}`
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
`${' '.repeat(date.length)} ${line.replace(
|
||||
'[now-builder-debug] ',
|
||||
''
|
||||
)}`
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
`${chalk.dim(date)} ${line.replace('[now-builder-debug] ', '')}`
|
||||
);
|
||||
});
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import chalk from 'chalk';
|
||||
import table from 'text-table';
|
||||
import ms from 'ms';
|
||||
import table from 'text-table';
|
||||
import strlen from '../util/strlen';
|
||||
import getArgs from '../util/get-args';
|
||||
import { handleError, error } from '../util/error';
|
||||
@@ -8,8 +8,8 @@ import exit from '../util/exit';
|
||||
import logo from '../util/output/logo';
|
||||
import getScope from '../util/get-scope';
|
||||
import getCommandFlags from '../util/get-command-flags';
|
||||
import wait from '../util/output/wait';
|
||||
import { getPkgName, getCommandName } from '../util/pkg-name.ts';
|
||||
import { getPkgName, getCommandName } from '../util/pkg-name';
|
||||
import Client from '../util/client';
|
||||
|
||||
const e = encodeURIComponent;
|
||||
|
||||
@@ -46,11 +46,10 @@ const help = () => {
|
||||
`);
|
||||
};
|
||||
|
||||
// Options
|
||||
let argv;
|
||||
let subcommand;
|
||||
let argv: any;
|
||||
let subcommand: string | string[];
|
||||
|
||||
const main = async client => {
|
||||
const main = async (client: Client) => {
|
||||
try {
|
||||
argv = getArgs(client.argv.slice(2), {
|
||||
'--next': Number,
|
||||
@@ -93,7 +92,7 @@ const main = async client => {
|
||||
}
|
||||
};
|
||||
|
||||
export default async client => {
|
||||
export default async (client: Client) => {
|
||||
try {
|
||||
await main(client);
|
||||
} catch (err) {
|
||||
@@ -102,8 +101,16 @@ export default async client => {
|
||||
}
|
||||
};
|
||||
|
||||
async function run({ client, contextName }) {
|
||||
async function run({
|
||||
client,
|
||||
contextName,
|
||||
}: {
|
||||
client: Client;
|
||||
contextName: string;
|
||||
}) {
|
||||
const { output } = client;
|
||||
const args = argv._.slice(1);
|
||||
|
||||
const start = Date.now();
|
||||
|
||||
if (subcommand === 'ls' || subcommand === 'list') {
|
||||
@@ -118,7 +125,7 @@ async function run({ client, contextName }) {
|
||||
return exit(2);
|
||||
}
|
||||
|
||||
const stopSpinner = wait(`Fetching projects in ${chalk.bold(contextName)}`);
|
||||
output.spinner(`Fetching projects in ${chalk.bold(contextName)}`);
|
||||
|
||||
let projectsUrl = '/v4/projects/?limit=20';
|
||||
|
||||
@@ -127,13 +134,19 @@ async function run({ client, contextName }) {
|
||||
projectsUrl += `&until=${next}`;
|
||||
}
|
||||
|
||||
const { projects: list, pagination } = await client.fetch(projectsUrl, {
|
||||
const {
|
||||
projects: list,
|
||||
pagination,
|
||||
}: {
|
||||
projects: [{ name: string; updatedAt: number }];
|
||||
pagination: { count: number; next: number };
|
||||
} = await client.fetch(projectsUrl, {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
stopSpinner();
|
||||
output.stopSpinner();
|
||||
|
||||
const elapsed = ms(new Date() - start);
|
||||
const elapsed = ms(Date.now() - start);
|
||||
|
||||
console.log(
|
||||
`> ${
|
||||
@@ -143,14 +156,14 @@ async function run({ client, contextName }) {
|
||||
|
||||
if (list.length > 0) {
|
||||
const cur = Date.now();
|
||||
const header = [['', 'name', 'updated'].map(s => chalk.dim(s))];
|
||||
const header = [['', 'name', 'updated'].map(title => chalk.dim(title))];
|
||||
|
||||
const out = table(
|
||||
header.concat(
|
||||
list.map(secret => [
|
||||
'',
|
||||
chalk.bold(secret.name),
|
||||
chalk.gray(`${ms(cur - new Date(secret.updatedAt))} ago`),
|
||||
chalk.gray(`${ms(cur - secret.updatedAt)} ago`),
|
||||
])
|
||||
),
|
||||
{
|
||||
@@ -203,7 +216,7 @@ async function run({ client, contextName }) {
|
||||
return exit(1);
|
||||
}
|
||||
}
|
||||
const elapsed = ms(new Date() - start);
|
||||
const elapsed = ms(Date.now() - start);
|
||||
console.log(
|
||||
`${chalk.cyan('> Success!')} Project ${chalk.bold(
|
||||
name
|
||||
@@ -248,7 +261,7 @@ async function run({ client, contextName }) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
const elapsed = ms(new Date() - start);
|
||||
const elapsed = ms(Date.now() - start);
|
||||
|
||||
console.log(
|
||||
`${chalk.cyan('> Success!')} Project ${chalk.bold(
|
||||
@@ -268,7 +281,7 @@ process.on('uncaughtException', err => {
|
||||
exit(1);
|
||||
});
|
||||
|
||||
function readConfirmation(projectName) {
|
||||
function readConfirmation(projectName: string) {
|
||||
return new Promise(resolve => {
|
||||
process.stdout.write(
|
||||
`The project: ${chalk.bold(projectName)} will be removed permanently.\n` +
|
||||
@@ -1,12 +1,9 @@
|
||||
import chalk from 'chalk';
|
||||
import stamp from '../../util/output/stamp.ts';
|
||||
import info from '../../util/output/info';
|
||||
import error from '../../util/output/error';
|
||||
import wait from '../../util/output/wait';
|
||||
import rightPad from '../../util/output/right-pad';
|
||||
import eraseLines from '../../util/output/erase-lines';
|
||||
import chars from '../../util/output/chars';
|
||||
import success from '../../util/output/success';
|
||||
import note from '../../util/output/note';
|
||||
import textInput from '../../util/input/text';
|
||||
import invite from './invite';
|
||||
@@ -40,14 +37,12 @@ export default async function add(client, teams) {
|
||||
let slug;
|
||||
let team;
|
||||
let elapsed;
|
||||
let stopSpinner;
|
||||
const { output } = client;
|
||||
|
||||
console.log(
|
||||
info(
|
||||
`Pick a team identifier for its url (e.g.: ${chalk.cyan(
|
||||
'`vercel.com/acme`'
|
||||
)})`
|
||||
)
|
||||
output.log(
|
||||
`Pick a team identifier for its url (e.g.: ${chalk.cyan(
|
||||
'`vercel.com/acme`'
|
||||
)})`
|
||||
);
|
||||
do {
|
||||
try {
|
||||
@@ -61,7 +56,7 @@ export default async function add(client, teams) {
|
||||
});
|
||||
} catch (err) {
|
||||
if (err.message === 'USER_ABORT') {
|
||||
console.log(info('Aborted'));
|
||||
output.log('Aborted');
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -69,26 +64,26 @@ export default async function add(client, teams) {
|
||||
}
|
||||
|
||||
elapsed = stamp();
|
||||
stopSpinner = wait(teamUrlPrefix + slug);
|
||||
output.spinner(teamUrlPrefix + slug);
|
||||
|
||||
let res;
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
res = await teams.create({ slug });
|
||||
stopSpinner();
|
||||
team = res;
|
||||
} catch (err) {
|
||||
stopSpinner();
|
||||
output.stopSpinner();
|
||||
process.stdout.write(eraseLines(2));
|
||||
console.error(error(err.message));
|
||||
output.error(err.message);
|
||||
}
|
||||
} while (!team);
|
||||
|
||||
output.stopSpinner();
|
||||
process.stdout.write(eraseLines(2));
|
||||
|
||||
console.log(success(`Team created ${elapsed()}`));
|
||||
console.log(`${chalk.cyan(`${chars.tick} `) + teamUrlPrefix + slug}\n`);
|
||||
console.log(info('Pick a display name for your team'));
|
||||
output.success(`Team created ${elapsed()}`);
|
||||
output.log(`${chalk.cyan(`${chars.tick} `) + teamUrlPrefix + slug}\n`);
|
||||
output.log('Pick a display name for your team');
|
||||
|
||||
let name;
|
||||
|
||||
@@ -107,17 +102,16 @@ export default async function add(client, teams) {
|
||||
}
|
||||
|
||||
elapsed = stamp();
|
||||
stopSpinner = wait(teamNamePrefix + name);
|
||||
output.spinner(teamNamePrefix + name);
|
||||
|
||||
const res = await teams.edit({ id: team.id, name });
|
||||
|
||||
stopSpinner();
|
||||
|
||||
output.stopSpinner();
|
||||
process.stdout.write(eraseLines(2));
|
||||
|
||||
if (res.error) {
|
||||
console.error(error(res.error.message));
|
||||
console.log(`${chalk.red(`✖ ${teamNamePrefix}`)}${name}`);
|
||||
output.error(res.error.message);
|
||||
output.log(`${chalk.red(`✖ ${teamNamePrefix}`)}${name}`);
|
||||
|
||||
return 1;
|
||||
// TODO: maybe we want to ask the user to retry? not sure if
|
||||
@@ -126,10 +120,10 @@ export default async function add(client, teams) {
|
||||
|
||||
team = Object.assign(team, res);
|
||||
|
||||
console.log(success(`Team name saved ${elapsed()}`));
|
||||
console.log(`${chalk.cyan(`${chars.tick} `) + teamNamePrefix + team.name}\n`);
|
||||
output.success(`Team name saved ${elapsed()}`);
|
||||
output.log(`${chalk.cyan(`${chars.tick} `) + teamNamePrefix + team.name}\n`);
|
||||
|
||||
stopSpinner = wait('Saving');
|
||||
output.spinner('Saving');
|
||||
|
||||
// Update config file
|
||||
const configCopy = Object.assign({}, client.config);
|
||||
@@ -142,7 +136,7 @@ export default async function add(client, teams) {
|
||||
|
||||
writeToConfigFile(configCopy);
|
||||
|
||||
stopSpinner();
|
||||
output.stopSpinner();
|
||||
|
||||
await invite(client, { _: [] }, teams, {
|
||||
introMsg: 'Invite your teammates! When done, press enter on an empty field',
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
// Packages
|
||||
import chalk from 'chalk';
|
||||
|
||||
// Utilities
|
||||
import wait from '../../util/output/wait';
|
||||
|
||||
import info from '../../util/output/info';
|
||||
import error from '../../util/output/error';
|
||||
import chars from '../../util/output/chars';
|
||||
import table from '../../util/output/table';
|
||||
import getUser from '../../util/get-user.ts';
|
||||
@@ -23,7 +15,7 @@ export default async function list(client, argv, teams) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const stopSpinner = wait('Fetching teams');
|
||||
output.spinner('Fetching teams');
|
||||
const { teams: list, pagination } = await teams.ls({
|
||||
next,
|
||||
apiVersion: 2,
|
||||
@@ -31,23 +23,19 @@ export default async function list(client, argv, teams) {
|
||||
let { currentTeam } = config;
|
||||
const accountIsCurrent = !currentTeam;
|
||||
|
||||
stopSpinner();
|
||||
|
||||
const stopUserSpinner = wait('Fetching user information');
|
||||
output.spinner('Fetching user information');
|
||||
let user;
|
||||
try {
|
||||
user = await getUser(client);
|
||||
} catch (err) {
|
||||
if (err.code === 'NOT_AUTHORIZED' || err.code === 'TEAM_DELETED') {
|
||||
console.error(error(err.message));
|
||||
output.error(err.message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
stopUserSpinner();
|
||||
|
||||
if (accountIsCurrent) {
|
||||
currentTeam = {
|
||||
slug: user.username || user.email,
|
||||
@@ -79,12 +67,12 @@ export default async function list(client, argv, teams) {
|
||||
const count = teamList.length;
|
||||
if (!count) {
|
||||
// Maybe should not happen
|
||||
console.error(error(`No team found`));
|
||||
output.error(`No teams found`);
|
||||
return 1;
|
||||
}
|
||||
|
||||
info(`${chalk.bold(count)} team${count > 1 ? 's' : ''} found`);
|
||||
console.log();
|
||||
output.stopSpinner();
|
||||
console.log(); // empty line
|
||||
|
||||
table(
|
||||
['', 'id', 'email / name'],
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import chalk from 'chalk';
|
||||
import logo from '../util/output/logo';
|
||||
import getScope from '../util/get-scope.ts';
|
||||
import { getPkgName } from '../util/pkg-name.ts';
|
||||
import getArgs from '../util/get-args.ts';
|
||||
import handleError from '../util/handle-error.ts';
|
||||
import getScope from '../util/get-scope';
|
||||
import { getPkgName } from '../util/pkg-name';
|
||||
import getArgs from '../util/get-args';
|
||||
import handleError from '../util/handle-error';
|
||||
import Client from '../util/client';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
@@ -31,7 +32,7 @@ const help = () => {
|
||||
`);
|
||||
};
|
||||
|
||||
export default async client => {
|
||||
export default async (client: Client) => {
|
||||
const { output } = client;
|
||||
let argv;
|
||||
try {
|
||||
@@ -50,6 +50,7 @@ import { SENTRY_DSN } from './util/constants.ts';
|
||||
import getUpdateCommand from './util/get-update-command';
|
||||
import { metrics, shouldCollectMetrics } from './util/metrics.ts';
|
||||
import { getCommandName, getTitleName } from './util/pkg-name.ts';
|
||||
import doLoginPrompt from './util/login/prompt.ts';
|
||||
|
||||
const isCanary = pkg.version.includes('canary');
|
||||
|
||||
@@ -422,13 +423,24 @@ const main = async () => {
|
||||
) {
|
||||
if (isTTY) {
|
||||
output.log(info(`No existing credentials found. Please log in:`));
|
||||
const result = await doLoginPrompt(client);
|
||||
|
||||
subcommand = 'login';
|
||||
client.argv[2] = 'login';
|
||||
// The login function failed, so it returned an exit code
|
||||
if (typeof result === 'number') {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Ensure that subcommands lead to login as well, if
|
||||
// no credentials are defined
|
||||
client.argv = client.argv.splice(0, 3);
|
||||
// When `result` is a string it's the user's authentication token.
|
||||
// It needs to be saved to the configuration file.
|
||||
client.authConfig.token = result;
|
||||
|
||||
// New user, so we can't keep the team
|
||||
delete client.config.currentTeam;
|
||||
|
||||
configFiles.writeToAuthConfigFile(client.authConfig);
|
||||
configFiles.writeToConfigFile(client.config);
|
||||
|
||||
output.debug(`Saved credentials in "${hp(VERCEL_DIR)}"`);
|
||||
} else {
|
||||
output.prettyError({
|
||||
message:
|
||||
|
||||
@@ -270,6 +270,7 @@ export interface Project extends ProjectSettings {
|
||||
rootDirectory?: string | null;
|
||||
latestDeployments?: Partial<Deployment>[];
|
||||
autoExposeSystemEnvs?: boolean;
|
||||
sourceFilesOutsideRootDirectory: boolean;
|
||||
}
|
||||
|
||||
export interface Org {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import wait from '../output/wait';
|
||||
import Client from '../client';
|
||||
import { Cert } from '../../types';
|
||||
|
||||
@@ -10,7 +9,7 @@ export default async function createCertFromFile(
|
||||
certPath: string,
|
||||
caPath: string
|
||||
) {
|
||||
const cancelWait = wait('Adding your custom certificate');
|
||||
client.output.spinner('Adding your custom certificate');
|
||||
|
||||
try {
|
||||
const cert = readFileSync(resolve(certPath), 'utf8');
|
||||
@@ -36,7 +35,5 @@ export default async function createCertFromFile(
|
||||
}
|
||||
|
||||
throw error;
|
||||
} finally {
|
||||
cancelWait();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import chalk from 'chalk';
|
||||
import { Cert } from '../../types';
|
||||
import * as ERRORS from '../errors-ts';
|
||||
import Client from '../client';
|
||||
import wait from '../output/wait';
|
||||
import mapCertError from './map-cert-error';
|
||||
|
||||
export default async function startCertOrder(
|
||||
@@ -11,7 +10,7 @@ export default async function startCertOrder(
|
||||
cns: string[],
|
||||
context: string // eslint-disable-line
|
||||
) {
|
||||
const cancelWait = wait(
|
||||
client.output.spinner(
|
||||
`Issuing a certificate for ${chalk.bold(cns.join(', '))}`
|
||||
);
|
||||
try {
|
||||
@@ -22,10 +21,8 @@ export default async function startCertOrder(
|
||||
domains: cns,
|
||||
},
|
||||
});
|
||||
cancelWait();
|
||||
return cert;
|
||||
} catch (error) {
|
||||
cancelWait();
|
||||
if (error.code === 'cert_order_not_found') {
|
||||
return new ERRORS.CertOrderNotFound(cns);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import chalk from 'chalk';
|
||||
import wait from '../output/wait';
|
||||
import Client from '../client';
|
||||
|
||||
export type CertificateChallenge = {
|
||||
@@ -24,23 +23,17 @@ export default async function startCertOrder(
|
||||
cns: string[],
|
||||
contextName: string
|
||||
) {
|
||||
const cancelWait = wait(
|
||||
client.output.spinner(
|
||||
`Starting certificate issuance for ${chalk.bold(
|
||||
cns.join(', ')
|
||||
)} under ${chalk.bold(contextName)}`
|
||||
);
|
||||
try {
|
||||
const order = await client.fetch<CertificateOrder>('/v3/now/certs', {
|
||||
method: 'PATCH',
|
||||
body: {
|
||||
op: 'startOrder',
|
||||
domains: cns
|
||||
}
|
||||
});
|
||||
cancelWait();
|
||||
return order;
|
||||
} catch (error) {
|
||||
cancelWait();
|
||||
throw error;
|
||||
}
|
||||
const order = await client.fetch<CertificateOrder>('/v3/now/certs', {
|
||||
method: 'PATCH',
|
||||
body: {
|
||||
op: 'startOrder',
|
||||
domains: cns,
|
||||
},
|
||||
});
|
||||
return order;
|
||||
}
|
||||
|
||||
@@ -90,8 +90,10 @@ export default class Client extends EventEmitter {
|
||||
}
|
||||
|
||||
const headers = new Headers(opts.headers);
|
||||
headers.set('authorization', `Bearer ${this.authConfig.token}`);
|
||||
headers.set('user-agent', ua);
|
||||
if (this.authConfig.token) {
|
||||
headers.set('authorization', `Bearer ${this.authConfig.token}`);
|
||||
}
|
||||
|
||||
let body;
|
||||
if (isJSONObject(opts.body)) {
|
||||
@@ -163,7 +165,7 @@ export default class Client extends EventEmitter {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
this.authConfig.token = result;
|
||||
this.authConfig.token = result.token;
|
||||
writeToAuthConfigFile(this.authConfig);
|
||||
});
|
||||
|
||||
|
||||
@@ -3,17 +3,21 @@ import * as ERRORS_TS from '../errors-ts';
|
||||
import * as ERRORS from '../errors';
|
||||
import { NowError } from '../now-error';
|
||||
import mapCertError from '../certs/map-cert-error';
|
||||
import { Org } from '../../types';
|
||||
import Now from '..';
|
||||
import Client from '../client';
|
||||
import { DeploymentError } from '../../../../client/dist';
|
||||
|
||||
export default async function createDeploy(
|
||||
output,
|
||||
now,
|
||||
contextName,
|
||||
paths,
|
||||
createArgs,
|
||||
org,
|
||||
isSettingUpProject,
|
||||
cwd
|
||||
) {
|
||||
client: Client,
|
||||
now: Now,
|
||||
contextName: string,
|
||||
paths: string[],
|
||||
createArgs: any,
|
||||
org: Org | null,
|
||||
isSettingUpProject: boolean,
|
||||
cwd?: string
|
||||
): Promise<any | DeploymentError> {
|
||||
try {
|
||||
return await now.create(paths, createArgs, org, isSettingUpProject, cwd);
|
||||
} catch (error) {
|
||||
@@ -83,16 +87,17 @@ export default async function createDeploy(
|
||||
// If the cert is missing we try to generate a new one and the retry
|
||||
if (error.code === 'cert_missing') {
|
||||
const result = await generateCertForDeploy(
|
||||
output,
|
||||
now,
|
||||
client,
|
||||
contextName,
|
||||
error.value
|
||||
);
|
||||
|
||||
if (result instanceof NowError) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return createDeploy(
|
||||
output,
|
||||
client,
|
||||
now,
|
||||
contextName,
|
||||
paths,
|
||||
@@ -1,17 +1,16 @@
|
||||
import psl from 'psl';
|
||||
import { NowError } from '../now-error';
|
||||
import { Output } from '../output';
|
||||
import Client from '../client';
|
||||
import createCertForCns from '../certs/create-cert-for-cns';
|
||||
import setupDomain from '../domains/setup-domain';
|
||||
import { InvalidDomain } from '../errors-ts';
|
||||
|
||||
export default async function generateCertForDeploy(
|
||||
output: Output,
|
||||
client: Client,
|
||||
contextName: string,
|
||||
deployURL: string
|
||||
) {
|
||||
const { output } = client;
|
||||
const parsedDomain = psl.parse(deployURL);
|
||||
if (parsedDomain.error) {
|
||||
return new InvalidDomain(deployURL, parsedDomain.error.message);
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Output } from '../output';
|
||||
import Client from '../client';
|
||||
import getDomainDNSRecords from './get-domain-dns-records';
|
||||
import getDomains from '../domains/get-domains';
|
||||
import wait from '../output/wait';
|
||||
import chalk from 'chalk';
|
||||
|
||||
export type DomainRecordsItem = {
|
||||
@@ -60,11 +59,7 @@ async function getDomainNames(
|
||||
contextName: string,
|
||||
next?: number
|
||||
) {
|
||||
const cancelWait = wait(`Fetching domains under ${chalk.bold(contextName)}`);
|
||||
try {
|
||||
const { domains, pagination } = await getDomains(client, next);
|
||||
return { domainNames: domains.map(domain => domain.name), pagination };
|
||||
} finally {
|
||||
cancelWait();
|
||||
}
|
||||
client.output.spinner(`Fetching domains under ${chalk.bold(contextName)}`);
|
||||
const { domains, pagination } = await getDomains(client, next);
|
||||
return { domainNames: domains.map(domain => domain.name), pagination };
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import { resolve } from 'path';
|
||||
import { Response } from 'node-fetch';
|
||||
import { DomainNotFound, InvalidDomain } from '../errors-ts';
|
||||
import Client from '../client';
|
||||
import wait from '../output/wait';
|
||||
|
||||
type JSONResponse = {
|
||||
recordIds: string[];
|
||||
@@ -16,7 +15,7 @@ export default async function importZonefile(
|
||||
domain: string,
|
||||
zonefilePath: string
|
||||
) {
|
||||
const cancelWait = wait(
|
||||
client.output.spinner(
|
||||
`Importing Zone file for domain ${domain} under ${chalk.bold(contextName)}`
|
||||
);
|
||||
const zonefile = readFileSync(resolve(zonefilePath), 'utf8');
|
||||
@@ -33,10 +32,8 @@ export default async function importZonefile(
|
||||
);
|
||||
|
||||
const { recordIds } = (await res.json()) as JSONResponse;
|
||||
cancelWait();
|
||||
return recordIds;
|
||||
} catch (error) {
|
||||
cancelWait();
|
||||
if (error.code === 'not_found') {
|
||||
return new DomainNotFound(domain, contextName);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import retry from 'async-retry';
|
||||
import { DomainAlreadyExists, InvalidDomain } from '../errors-ts';
|
||||
import { Domain } from '../../types';
|
||||
import Client from '../client';
|
||||
import wait from '../output/wait';
|
||||
|
||||
type Response = {
|
||||
domain: Domain;
|
||||
@@ -14,17 +13,11 @@ export default async function addDomain(
|
||||
domain: string,
|
||||
contextName: string
|
||||
) {
|
||||
const cancelWait = wait(
|
||||
client.output.spinner(
|
||||
`Adding domain ${domain} under ${chalk.bold(contextName)}`
|
||||
);
|
||||
try {
|
||||
const addedDomain = await performAddRequest(client, domain);
|
||||
cancelWait();
|
||||
return addedDomain;
|
||||
} catch (error) {
|
||||
cancelWait();
|
||||
throw error;
|
||||
}
|
||||
const addedDomain = await performAddRequest(client, domain);
|
||||
return addedDomain;
|
||||
}
|
||||
|
||||
async function performAddRequest(client: Client, domainName: string) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import chalk from 'chalk';
|
||||
import Client from '../client';
|
||||
import wait from '../output/wait';
|
||||
import { Domain } from '../../types';
|
||||
import { DomainPermissionDenied, DomainNotFound } from '../errors-ts';
|
||||
|
||||
@@ -16,14 +15,15 @@ export default async function getDomainByName(
|
||||
ignoreWait?: boolean;
|
||||
} = {}
|
||||
) {
|
||||
const cancelWait = options.ignoreWait
|
||||
? null
|
||||
: wait(`Fetching domain ${domainName} under ${chalk.bold(contextName)}`);
|
||||
if (!options.ignoreWait) {
|
||||
client.output.spinner(
|
||||
`Fetching domain ${domainName} under ${chalk.bold(contextName)}`
|
||||
);
|
||||
}
|
||||
try {
|
||||
const { domain } = await client.fetch<Response>(
|
||||
`/v4/domains/${encodeURIComponent(domainName)}`
|
||||
);
|
||||
|
||||
return domain;
|
||||
} catch (error) {
|
||||
if (error.status === 404) {
|
||||
@@ -35,7 +35,5 @@ export default async function getDomainByName(
|
||||
}
|
||||
|
||||
throw error;
|
||||
} finally {
|
||||
cancelWait?.();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import chalk from 'chalk';
|
||||
import Client from '../client';
|
||||
import wait from '../output/wait';
|
||||
import { Domain } from '../../types';
|
||||
|
||||
type Response = {
|
||||
@@ -12,7 +11,7 @@ export async function getDomain(
|
||||
contextName: string,
|
||||
domainName: string
|
||||
) {
|
||||
const cancelWait = wait(
|
||||
client.output.spinner(
|
||||
`Fetching domain ${domainName} under ${chalk.bold(contextName)}`
|
||||
);
|
||||
try {
|
||||
@@ -27,7 +26,5 @@ export async function getDomain(
|
||||
}
|
||||
|
||||
throw error;
|
||||
} finally {
|
||||
cancelWait();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,22 +3,19 @@ import retry from 'async-retry';
|
||||
import { Domain } from '../../types';
|
||||
import * as ERRORS from '../errors-ts';
|
||||
import Client from '../client';
|
||||
import wait from '../output/wait';
|
||||
|
||||
export default async function verifyDomain(
|
||||
client: Client,
|
||||
domainName: string,
|
||||
contextName: string
|
||||
) {
|
||||
const cancelWait = wait(
|
||||
client.output.spinner(
|
||||
`Verifying domain ${domainName} under ${chalk.bold(contextName)}`
|
||||
);
|
||||
try {
|
||||
const { domain } = await performVerifyDomain(client, domainName);
|
||||
cancelWait();
|
||||
return domain;
|
||||
} catch (error) {
|
||||
cancelWait();
|
||||
if (error.code === 'verification_failed') {
|
||||
return new ERRORS.DomainVerificationFailed({
|
||||
purchased: false,
|
||||
|
||||
@@ -588,7 +588,7 @@ export class DeploymentNotFound extends NowError<
|
||||
'DEPLOYMENT_NOT_FOUND',
|
||||
{ id: string; context: string }
|
||||
> {
|
||||
constructor({ context, id = '' }: { context: string; id: string }) {
|
||||
constructor({ context, id = '' }: { context: string; id?: string }) {
|
||||
super({
|
||||
code: 'DEPLOYMENT_NOT_FOUND',
|
||||
meta: { id, context },
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
async function* eventListenerToGenerator(event: string, emitter: EventEmitter) {
|
||||
while (true) {
|
||||
yield new Promise(resolve => {
|
||||
const handler = (...args: any[]) => {
|
||||
emitter.removeListener(event, handler);
|
||||
resolve(...args);
|
||||
};
|
||||
emitter.on(event, handler);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default eventListenerToGenerator;
|
||||
@@ -20,6 +20,7 @@ export default class Now extends EventEmitter {
|
||||
constructor({
|
||||
apiUrl,
|
||||
token,
|
||||
url = null,
|
||||
currentTeam = null,
|
||||
forceNew = false,
|
||||
withCache = false,
|
||||
@@ -28,6 +29,7 @@ export default class Now extends EventEmitter {
|
||||
}) {
|
||||
super();
|
||||
|
||||
this.url = url;
|
||||
this._token = token;
|
||||
this._debug = debug;
|
||||
this._forceNew = forceNew;
|
||||
|
||||
@@ -22,7 +22,7 @@ export default async function editProjectSettings(
|
||||
output: Output,
|
||||
projectSettings: PartialProjectSettings | null,
|
||||
framework: Framework | null,
|
||||
autoConfirm: boolean
|
||||
autoConfirm?: boolean
|
||||
): Promise<ProjectSettings> {
|
||||
// create new settings object, missing values will be filled with `null`
|
||||
const settings: ProjectSettings = Object.assign(
|
||||
|
||||
@@ -177,7 +177,7 @@ export default async function setupAndLink(
|
||||
}
|
||||
|
||||
const deployment = await createDeploy(
|
||||
output,
|
||||
client,
|
||||
now,
|
||||
config.currentTeam || 'current user',
|
||||
[sourcePath],
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import { URL } from 'url';
|
||||
import { LoginParams } from './types';
|
||||
import Client from '../client';
|
||||
import doOauthLogin from './oauth';
|
||||
|
||||
export default function doBitbucketLogin(params: LoginParams) {
|
||||
export default function doBitbucketLogin(
|
||||
client: Client,
|
||||
outOfBand?: boolean,
|
||||
ssoUserId?: string
|
||||
) {
|
||||
const url = new URL(
|
||||
'/api/registration/bitbucket/connect',
|
||||
// Can't use `apiUrl` here because this URL sets a
|
||||
// cookie that the OAuth callback URL depends on
|
||||
'https://vercel.com'
|
||||
);
|
||||
return doOauthLogin(params, url, 'Bitbucket');
|
||||
return doOauthLogin(client, url, 'Bitbucket', outOfBand, ssoUserId);
|
||||
}
|
||||
|
||||
@@ -4,20 +4,22 @@ import highlight from '../output/highlight';
|
||||
import eraseLines from '../output/erase-lines';
|
||||
import verify from './verify';
|
||||
import executeLogin from './login';
|
||||
import { LoginParams } from './types';
|
||||
import Client from '../client';
|
||||
import { LoginResult } from './types';
|
||||
|
||||
export default async function doEmailLogin(
|
||||
params: LoginParams,
|
||||
email: string
|
||||
): Promise<number | string> {
|
||||
client: Client,
|
||||
email: string,
|
||||
ssoUserId?: string
|
||||
): Promise<LoginResult> {
|
||||
let securityCode;
|
||||
let verificationToken;
|
||||
const { apiUrl, output } = params;
|
||||
const { output } = client;
|
||||
|
||||
output.spinner('Sending you an email');
|
||||
|
||||
try {
|
||||
const data = await executeLogin(apiUrl, email);
|
||||
const data = await executeLogin(client, email);
|
||||
verificationToken = data.token;
|
||||
securityCode = data.securityCode;
|
||||
} catch (err) {
|
||||
@@ -38,13 +40,19 @@ export default async function doEmailLogin(
|
||||
|
||||
output.spinner('Waiting for your confirmation');
|
||||
|
||||
let token = '';
|
||||
while (!token) {
|
||||
let result;
|
||||
while (!result) {
|
||||
try {
|
||||
await sleep(ms('1s'));
|
||||
token = await verify(email, verificationToken, 'Email', params);
|
||||
result = await verify(
|
||||
client,
|
||||
verificationToken,
|
||||
email,
|
||||
'Email',
|
||||
ssoUserId
|
||||
);
|
||||
} catch (err) {
|
||||
if (err.message !== 'Confirmation incomplete') {
|
||||
if (err.serverMessage !== 'Confirmation incomplete') {
|
||||
output.error(err.message);
|
||||
return 1;
|
||||
}
|
||||
@@ -52,5 +60,5 @@ export default async function doEmailLogin(
|
||||
}
|
||||
|
||||
output.success(`Email authentication complete for ${email}`);
|
||||
return token;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import { URL } from 'url';
|
||||
import { LoginParams } from './types';
|
||||
import Client from '../client';
|
||||
import doOauthLogin from './oauth';
|
||||
|
||||
export default function doGithubLogin(params: LoginParams) {
|
||||
export default function doGithubLogin(
|
||||
client: Client,
|
||||
outOfBand?: boolean,
|
||||
ssoUserId?: string
|
||||
) {
|
||||
const url = new URL(
|
||||
'/api/registration/login-with-github',
|
||||
// Can't use `apiUrl` here because this URL sets a
|
||||
// cookie that the OAuth callback URL depends on
|
||||
'https://vercel.com'
|
||||
);
|
||||
return doOauthLogin(params, url, 'GitHub');
|
||||
return doOauthLogin(client, url, 'GitHub', outOfBand, ssoUserId);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import { URL } from 'url';
|
||||
import { LoginParams } from './types';
|
||||
import Client from '../client';
|
||||
import doOauthLogin from './oauth';
|
||||
|
||||
export default function doGitlabLogin(params: LoginParams) {
|
||||
export default function doGitlabLogin(
|
||||
client: Client,
|
||||
outOfBand?: boolean,
|
||||
ssoUserId?: string
|
||||
) {
|
||||
// Can't use `apiUrl` here because this URL sets a
|
||||
// cookie that the OAuth callback URL depends on
|
||||
const url = new URL('/api/registration/gitlab/connect', 'https://vercel.com');
|
||||
return doOauthLogin(params, url, 'GitLab');
|
||||
return doOauthLogin(client, url, 'GitLab', outOfBand, ssoUserId);
|
||||
}
|
||||
|
||||
@@ -1,38 +1,28 @@
|
||||
import fetch from 'node-fetch';
|
||||
import Client from '../client';
|
||||
import { InvalidEmail, AccountNotFound } from '../errors-ts';
|
||||
import ua from '../ua';
|
||||
import { LoginData } from './types';
|
||||
|
||||
export default async function login(
|
||||
apiUrl: string,
|
||||
email: string,
|
||||
mode: 'login' | 'signup' = 'login'
|
||||
client: Client,
|
||||
email: string
|
||||
): Promise<LoginData> {
|
||||
const response = await fetch(`${apiUrl}/now/registration?mode=${mode}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent': ua,
|
||||
},
|
||||
body: JSON.stringify({ email }),
|
||||
});
|
||||
|
||||
const body = await response.json();
|
||||
if (!response.ok) {
|
||||
const { error = {} } = body;
|
||||
if (error.code === 'not_exists') {
|
||||
try {
|
||||
return await client.fetch<LoginData>(`/registration?mode=login`, {
|
||||
method: 'POST',
|
||||
body: { email },
|
||||
});
|
||||
} catch (err) {
|
||||
if (err.code === 'not_exists') {
|
||||
throw new AccountNotFound(
|
||||
email,
|
||||
`Please sign up: https://vercel.com/signup`
|
||||
);
|
||||
}
|
||||
|
||||
if (error.code === 'invalid_email') {
|
||||
throw new InvalidEmail(email, error.message);
|
||||
if (err.code === 'invalid_email') {
|
||||
throw new InvalidEmail(email, err.message);
|
||||
}
|
||||
|
||||
throw new Error(`Unexpected error: ${error.message}`);
|
||||
throw new Error(`Unexpected error: ${err.message}`);
|
||||
}
|
||||
|
||||
return body as LoginData;
|
||||
}
|
||||
|
||||
@@ -2,24 +2,70 @@ import http from 'http';
|
||||
import open from 'open';
|
||||
import { URL } from 'url';
|
||||
import listen from 'async-listen';
|
||||
import { LoginParams } from './types';
|
||||
import prompt from './prompt';
|
||||
import isDocker from 'is-docker';
|
||||
import Client from '../client';
|
||||
import prompt, { readInput } from './prompt';
|
||||
import verify from './verify';
|
||||
import highlight from '../output/highlight';
|
||||
import link from '../output/link';
|
||||
import eraseLines from '../output/erase-lines';
|
||||
import { LoginResult } from './types';
|
||||
|
||||
export default async function doOauthLogin(
|
||||
params: LoginParams,
|
||||
client: Client,
|
||||
url: URL,
|
||||
provider: string,
|
||||
outOfBand = isHeadless(),
|
||||
ssoUserId?: string
|
||||
): Promise<LoginResult> {
|
||||
url.searchParams.set('mode', 'login');
|
||||
|
||||
const getVerificationToken = outOfBand
|
||||
? getVerificationTokenOutOfBand
|
||||
: getVerificationTokenInBand;
|
||||
|
||||
let result = await getVerificationToken(client, url, provider);
|
||||
|
||||
if (typeof result === 'number') {
|
||||
return result;
|
||||
}
|
||||
|
||||
if ('verificationToken' in result) {
|
||||
const { output } = client;
|
||||
output.spinner('Verifying authentication token');
|
||||
result = await verify(
|
||||
client,
|
||||
result.verificationToken,
|
||||
undefined,
|
||||
provider,
|
||||
ssoUserId
|
||||
);
|
||||
output.success(
|
||||
`${provider} authentication complete for ${highlight(result.email)}`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the verification token "in-band" by spawning a localhost
|
||||
* HTTP server that gets redirected to as the OAuth callback URL.
|
||||
*
|
||||
* This method is preferred since it doesn't require additional
|
||||
* user interaction, however it only works when the web browser
|
||||
* is on the same machine as the localhost HTTP server (so doesn't
|
||||
* work over SSH, for example).
|
||||
*/
|
||||
async function getVerificationTokenInBand(
|
||||
client: Client,
|
||||
url: URL,
|
||||
provider: string
|
||||
): Promise<number | string> {
|
||||
const { output } = params;
|
||||
|
||||
) {
|
||||
const { output } = client;
|
||||
const server = http.createServer();
|
||||
const address = await listen(server, 0, '127.0.0.1');
|
||||
const { port } = new URL(address);
|
||||
url.searchParams.set('mode', 'login');
|
||||
url.searchParams.set('next', `http://localhost:${port}`);
|
||||
|
||||
output.log(`Please visit the following URL in your web browser:`);
|
||||
@@ -30,6 +76,10 @@ export default async function doOauthLogin(
|
||||
const [query] = await Promise.all([
|
||||
new Promise<URL['searchParams']>((resolve, reject) => {
|
||||
server.once('request', (req, res) => {
|
||||
// Close the HTTP connection to prevent
|
||||
// `server.close()` from hanging
|
||||
res.setHeader('connection', 'close');
|
||||
|
||||
const query = new URL(req.url || '/', 'http://localhost')
|
||||
.searchParams;
|
||||
resolve(query);
|
||||
@@ -85,30 +135,61 @@ export default async function doOauthLogin(
|
||||
// If an `ssoUserId` was returned, then the SAML Profile is not yet connected
|
||||
// to a Team member. Prompt the user to log in to a Vercel account now, which
|
||||
// will complete the connection to the SAML Profile.
|
||||
const ssoUserId = query.get('ssoUserId');
|
||||
if (ssoUserId) {
|
||||
const ssoUserIdParam = query.get('ssoUserId');
|
||||
if (ssoUserIdParam) {
|
||||
output.log(
|
||||
'Please log in to your Vercel account to complete SAML connection.'
|
||||
);
|
||||
return prompt({ ...params, ssoUserId });
|
||||
return prompt(client, undefined, false, ssoUserIdParam);
|
||||
}
|
||||
|
||||
const email = query.get('email');
|
||||
const verificationToken = query.get('token');
|
||||
if (!email || !verificationToken) {
|
||||
if (!verificationToken) {
|
||||
output.error(
|
||||
'Verification token was not provided. Please contact support.'
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
output.spinner('Verifying authentication token');
|
||||
const token = await verify(email, verificationToken, provider, params);
|
||||
output.success(
|
||||
`${provider} authentication complete for ${highlight(email)}`
|
||||
);
|
||||
return token;
|
||||
return { verificationToken };
|
||||
} finally {
|
||||
server.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the verification token "out-of-band" by presenting the login URL
|
||||
* to the user and directing them to visit the URL in their web browser.
|
||||
*
|
||||
* A prompt is rendered asking for the verification token that is
|
||||
* provided to them in the callback URL after the login is successful.
|
||||
*/
|
||||
async function getVerificationTokenOutOfBand(client: Client, url: URL) {
|
||||
const { output } = client;
|
||||
url.searchParams.set(
|
||||
'next',
|
||||
`https://vercel.com/notifications/cli-login-oob`
|
||||
);
|
||||
output.log(`Please visit the following URL in your web browser:`);
|
||||
output.log(link(url.href));
|
||||
output.print('\n');
|
||||
output.log(
|
||||
`After login is complete, enter the verification code printed in your browser.`
|
||||
);
|
||||
const verificationToken = await readInput('Verification code:');
|
||||
output.print(eraseLines(6));
|
||||
return { verificationToken };
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to detect whether CLI is running inside a "headless"
|
||||
* environment, such as inside a Docker container or in an SSH
|
||||
* session.
|
||||
*/
|
||||
function isHeadless() {
|
||||
return isDocker() || isSSH();
|
||||
}
|
||||
|
||||
function isSSH() {
|
||||
return Boolean(process.env.SSH_CLIENT || process.env.SSH_TTY);
|
||||
}
|
||||
|
||||
@@ -1,29 +1,32 @@
|
||||
import inquirer from 'inquirer';
|
||||
import Client from '../client';
|
||||
import error from '../output/error';
|
||||
import listInput from '../input/list';
|
||||
import { getCommandName } from '../pkg-name';
|
||||
import { LoginParams, SAMLError } from './types';
|
||||
import doSsoLogin from './sso';
|
||||
import { LoginResult, SAMLError } from './types';
|
||||
import doSamlLogin from './saml';
|
||||
import doEmailLogin from './email';
|
||||
import doGithubLogin from './github';
|
||||
import doGitlabLogin from './gitlab';
|
||||
import doBitbucketLogin from './bitbucket';
|
||||
|
||||
export default async function prompt(
|
||||
params: LoginParams,
|
||||
error?: Pick<SAMLError, 'teamId'>
|
||||
client: Client,
|
||||
error?: Pick<SAMLError, 'teamId'>,
|
||||
outOfBand?: boolean,
|
||||
ssoUserId?: string
|
||||
) {
|
||||
let result: number | string = 1;
|
||||
let result: LoginResult = 1;
|
||||
|
||||
const choices = [
|
||||
{ name: 'Continue with GitHub', value: 'github', short: 'github' },
|
||||
{ name: 'Continue with GitLab', value: 'gitlab', short: 'gitlab' },
|
||||
{ name: 'Continue with Bitbucket', value: 'bitbucket', short: 'bitbucket' },
|
||||
{ name: 'Continue with Email', value: 'email', short: 'email' },
|
||||
{ name: 'Continue with SAML Single Sign-On', value: 'sso', short: 'sso' },
|
||||
{ name: 'Continue with SAML Single Sign-On', value: 'saml', short: 'saml' },
|
||||
];
|
||||
|
||||
if (params.ssoUserId || (error && !error.teamId)) {
|
||||
if (ssoUserId || (error && !error.teamId)) {
|
||||
// Remove SAML login option if we're connecting SAML Profile,
|
||||
// or if this is a SAML error for a user / team without SAML
|
||||
choices.pop();
|
||||
@@ -35,23 +38,23 @@ export default async function prompt(
|
||||
});
|
||||
|
||||
if (choice === 'github') {
|
||||
result = await doGithubLogin(params);
|
||||
result = await doGithubLogin(client, outOfBand, ssoUserId);
|
||||
} else if (choice === 'gitlab') {
|
||||
result = await doGitlabLogin(params);
|
||||
result = await doGitlabLogin(client, outOfBand, ssoUserId);
|
||||
} else if (choice === 'bitbucket') {
|
||||
result = await doBitbucketLogin(params);
|
||||
result = await doBitbucketLogin(client, outOfBand, ssoUserId);
|
||||
} else if (choice === 'email') {
|
||||
const email = await readInput('Enter your email address');
|
||||
result = await doEmailLogin(params, email);
|
||||
} else if (choice === 'sso') {
|
||||
const slug = error?.teamId || (await readInput('Enter your Team slug'));
|
||||
result = await doSsoLogin(params, slug);
|
||||
const email = await readInput('Enter your email address:');
|
||||
result = await doEmailLogin(client, email, ssoUserId);
|
||||
} else if (choice === 'saml') {
|
||||
const slug = error?.teamId || (await readInput('Enter your Team slug:'));
|
||||
result = await doSamlLogin(client, slug, outOfBand, ssoUserId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async function readInput(message: string) {
|
||||
export async function readInput(message: string): Promise<string> {
|
||||
let input;
|
||||
|
||||
while (!input) {
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import { bold } from 'chalk';
|
||||
import doSsoLogin from './sso';
|
||||
import doSamlLogin from './saml';
|
||||
import showLoginPrompt from './prompt';
|
||||
import { LoginParams, SAMLError } from './types';
|
||||
import { LoginResult, SAMLError } from './types';
|
||||
import confirm from '../input/confirm';
|
||||
import Client from '../client';
|
||||
|
||||
export default async function reauthenticate(
|
||||
params: LoginParams,
|
||||
client: Client,
|
||||
error: Pick<SAMLError, 'enforced' | 'scope' | 'teamId'>
|
||||
): Promise<string | number> {
|
||||
let result: string | number = 1;
|
||||
): Promise<LoginResult> {
|
||||
if (error.teamId && error.enforced) {
|
||||
// If team has SAML enforced then trigger the SSO login directly
|
||||
params.output.log(
|
||||
client.output.log(
|
||||
`You must re-authenticate with SAML to use ${bold(error.scope)} scope.`
|
||||
);
|
||||
if (await confirm(`Log in with SAML?`, true)) {
|
||||
result = await doSsoLogin(params, error.teamId);
|
||||
return doSamlLogin(client, error.teamId);
|
||||
}
|
||||
} else {
|
||||
// Personal account, or team that does not have SAML enforced
|
||||
params.output.log(
|
||||
client.output.log(
|
||||
`You must re-authenticate to use ${bold(error.scope)} scope.`
|
||||
);
|
||||
result = await showLoginPrompt(params, error);
|
||||
return showLoginPrompt(client, error);
|
||||
}
|
||||
return result;
|
||||
return 1;
|
||||
}
|
||||
|
||||
14
packages/cli/src/util/login/saml.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { URL } from 'url';
|
||||
import Client from '../client';
|
||||
import doOauthLogin from './oauth';
|
||||
|
||||
export default function doSamlLogin(
|
||||
client: Client,
|
||||
teamIdOrSlug: string,
|
||||
outOfBand?: boolean,
|
||||
ssoUserId?: string
|
||||
) {
|
||||
const url = new URL('/auth/sso', client.apiUrl);
|
||||
url.searchParams.set('teamId', teamIdOrSlug);
|
||||
return doOauthLogin(client, url, 'SAML Single Sign-On', outOfBand, ssoUserId);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { URL } from 'url';
|
||||
import { LoginParams } from './types';
|
||||
import doOauthLogin from './oauth';
|
||||
|
||||
export default function doSsoLogin(params: LoginParams, teamIdOrSlug: string) {
|
||||
const url = new URL('/auth/sso', params.apiUrl);
|
||||
url.searchParams.set('teamId', teamIdOrSlug);
|
||||
return doOauthLogin(params, url, 'SAML Single Sign-On');
|
||||
}
|
||||
@@ -1,18 +1,16 @@
|
||||
import { AuthConfig } from '../../types';
|
||||
import { Output } from '../output';
|
||||
|
||||
export interface LoginParams {
|
||||
authConfig: AuthConfig;
|
||||
apiUrl: string;
|
||||
output: Output;
|
||||
ssoUserId?: string;
|
||||
}
|
||||
|
||||
export interface LoginData {
|
||||
token: string;
|
||||
securityCode: string;
|
||||
}
|
||||
|
||||
export type LoginResult = number | LoginResultSuccess;
|
||||
|
||||
export interface LoginResultSuccess {
|
||||
token: string;
|
||||
email: string;
|
||||
teamId?: string;
|
||||
}
|
||||
|
||||
export interface SAMLError {
|
||||
saml?: true;
|
||||
teamId: string | null;
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
import { URL } from 'url';
|
||||
import fetch, { Headers } from 'node-fetch';
|
||||
import ua from '../ua';
|
||||
import { LoginParams } from './types';
|
||||
import Client from '../client';
|
||||
import { hostname } from 'os';
|
||||
import { getTitleName } from '../pkg-name';
|
||||
import { LoginResultSuccess } from './types';
|
||||
|
||||
export default async function verify(
|
||||
email: string,
|
||||
export default function verify(
|
||||
client: Client,
|
||||
verificationToken: string,
|
||||
email: string | undefined,
|
||||
provider: string,
|
||||
{ authConfig, apiUrl, ssoUserId }: LoginParams
|
||||
): Promise<string> {
|
||||
const url = new URL('/registration/verify', apiUrl);
|
||||
url.searchParams.set('email', email);
|
||||
ssoUserId?: string
|
||||
) {
|
||||
const url = new URL('/registration/verify', client.apiUrl);
|
||||
url.searchParams.set('token', verificationToken);
|
||||
if (email) {
|
||||
url.searchParams.set('email', email);
|
||||
}
|
||||
|
||||
const headers = new Headers({ 'User-Agent': ua });
|
||||
|
||||
if (authConfig.token) {
|
||||
// If there is already an auth token then it will be
|
||||
// upgraded, rather than a new token being created
|
||||
headers.set('Authorization', `Bearer ${authConfig.token}`);
|
||||
} else {
|
||||
if (!client.authConfig.token) {
|
||||
// Set the "name" of the Token that will be created
|
||||
const hyphens = new RegExp('-', 'g');
|
||||
const host = hostname().replace(hyphens, ' ').replace('.local', '');
|
||||
@@ -35,16 +31,5 @@ export default async function verify(
|
||||
url.searchParams.set('ssoUserId', ssoUserId);
|
||||
}
|
||||
|
||||
const res = await fetch(url.href, { headers });
|
||||
const body = await res.json();
|
||||
|
||||
if (!res.ok) {
|
||||
const err = new Error(
|
||||
`Unexpected ${res.status} status code from verify API`
|
||||
);
|
||||
Object.assign(err, body.error);
|
||||
throw err;
|
||||
}
|
||||
|
||||
return body.token;
|
||||
return client.fetch<LoginResultSuccess>(url.href);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import chalk from 'chalk';
|
||||
import Client from '../client';
|
||||
import wait from '../output/wait';
|
||||
import { ProjectAliasTarget } from '../../types';
|
||||
|
||||
export async function addDomainToProject(
|
||||
@@ -8,7 +7,7 @@ export async function addDomainToProject(
|
||||
projectNameOrId: string,
|
||||
domain: string
|
||||
) {
|
||||
const cancelWait = wait(
|
||||
client.output.spinner(
|
||||
`Adding domain ${domain} to project ${chalk.bold(projectNameOrId)}`
|
||||
);
|
||||
try {
|
||||
@@ -40,7 +39,5 @@ export async function addDomainToProject(
|
||||
}
|
||||
|
||||
throw err;
|
||||
} finally {
|
||||
cancelWait();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import chalk from 'chalk';
|
||||
import Client from '../client';
|
||||
import wait from '../output/wait';
|
||||
import { ProjectAliasTarget } from '../../types';
|
||||
|
||||
export async function removeDomainFromProject(
|
||||
@@ -8,7 +7,7 @@ export async function removeDomainFromProject(
|
||||
projectNameOrId: string,
|
||||
domain: string
|
||||
) {
|
||||
const cancelWait = wait(
|
||||
client.output.spinner(
|
||||
`Removing domain ${domain} from project ${chalk.bold(projectNameOrId)}`
|
||||
);
|
||||
try {
|
||||
@@ -28,7 +27,5 @@ export async function removeDomainFromProject(
|
||||
}
|
||||
|
||||
throw err;
|
||||
} finally {
|
||||
cancelWait();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { dep1 } from './js/ecmascript-module';
|
||||
|
||||
const { dep2 } = require('./js/commonjs-module');
|
||||
|
||||
module.exports = (req, res) => {
|
||||
if (req && typeof dep1 === 'string' && typeof dep2 === 'string') {
|
||||
res.end('mixed-modules:js');
|
||||
} else {
|
||||
res.end('import failed');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
import { dep1 } from './js/em-jay-ess.mjs';
|
||||
|
||||
async function handler(_req, res) {
|
||||
const cjs = await import('./js/commonjs-module.js');
|
||||
if (dep1 === 'dep1' && cjs.default && cjs.default.dep2 === 'dep2') {
|
||||
res.end('mixed-modules:mjs');
|
||||
} else {
|
||||
res.end('import failed');
|
||||
}
|
||||
};
|
||||
|
||||
export default handler;
|
||||
@@ -0,0 +1,11 @@
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
import { dep1 } from './ts/ecmascript-module';
|
||||
const { dep2 } = require('./ts/commonjs-module');
|
||||
|
||||
module.exports = (req: IncomingMessage, res: ServerResponse) => {
|
||||
if (req && typeof dep1 === 'string' && typeof dep2 === 'string') {
|
||||
res.end('mixed-modules:ts');
|
||||
} else {
|
||||
res.end('import failed');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = { dep2: 'dep2' };
|
||||
@@ -0,0 +1,2 @@
|
||||
export const dep1 = 'dep1';
|
||||
export const another = 'another';
|
||||
@@ -0,0 +1,2 @@
|
||||
export const dep1 = 'dep1';
|
||||
export const another = 'another';
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"private": true
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = { dep2: 'dep2' };
|
||||
@@ -0,0 +1 @@
|
||||
export const dep1 = 'dep1';
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"private": true
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { dep1 } from '../js/em-jay-ess.mjs';
|
||||
|
||||
async function handler(_req, res) {
|
||||
const cjs = await import('../js/commonjs-module.js');
|
||||
if (dep1 === 'dep1' && cjs.default && cjs.default.dep2 === 'dep2') {
|
||||
res.end('mixed-modules:auto');
|
||||
} else {
|
||||
res.end('import failed');
|
||||
}
|
||||
}
|
||||
|
||||
export default handler;
|
||||
@@ -0,0 +1,12 @@
|
||||
import { dep1 } from '../../js/em-jay-ess.mjs';
|
||||
|
||||
async function handler(_req, res) {
|
||||
const cjs = await import('../../js/commonjs-module.js');
|
||||
if (dep1 === 'dep1' && cjs.default && cjs.default.dep2 === 'dep2') {
|
||||
res.end('mixed-modules:also');
|
||||
} else {
|
||||
res.end('import failed');
|
||||
}
|
||||
}
|
||||
|
||||
export default handler;
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{ "src": "entrypoint**", "use": "@vercel/node@canary" },
|
||||
{ "src": "type-module-package-json/**/*.js", "use": "@vercel/node@canary" }
|
||||
]
|
||||
}
|
||||
@@ -1732,6 +1732,25 @@ test(
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] 40-mixed-modules',
|
||||
testFixtureStdio('40-mixed-modules', async testPath => {
|
||||
await testPath(200, '/entrypoint.js', 'mixed-modules:js');
|
||||
await testPath(200, '/entrypoint.mjs', 'mixed-modules:mjs');
|
||||
await testPath(200, '/entrypoint.ts', 'mixed-modules:ts');
|
||||
await testPath(
|
||||
200,
|
||||
'/type-module-package-json/auto.js',
|
||||
'mixed-modules:auto'
|
||||
);
|
||||
await testPath(
|
||||
200,
|
||||
'/type-module-package-json/nested/also.js',
|
||||
'mixed-modules:also'
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] Use `@vercel/python` with Flask requirements.txt',
|
||||
testFixtureStdio('python-flask', async testPath => {
|
||||
|
||||
3
packages/cli/test/integration.js
vendored
@@ -157,9 +157,10 @@ function mockLoginApi(req, res) {
|
||||
let { pathname = '/', query = {} } = parseUrl(url, true);
|
||||
console.log(`[mock-login-server] ${method} ${pathname}`);
|
||||
const securityCode = 'Bears Beets Battlestar Galactica';
|
||||
res.setHeader('content-type', 'application/json');
|
||||
if (
|
||||
method === 'POST' &&
|
||||
pathname === '/now/registration' &&
|
||||
pathname === '/registration' &&
|
||||
query.mode === 'login'
|
||||
) {
|
||||
res.end(JSON.stringify({ token, securityCode }));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/client",
|
||||
"version": "10.1.1",
|
||||
"version": "10.1.2-canary.4",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"homepage": "https://vercel.com",
|
||||
@@ -29,7 +29,7 @@
|
||||
"@types/node": "12.0.4",
|
||||
"@types/node-fetch": "2.5.4",
|
||||
"@types/recursive-readdir": "2.2.0",
|
||||
"typescript": "3.9.3"
|
||||
"typescript": "4.3.4"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
@@ -40,7 +40,7 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "2.11.1",
|
||||
"@vercel/build-utils": "2.11.2-canary.3",
|
||||
"@zeit/fetch": "5.2.0",
|
||||
"async-retry": "1.2.3",
|
||||
"async-sema": "3.0.0",
|
||||
|
||||
@@ -89,16 +89,6 @@ export async function* checkDeploymentStatus(
|
||||
}
|
||||
|
||||
if (isAliasAssigned(deploymentUpdate)) {
|
||||
if (
|
||||
deploymentUpdate.aliasWarning &&
|
||||
deploymentUpdate.aliasWarning.message
|
||||
) {
|
||||
yield {
|
||||
type: 'warning',
|
||||
payload: deploymentUpdate.aliasWarning.message,
|
||||
};
|
||||
}
|
||||
|
||||
debug('Deployment alias assigned');
|
||||
return yield { type: 'alias-assigned', payload: deploymentUpdate };
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ export const fileNameSymbol = Symbol('fileName');
|
||||
export interface VercelConfig {
|
||||
[fileNameSymbol]?: string;
|
||||
name?: string;
|
||||
meta?: string[];
|
||||
version?: number;
|
||||
public?: boolean;
|
||||
env?: Dictionary<string>;
|
||||
|
||||
15
packages/frameworks/logos/vite.svg
Normal file
@@ -0,0 +1,15 @@
|
||||
<svg width="410" height="404" viewBox="0 0 410 404" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M399.641 59.5246L215.643 388.545C211.844 395.338 202.084 395.378 198.228 388.618L10.5817 59.5563C6.38087 52.1896 12.6802 43.2665 21.0281 44.7586L205.223 77.6824C206.398 77.8924 207.601 77.8904 208.776 77.6763L389.119 44.8058C397.439 43.2894 403.768 52.1434 399.641 59.5246Z" fill="url(#paint0_linear)"/>
|
||||
<path d="M292.965 1.5744L156.801 28.2552C154.563 28.6937 152.906 30.5903 152.771 32.8664L144.395 174.33C144.198 177.662 147.258 180.248 150.51 179.498L188.42 170.749C191.967 169.931 195.172 173.055 194.443 176.622L183.18 231.775C182.422 235.487 185.907 238.661 189.532 237.56L212.947 230.446C216.577 229.344 220.065 232.527 219.297 236.242L201.398 322.875C200.278 328.294 207.486 331.249 210.492 326.603L212.5 323.5L323.454 102.072C325.312 98.3645 322.108 94.137 318.036 94.9228L279.014 102.454C275.347 103.161 272.227 99.746 273.262 96.1583L298.731 7.86689C299.767 4.27314 296.636 0.855181 292.965 1.5744Z" fill="url(#paint1_linear)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear" x1="6.00017" y1="32.9999" x2="235" y2="344" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#41D1FF"/>
|
||||
<stop offset="1" stop-color="#BD34FE"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear" x1="194.651" y1="8.81818" x2="236.076" y2="292.989" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FFEA83"/>
|
||||
<stop offset="0.0833333" stop-color="#FFDD35"/>
|
||||
<stop offset="1" stop-color="#FFA800"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/frameworks",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.2-canary.2",
|
||||
"main": "./dist/frameworks.js",
|
||||
"types": "./dist/frameworks.d.ts",
|
||||
"files": [
|
||||
@@ -20,10 +20,10 @@
|
||||
"@types/js-yaml": "3.12.1",
|
||||
"@types/node": "12.0.4",
|
||||
"@types/node-fetch": "2.5.8",
|
||||
"@vercel/routing-utils": "1.11.2",
|
||||
"@vercel/routing-utils": "1.11.3-canary.0",
|
||||
"ajv": "6.12.2",
|
||||
"jest": "24.9.0",
|
||||
"ts-jest": "24.1.0",
|
||||
"typescript": "3.9.3"
|
||||
"typescript": "4.3.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,7 @@ export const frameworks = [
|
||||
name: 'Blitz.js',
|
||||
slug: 'blitzjs',
|
||||
demo: 'https://blitzjs.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/blitz.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/blitz.svg',
|
||||
tagline: 'Blitz.js: The Fullstack React Framework',
|
||||
description:
|
||||
'A brand new Blitz.js app - the result of running `npx blitz new`.',
|
||||
@@ -62,8 +61,7 @@ export const frameworks = [
|
||||
name: 'Next.js',
|
||||
slug: 'nextjs',
|
||||
demo: 'https://nextjs.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/next.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/next.svg',
|
||||
tagline:
|
||||
'Next.js makes you productive with React instantly — whether you want to build static or dynamic sites.',
|
||||
description: 'A Next.js app and a Serverless Function API.',
|
||||
@@ -104,13 +102,13 @@ export const frameworks = [
|
||||
devCommand: 'next dev --port $PORT',
|
||||
buildCommand: 'next build',
|
||||
getOutputDirName: async () => 'public',
|
||||
cachePattern: '.next/cache/**',
|
||||
},
|
||||
{
|
||||
name: 'Gatsby.js',
|
||||
slug: 'gatsby',
|
||||
demo: 'https://gatsby.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/gatsby.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/gatsby.svg',
|
||||
tagline:
|
||||
'Gatsby helps developers build blazing fast websites and apps with React.',
|
||||
description:
|
||||
@@ -199,8 +197,7 @@ export const frameworks = [
|
||||
name: 'Hexo',
|
||||
slug: 'hexo',
|
||||
demo: 'https://hexo.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/hexo.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/hexo.svg',
|
||||
tagline:
|
||||
'Hexo is a fast, simple & powerful blog framework powered by Node.js.',
|
||||
description: 'A Hexo site, created with the Hexo CLI.',
|
||||
@@ -239,8 +236,7 @@ export const frameworks = [
|
||||
name: 'Eleventy',
|
||||
slug: 'eleventy',
|
||||
demo: 'https://eleventy.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/eleventy.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/eleventy.svg',
|
||||
tagline:
|
||||
'11ty is a simpler static site generator written in JavaScript, created to be an alternative to Jekyll.',
|
||||
description: 'An Eleventy site, created with npm init.',
|
||||
@@ -280,8 +276,7 @@ export const frameworks = [
|
||||
name: 'Docusaurus 2',
|
||||
slug: 'docusaurus-2',
|
||||
demo: 'https://docusaurus-2.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/docusaurus.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/docusaurus.svg',
|
||||
tagline:
|
||||
'Docusaurus makes it easy to maintain Open Source documentation websites.',
|
||||
description:
|
||||
@@ -337,20 +332,17 @@ export const frameworks = [
|
||||
continue: true,
|
||||
},
|
||||
{
|
||||
src:
|
||||
'^/assets/images/[^/]+-[0-9a-f]{32}\\.(ico|svg|jpg|jpeg|png|gif|webp)$',
|
||||
src: '^/assets/images/[^/]+-[0-9a-f]{32}\\.(ico|svg|jpg|jpeg|png|gif|webp)$',
|
||||
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
||||
continue: true,
|
||||
},
|
||||
{
|
||||
src:
|
||||
'^/assets/medias/[^/]+-[0-9a-f]{32}\\.(ogv|wav|mp3|m4a|aac|oga|flac)$',
|
||||
src: '^/assets/medias/[^/]+-[0-9a-f]{32}\\.(ogv|wav|mp3|m4a|aac|oga|flac)$',
|
||||
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
||||
continue: true,
|
||||
},
|
||||
{
|
||||
src:
|
||||
'^/assets/files/[^/]+-[0-9a-f]{32}\\.(pdf|doc|docx|xls|xlsx|zip|rar)$',
|
||||
src: '^/assets/files/[^/]+-[0-9a-f]{32}\\.(pdf|doc|docx|xls|xlsx|zip|rar)$',
|
||||
headers: { 'cache-control': 'max-age=31536000, immutable' },
|
||||
continue: true,
|
||||
},
|
||||
@@ -373,8 +365,7 @@ export const frameworks = [
|
||||
name: 'Docusaurus 1',
|
||||
slug: 'docusaurus',
|
||||
demo: 'https://docusaurus.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/docusaurus.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/docusaurus.svg',
|
||||
tagline:
|
||||
'Docusaurus makes it easy to maintain Open Source documentation websites.',
|
||||
description:
|
||||
@@ -427,8 +418,7 @@ export const frameworks = [
|
||||
name: 'Preact',
|
||||
slug: 'preact',
|
||||
demo: 'https://preact.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/preact.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/preact.svg',
|
||||
tagline:
|
||||
'Preact is a fast 3kB alternative to React with the same modern API.',
|
||||
description: 'A Preact app, created with the Preact CLI.',
|
||||
@@ -475,8 +465,7 @@ export const frameworks = [
|
||||
name: 'Dojo',
|
||||
slug: 'dojo',
|
||||
demo: 'https://dojo.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/dojo.png',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/dojo.png',
|
||||
tagline: 'Dojo is a modern progressive, TypeScript first framework.',
|
||||
description:
|
||||
"A Dojo app, created with the Dojo CLI's cli-create-app command.",
|
||||
@@ -531,8 +520,7 @@ export const frameworks = [
|
||||
name: 'Ember.js',
|
||||
slug: 'ember',
|
||||
demo: 'https://ember.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/ember.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/ember.svg',
|
||||
tagline:
|
||||
'Ember.js helps webapp developers be more productive out of the box.',
|
||||
description: 'An Ember app, created with the Ember CLI.',
|
||||
@@ -579,8 +567,7 @@ export const frameworks = [
|
||||
name: 'Vue.js',
|
||||
slug: 'vue',
|
||||
demo: 'https://vue.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/vue.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/vue.svg',
|
||||
tagline:
|
||||
'Vue.js is a versatile JavaScript framework that is as approachable as it is performant.',
|
||||
description: 'A Vue.js app, created with the Vue CLI.',
|
||||
@@ -638,8 +625,7 @@ export const frameworks = [
|
||||
name: 'Scully',
|
||||
slug: 'scully',
|
||||
demo: 'https://scully.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/scullyio-logo.png',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/scullyio-logo.png',
|
||||
tagline: 'Scully is a static site generator for Angular.',
|
||||
description: 'The Static Site Generator for Angular apps.',
|
||||
website: 'https://github.com/scullyio/scully',
|
||||
@@ -676,8 +662,7 @@ export const frameworks = [
|
||||
name: 'Ionic Angular',
|
||||
slug: 'ionic-angular',
|
||||
demo: 'https://ionic-angular.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/ionic.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/ionic.svg',
|
||||
tagline:
|
||||
'Ionic Angular allows you to build mobile PWAs with Angular and the Ionic Framework.',
|
||||
description: 'An Ionic Angular site, created with the Ionic CLI.',
|
||||
@@ -723,8 +708,7 @@ export const frameworks = [
|
||||
name: 'Angular',
|
||||
slug: 'angular',
|
||||
demo: 'https://angular.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/angular.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/angular.svg',
|
||||
tagline:
|
||||
'Angular is a TypeScript-based cross-platform framework from Google.',
|
||||
description: 'An Angular app, created with the Angular CLI.',
|
||||
@@ -785,8 +769,7 @@ export const frameworks = [
|
||||
name: 'Polymer',
|
||||
slug: 'polymer',
|
||||
demo: 'https://polymer.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/polymer.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/polymer.svg',
|
||||
tagline:
|
||||
'Polymer is an open-source webapps library from Google, for building using Web Components.',
|
||||
description: 'A Polymer app, created with the Polymer CLI.',
|
||||
@@ -844,8 +827,7 @@ export const frameworks = [
|
||||
name: 'Svelte',
|
||||
slug: 'svelte',
|
||||
demo: 'https://svelte.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/svelte.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/svelte.svg',
|
||||
tagline:
|
||||
'Svelte lets you write high performance reactive apps with significantly less boilerplate. ',
|
||||
description:
|
||||
@@ -897,8 +879,7 @@ export const frameworks = [
|
||||
name: 'Ionic React',
|
||||
slug: 'ionic-react',
|
||||
demo: 'https://ionic-react.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/ionic.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/ionic.svg',
|
||||
tagline:
|
||||
'Ionic React allows you to build mobile PWAs with React and the Ionic Framework.',
|
||||
description: 'An Ionic React site, created with the Ionic CLI.',
|
||||
@@ -960,8 +941,7 @@ export const frameworks = [
|
||||
name: 'Create React App',
|
||||
slug: 'create-react-app',
|
||||
demo: 'https://react-functions.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/react.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/react.svg',
|
||||
tagline: 'Create React App allows you to get going with React in no time.',
|
||||
description:
|
||||
'A React app, bootstrapped with create-react-app, and a Serverless Function API.',
|
||||
@@ -1029,8 +1009,7 @@ export const frameworks = [
|
||||
name: 'Gridsome',
|
||||
slug: 'gridsome',
|
||||
demo: 'https://gridsome.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/gridsome.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/gridsome.svg',
|
||||
tagline:
|
||||
'Gridsome is a Vue.js-powered framework for building websites & apps that are fast by default.',
|
||||
description: 'A Gridsome app, created with the Gridsome CLI.',
|
||||
@@ -1068,8 +1047,7 @@ export const frameworks = [
|
||||
name: 'UmiJS',
|
||||
slug: 'umijs',
|
||||
demo: 'https://umijs.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/umi.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/umi.svg',
|
||||
tagline:
|
||||
'UmiJS is an extensible enterprise-level React application framework.',
|
||||
description: 'An UmiJS app, created using the Umi CLI.',
|
||||
@@ -1116,8 +1094,7 @@ export const frameworks = [
|
||||
name: 'Sapper',
|
||||
slug: 'sapper',
|
||||
demo: 'https://sapper.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/svelte.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/svelte.svg',
|
||||
tagline:
|
||||
'Sapper is a framework for building high-performance universal web apps with Svelte.',
|
||||
description: 'A Sapper app, using the Sapper template.',
|
||||
@@ -1155,8 +1132,7 @@ export const frameworks = [
|
||||
name: 'Saber',
|
||||
slug: 'saber',
|
||||
demo: 'https://saber.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/saber.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/saber.svg',
|
||||
tagline:
|
||||
'Saber is a framework for building static sites in Vue.js that supports data from any source.',
|
||||
description: 'A Saber site, created with npm init.',
|
||||
@@ -1208,8 +1184,7 @@ export const frameworks = [
|
||||
name: 'Stencil',
|
||||
slug: 'stencil',
|
||||
demo: 'https://stencil.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/stencil.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/stencil.svg',
|
||||
tagline:
|
||||
'Stencil is a powerful toolchain for building Progressive Web Apps and Design Systems.',
|
||||
description: 'A Stencil site, created with the Stencil CLI.',
|
||||
@@ -1271,8 +1246,7 @@ export const frameworks = [
|
||||
name: 'Nuxt.js',
|
||||
slug: 'nuxtjs',
|
||||
demo: 'https://nuxtjs.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/nuxt.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/nuxt.svg',
|
||||
tagline:
|
||||
'Nuxt.js is the web comprehensive framework that lets you dream big with Vue.js.',
|
||||
description: 'A Nuxt.js app, bootstrapped with create-nuxt-app.',
|
||||
@@ -1330,8 +1304,7 @@ export const frameworks = [
|
||||
name: 'RedwoodJS',
|
||||
slug: 'redwoodjs',
|
||||
demo: 'https://redwoodjs.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/redwoodjs.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/redwoodjs.svg',
|
||||
tagline: 'RedwoodJS is a full-stack framework for the Jamstack.',
|
||||
description: 'A RedwoodJS app, bootstraped with create-redwood-app.',
|
||||
website: 'https://redwoodjs.com',
|
||||
@@ -1370,8 +1343,7 @@ export const frameworks = [
|
||||
name: 'Hugo',
|
||||
slug: 'hugo',
|
||||
demo: 'https://hugo.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/hugo.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/hugo.svg',
|
||||
tagline:
|
||||
'Hugo is the world’s fastest framework for building websites, written in Go.',
|
||||
description: 'A Hugo site, created with the Hugo CLI.',
|
||||
@@ -1426,8 +1398,7 @@ export const frameworks = [
|
||||
name: 'Jekyll',
|
||||
slug: 'jekyll',
|
||||
demo: 'https://jekyll.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/jekyll.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/jekyll.svg',
|
||||
tagline:
|
||||
'Jekyll makes it super easy to transform your plain text into static websites and blogs.',
|
||||
description: 'A Jekyll site, created with the Jekyll CLI.',
|
||||
@@ -1469,8 +1440,7 @@ export const frameworks = [
|
||||
name: 'Brunch',
|
||||
slug: 'brunch',
|
||||
demo: 'https://brunch.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/brunch.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/brunch.svg',
|
||||
tagline:
|
||||
'Brunch is a fast and simple webapp build tool with seamless incremental compilation for rapid development.',
|
||||
description: 'A Brunch app, created with the Brunch CLI.',
|
||||
@@ -1505,8 +1475,7 @@ export const frameworks = [
|
||||
name: 'Middleman',
|
||||
slug: 'middleman',
|
||||
demo: 'https://middleman.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/middleman.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/middleman.svg',
|
||||
tagline:
|
||||
'Middleman is a static site generator that uses all the shortcuts and tools in modern web development.',
|
||||
description: 'A Middleman app, created with the Middleman CLI.',
|
||||
@@ -1542,8 +1511,7 @@ export const frameworks = [
|
||||
name: 'Zola',
|
||||
slug: 'zola',
|
||||
demo: 'https://zola.examples.vercel.com',
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/zola.png',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/zola.png',
|
||||
tagline: 'Everything you need to make a static site engine in one binary.',
|
||||
description: 'A Zola app, created with the "Getting Started" tutorial.',
|
||||
website: 'https://www.getzola.org',
|
||||
@@ -1575,11 +1543,48 @@ export const frameworks = [
|
||||
getOutputDirName: async () => 'public',
|
||||
defaultVersion: '0.13.0',
|
||||
},
|
||||
{
|
||||
name: 'Vite',
|
||||
slug: 'vite',
|
||||
demo: 'https://vite.examples.vercel.com',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/vite.svg',
|
||||
tagline:
|
||||
'Vite is a new breed of frontend build tool that significantly improves the frontend development experience.',
|
||||
description: 'A Vue.js app, created with Vite.',
|
||||
website: 'https://vitejs.dev',
|
||||
envPrefix: 'VITE_',
|
||||
detectors: {
|
||||
every: [
|
||||
{
|
||||
path: 'package.json',
|
||||
matchContent:
|
||||
'"(dev)?(d|D)ependencies":\\s*{[^}]*"vite":\\s*".+?"[^}]*}',
|
||||
},
|
||||
],
|
||||
},
|
||||
settings: {
|
||||
installCommand: {
|
||||
placeholder: '`yarn install` or `npm install`',
|
||||
},
|
||||
buildCommand: {
|
||||
placeholder: '`npm run build` or `vite build`',
|
||||
},
|
||||
devCommand: {
|
||||
placeholder: 'vite',
|
||||
},
|
||||
outputDirectory: {
|
||||
value: 'dist',
|
||||
},
|
||||
},
|
||||
dependency: 'vite',
|
||||
devCommand: 'vite',
|
||||
buildCommand: 'vite build',
|
||||
getOutputDirName: async () => 'dist',
|
||||
},
|
||||
{
|
||||
name: 'Other',
|
||||
slug: null,
|
||||
logo:
|
||||
'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/other.svg',
|
||||
logo: 'https://raw.githubusercontent.com/vercel/vercel/main/packages/frameworks/logos/other.svg',
|
||||
description: 'No framework or a unoptimized framework.',
|
||||
settings: {
|
||||
installCommand: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/go",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3-canary.0",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/go",
|
||||
@@ -31,6 +31,6 @@
|
||||
"node-fetch": "^2.2.1",
|
||||
"string-argv": "0.3.1",
|
||||
"tar": "4.4.6",
|
||||
"typescript": "3.9.3"
|
||||
"typescript": "4.3.4"
|
||||
}
|
||||
}
|
||||
|
||||
2
packages/node-bridge/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
/bridge.*
|
||||
/launcher.*
|
||||
18
packages/node-bridge/bridge.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/// <reference types="node" />
|
||||
import { Server } from 'http';
|
||||
import {
|
||||
VercelProxyRequest,
|
||||
VercelProxyResponse,
|
||||
VercelProxyEvent,
|
||||
ServerLike,
|
||||
} from './types';
|
||||
|
||||
export declare class Bridge {
|
||||
constructor(server?: ServerLike, shouldStoreEvents?: boolean);
|
||||
setServer(server: ServerLike): void;
|
||||
setStoreEvents(shouldStoreEvents: boolean): void;
|
||||
listen(): void | Server;
|
||||
launcher(event: VercelProxyEvent, context: any): Promise<VercelProxyResponse>;
|
||||
consumeEvent(reqId: string): VercelProxyRequest;
|
||||
}
|
||||
export {};
|
||||
@@ -1,43 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
import { AddressInfo } from 'net';
|
||||
import { APIGatewayProxyEvent, Context } from 'aws-lambda';
|
||||
import {
|
||||
Server,
|
||||
IncomingHttpHeaders,
|
||||
OutgoingHttpHeaders,
|
||||
request,
|
||||
} from 'http';
|
||||
|
||||
interface NowProxyEvent {
|
||||
Action: string;
|
||||
body: string;
|
||||
}
|
||||
|
||||
export interface NowProxyRequest {
|
||||
isApiGateway?: boolean;
|
||||
method: string;
|
||||
path: string;
|
||||
headers: IncomingHttpHeaders;
|
||||
body: Buffer;
|
||||
}
|
||||
|
||||
export interface NowProxyResponse {
|
||||
statusCode: number;
|
||||
headers: OutgoingHttpHeaders;
|
||||
body: string;
|
||||
encoding: BufferEncoding;
|
||||
}
|
||||
|
||||
interface ServerLike {
|
||||
timeout?: number;
|
||||
listen: (
|
||||
opts: {
|
||||
host?: string;
|
||||
port?: number;
|
||||
},
|
||||
callback: (this: Server | null) => void
|
||||
) => Server | void;
|
||||
}
|
||||
const { request } = require('http');
|
||||
|
||||
/**
|
||||
* If the `http.Server` handler function throws an error asynchronously,
|
||||
@@ -51,8 +12,11 @@ process.on('unhandledRejection', err => {
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
function normalizeNowProxyEvent(event: NowProxyEvent): NowProxyRequest {
|
||||
let bodyBuffer: Buffer | null;
|
||||
/**
|
||||
* @param {import('./types').VercelProxyEvent} event
|
||||
*/
|
||||
function normalizeProxyEvent(event) {
|
||||
let bodyBuffer;
|
||||
const { method, path, headers, encoding, body } = JSON.parse(event.body);
|
||||
|
||||
if (body) {
|
||||
@@ -70,10 +34,11 @@ function normalizeNowProxyEvent(event: NowProxyEvent): NowProxyRequest {
|
||||
return { isApiGateway: false, method, path, headers, body: bodyBuffer };
|
||||
}
|
||||
|
||||
function normalizeAPIGatewayProxyEvent(
|
||||
event: APIGatewayProxyEvent
|
||||
): NowProxyRequest {
|
||||
let bodyBuffer: Buffer | null;
|
||||
/**
|
||||
* @param {import('aws-lambda').APIGatewayProxyEvent} event
|
||||
*/
|
||||
function normalizeAPIGatewayProxyEvent(event) {
|
||||
let bodyBuffer;
|
||||
const { httpMethod: method, path, headers, body } = event;
|
||||
|
||||
if (body) {
|
||||
@@ -89,12 +54,13 @@ function normalizeAPIGatewayProxyEvent(
|
||||
return { isApiGateway: true, method, path, headers, body: bodyBuffer };
|
||||
}
|
||||
|
||||
function normalizeEvent(
|
||||
event: NowProxyEvent | APIGatewayProxyEvent
|
||||
): NowProxyRequest {
|
||||
/**
|
||||
* @param {import('./types').VercelProxyEvent | import('aws-lambda').APIGatewayProxyEvent} event
|
||||
*/
|
||||
function normalizeEvent(event) {
|
||||
if ('Action' in event) {
|
||||
if (event.Action === 'Invoke') {
|
||||
return normalizeNowProxyEvent(event);
|
||||
return normalizeProxyEvent(event);
|
||||
} else {
|
||||
throw new Error(`Unexpected event.Action: ${event.Action}`);
|
||||
}
|
||||
@@ -103,35 +69,40 @@ function normalizeEvent(
|
||||
}
|
||||
}
|
||||
|
||||
export class Bridge {
|
||||
private server: ServerLike | null;
|
||||
private listening: Promise<AddressInfo>;
|
||||
private resolveListening: (info: AddressInfo) => void;
|
||||
private events: { [key: string]: NowProxyRequest } = {};
|
||||
private reqIdSeed = 1;
|
||||
private shouldStoreEvents = false;
|
||||
|
||||
constructor(server?: ServerLike, shouldStoreEvents = false) {
|
||||
this.server = null;
|
||||
class Bridge {
|
||||
/**
|
||||
* @param {import('./types').ServerLike | null} server
|
||||
* @param {boolean} shouldStoreEvents
|
||||
*/
|
||||
constructor(server = null, shouldStoreEvents = false) {
|
||||
this.server = server;
|
||||
this.shouldStoreEvents = shouldStoreEvents;
|
||||
if (server) {
|
||||
this.setServer(server);
|
||||
}
|
||||
this.launcher = this.launcher.bind(this);
|
||||
|
||||
// This is just to appease TypeScript strict mode, since it doesn't
|
||||
// understand that the Promise constructor is synchronous
|
||||
this.resolveListening = (_info: AddressInfo) => {}; // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
this.reqIdSeed = 1;
|
||||
/**
|
||||
* @type {{ [key: string]: import('./types').VercelProxyRequest }}
|
||||
*/
|
||||
this.events = {};
|
||||
|
||||
this.listening = new Promise(resolve => {
|
||||
this.resolveListening = resolve;
|
||||
});
|
||||
}
|
||||
|
||||
setServer(server: ServerLike) {
|
||||
/**
|
||||
* @param {import('./types').ServerLike} server
|
||||
*/
|
||||
setServer(server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} shouldStoreEvents
|
||||
*/
|
||||
setStoreEvents(shouldStoreEvents) {
|
||||
this.shouldStoreEvents = shouldStoreEvents;
|
||||
}
|
||||
|
||||
listen() {
|
||||
const { server, resolveListening } = this;
|
||||
if (!server) {
|
||||
@@ -173,10 +144,13 @@ export class Bridge {
|
||||
);
|
||||
}
|
||||
|
||||
async launcher(
|
||||
event: NowProxyEvent | APIGatewayProxyEvent,
|
||||
context: Pick<Context, 'callbackWaitsForEmptyEventLoop'>
|
||||
): Promise<NowProxyResponse> {
|
||||
/**
|
||||
*
|
||||
* @param {import('./types').VercelProxyEvent | import('aws-lambda').APIGatewayProxyEvent} event
|
||||
* @param {import('aws-lambda').Context} context
|
||||
* @return {Promise<{statusCode: number, headers: import('http').IncomingHttpHeaders, body: string, encoding: 'base64'}>}
|
||||
*/
|
||||
async launcher(event, context) {
|
||||
context.callbackWaitsForEmptyEventLoop = false;
|
||||
const { port } = await this.listening;
|
||||
|
||||
@@ -194,7 +168,10 @@ export class Bridge {
|
||||
const opts = { hostname: '127.0.0.1', port, path, method };
|
||||
const req = request(opts, res => {
|
||||
const response = res;
|
||||
const respBodyChunks: Buffer[] = [];
|
||||
/**
|
||||
* @type {Buffer[]}
|
||||
*/
|
||||
const respBodyChunks = [];
|
||||
response.on('data', chunk => respBodyChunks.push(Buffer.from(chunk)));
|
||||
response.on('error', reject);
|
||||
response.on('end', () => {
|
||||
@@ -227,18 +204,14 @@ export class Bridge {
|
||||
for (const [name, value] of Object.entries(headers)) {
|
||||
if (value === undefined) {
|
||||
console.error(
|
||||
'Skipping HTTP request header %j because value is undefined',
|
||||
name
|
||||
`Skipping HTTP request header "${name}" because value is undefined`
|
||||
);
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
req.setHeader(name, value);
|
||||
} catch (err) {
|
||||
console.error(
|
||||
'Skipping HTTP request header: %j',
|
||||
`${name}: ${value}`
|
||||
);
|
||||
console.error(`Skipping HTTP request header: "${name}: ${value}"`);
|
||||
console.error(err.message);
|
||||
}
|
||||
}
|
||||
@@ -248,9 +221,15 @@ export class Bridge {
|
||||
});
|
||||
}
|
||||
|
||||
consumeEvent(reqId: string) {
|
||||
/**
|
||||
* @param {string} reqId
|
||||
* @return {import('./types').VercelProxyRequest}
|
||||
*/
|
||||
consumeEvent(reqId) {
|
||||
const event = this.events[reqId];
|
||||
delete this.events[reqId];
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { Bridge };
|
||||
16
packages/node-bridge/launcher.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Bridge } from './bridge';
|
||||
import { LauncherConfiguration } from './types';
|
||||
export declare function makeVercelLauncher(
|
||||
config: LauncherConfiguration
|
||||
): string;
|
||||
export declare function getVercelLauncher({
|
||||
entrypointPath,
|
||||
helpersPath,
|
||||
shouldAddHelpers,
|
||||
}: LauncherConfiguration): () => Bridge;
|
||||
export declare function makeAwsLauncher(config: LauncherConfiguration): string;
|
||||
export declare function getAwsLauncher({
|
||||
entrypointPath,
|
||||
awsLambdaHandler,
|
||||
}: LauncherConfiguration): (e: any, context: any, callback: any) => any;
|
||||
export {};
|
||||