glass-js
Version:
The relevant directories are `glass-react`, `glass-swc`, and `vscode-extension`.
76 lines (47 loc) • 2.32 kB
Markdown
# 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
1. 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', {}],
],
}
}
```
2. 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";
```
3. Run the vscode extension either through the VSCode marketplace, or opening `vscode-extension` inside a separate VSCode window and pressing `F5`.
## 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:
1. Contents of the vscode extension (from `vscode-extension`) to the VSCode marketplace.
2. The `<GlassProvider />` package (from `glass-react`) together with the SWC plugin (from `glass-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.