build: migrate to monorepo (#243)

This commit is contained in:
winston 2024-01-02 15:48:13 +01:00 committed by GitHub
parent 55b3e5d624
commit 3cc3258dfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
125 changed files with 4936 additions and 4763 deletions

2
.envrc
View File

@ -1,2 +0,0 @@
use nix ./nix/shell.nix
layout node

View File

@ -1,3 +1,10 @@
const nodeStdLib = [
...require("node:module").builtinModules.flatMap((module) => [
module,
`node:${module}`,
]),
];
/** @type {import('eslint').Linter.Config} */
module.exports = {
env: {
@ -7,33 +14,31 @@ module.exports = {
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:storybook/recommended",
],
overrides: [
{
// eslint is having trouble linting its own config file
files: [".eslintrc.js"],
rules: { "@typescript-eslint/no-var-requires": "off", "no-undef": "off" },
rules: {
"@typescript-eslint/no-var-requires": "off",
"no-undef": "off",
},
},
{
files: ["packages/catppuccin-vsc/src/**/*"],
rules: {
"no-restricted-imports": ["error", { paths: nodeStdLib }],
"no-restricted-modules": ["error", { paths: nodeStdLib }],
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
project: ["tsconfig.json", "stories/tsconfig.json"],
sourceType: "module",
},
plugins: ["@typescript-eslint", "prettier"],
rules: {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"no-restricted-imports": [
"error",
{ paths: require("node:module").builtinModules },
],
"no-restricted-modules": [
"error",
{ paths: require("node:module").builtinModules },
],
},
};

4
.gitattributes vendored
View File

@ -1,4 +1,4 @@
* text=auto
.husky/** linguist-generated
.yarn/** linguist-vendored
yarn-project.nix linguist-generated
.yarn/** linguist-vendored -diff
yarn-project.nix linguist-generated -diff

View File

@ -2,14 +2,12 @@ on:
push:
branches: [main]
paths:
- ".storybook/**/*"
- "stories/**/*"
- "src/theme/**/*.ts"
- "packages/catppuccin-vsc/src/theme/**/*.ts"
- "packages/catppuccin-vsc-storybook/**/*"
pull_request:
paths:
- ".storybook/**/*"
- "stories/**/*"
- "src/theme/**/*.ts"
- "packages/catppuccin-vsc/src/theme/**/*.ts"
- "packages/catppuccin-vsc-storybook/**/*"
name: "Chromatic"
@ -20,21 +18,17 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- run: yarn install --immutable
- run: yarn build
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
buildScriptName: "storybook:build"
buildScriptName: storybook:build
exitOnceUploaded: true
projectToken: "chpt_e3cba49738d7554"
projectToken: chpt_e3cba49738d7554
workingDir: packages/catppuccin-vsc-storybook

View File

@ -9,25 +9,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- run: yarn install --immutable
- run: yarn lint
- name: Lint
run: yarn lint
- name: Build
run: |
yarn build
yarn build:ads
yarn core:build
yarn core:build-ads
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: catppuccin-vsc.vsix
path: catppuccin-*.vsix
name: catppuccin-vsc-${{ github.sha }}
path: packages/catppuccin-vsc/catppuccin-*.vsix

View File

@ -7,14 +7,25 @@ jobs:
build:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
os:
- macos-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# use yarn-nixify to prepare the cache in /nix/store
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- run: yarn install --immutable
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Flake check

View File

@ -4,78 +4,88 @@ on:
push:
branches: [main]
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
id: release
outputs:
vscode_release: ${{ steps.release.outputs['catppuccin-vsc--release_created'] }}
vscode_tag: ${{ steps.release.outputs['catppuccin-vsc--tag_name'] }}
release-vscode:
permissions:
contents: write
release:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
if: ${{ needs.release-please.outputs.vscode_release }}
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- run: yarn install --immutable
- name: Build VSCode
id: build-vscode
run: yarn build
run: yarn core:build
- name: Build Azure Data Studio
id: build-ads
run: yarn build:ads
- name: Publish to orphaned branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./themes
publish_branch: compiled
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
exclude_assets: ".flag"
enable_jekyll: true
run: yarn core:build-ads
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v1
with:
yarn: true
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
extensionFile: ${{ steps.build-vscode.outputs.vsixPath }}
registryUrl: https://marketplace.visualstudio.com
working-directory: ./packages/catppuccin-vsc
run: |
npx @vscode/vsce publish --pat "${{ secrets.VS_MARKETPLACE_TOKEN }}" --packagePath "${{ steps.build-vscode.outputs.vsixPath }}"
- name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v1
working-directory: ./packages/catppuccin-vsc
# continue even if OpenVSX fails
# -> see https://github.com/catppuccin/vscode/issues/51
continue-on-error: true
timeout-minutes: 10
with:
yarn: true
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ${{ steps.build-vscode.outputs.vsixPath }}
run: |
npx ovsx publish --pat "${{ secrets.VS_MARKETPLACE_TOKEN }}" --packagePath "${{ steps.build-vscode.outputs.vsixPath }}"
- name: Add files to GH Release
working-directory: ./packages/catppuccin-vsc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.release-please.outputs.tag_name }} catppuccin-*.vsix
gh release upload ${{ needs.release-please.outputs.vscode_tag }} catppuccin-*.vsix
release-compiled:
permissions:
id-token: write
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.vscode_release }}
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
registry-url: https://registry.npmjs.org
- run: yarn install --immutable
- name: Publish compiled NPM package
working-directory: ./packages/catppuccin-vscode
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --provenance

6
.gitignore vendored
View File

@ -1,10 +1,12 @@
dist/
node_modules/
result
storybook-static/
themes/
.eslintcache
*.tar
*.tar.gz
*.tgz
*.vsix
*.zip
# yarn v4
.yarn-error.log

View File

@ -1,2 +1,4 @@
.yarn/
dist/
packages/*/themes/*.json
CHANGELOG.md

View File

@ -0,0 +1,5 @@
{
"packages/catppuccin-vsc": "3.9.0",
"packages/catppuccin-vsc-pack": "0.1.0",
"packages/catppuccin-vscode": "3.9.0"
}

7
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}

10
.vscode/launch.json vendored
View File

@ -1,17 +1,13 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Extension",
"name": "Debug VSCode core extension",
"type": "extensionHost",
"request": "launch",
"preLaunchTask": "npm: dev",
"preLaunchTask": "npm: core:dev - packages/core",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/dist/*.js"]
"outFiles": ["${workspaceFolder}/packages/core/dist/*.js"]
}
]
}

10
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}

20
.yarn/sdks/eslint/bin/eslint.js vendored Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}
// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);

20
.yarn/sdks/eslint/lib/api.js vendored Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
require(absPnpApiPath).setup();
}
}
// Defer to the real eslint your application uses
module.exports = absRequire(`eslint`);

View File

@ -0,0 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/use-at-your-own-risk
require(absPnpApiPath).setup();
}
}
// Defer to the real eslint/use-at-your-own-risk your application uses
module.exports = absRequire(`eslint/use-at-your-own-risk`);

14
.yarn/sdks/eslint/package.json vendored Normal file
View File

@ -0,0 +1,14 @@
{
"name": "eslint",
"version": "8.56.0-sdk",
"main": "./lib/api.js",
"type": "commonjs",
"bin": {
"eslint": "./bin/eslint.js"
},
"exports": {
"./package.json": "./package.json",
".": "./lib/api.js",
"./use-at-your-own-risk": "./lib/unsupported-api.js"
}
}

5
.yarn/sdks/integrations.yml vendored Normal file
View File

@ -0,0 +1,5 @@
# This file is automatically generated by @yarnpkg/sdks.
# Manual changes might be lost!
integrations:
- vscode

20
.yarn/sdks/prettier/bin/prettier.cjs vendored Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/bin/prettier.cjs
require(absPnpApiPath).setup();
}
}
// Defer to the real prettier/bin/prettier.cjs your application uses
module.exports = absRequire(`prettier/bin/prettier.cjs`);

20
.yarn/sdks/prettier/index.cjs vendored Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier
require(absPnpApiPath).setup();
}
}
// Defer to the real prettier your application uses
module.exports = absRequire(`prettier`);

7
.yarn/sdks/prettier/package.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"name": "prettier",
"version": "3.1.1-sdk",
"main": "./index.cjs",
"type": "commonjs",
"bin": "./bin/prettier.cjs"
}

20
.yarn/sdks/typescript/bin/tsc vendored Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/bin/tsc your application uses
module.exports = absRequire(`typescript/bin/tsc`);

20
.yarn/sdks/typescript/bin/tsserver vendored Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/bin/tsserver your application uses
module.exports = absRequire(`typescript/bin/tsserver`);

20
.yarn/sdks/typescript/lib/tsc.js vendored Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsc.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/tsc.js your application uses
module.exports = absRequire(`typescript/lib/tsc.js`);

225
.yarn/sdks/typescript/lib/tsserver.js vendored Normal file
View File

@ -0,0 +1,225 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
const moduleWrapper = tsserver => {
if (!process.versions.pnp) {
return tsserver;
}
const {isAbsolute} = require(`path`);
const pnpApi = require(`pnpapi`);
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
const isPortal = str => str.startsWith("portal:/");
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
return `${locator.name}@${locator.reference}`;
}));
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
// doesn't understand. This layer makes sure to remove the protocol
// before forwarding it to TS, and to add it back on all returned paths.
function toEditorPath(str) {
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
// We also take the opportunity to turn virtual paths into physical ones;
// this makes it much easier to work with workspaces that list peer
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
// file instances instead of the real ones.
//
// We only do this to modules owned by the the dependency tree roots.
// This avoids breaking the resolution when jumping inside a vendor
// with peer dep (otherwise jumping into react-dom would show resolution
// errors on react).
//
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
if (resolved) {
const locator = pnpApi.findPackageLocator(resolved);
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
str = resolved;
}
}
str = normalize(str);
if (str.match(/\.zip\//)) {
switch (hostInfo) {
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
// VSCode only adds it automatically for supported schemes,
// so we have to do it manually for the `zip` scheme.
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
//
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
//
// 2021-10-08: VSCode changed the format in 1.61.
// Before | ^zip:/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
// 2022-04-06: VSCode changed the format in 1.66.
// Before | ^/zip//c:/foo/bar.zip/package.json
// After | ^/zip/c:/foo/bar.zip/package.json
//
// 2022-05-06: VSCode changed the format in 1.68
// Before | ^/zip/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
case `vscode <1.61`: {
str = `^zip:${str}`;
} break;
case `vscode <1.66`: {
str = `^/zip/${str}`;
} break;
case `vscode <1.68`: {
str = `^/zip${str}`;
} break;
case `vscode`: {
str = `^/zip/${str}`;
} break;
// To make "go to definition" work,
// We have to resolve the actual file system path from virtual path
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
case `coc-nvim`: {
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
str = resolve(`zipfile:${str}`);
} break;
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
// We have to resolve the actual file system path from virtual path,
// everything else is up to neovim
case `neovim`: {
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
str = `zipfile://${str}`;
} break;
default: {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}
return str;
}
function fromEditorPath(str) {
switch (hostInfo) {
case `coc-nvim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
// So in order to convert it back, we use .* to match all the thing
// before `zipfile:`
return process.platform === `win32`
? str.replace(/^.*zipfile:\//, ``)
: str.replace(/^.*zipfile:/, ``);
} break;
case `neovim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
return str.replace(/^zipfile:\/\//, ``);
} break;
case `vscode`:
default: {
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
} break;
}
}
// Force enable 'allowLocalPluginLoads'
// TypeScript tries to resolve plugins using a path relative to itself
// which doesn't work when using the global cache
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
// TypeScript already does local loads and if this code is running the user trusts the workspace
// https://github.com/microsoft/vscode/issues/45856
const ConfiguredProject = tsserver.server.ConfiguredProject;
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
this.projectService.allowLocalPluginLoads = true;
return originalEnablePluginsWithOptions.apply(this, arguments);
};
// And here is the point where we hijack the VSCode <-> TS communications
// by adding ourselves in the middle. We locate everything that looks
// like an absolute path of ours and normalize it.
const Session = tsserver.server.Session;
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
let hostInfo = `unknown`;
Object.assign(Session.prototype, {
onMessage(/** @type {string | object} */ message) {
const isStringMessage = typeof message === 'string';
const parsedMessage = isStringMessage ? JSON.parse(message) : message;
if (
parsedMessage != null &&
typeof parsedMessage === `object` &&
parsedMessage.arguments &&
typeof parsedMessage.arguments.hostInfo === `string`
) {
hostInfo = parsedMessage.arguments.hostInfo;
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
// The RegExp from https://semver.org/ but without the caret at the start
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
) ?? []).map(Number)
if (major === 1) {
if (minor < 61) {
hostInfo += ` <1.61`;
} else if (minor < 66) {
hostInfo += ` <1.66`;
} else if (minor < 68) {
hostInfo += ` <1.68`;
}
}
}
}
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
return typeof value === 'string' ? fromEditorPath(value) : value;
});
return originalOnMessage.call(
this,
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
);
},
send(/** @type {any} */ msg) {
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
return typeof value === `string` ? toEditorPath(value) : value;
})));
}
});
return tsserver;
};
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserver.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/tsserver.js your application uses
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));

View File

@ -0,0 +1,225 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
const moduleWrapper = tsserver => {
if (!process.versions.pnp) {
return tsserver;
}
const {isAbsolute} = require(`path`);
const pnpApi = require(`pnpapi`);
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
const isPortal = str => str.startsWith("portal:/");
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
return `${locator.name}@${locator.reference}`;
}));
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
// doesn't understand. This layer makes sure to remove the protocol
// before forwarding it to TS, and to add it back on all returned paths.
function toEditorPath(str) {
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
// We also take the opportunity to turn virtual paths into physical ones;
// this makes it much easier to work with workspaces that list peer
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
// file instances instead of the real ones.
//
// We only do this to modules owned by the the dependency tree roots.
// This avoids breaking the resolution when jumping inside a vendor
// with peer dep (otherwise jumping into react-dom would show resolution
// errors on react).
//
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
if (resolved) {
const locator = pnpApi.findPackageLocator(resolved);
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
str = resolved;
}
}
str = normalize(str);
if (str.match(/\.zip\//)) {
switch (hostInfo) {
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
// VSCode only adds it automatically for supported schemes,
// so we have to do it manually for the `zip` scheme.
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
//
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
//
// 2021-10-08: VSCode changed the format in 1.61.
// Before | ^zip:/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
// 2022-04-06: VSCode changed the format in 1.66.
// Before | ^/zip//c:/foo/bar.zip/package.json
// After | ^/zip/c:/foo/bar.zip/package.json
//
// 2022-05-06: VSCode changed the format in 1.68
// Before | ^/zip/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
case `vscode <1.61`: {
str = `^zip:${str}`;
} break;
case `vscode <1.66`: {
str = `^/zip/${str}`;
} break;
case `vscode <1.68`: {
str = `^/zip${str}`;
} break;
case `vscode`: {
str = `^/zip/${str}`;
} break;
// To make "go to definition" work,
// We have to resolve the actual file system path from virtual path
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
case `coc-nvim`: {
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
str = resolve(`zipfile:${str}`);
} break;
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
// We have to resolve the actual file system path from virtual path,
// everything else is up to neovim
case `neovim`: {
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
str = `zipfile://${str}`;
} break;
default: {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}
return str;
}
function fromEditorPath(str) {
switch (hostInfo) {
case `coc-nvim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
// So in order to convert it back, we use .* to match all the thing
// before `zipfile:`
return process.platform === `win32`
? str.replace(/^.*zipfile:\//, ``)
: str.replace(/^.*zipfile:/, ``);
} break;
case `neovim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
return str.replace(/^zipfile:\/\//, ``);
} break;
case `vscode`:
default: {
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
} break;
}
}
// Force enable 'allowLocalPluginLoads'
// TypeScript tries to resolve plugins using a path relative to itself
// which doesn't work when using the global cache
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
// TypeScript already does local loads and if this code is running the user trusts the workspace
// https://github.com/microsoft/vscode/issues/45856
const ConfiguredProject = tsserver.server.ConfiguredProject;
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
this.projectService.allowLocalPluginLoads = true;
return originalEnablePluginsWithOptions.apply(this, arguments);
};
// And here is the point where we hijack the VSCode <-> TS communications
// by adding ourselves in the middle. We locate everything that looks
// like an absolute path of ours and normalize it.
const Session = tsserver.server.Session;
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
let hostInfo = `unknown`;
Object.assign(Session.prototype, {
onMessage(/** @type {string | object} */ message) {
const isStringMessage = typeof message === 'string';
const parsedMessage = isStringMessage ? JSON.parse(message) : message;
if (
parsedMessage != null &&
typeof parsedMessage === `object` &&
parsedMessage.arguments &&
typeof parsedMessage.arguments.hostInfo === `string`
) {
hostInfo = parsedMessage.arguments.hostInfo;
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
// The RegExp from https://semver.org/ but without the caret at the start
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
) ?? []).map(Number)
if (major === 1) {
if (minor < 61) {
hostInfo += ` <1.61`;
} else if (minor < 66) {
hostInfo += ` <1.66`;
} else if (minor < 68) {
hostInfo += ` <1.68`;
}
}
}
}
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
return typeof value === 'string' ? fromEditorPath(value) : value;
});
return originalOnMessage.call(
this,
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
);
},
send(/** @type {any} */ msg) {
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
return typeof value === `string` ? toEditorPath(value) : value;
})));
}
});
return tsserver;
};
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/tsserverlibrary.js your application uses
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));

20
.yarn/sdks/typescript/lib/typescript.js vendored Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript your application uses
module.exports = absRequire(`typescript`);

10
.yarn/sdks/typescript/package.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"name": "typescript",
"version": "5.3.3-sdk",
"main": "./lib/typescript.js",
"type": "commonjs",
"bin": {
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver"
}
}

View File

@ -1,11 +1,22 @@
compressionLevel: mixed
enableGlobalCache: false
nodeLinker: node-modules
nodeLinker: pnp
supportedArchitectures:
os: [linux, darwin, win32]
cpu: [x64, arm64]
libc: [glibc, musl]
packageExtensions:
"@storybook/builder-vite@*":
dependencies:
"vite": "^4"
"@storybook/core-common@*":
dependencies:
"@storybook/react-vite": "^7"
"react-dom": "^18"
"vite": "^4"
"@vitejs/plugin-react@*":
dependencies:
"vite": "^4"
plugins:
- checksum: 4ae37aa0a6a0d226889f66fb2f7482e321b0c82b8fa8ed2110d8cdfbd482c87542050ded54cb08bf473e4245ef0160668c689c93848416499a975d876a1e18b1
path: .yarn/plugins/yarn-plugin-nixify.cjs

View File

6
flake.lock generated
View File

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1701718080,
"narHash": "sha256-6ovz0pG76dE0P170pmmZex1wWcQoeiomUZGggfH9XPs=",
"lastModified": 1703961334,
"narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2c7f3c0fb7c08a0814627611d9d7d45ab6d75335",
"rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9",
"type": "github"
},
"original": {

View File

@ -3,17 +3,15 @@
outputs = {nixpkgs, ...} @ inputs: let
systems = ["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
in {
packages = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in rec {
packages = forAllSystems (pkgs: rec {
default = catppuccin-vsc;
catppuccin-vsc = pkgs.callPackage ./nix {};
});
overlays.default = final: prev: let
pkg = inputs.self.packages.${prev.stdenv.hostPlatform.system}.default;
pkg = inputs.self.packages.${prev.stdenv.system}.default;
in {
# create a new package
catppuccin-vsc = pkg;
@ -29,10 +27,8 @@
};
};
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = import ./nix/shell.nix {inherit pkgs;};
});
devShells = forAllSystems (pkgs: {default = import ./nix/shell.nix {inherit pkgs;};});
formatter = forAllSystems (pkgs: pkgs.alejandra);
};
}

View File

@ -13,7 +13,7 @@
} @ inputs: let
inherit (pkgs) lib;
packageJSON = builtins.fromJSON (builtins.readFile ../package.json);
packageJSON = builtins.fromJSON (builtins.readFile ../packages/catppuccin-vsc/package.json);
properties = packageJSON.contributes.configuration.properties;
validAccents = properties."catppuccin.accentColor".enum;
validWorkbenchModes = properties."catppuccin.workbenchMode".enum;
@ -28,64 +28,45 @@
builder = pkgs.callPackage ./yarn-project.nix {} {
inherit src;
overrideAttrs = {
name = "${pname}-builder";
pname = "${pname}-builder";
buildPhase = ''
runHook preBuild
yarn build
yarn core:build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r dist/* $out
cd packages/catppuccin-vsc
cp -rL LICENSE README.md package.json dist/ themes/ $out/
runHook postInstall
'';
};
};
extension = pkgs.stdenvNoCC.mkDerivation {
inherit name version pname src;
buildInputs = [pkgs.nodejs pkgs.vsce];
# check in the ./themes/.flag so it doesn't prompt for initial rebuilds
patchPhase = ''
runHook prePatch
printf "\n!themes/.flag\n" >> .vscodeignore
runHook postPatch
'';
env.CATPPUCCIN_OPTIONS = builtins.toJSON options;
buildPhase = ''
runHook preBuild
mkdir -p themes dist
cp -r ${builder}/* dist/
touch ./themes/.flag
node dist/hooks/generateThemes.js
vsce package --no-dependencies
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
# rename the file extension to zip for the buildVSCodeMarketplaceExtension builder
mv catppuccin-vsc-*.vsix $out/catppuccin-vsc.zip
runHook postInstall
'';
};
in
(lib.throwIfNot (accentColor == null) "${pname}: deprecated option 'accentColor' is no longer supported, please use 'accent' instead.")
(lib.checkListOfEnum "${pname}: accent" validAccents [accent])
(lib.checkListOfEnum "${pname}: workbenchMode" validWorkbenchModes [workbenchMode])
(lib.checkListOfEnum "${pname}: bracketMode" validBracketModes [bracketMode])
pkgs.vscode-utils.buildVscodeMarketplaceExtension {
vsix = "${extension.outPath}/catppuccin-vsc.zip";
mktplcRef = {
# lowercase since it is used in the pname
publisher = "catppuccin";
inherit name version;
};
pkgs.vscode-utils.buildVscodeExtension rec {
inherit name;
src = builder.outPath;
vscodeExtPublisher = "catppuccin";
vscodeExtName = name;
vscodeExtUniqueId = "${vscodeExtPublisher}.${vscodeExtName}";
buildInputs = [pkgs.nodejs];
env.CATPPUCCIN_OPTIONS = builtins.toJSON options;
# we're checking in the ./themes/.flag file so it doesn't prompt for initial rebuilds
buildPhase = ''
runHook preBuild
node dist/hooks/generateThemes.js
touch ./themes/.flag
runHook postBuild
'';
}

33
nix/incremental-check.nix Normal file
View File

@ -0,0 +1,33 @@
# If incremental builds work, this derivation should be the base for the
# customized derivation. To check that incremental builds work, run:
# > nix-build ./incremental-check.nix -A default
# > nix-build ./incremental-check.nix -A customized
# The rebuild should take less than 5 seconds for the customized derivation.
{pkgs ? import <nixpkgs> {}}: let
default = pkgs.callPackage ./. {};
in {
inherit default;
customized = default.override {
accent = "pink";
boldKeywords = false;
italicComments = false;
italicKeywords = false;
colorOverrides = {
mocha = rec {
base = "#000000";
mantle = base;
crust = base;
};
};
customUIColors = {
all = {
"statusBar.foreground" = "accent";
"statusBar.noFolderForeground" = "accent";
};
};
workbenchMode = "minimal";
bracketMode = "monochromatic";
extraBordersEnabled = true;
};
}

View File

@ -1,4 +1,4 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
buildInputs = with pkgs; [alejandra nil nodejs_18 corepack];
buildInputs = with pkgs; [alejandra nil nodejs_20 corepack_20];
}

2314
nix/yarn-project.nix generated

File diff suppressed because it is too large Load Diff

View File

@ -1,213 +1,37 @@
{
"name": "catppuccin-vsc",
"displayName": "Catppuccin for VSCode",
"publisher": "Catppuccin",
"description": "🦌 Soothing pastel theme for VSCode",
"version": "3.9.0",
"engines": {
"vscode": "^1.80.0",
"node": ">=18.0.0"
"name": "@catppuccin/vscode-monorepo",
"private": true,
"devDependencies": {
"@types/node": "^18.19.4",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"@vscode/vsce": "^2.22.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.2",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"tsup": "^8.0.1",
"tsx": "^4.7.0",
"typescript": "^5.3.3"
},
"categories": [
"Themes"
],
"extensionKind": [
"ui",
"workspace"
],
"activationEvents": [
"onStartupFinished"
],
"capabilities": {
"untrustedWorkspaces": {
"supported": true
},
"virtualWorkspaces": true
},
"main": "dist/main.js",
"browser": "dist/browser.js",
"contributes": {
"themes": [
{
"label": "Catppuccin Mocha",
"uiTheme": "vs-dark",
"path": "./themes/mocha.json"
},
{
"label": "Catppuccin Macchiato",
"uiTheme": "vs-dark",
"path": "./themes/macchiato.json"
},
{
"label": "Catppuccin Frappé",
"uiTheme": "vs-dark",
"path": "./themes/frappe.json"
},
{
"label": "Catppuccin Latte",
"uiTheme": "vs",
"path": "./themes/latte.json"
}
],
"configuration": {
"title": "Catppuccin",
"properties": {
"catppuccin.boldKeywords": {
"type": "boolean",
"default": true,
"markdownDescription": "Controls whether to use **bold** for keywords."
},
"catppuccin.italicComments": {
"type": "boolean",
"default": true,
"markdownDescription": "Controls whether to use *italics* for comments."
},
"catppuccin.italicKeywords": {
"type": "boolean",
"default": true,
"markdownDescription": "Controls whether to use *italics* for keywords."
},
"catppuccin.colorOverrides": {
"type": "object",
"default": {},
"markdownDescription": "Custom color overrides. Assign your own hex codes to palette colors. See [the docs](https://github.com/catppuccin/vscode#override-palette-colors) for reference.",
"$ref": "https://cdn.jsdelivr.net/gh/catppuccin/vscode@v3.7.1/schemas/colorOverrides.schema.json"
},
"catppuccin.customUIColors": {
"type": "object",
"default": {},
"markdownDescription": "Customize UI colors. Map `workbench.colorCustomizations` to palette colors. See [the docs](https://github.com/catppuccin/vscode#use-palette-colors-on-workbench-elements-ui) for reference.",
"$ref": "https://cdn.jsdelivr.net/gh/catppuccin/vscode@v3.7.1/schemas/customUIColors.schema.json"
},
"catppuccin.accentColor": {
"type": "string",
"default": "mauve",
"description": "Controls which accent color to use.",
"enum": [
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender"
]
},
"catppuccin.workbenchMode": {
"type": "string",
"default": "default",
"description": "Controls how the workbench should be styled.",
"enum": [
"default",
"flat",
"minimal"
],
"enumDescriptions": [
"The default look, using 3 shades of the base color.",
"A more flat look, using 2 shades of the base color.",
"A minimal look, using 1 shade of the base color."
]
},
"catppuccin.bracketMode": {
"type": "string",
"default": "rainbow",
"description": "Controls how bracket pairs should be themed",
"enum": [
"rainbow",
"dimmed",
"monochromatic",
"neovim"
],
"enumDescriptions": [
"Uses 6 rainbow colors for matching bracket pairs.",
"Uses the same 6 rainbow colors as `rainbow`, but has a dimmed appearance.",
"A monochromatic, grey appearance for matching bracket pairs.",
"Uses the same bracket pair colors as our neovim port."
]
},
"catppuccin.extraBordersEnabled": {
"type": "boolean",
"default": false,
"description": "Controls whether borders should be enabled on some additional UI elements."
}
}
"dependenciesMeta": {
"keytar": {
"built": false
}
},
"repository": {
"type": "git",
"url": "https://github.com/catppuccin/vscode.git"
},
"bugs": {
"url": "https://github.com/catppuccin/vscode/issues"
},
"sponsor": {
"url": "https://opencollective.com/catppuccin"
},
"icon": "assets/icon.png",
"license": "MIT",
"__metadata": {
"publisherDisplayName": "Catppuccin",
"publisherId": "e7d2ed61-53e0-4dd4-afbe-f536c3bb4316",
"id": "69264e4d-cd3b-468a-8f2b-e69673c7d864",
"isPreReleaseVersion": false
},
"devDependencies": {
"@actions/core": "^1.10.1",
"@catppuccin/palette": "^0.2.0",
"@storybook/addon-essentials": "^7.5.3",
"@storybook/addon-styling": "^1.3.7",
"@storybook/addon-themes": "^7.5.3",
"@storybook/blocks": "^7.5.3",
"@storybook/react": "^7.5.3",
"@storybook/react-vite": "^7.5.3",
"@types/node": "^18.18.13",
"@types/tinycolor2": "^1",
"@types/vscode": "~1.80.0",
"@typescript-eslint/eslint-plugin": "^6.13.0",
"@typescript-eslint/parser": "^6.13.0",
"@vscode/vsce": "^2.22.0",
"chromatic": "^7.6.0",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-storybook": "^0.6.15",
"husky": "^8.0.3",
"json-schema-to-typescript": "^13.1.1",
"lint-staged": "^15.1.0",
"prettier": "^3.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"shikiji": "^0.7.4",
"storybook": "^7.5.3",
"tinycolor2": "^1.6.0",
"tsup": "^8.0.1",
"tsx": "^4.6.2",
"type-flag": "^3.0.0",
"typescript": "^5.3.2",
"vite": "^4.5.0"
},
"lint-staged": {
"*.ts": "eslint --cache --fix",
"*.{ts,json,md}": "prettier --write"
"*.ts": "yarn eslint --cache --fix",
"*.{ts,json,md}": "yarn prettier --write"
},
"scripts": {
"build": "tsx build.ts",
"build:ads": "tsx build.ts --ads",
"chromatic": "chromatic --exit-zero-on-changes --exit-once-uploaded --project-token chpt_e3cba49738d7554",
"dev": "tsx build.ts --dev",
"lint": "eslint . --ext .ts",
"package": "vsce package --yarn",
"prepare": "husky install",
"storybook:build": "storybook build",
"storybook:dev": "storybook dev -p 6006",
"update-types": "tsx src/hooks/updateVSCtypes.ts"
"g:typecheck": "tsc --noEmit -p packages/catppuccin-vsc && tsc --noEmit -p packages/catppuccin-vsc-storybook",
"lint": "eslint . --ext .ts && yarn g:typecheck",
"postinstall": "husky install"
},
"workspaces": [
"packages/*"
],
"packageManager": "yarn@4.0.2"
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Catppuccin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,33 @@
<h3 align="center">
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/logos/exports/1544x1544_circle.png" width="100" alt="Logo"/><br/>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
Catppuccin Extension Pack for <a href="https://github.com/catppuccin/vscode/tree/main/packages/pack">VSCode</a>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
</h3>
<p align="center">
<a href="https://github.com/catppuccin/vscode"><img src="https://img.shields.io/github/stars/catppuccin/vscode?colorA=363a4f&colorB=b7bdf8&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/vscode"><img src="https://img.shields.io/github/issues/catppuccin/vscode?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/vscode"><img src="https://img.shields.io/github/contributors/catppuccin/vscode?colorA=363a4f&colorB=a6da95&style=for-the-badge"></a>
</p>
This extension pack is a collection of all official [Catppuccin](https://github.com/catppuccin) extensions for VSCode.
- [**Catppuccin** for VSCode](https://marketplace.visualstudio.com/items?itemName=Catppuccin.catppuccin-vsc)
- [**Catppuccin Icons** for VSCode](https://marketplace.visualstudio.com/items?itemName=Catppuccin.catppuccin-vsc-icons)
Please see the respective extensions for usage instructions & more information.
&nbsp;
<p align="center">
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/footers/gray0_ctp_on_line.png" />
</p>
<p align="center">
Copyright &copy; 2021-present <a href="https://github.com/catppuccin" target="_blank">Catppuccin Org</a>
</p>
<p align="center">
<a href="https://github.com/catppuccin/catppuccin/blob/main/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8"/></a>
</p>

View File

@ -0,0 +1,27 @@
{
"name": "catppuccin-vsc-pack",
"description": "Soothing pastel theme pack for VSCode",
"version": "0.1.0",
"displayName": "Catppuccin Pack",
"publisher": "catppuccin",
"repository": {
"type": "git",
"url": "https://github.com/catppuccin/vscode.git"
},
"engines": {
"vscode": "^1.70.0"
},
"categories": [
"Extension Packs"
],
"extensionPack": [
"Catppuccin.catppuccin-vsc",
"Catppuccin.catppuccin-vsc-icons"
],
"devDependencies": {
"@vscode/vsce": "^2.22.0"
},
"scripts": {
"pack:vsix": "vsce package --no-dependencies"
}
}

View File

@ -0,0 +1,3 @@
{
"extends": ["plugin:storybook/recommended"]
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Catppuccin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,31 @@
{
"name": "@catppuccin/vsc-storybook",
"license": "MIT",
"private": true,
"devDependencies": {
"@catppuccin/palette": "^0.2.0",
"@storybook/addon-essentials": "^7.6.7",
"@storybook/addon-styling": "^1.3.7",
"@storybook/addon-themes": "^7.6.7",
"@storybook/blocks": "^7.6.7",
"@storybook/react": "^7.6.7",
"@storybook/react-vite": "^7.6.7",
"@types/node": "^18.19.4",
"@types/react": "^18.2.46",
"catppuccin-vsc": "workspace:*",
"chromatic": "^10.2.0",
"eslint": "^8.56.0",
"eslint-plugin-storybook": "^0.6.15",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"shikiji": "^0.9.17",
"storybook": "^7.6.7",
"tsx": "^4.7.0",
"vite": "^4.5.1"
},
"scripts": {
"storybook:chromatic": "chromatic --exit-zero-on-changes --exit-once-uploaded --project-token chpt_e3cba49738d7554",
"storybook:build": "yarn core:build && storybook build",
"storybook:dev": "storybook dev -p 6006"
}
}

View File

@ -1,15 +1,13 @@
import React, { useEffect, useState } from "react";
import { getHighlighter, bundledLanguages } from "shikiji";
import "@catppuccin/palette/style";
import mocha from "../themes/mocha.json";
import macchiato from "../themes/macchiato.json";
import frappe from "../themes/frappe.json";
import latte from "../themes/latte.json";
import mocha from "catppuccin-vsc/themes/mocha.json";
import macchiato from "catppuccin-vsc/themes/macchiato.json";
import frappe from "catppuccin-vsc/themes/frappe.json";
import latte from "catppuccin-vsc/themes/latte.json";
const themes = [mocha, macchiato, frappe, latte];
const themes = [mocha, macchiato, frappe, latte] as any[];
const shiki = getHighlighter({
//eslint-disable-next-line
//@ts-ignore
themes,
langs: Object.keys(bundledLanguages),
});

View File

@ -1,4 +1,5 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"esModuleInterop": true,
"resolveJsonModule": true,

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Catppuccin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,12 @@
{
"name": "@catppuccin/vsc-typegen",
"license": "MIT",
"private": true,
"devDependencies": {
"json-schema-to-typescript": "^13.1.1",
"tsx": "^4.7.0"
},
"scripts": {
"typegen:update": "tsx update.ts"
}
}

View File

@ -1,7 +1,8 @@
import { join } from "node:path";
import { writeFileSync } from "node:fs";
import { compile, JSONSchema } from "json-schema-to-typescript";
import { repoRoot, vscodeSchemasRoot } from "./constants";
const vscodeSchemasRoot =
"https://raw.githubusercontent.com/wraith13/vscode-schemas/master/en/latest/schemas/";
const bannerComment = `/* eslint-disable */
/**
@ -69,7 +70,7 @@ for (const { schema, name, fname, kind } of mappings) {
}
})
.then((typeDefs) =>
writeFileSync(join(repoRoot, fname), typeDefs, "utf-8"),
writeFileSync(join(__dirname, "types", fname), typeDefs, "utf-8"),
);
}

2
packages/catppuccin-vsc/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
dist/
themes/

View File

@ -3,7 +3,7 @@
!CHANGELOG.md
!LICENSE
!README.md
!assets/icon.png
!icon.png
!dist/*.js
!package.json
!themes/*.json

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Catppuccin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1 @@
../../README.md

View File

@ -0,0 +1 @@
../../assets

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1,180 @@
{
"name": "catppuccin-vsc",
"license": "MIT",
"private": true,
"displayName": "Catppuccin for VSCode",
"publisher": "Catppuccin",
"description": "🦌 Soothing pastel theme for VSCode",
"version": "3.9.0",
"engines": {
"vscode": "^1.80.0",
"node": ">=18.0.0"
},
"categories": [
"Themes"
],
"extensionKind": [
"ui",
"workspace"
],
"activationEvents": [
"onStartupFinished"
],
"capabilities": {
"untrustedWorkspaces": {
"supported": true
},
"virtualWorkspaces": true
},
"main": "dist/main.js",
"browser": "dist/browser.js",
"contributes": {
"themes": [
{
"label": "Catppuccin Mocha",
"uiTheme": "vs-dark",
"path": "./themes/mocha.json"
},
{
"label": "Catppuccin Macchiato",
"uiTheme": "vs-dark",
"path": "./themes/macchiato.json"
},
{
"label": "Catppuccin Frappé",
"uiTheme": "vs-dark",
"path": "./themes/frappe.json"
},
{
"label": "Catppuccin Latte",
"uiTheme": "vs",
"path": "./themes/latte.json"
}
],
"configuration": {
"title": "Catppuccin",
"properties": {
"catppuccin.boldKeywords": {
"type": "boolean",
"default": true,
"markdownDescription": "Controls whether to use **bold** for keywords."
},
"catppuccin.italicComments": {
"type": "boolean",
"default": true,
"markdownDescription": "Controls whether to use *italics* for comments."
},
"catppuccin.italicKeywords": {
"type": "boolean",
"default": true,
"markdownDescription": "Controls whether to use *italics* for keywords."
},
"catppuccin.colorOverrides": {
"type": "object",
"default": {},
"markdownDescription": "Custom color overrides. Assign your own hex codes to palette colors. See [the docs](https://github.com/catppuccin/vscode#override-palette-colors) for reference.",
"$ref": "https://cdn.jsdelivr.net/gh/catppuccin/vscode@v3.9.0/packages/catppucin-vsc/schemas/colorOverrides.schema.json"
},
"catppuccin.customUIColors": {
"type": "object",
"default": {},
"markdownDescription": "Customize UI colors. Map `workbench.colorCustomizations` to palette colors. See [the docs](https://github.com/catppuccin/vscode#use-palette-colors-on-workbench-elements-ui) for reference.",
"$ref": "https://cdn.jsdelivr.net/gh/catppuccin/vscode@v3.9.0/packages/catppuccin-vsc/schemas/customUIColors.schema.json"
},
"catppuccin.accentColor": {
"type": "string",
"default": "mauve",
"description": "Controls which accent color to use.",
"enum": [
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender"
]
},
"catppuccin.workbenchMode": {
"type": "string",
"default": "default",
"description": "Controls how the workbench should be styled.",
"enum": [
"default",
"flat",
"minimal"
],
"enumDescriptions": [
"The default look, using 3 shades of the base color.",
"A more flat look, using 2 shades of the base color.",
"A minimal look, using 1 shade of the base color."
]
},
"catppuccin.bracketMode": {
"type": "string",
"default": "rainbow",
"description": "Controls how bracket pairs should be themed",
"enum": [
"rainbow",
"dimmed",
"monochromatic",
"neovim"
],
"enumDescriptions": [
"Uses 6 rainbow colors for matching bracket pairs.",
"Uses the same 6 rainbow colors as `rainbow`, but has a dimmed appearance.",
"A monochromatic, grey appearance for matching bracket pairs.",
"Uses the same bracket pair colors as our neovim port."
]
},
"catppuccin.extraBordersEnabled": {
"type": "boolean",
"default": false,
"description": "Controls whether borders should be enabled on some additional UI elements."
}
}
}
},
"repository": {
"type": "git",
"url": "https://github.com/catppuccin/vscode.git"
},
"bugs": {
"url": "https://github.com/catppuccin/vscode/issues"
},
"sponsor": {
"url": "https://opencollective.com/catppuccin"
},
"icon": "icon.png",
"__metadata": {
"publisherDisplayName": "Catppuccin",
"publisherId": "e7d2ed61-53e0-4dd4-afbe-f536c3bb4316",
"id": "69264e4d-cd3b-468a-8f2b-e69673c7d864",
"isPreReleaseVersion": false
},
"devDependencies": {
"@actions/core": "^1.10.1",
"@catppuccin/palette": "^0.2.0",
"@catppuccin/vsc-typegen": "workspace:*",
"@types/node": "^18.19.4",
"@types/tinycolor2": "^1.4.6",
"@types/vscode": "~1.80.0",
"@vscode/vsce": "^2.22.0",
"tinycolor2": "^1.6.0",
"tsup": "^8.0.1",
"tsx": "^4.7.0",
"type-flag": "^3.0.0"
},
"scripts": {
"core:build": "tsx build.ts",
"core:build-ads": "tsx build.ts --ads",
"core:dev": "tsx build.ts --dev"
}
}

View File

@ -0,0 +1,7 @@
{
"rules": {
// using Node APIs here is fine
"no-restricted-imports": "off",
"no-restricted-modules": "off"
}
}

View File

@ -44,14 +44,14 @@ const configuration = (version: string) => {
default: {},
markdownDescription:
"Custom color overrides. Assign your own hex codes to palette colors. See [the docs](https://github.com/catppuccin/vscode#override-palette-colors) for reference.",
$ref: `https://cdn.jsdelivr.net/gh/catppuccin/vscode@v${version}/schemas/colorOverrides.schema.json`,
$ref: `https://cdn.jsdelivr.net/gh/catppuccin/vscode@v${version}/packages/catppucin-vsc/schemas/colorOverrides.schema.json`,
},
"catppuccin.customUIColors": {
type: "object",
default: {},
markdownDescription:
"Customize UI colors. Map `workbench.colorCustomizations` to palette colors. See [the docs](https://github.com/catppuccin/vscode#use-palette-colors-on-workbench-elements-ui) for reference.",
$ref: `https://cdn.jsdelivr.net/gh/catppuccin/vscode@v${version}/schemas/customUIColors.schema.json`,
$ref: `https://cdn.jsdelivr.net/gh/catppuccin/vscode@v${version}/packages/catppuccin-vsc/schemas/customUIColors.schema.json`,
},
"catppuccin.accentColor": {
type: "string",

Some files were not shown because too many files have changed in this diff Show More