Update vscode extension (#942)

This commit is contained in:
Steve Ruiz 2022-09-01 09:49:01 +01:00 committed by GitHub
parent 1be09d2204
commit 7b3c6ed808
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 50 additions and 29 deletions

View file

@ -1,7 +1,6 @@
import * as React from 'react' import * as React from 'react'
import * as ReactDOM from 'react-dom' import * as ReactDOM from 'react-dom'
import App from './App' import App from './app'
import './styles.css'
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>

View file

@ -1,20 +0,0 @@
html,
* {
box-sizing: border-box;
}
body {
overscroll-behavior: none;
margin: 0px;
padding: 0px;
}
.tldraw {
position: fixed;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
width: 100%;
height: 100%;
}

View file

@ -7,6 +7,7 @@
"rootDir": "src", "rootDir": "src",
"baseUrl": "src", "baseUrl": "src",
"emitDeclarationOnly": false, "emitDeclarationOnly": false,
"jsx": "react-jsx",
"paths": { "paths": {
"@tldraw/tldraw": ["../../../packages/tldraw"] "@tldraw/tldraw": ["../../../packages/tldraw"]
} }

View file

@ -1,10 +1,38 @@
/* eslint-disable */ /* eslint-disable */
const fs = require('fs') const fs = require('fs')
const pkg = require('../package.json')
const esbuild = require('esbuild') const esbuild = require('esbuild')
const { exec } = require('child_process')
const { log: jslog } = console const { log: jslog } = console
async function copyEditor() {
if (fs.existsSync('./editor')) {
fs.rmSync('./editor', { recursive: true }, (e) => {
if (e) {
throw e
}
})
}
try {
exec(`cp -r ../editor/dist editor;`, (error, stdout, stderr) => {
if (error) {
throw new Error(error.message)
}
if (stderr && stderr.search('warning') !== 0) {
throw new Error(stderr)
}
})
} catch (e) {
jslog(`× ${pkg.name}: Build failed due to an error.`)
jslog(e)
}
}
async function main() { async function main() {
await copyEditor()
if (fs.existsSync('./dist')) { if (fs.existsSync('./dist')) {
fs.rmSync('./dist', { recursive: true }, (e) => { fs.rmSync('./dist', { recursive: true }, (e) => {
if (e) { if (e) {

View file

@ -140,10 +140,10 @@ export class TldrawWebviewManager {
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
cssSrc = webviewPanel.webview.asWebviewUri( cssSrc = webviewPanel.webview.asWebviewUri(
vscode.Uri.joinPath(context.extensionUri, 'editor/', 'index.css') vscode.Uri.joinPath(context.extensionUri, 'editor', 'index.css')
) )
jsSrc = webviewPanel.webview.asWebviewUri( jsSrc = webviewPanel.webview.asWebviewUri(
vscode.Uri.joinPath(context.extensionUri, 'editor/', 'index.js') vscode.Uri.joinPath(context.extensionUri, 'editor', 'index.js')
) )
} else { } else {
const localhost = 'http://localhost:5420/' const localhost = 'http://localhost:5420/'

View file

@ -25,10 +25,18 @@
} }
}, },
"references": [ "references": [
{ "path": "../../packages/vec" }, {
{ "path": "../../packages/intersect" }, "path": "../../packages/vec"
{ "path": "../../packages/core" }, },
{ "path": "../../packages/tldraw" } {
"path": "../../packages/intersect"
},
{
"path": "../../packages/core"
},
{
"path": "../../packages/tldraw"
}
], ],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"] "exclude": ["node_modules"]

View file

@ -12,7 +12,7 @@
"importHelpers": true, "importHelpers": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"incremental": true, "incremental": true,
"jsx": "preserve", "jsx": "react-jsx",
"lib": ["dom", "esnext"], "lib": ["dom", "esnext"],
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",

View file

@ -6849,6 +6849,11 @@ json5@^2.2.1:
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
jsoncrush@^1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/jsoncrush/-/jsoncrush-1.1.8.tgz#5dd9389df1979592df8c89ab99ba69b029a030be"
integrity sha512-lvIMGzMUA0fjuqwNcxlTNRq2bibPZ9auqT/LyGdlR5hvydJtA/BasSgkx4qclqTKVeTidrJvsS/oVjlTCPQ4Nw==
jsonfile@^4.0.0: jsonfile@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"