glass-js
v1.3.7
Published
The relevant directories are `glass-react`, `glass-swc`, and `vscode-extension`.
Downloads
420
Readme
Glass
Explanation
The relevant directories are glass-react
, glass-swc
, and vscode-extension
.
The other directories are irrelevant (babel-extension
is not used, and www
is a Next.js project that renders what you see on https://useglass.ai).
Running
- Add
glass_swc.wasm
to your config:
// next.config.js
const nextConfig = {
experimental: {
swcPlugins: [
['glass-js/swc', {}],
],
}
}
Or if you want to use the development version on your own computer:
// next.config.js
const nextConfig = {
experimental: {
swcPlugins: [
['PATH/TO/glass/glass-swc/dist/glass_swc.wasm', {}],
],
}
}
- Add
<GlassProvider />
to your app.
import GlassProvider from "glass-js";
Or if you want to use the development version on your own computer:
import GlassProvider from "PATH/TO/GlassProvider";
- Run the vscode extension either through the VSCode marketplace, or opening
vscode-extension
inside a separate VSCode window and pressingF5
.
Building
To get started developing, run these steps:
Run pnpm install
to install everything. We use pnpm instead of npm because we're a monorepo and pnpm is more efficient, but it works exactly the same as npm.
Run npm run build:all
to build both the Glass React bar and the Nextjs swc plugin (this just runs npm run build
in both folders).
You don't have to do anything more unless you want to edit the extension. If you want to edit the extension, cd into vscode-extension and run npm install
(we disabled pnpm
in vscode-extension because most vscode docs use npm instead).
Publishing
You can publish two things:
Contents of the vscode extension (from
vscode-extension
) to the VSCode marketplace.The
<GlassProvider />
package (fromglass-react
) together with the SWC plugin (fromglass-swc
) to npm.
To publish vscode extension, it's like publishing any other vscode extension. Run vsce publish
.
To publish the the npm package, run npm run publish
. Make sure to increment the version number in the relevant package.json or you'll be rejected. Look at the command for more details, but in short it publishes only the built files.