Skip to content

Commit

Permalink
Merge pull request #125 from voideditor/multiple-webviews
Browse files Browse the repository at this point in the history
Speculative Edits
  • Loading branch information
andrewpareles authored Oct 28, 2024
2 parents 59dc193 + 70b6af3 commit 8e72c13
Show file tree
Hide file tree
Showing 39 changed files with 2,105 additions and 950 deletions.
19 changes: 0 additions & 19 deletions extensions/void/build-css.js

This file was deleted.

13 changes: 0 additions & 13 deletions extensions/void/build-tsx.js

This file was deleted.

59 changes: 59 additions & 0 deletions extensions/void/build/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const tailwindcss = require('tailwindcss')
const autoprefixer = require('autoprefixer')
const postcss = require('postcss')
const fs = require('fs')

const convertTailwindToCSS = ({ from, to }) => {
console.log('converting ', from, ' --> ', to)

const original_css_contents = fs.readFileSync(from, 'utf8')

return postcss([
tailwindcss, // this compiles tailwind of all the files specified in tailwind.config.json
autoprefixer,
])
.process(original_css_contents, { from, to })
.then(processed_css_contents => { fs.writeFileSync(to, processed_css_contents.css) })
.catch(error => {
console.error('Error in build-css:', error)
})
}


const esbuild = require('esbuild')

const convertTSXtoJS = async ({ from, to }) => {
console.log('converting ', from, ' --> ', to)

return esbuild.build({
entryPoints: [from],
bundle: true,
minify: true,
sourcemap: true,
outfile: to,
format: 'iife', // apparently iife is safe for browsers (safer than cjs)
platform: 'browser',
external: ['vscode'],
}).catch(() => process.exit(1));
}

(async () => {
// convert tsx to js
await convertTSXtoJS({
from: 'src/webviews/sidebar/index.tsx',
to: 'dist/webviews/sidebar/index.js',
})

await convertTSXtoJS({
from: 'src/webviews/ctrlk/index.tsx',
to: 'dist/webviews/ctrlk/index.js',
})

// convert tailwind to css
await convertTailwindToCSS({
from: 'src/webviews/styles.css',
to: 'dist/webviews/styles.css',
})

})()

47 changes: 29 additions & 18 deletions extensions/void/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions extensions/void/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"Other"
],
"activationEvents": [],
"main": "./out/extension.js",
"main": "./out/extension/extension.js",
"contributes": {
"configuration": {
"title": "Void",
Expand Down Expand Up @@ -104,7 +104,7 @@
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"build": "rimraf dist && node build-tsx.js && node build-css.js",
"build": "rimraf dist && node build/build.js",
"pretest": "tsc -p ./ && eslint src --ext ts",
"test": "vscode-test"
},
Expand All @@ -116,6 +116,7 @@
"@types/diff": "^5.2.2",
"@types/diff-match-patch": "^1.0.36",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.12",
"@types/mocha": "^10.0.8",
"@types/node": "^22.5.1",
"@types/react": "^18.3.4",
Expand All @@ -134,11 +135,12 @@
"eslint-plugin-react": "^7.35.1",
"eslint-plugin-react-hooks": "^4.6.2",
"globals": "^15.9.0",
"lodash": "^4.17.21",
"marked": "^14.1.0",
"ollama": "^0.5.9",
"openai": "^4.68.1",
"openai": "^4.68.4",
"postcss": "^8.4.41",
"posthog-js": "^1.174.0",
"posthog-js": "^1.176.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-markdown": "^9.0.1",
Expand Down
Loading

0 comments on commit 8e72c13

Please sign in to comment.