2
0

build: add pnpm

This commit is contained in:
Baptiste Arnaud
2022-08-08 08:21:36 +02:00
parent 8c3b5058f1
commit ee338f62dc
183 changed files with 19442 additions and 18364 deletions

View File

@@ -7,29 +7,25 @@
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-commonjs": "22.0.2",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-typescript": "^8.3.2",
"@types/aws-sdk": "^2.7.0",
"rollup": "^2.72.1",
"rollup-plugin-dts": "^4.2.1",
"@rollup/plugin-typescript": "8.3.4",
"rollup": "2.77.2",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-peer-deps-external": "^2.2.4",
"tslib": "^2.4.0",
"typescript": "^4.6.4"
},
"dependencies": {
"aws-sdk": "^2.1152.0",
"models": "*",
"next": "^12.1.6"
"typescript": "^4.7.4",
"aws-sdk": "2.1190.0",
"models": "workspace:*",
"next": "12.2.4"
},
"peerDependencies": {
"aws-sdk": "^2.1152.0",
"@types/aws-sdk": "^2.7.0",
"models": "*",
"next": "^12.1.6"
"models": "workspace:*",
"next": "^12.0.0"
},
"scripts": {
"build": "yarn rollup -c",
"dx": "yarn rollup -c --watch"
"build": "pnpm rollup -c",
"dx": "pnpm rollup -c --watch"
}
}

View File

@@ -31,7 +31,7 @@ export default [
],
},
{
input: 'dist/esm/types/index.d.ts',
input: 'dist/esm/index.d.ts',
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
plugins: [dts()],
},

View File

@@ -241,16 +241,13 @@ export const uploadFiles = async ({
declare const window: any
const isBrowser = () => {
return Boolean(typeof window !== 'undefined' && window.__env)
}
const isBrowser = () => Boolean(typeof window !== 'undefined')
export const env = (key = ''): string | undefined => {
if (isBrowser() && window.__env) {
return window.__env[key] === "''" ? undefined : window.__env[key]
}
if (isBrowser() && window.__env)
return isEmpty(window.__env[key]) ? undefined : window.__env[key]
return process.env['NEXT_PUBLIC_' + key] === "''"
return isEmpty(process.env['NEXT_PUBLIC_' + key])
? undefined
: (process.env['NEXT_PUBLIC_' + key] as string)
}
@@ -263,3 +260,19 @@ export const hasValue = (
value !== '' &&
value !== 'undefined' &&
value !== 'null'
export const getViewerUrl = (props?: {
isBuilder?: boolean
returnAll?: boolean
}): string | undefined => {
if (env('VIEWER_URL'))
return props?.returnAll
? env('VIEWER_URL')
: env('VIEWER_URL')?.split(',')[0]
return (
'https://' +
(props?.isBuilder
? process.env.NEXT_PUBLIC_VERCEL_URL?.replace('builder-v2', 'viewer-v2')
: process.env.NEXT_PUBLIC_VERCEL_URL)
)
}