build: migrate to catppuccin/nix
& switch to pnpm
(#487)
* build(nix): migrate to `catppuccin/nix` * chore(.yarnrc.yml): remove nix * chore: re-order package.json * build: move to `pnpm` & update schema root link There is a 99% chance that the next release will fail. * chore: try to fix storybook on pnpm * revert: schema update * Update README.md Co-authored-by: Seth Flynn <getchoo@tuta.io> * docs: update nix instructions * build: use pnpm catalogs * chore: fix warnings * chore: ignore dictionary * chore: move `.npmrc` to subproject * chore: use `pnpm publish` * chore: add `@storybook/web-components` --------- Co-authored-by: Seth Flynn <getchoo@tuta.io>
This commit is contained in:
parent
9bcff9eba7
commit
ac7d7aab99
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,3 +1,2 @@
|
||||
* text=auto
|
||||
.husky/** linguist-generated
|
||||
.yarn/** linguist-vendored -diff
|
||||
|
7
.github/workflows/chromatic.yml
vendored
7
.github/workflows/chromatic.yml
vendored
@ -18,12 +18,13 @@ jobs:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: corepack enable
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
- run: yarn install --immutable
|
||||
cache: pnpm
|
||||
- run: pnpm i --frozen-lockfile
|
||||
|
||||
- name: Publish to Chromatic
|
||||
uses: chromaui/action@cbce1be7d075d5317d2193e7a3d3872dca86cf0c # v11
|
||||
|
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@ -9,20 +9,20 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
- run: corepack enable
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
- run: yarn install --immutable
|
||||
cache: pnpm
|
||||
- run: pnpm i --frozen-lockfile
|
||||
|
||||
- name: Lint
|
||||
run: yarn lint
|
||||
run: pnpm lint
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
yarn core:build
|
||||
yarn core:build-ads
|
||||
pnpm --filter catppuccin-vsc core:build
|
||||
pnpm --filter catppuccin-vsc core:build-ads
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
|
||||
|
53
.github/workflows/flakehub-publish.yml
vendored
53
.github/workflows/flakehub-publish.yml
vendored
@ -1,53 +0,0 @@
|
||||
name: Publish tags to FlakeHub
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- ".+-v?[0-9]+.[0-9]+.[0-9]+*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: The existing tag to publish to FlakeHub
|
||||
type: string
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
flakehub-publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
id-token: write # Necessary for authenticating against FlakeHub
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
with:
|
||||
ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}"
|
||||
|
||||
# use yarn-nixify to prepare the cache in /nix/store
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
- run: yarn install --immutable
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: Setup cachix
|
||||
uses: cachix/cachix-action@ad2ddac53f961de1989924296a1f236fcfbaa4fc # v15
|
||||
with:
|
||||
name: catppuccin
|
||||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
skipPush: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
- name: Parse the semver tag
|
||||
id: semver
|
||||
run: echo "${{ inputs.tag }}" | sed -E 's/.+-v?([0-9]+\.[0-9]+\.[0-9]+).*/tag=v\1/' >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: DeterminateSystems/flakehub-push@main
|
||||
with:
|
||||
visibility: public
|
||||
name: catppuccin/vscode
|
||||
tag: ${{ steps.semver.outputs.tag }}
|
39
.github/workflows/nix.yml
vendored
39
.github/workflows/nix.yml
vendored
@ -1,39 +0,0 @@
|
||||
name: Nix Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- macos-latest
|
||||
- ubuntu-latest
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
|
||||
# use yarn-nixify to prepare the cache in /nix/store
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
- run: yarn install --immutable
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: Flake check
|
||||
run: nix flake check -Lv
|
||||
|
||||
- name: Build packages
|
||||
run: nix build -Lv .
|
26
.github/workflows/release-please.yml
vendored
26
.github/workflows/release-please.yml
vendored
@ -57,20 +57,20 @@ jobs:
|
||||
with:
|
||||
ref: ${{ github.event.inputs.rev || github.sha }}
|
||||
|
||||
- run: corepack enable
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
- run: yarn install --immutable
|
||||
cache: pnpm
|
||||
- run: pnpm i --frozen-lockfile
|
||||
|
||||
- name: Build VSCode
|
||||
id: build-vscode
|
||||
run: yarn core:build
|
||||
run: pnpm --filter catppuccin-vsc core:build
|
||||
|
||||
- name: Build Azure Data Studio
|
||||
id: build-ads
|
||||
run: yarn core:build-ads
|
||||
run: pnpm --filter catppuccin-vsc core:build-ads
|
||||
|
||||
- name: Publish to Visual Studio Marketplace
|
||||
working-directory: ./packages/catppuccin-vsc
|
||||
@ -100,14 +100,14 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
- run: corepack enable
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
- run: yarn install --immutable
|
||||
cache: pnpm
|
||||
- run: pnpm i --frozen-lockfile
|
||||
|
||||
- run: yarn pack:build
|
||||
- run: pnpm --filter catppuccin-vsc-pack pack:build
|
||||
|
||||
- name: Publish to Visual Studio Marketplace
|
||||
working-directory: ./packages/catppuccin-vsc-pack
|
||||
@ -133,19 +133,19 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
- run: corepack enable
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
cache: pnpm
|
||||
registry-url: https://registry.npmjs.org
|
||||
- run: yarn install --immutable
|
||||
- run: pnpm i --frozen-lockfile
|
||||
|
||||
- name: Publish compiled NPM package
|
||||
working-directory: ./packages/catppuccin-vscode
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npm publish --provenance
|
||||
run: pnpm publish
|
||||
|
||||
mark-vscode-theme-as-latest:
|
||||
runs-on: ubuntu-latest
|
||||
|
32
.github/workflows/renovate-post.yml
vendored
32
.github/workflows/renovate-post.yml
vendored
@ -1,32 +0,0 @@
|
||||
name: renovate-post
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "**/package.json"
|
||||
- "**.lock"
|
||||
branches:
|
||||
- "renovate/*"
|
||||
|
||||
jobs:
|
||||
update_nix_hash:
|
||||
name: Update Nix hash
|
||||
runs-on: ubuntu-latest
|
||||
if: "${{github.actor == 'renovate[bot]'}}"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
- run: yarn install --immutable
|
||||
- uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
|
||||
with:
|
||||
author_email: "<29139614+renovate[bot]@users.noreply.github.com>"
|
||||
author_name: "renovate[bot]"
|
||||
message: "chore(deps): update nix hash"
|
9
.gitignore
vendored
9
.gitignore
vendored
@ -7,11 +7,4 @@ storybook-static/
|
||||
*.tgz
|
||||
*.vsix
|
||||
*.zip
|
||||
|
||||
# yarn v4
|
||||
.yarn-error.log
|
||||
.yarn/*
|
||||
!.yarn/plugins
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
.vscode/ltex.dictionary*
|
||||
|
2
.husky/pre-commit
generated
2
.husky/pre-commit
generated
@ -1 +1 @@
|
||||
yarn lint-staged
|
||||
pnpm lint-staged
|
||||
|
@ -1,4 +1,3 @@
|
||||
.yarn/
|
||||
dist/
|
||||
packages/*/themes/*.json
|
||||
CHANGELOG.md
|
||||
|
1
.yarn/plugins/yarn-plugin-nixify.cjs
vendored
1
.yarn/plugins/yarn-plugin-nixify.cjs
vendored
File diff suppressed because one or more lines are too long
24
.yarnrc.yml
24
.yarnrc.yml
@ -1,24 +0,0 @@
|
||||
enableConstraintsChecks: true
|
||||
|
||||
generateDefaultNix: false
|
||||
|
||||
nixExprPath: nix/yarn-project.nix
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
- checksum: 262555f70f393385c7b94658bf64e3c673a90cb79b6e3da036c5ff89e2b0133a033c620632b88e1252356926322922deb809aee91bb1c6d1ce0f2d8a4c917480
|
||||
path: .yarn/plugins/yarn-plugin-nixify.cjs
|
||||
spec: "https://github.com/stephank/yarn-plugin-nixify/raw/649a8a80988040093dbeca4eb79fcb04715cc843/dist/yarn-plugin-nixify.js"
|
||||
|
||||
supportedArchitectures:
|
||||
cpu:
|
||||
- x64
|
||||
- arm64
|
||||
libc:
|
||||
- glibc
|
||||
- musl
|
||||
os:
|
||||
- linux
|
||||
- darwin
|
||||
- win32
|
54
README.md
54
README.md
@ -55,50 +55,44 @@ If you need to use the JSON files for libraries like [Shiki](https://www.npmjs.c
|
||||
|
||||
### Nix (Home-Manager) users
|
||||
|
||||
[](https://flakehub.com/flake/catppuccin/vscode)
|
||||
|
||||
If you would like to change the theme configuration, the theme expects to have a mutable directory to write its JSON files into.
|
||||
This means that you will have to either:
|
||||
|
||||
- Install this extension in a non-declarative way so that the extension has permissions to write files.\
|
||||
This means fully excluding `nixpkgs.vscode-extensions.catppuccin.catppuccin-vsc` from your configuration; Just using `programs.vscode.mutableExtensionsDir = true;` will **NOT WORK**.
|
||||
- Use the `flake.nix` to build it with your VSCode configuration, using overrides.\
|
||||
This is a declarative way to compile the theme with your preferred options. Please refer to the example below for a sample configuration.
|
||||
|
||||
<details>
|
||||
<summary>❄️ Nix Configuration</summary>
|
||||
- Use our [catppuccin/nix](https://github.com/catppuccin/nix) module to build it with your VSCode configuration, using overrides.\
|
||||
This is a declarative way to compile the theme with your preferred options. **Please refer to the example below for a sample configuration.**
|
||||
|
||||
```nix
|
||||
{
|
||||
# in your inputs:
|
||||
inputs.catppuccin-vsc.url = "https://flakehub.com/f/catppuccin/vscode/*.tar.gz";
|
||||
|
||||
# add the overlay:
|
||||
nixpkgs.overlays = [inputs.catppuccin-vsc.overlays.default];
|
||||
# the package will be available as
|
||||
# - pkgs.catppuccin-vsc
|
||||
# - pkgs.vscode-extensions.catppuccin.catppuccin-vsc
|
||||
inputs.catppuccin.url = "github:catppuccin/nix";
|
||||
|
||||
# in your home-manager options:
|
||||
programs.vscode.extensions = [
|
||||
# all the theme options will be available as overrides, these are defaults:
|
||||
(pkgs.catppuccin-vsc.override {
|
||||
accent = "mauve";
|
||||
boldKeywords = true;
|
||||
italicComments = true;
|
||||
italicKeywords = true;
|
||||
extraBordersEnabled = false;
|
||||
workbenchMode = "default";
|
||||
bracketMode = "rainbow";
|
||||
colorOverrides = {};
|
||||
customUIColors = {};
|
||||
})
|
||||
];
|
||||
catppuccin = {
|
||||
enable = true;
|
||||
# optionally change the accent color
|
||||
# vscode.accent = "pink";
|
||||
};
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
# settings can be configured as normal, see extension defaults below:
|
||||
# userSettings = {
|
||||
# "catppuccin.boldKeywords": true;
|
||||
# "catppuccin.italicComments": true;
|
||||
# "catppuccin.italicKeywords": true;
|
||||
# "catppuccin.colorOverrides": {},
|
||||
# "catppuccin.customUIColors": {},
|
||||
# "catppuccin.workbenchMode": "default",
|
||||
# "catppuccin.bracketMode": "rainbow",
|
||||
# "catppuccin.extraBordersEnabled": false,
|
||||
# "catppuccin.syncWithIconPack": true,
|
||||
# ...
|
||||
# };
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Customization
|
||||
|
||||
> [!Note]
|
||||
|
23
flake.nix
23
flake.nix
@ -7,28 +7,7 @@
|
||||
in {
|
||||
packages = forAllSystems (pkgs: rec {
|
||||
default = catppuccin-vsc;
|
||||
catppuccin-vsc = pkgs.callPackage ./nix {};
|
||||
catppuccin-vsc = throw "catppuccin/vscode: This VSCode extension has been moved to catppuccin/nix.";
|
||||
});
|
||||
|
||||
overlays.default = final: prev: let
|
||||
pkg = inputs.self.packages.${prev.stdenv.system}.default;
|
||||
in {
|
||||
# create a new package
|
||||
catppuccin-vsc = pkg;
|
||||
# overwrite the vscode-extensions package
|
||||
vscode-extensions =
|
||||
prev.vscode-extensions
|
||||
// {
|
||||
catppuccin =
|
||||
(prev.vscode-extensions.catppuccin or {})
|
||||
// {
|
||||
catppuccin-vsc = pkg;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
devShells = forAllSystems (pkgs: {default = import ./nix/shell.nix {inherit pkgs;};});
|
||||
|
||||
formatter = forAllSystems (pkgs: pkgs.alejandra);
|
||||
};
|
||||
}
|
||||
|
@ -1,78 +0,0 @@
|
||||
{
|
||||
pkgs ? import <nixpkgs> {},
|
||||
accentColor ? null,
|
||||
accent ? "mauve",
|
||||
boldKeywords ? true,
|
||||
italicComments ? true,
|
||||
italicKeywords ? true,
|
||||
extraBordersEnabled ? false,
|
||||
workbenchMode ? "default",
|
||||
bracketMode ? "rainbow",
|
||||
colorOverrides ? {},
|
||||
customUIColors ? {},
|
||||
} @ inputs: let
|
||||
inherit (pkgs) lib;
|
||||
|
||||
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;
|
||||
validBracketModes = properties."catppuccin.bracketMode".enum;
|
||||
|
||||
inherit (packageJSON) version;
|
||||
pname = packageJSON.name;
|
||||
|
||||
options = builtins.removeAttrs inputs ["pkgs"];
|
||||
src = pkgs.nix-gitignore.gitignoreSource [] (builtins.path {
|
||||
name = "${pname}-${version}";
|
||||
path = ../.;
|
||||
});
|
||||
|
||||
nodejs = pkgs.nodejs_20;
|
||||
|
||||
builder = pkgs.callPackage ./yarn-project.nix {inherit nodejs;} {
|
||||
inherit src;
|
||||
overrideAttrs = {
|
||||
name = "${pname}-builder";
|
||||
pname = "${pname}-builder";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
yarn core:build
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cd packages/catppuccin-vsc
|
||||
cp -rL LICENSE README.md package.json icon.png dist/ themes/ $out/
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
};
|
||||
vscodeExtPublisher = "catppuccin";
|
||||
vscodeExtName = pname;
|
||||
vscodeExtUniqueId = "${vscodeExtPublisher}.${vscodeExtName}";
|
||||
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.buildVscodeExtension {
|
||||
inherit pname version vscodeExtPublisher vscodeExtName vscodeExtUniqueId;
|
||||
src = builder.outPath;
|
||||
|
||||
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.cjs
|
||||
touch ./themes/.flag
|
||||
runHook postBuild
|
||||
'';
|
||||
})
|
||||
.overrideAttrs (_: {sourceRoot = null;})
|
@ -1,33 +0,0 @@
|
||||
# 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;
|
||||
};
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
{pkgs ? import <nixpkgs> {}}:
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [alejandra nil nodejs_20 corepack_20];
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
# This file is generated by running "yarn install" inside your project.
|
||||
# Manual changes might be lost - proceed with caution!
|
||||
|
||||
{ lib, stdenv, nodejs, git, cacert, fetchurl, writeShellScript, writeShellScriptBin }:
|
||||
{ src, overrideAttrs ? null, ... } @ args:
|
||||
|
||||
let
|
||||
|
||||
yarnBin = fetchurl {
|
||||
url = "https://repo.yarnpkg.com/4.5.1/packages/yarnpkg-cli/bin/yarn.js";
|
||||
hash = "sha512-NB25OWtuKJ/swwzXqzr2UGDgXr/0s7R1R7J4ueZ7CPSF7NjHkAa0BURiYhQsejgVREXvfxfB1dHefZC/nOcFTQ==";
|
||||
};
|
||||
|
||||
cacheFolder = ".yarn/cache";
|
||||
lockfile = ./../yarn.lock;
|
||||
|
||||
# Call overrideAttrs on a derivation if a function is provided.
|
||||
optionalOverride = fn: drv:
|
||||
if fn == null then drv else drv.overrideAttrs fn;
|
||||
|
||||
# Simple stub that provides the global yarn command.
|
||||
yarn = writeShellScriptBin "yarn" ''
|
||||
exec '${nodejs}/bin/node' '${yarnBin}' "$@"
|
||||
'';
|
||||
|
||||
# Common attributes between Yarn derivations.
|
||||
drvCommon = {
|
||||
# Make sure the build uses the right Node.js version everywhere.
|
||||
buildInputs = [ nodejs yarn ];
|
||||
# All dependencies should already be cached.
|
||||
yarn_enable_network = "0";
|
||||
# Tell node-gyp to use the provided Node.js headers for native code builds.
|
||||
npm_config_nodedir = nodejs;
|
||||
};
|
||||
|
||||
# Comman variables that we set in a Nix build, but not in a Nix shell.
|
||||
buildVars = ''
|
||||
# Make Yarn produce friendlier logging for automated builds.
|
||||
export CI=1
|
||||
# Tell node-pre-gyp to never fetch binaries / always build from source.
|
||||
export npm_config_build_from_source=true
|
||||
# Disable Nixify plugin to save on some unnecessary processing.
|
||||
export yarn_enable_nixify=false
|
||||
'';
|
||||
|
||||
cacheDrv = stdenv.mkDerivation {
|
||||
name = "yarn-cache";
|
||||
buildInputs = [ yarn git cacert ];
|
||||
buildCommand = ''
|
||||
cp --reflink=auto --recursive '${src}' ./src
|
||||
cd ./src/
|
||||
${buildVars}
|
||||
HOME="$TMP" yarn_enable_global_cache=false yarn_cache_folder="$out" \
|
||||
yarn nixify fetch
|
||||
rm $out/.gitignore
|
||||
'';
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha512-hdP43ZJVfjv5O+wLPiogOHmOLm25kx2P0vVUVRm210yDi5YhSLnVtyzDJDPSRwunrHEUo2jzEs7327vePbuwiw==";
|
||||
};
|
||||
|
||||
# Main project derivation.
|
||||
project = stdenv.mkDerivation (drvCommon // {
|
||||
inherit src;
|
||||
name = "@catppuccin/vscode-monorepo";
|
||||
|
||||
configurePhase = ''
|
||||
${buildVars}
|
||||
|
||||
# Copy over the Yarn cache.
|
||||
rm -fr '${cacheFolder}'
|
||||
mkdir -p '${cacheFolder}'
|
||||
cp --reflink=auto --recursive ${cacheDrv}/* '${cacheFolder}/'
|
||||
|
||||
# Yarn may need a writable home directory.
|
||||
export yarn_global_folder="$TMP"
|
||||
|
||||
# Ensure global cache is disabled. Cache must be part of our output.
|
||||
touch .yarnrc.yml
|
||||
sed -i -e '/^enableGlobalCache/d' .yarnrc.yml
|
||||
echo 'enableGlobalCache: false' >> .yarnrc.yml
|
||||
|
||||
# Some node-gyp calls may call out to npm, which could fail due to an
|
||||
# read-only home dir.
|
||||
export HOME="$TMP"
|
||||
|
||||
# running preConfigure after the cache is populated allows for
|
||||
# preConfigure to contain substituteInPlace for dependencies as well as the
|
||||
# main project. This is necessary for native bindings that maybe have
|
||||
# hardcoded values.
|
||||
runHook preConfigure
|
||||
|
||||
# Run normal Yarn install to complete dependency installation.
|
||||
yarn install --immutable --immutable-cache
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
# Move the package contents to the output directory.
|
||||
if grep -q '"workspaces"' package.json; then
|
||||
# We can't use `yarn pack` in a workspace setup, because it only
|
||||
# packages the outer workspace.
|
||||
mkdir -p "$out/libexec"
|
||||
mv $PWD "$out/libexec/$name"
|
||||
else
|
||||
# - If the package.json has a `files` field, only files matching those patterns are copied
|
||||
# - Otherwise all files are copied.
|
||||
yarn pack --out package.tgz
|
||||
mkdir -p "$out/libexec/$name"
|
||||
tar xzf package.tgz --directory "$out/libexec/$name" --strip-components=1
|
||||
|
||||
cp --reflink=auto .yarnrc* "$out/libexec/$name"
|
||||
cp --reflink=auto ${lockfile} "$out/libexec/$name/yarn.lock"
|
||||
cp --reflink=auto --recursive .yarn "$out/libexec/$name"
|
||||
|
||||
# Copy the Yarn linker output into the package.
|
||||
cp --reflink=auto --recursive node_modules "$out/libexec/$name"
|
||||
fi
|
||||
|
||||
cd "$out/libexec/$name"
|
||||
|
||||
# Invoke a plugin internal command to setup binaries.
|
||||
mkdir -p "$out/bin"
|
||||
yarn nixify install-bin $out/bin
|
||||
|
||||
# A package with node_modules doesn't need the cache
|
||||
yarn cache clean
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit nodejs;
|
||||
yarn-freestanding = yarn;
|
||||
yarn = writeShellScriptBin "yarn" ''
|
||||
exec '${yarn}/bin/yarn' --cwd '${overriddenProject}/libexec/${overriddenProject.name}' "$@"
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
overriddenProject = optionalOverride overrideAttrs project;
|
||||
|
||||
in overriddenProject
|
74
package.json
74
package.json
@ -1,45 +1,6 @@
|
||||
{
|
||||
"name": "@catppuccin/vscode-monorepo",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@tsconfig/node18": "^18.2.4",
|
||||
"@types/node": "^20.12.7",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"@vscode/vsce": "^3.0.0",
|
||||
"@yarnpkg/types": "^4.0.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-unicorn": "^52.0.0",
|
||||
"husky": "^9.0.11",
|
||||
"lint-staged": "^15.2.2",
|
||||
"prettier": "^3.2.5",
|
||||
"tsup": "^8.0.2",
|
||||
"tsx": "^4.7.2",
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"dependenciesMeta": {
|
||||
"keytar": {
|
||||
"built": false
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": "yarn eslint --cache --fix",
|
||||
"*.{ts,json,md}": "yarn prettier --write"
|
||||
},
|
||||
"scripts": {
|
||||
"g:typecheck": "tsc --noEmit -p packages/catppuccin-vsc && tsc --noEmit -p packages/catppuccin-vsc-storybook",
|
||||
"lint": "eslint . --ext .ts \"$@\" && yarn g:typecheck",
|
||||
"postinstall": "husky && yarn compiled:pack"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"packageManager": "yarn@4.5.1",
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -51,5 +12,40 @@
|
||||
},
|
||||
"sponsor": {
|
||||
"url": "https://opencollective.com/catppuccin"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": "pnpm eslint --cache --fix",
|
||||
"*.{ts,json,md}": "pnpm prettier --write"
|
||||
},
|
||||
"scripts": {
|
||||
"g:typecheck": "tsc --noEmit -p packages/catppuccin-vsc && tsc --noEmit -p packages/catppuccin-vsc-storybook",
|
||||
"lint": "eslint . --ext .ts \"$@\" && pnpm g:typecheck",
|
||||
"postinstall": "husky && pnpm --filter @catppuccin/vscode compiled:pack"
|
||||
},
|
||||
"packageManager": "pnpm@10.6.5",
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-unicorn": "^52.0.0",
|
||||
"husky": "^9.0.11",
|
||||
"lint-staged": "^15.2.2",
|
||||
"prettier": "^3.2.5",
|
||||
"@tsconfig/node20": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"@vscode/vsce": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"tsup": "catalog:",
|
||||
"tsx": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
},
|
||||
"dependenciesMeta": {
|
||||
"keytar": {
|
||||
"built": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
"Catppuccin.catppuccin-vsc-icons"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@vscode/vsce": "^3.0.0"
|
||||
"@vscode/vsce": "catalog:"
|
||||
},
|
||||
"scripts": {
|
||||
"pack:build": "vsce package --no-dependencies --out catppuccin-vsc-pack.vsix"
|
||||
|
1
packages/catppuccin-vsc-storybook/.npmrc
Normal file
1
packages/catppuccin-vsc-storybook/.npmrc
Normal file
@ -0,0 +1 @@
|
||||
public-hoist-pattern[]=*storybook*
|
@ -3,29 +3,29 @@
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@catppuccin/palette": "^1.7.1",
|
||||
"@fontsource/jetbrains-mono": "^5.0.20",
|
||||
"@storybook/addon-essentials": "^8.0.9",
|
||||
"@storybook/addon-styling": "^1.3.7",
|
||||
"@storybook/addon-themes": "^8.0.9",
|
||||
"@storybook/blocks": "^8.0.9",
|
||||
"@storybook/web-components-vite": "^8.0.9",
|
||||
"@tsconfig/node18": "^18.2.4",
|
||||
"@types/node": "^20.12.7",
|
||||
"catppuccin-vsc": "workspace:*",
|
||||
"chromatic": "^11.3.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-storybook": "^0.11.0",
|
||||
"lit": "^3.1.3",
|
||||
"shiki": "^1.3.0",
|
||||
"storybook": "^8.0.9",
|
||||
"tsx": "^4.7.2",
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.2.10"
|
||||
"@fontsource/jetbrains-mono": "^5.2.5",
|
||||
"@storybook/addon-essentials": "^8.6.7",
|
||||
"@storybook/addon-themes": "^8.6.7",
|
||||
"@storybook/blocks": "^8.6.7",
|
||||
"@storybook/web-components": "^8.6.7",
|
||||
"@storybook/web-components-vite": "^8.6.7",
|
||||
"chromatic": "^11.27.0",
|
||||
"eslint-plugin-storybook": "^0.11.6",
|
||||
"lit": "^3.2.1",
|
||||
"shiki": "^1.29.2",
|
||||
"storybook": "^8.6.7",
|
||||
"vite": "^5.4.14",
|
||||
"@catppuccin/palette": "catalog:",
|
||||
"@catppuccin/vscode": "workspace:*",
|
||||
"@tsconfig/node20": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"tsx": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
},
|
||||
"scripts": {
|
||||
"storybook:chromatic": "chromatic --exit-zero-on-changes --exit-once-uploaded --project-token chpt_e3cba49738d7554",
|
||||
"storybook:build": "yarn core:build && storybook build",
|
||||
"storybook:build": "pnpm --filter catppuccin-vsc core:build && storybook build",
|
||||
"storybook:dev": "storybook dev -p 6006"
|
||||
},
|
||||
"engines": {
|
||||
|
@ -3,9 +3,9 @@
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"json-schema-to-typescript": "^15.0.0",
|
||||
"tsx": "^4.7.2",
|
||||
"typescript": "^5.4.5"
|
||||
"json-schema-to-typescript": "^15.0.4",
|
||||
"tsx": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
},
|
||||
"scripts": {
|
||||
"typegen:update": "tsx update.ts"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY IT BY HAND.
|
||||
* Instead, run `yarn run updateVSCtypes` to regenerate this file.
|
||||
* Instead, run `pnpm --filter @catppuccin/vsc-typegen typegen:update` to regenerate this file.
|
||||
*/
|
||||
export interface ErrorLensColors {
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY IT BY HAND.
|
||||
* Instead, run `yarn run updateVSCtypes` to regenerate this file.
|
||||
* Instead, run `pnpm --filter @catppuccin/vsc-typegen typegen:update` to regenerate this file.
|
||||
*/
|
||||
export interface GitHubPullRequestColors {
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY IT BY HAND.
|
||||
* Instead, run `yarn run updateVSCtypes` to regenerate this file.
|
||||
* Instead, run `pnpm --filter @catppuccin/vsc-typegen typegen:update` to regenerate this file.
|
||||
*/
|
||||
export interface GitLensColors {
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY IT BY HAND.
|
||||
* Instead, run `yarn run updateVSCtypes` to regenerate this file.
|
||||
* Instead, run `pnpm --filter @catppuccin/vsc-typegen typegen:update` to regenerate this file.
|
||||
*/
|
||||
|
||||
export type TextmateColors = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY IT BY HAND.
|
||||
* Instead, run `yarn run updateVSCtypes` to regenerate this file.
|
||||
* Instead, run `pnpm --filter @catppuccin/vsc-typegen typegen:update` to regenerate this file.
|
||||
*/
|
||||
|
||||
export interface SemanticTokens {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY IT BY HAND.
|
||||
* Instead, run `yarn run updateVSCtypes` to regenerate this file.
|
||||
* Instead, run `pnpm --filter @catppuccin/vsc-typegen typegen:update` to regenerate this file.
|
||||
*/
|
||||
|
||||
export interface WorkbenchColors {
|
||||
|
@ -3,12 +3,13 @@ import path from "node:path";
|
||||
import { writeFileSync } from "node:fs";
|
||||
import { compile, JSONSchema } from "json-schema-to-typescript";
|
||||
const vscodeSchemasRoot =
|
||||
// FIXME: main is broken with `json-schema-to-typescript` as explained in https://github.com/catppuccin/vscode/pull/459
|
||||
"https://raw.githubusercontent.com/ota-meshi/extract-vscode-schemas/main/resources/vscode/schemas/";
|
||||
|
||||
const bannerComment = `/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY IT BY HAND.
|
||||
* Instead, run \`yarn run updateVSCtypes\` to regenerate this file.
|
||||
* Instead, run \`pnpm --filter @catppuccin/vsc-typegen typegen:update\` to regenerate this file.
|
||||
*/`;
|
||||
|
||||
const mappings = [
|
||||
|
@ -3,8 +3,8 @@ import { createVSIX } from "@vscode/vsce";
|
||||
import { build } from "tsup";
|
||||
import { getFlag } from "type-flag";
|
||||
|
||||
import updatePackageJson from "./src/hooks/updatePackageJson";
|
||||
import generateThemes from "./src/hooks/generateThemes";
|
||||
import updatePackageJson from "@/hooks/updatePackageJson";
|
||||
import generateThemes from "@/hooks/generateThemes";
|
||||
|
||||
const buildForADS = getFlag("--ads", Boolean);
|
||||
const development = getFlag("--dev", Boolean);
|
||||
|
@ -167,19 +167,19 @@
|
||||
"isPreReleaseVersion": false
|
||||
},
|
||||
"devDependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@catppuccin/palette": "^1.7.1",
|
||||
"@catppuccin/vsc-typegen": "workspace:*",
|
||||
"@tsconfig/node18": "^18.2.4",
|
||||
"@types/node": "^20.12.7",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@types/tinycolor2": "^1.4.6",
|
||||
"@types/vscode": "~1.80.0",
|
||||
"@vscode/vsce": "^3.0.0",
|
||||
"tinycolor2": "^1.6.0",
|
||||
"tsup": "^8.0.2",
|
||||
"tsx": "^4.7.2",
|
||||
"type-flag": "^3.0.0",
|
||||
"typescript": "^5.4.5"
|
||||
"@catppuccin/palette": "catalog:",
|
||||
"@catppuccin/vsc-typegen": "workspace:*",
|
||||
"@tsconfig/node20": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"@vscode/vsce": "catalog:",
|
||||
"tsup": "catalog:",
|
||||
"tsx": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
},
|
||||
"scripts": {
|
||||
"core:build": "tsx build.ts",
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Script to generate theme files for all flavors, Node compatible.
|
||||
* Fires as a hook before packaging, and is included in the Nix build.
|
||||
* Fires as a hook before packaging.
|
||||
*/
|
||||
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
|
@ -22,9 +22,9 @@
|
||||
"module": "dist/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js",
|
||||
"require": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts"
|
||||
"require": "./dist/index.cjs"
|
||||
},
|
||||
"./themes/*.json": {
|
||||
"import": "./themes/*.json",
|
||||
@ -32,19 +32,19 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@catppuccin/palette": "^1.7.1"
|
||||
"@catppuccin/palette": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node20": "^20.1.4",
|
||||
"@types/node": "^20.12.7",
|
||||
"@tsconfig/node20": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"catppuccin-vsc": "workspace:*",
|
||||
"tsup": "^8.0.2",
|
||||
"typescript": "^5.4.5"
|
||||
"tsup": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn tsup",
|
||||
"compiled:pack": "npm pack",
|
||||
"prepack": "yarn core:build && yarn build"
|
||||
"build": "pnpm tsup",
|
||||
"compiled:pack": "pnpm pack",
|
||||
"prepack": "pnpm --filter catppuccin-vsc core:build && pnpm build"
|
||||
},
|
||||
"homepage": "https://github.com/catppuccin/vscode/tree/main/packages/catppuccin-vscode#readme",
|
||||
"bugs": {
|
||||
|
6044
pnpm-lock.yaml
generated
Normal file
6044
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
16
pnpm-workspace.yaml
Normal file
16
pnpm-workspace.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
packages:
|
||||
- packages/*
|
||||
catalog:
|
||||
"@catppuccin/palette": ^1.7.1
|
||||
"@tsconfig/node20": ^20.1.4
|
||||
"@types/node": ^20.17.25
|
||||
"@vscode/vsce": ^3.3.0
|
||||
"eslint": ^8.57.1
|
||||
"tsup": ^8.4.0
|
||||
"tsx": ^4.19.3
|
||||
"typescript": ^5.8.2
|
||||
onlyBuiltDependencies:
|
||||
- "@vscode/vsce-sign"
|
||||
- esbuild
|
||||
ignoredBuiltDependencies:
|
||||
- keytar
|
@ -1,16 +1,5 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:best-practices",
|
||||
"schedule:weekly",
|
||||
"schedule:automergeWeekly",
|
||||
":automergeMinor",
|
||||
":preserveSemverRanges"
|
||||
],
|
||||
"postUpdateOptions": ["yarnDedupeHighest"],
|
||||
"ignoreDeps": ["@types/vscode"],
|
||||
"ignorePaths": [".yarn/sdks/**"],
|
||||
"nix": {
|
||||
"enabled": true
|
||||
}
|
||||
"extends": ["local>catppuccin/renovate-config"],
|
||||
"ignoreDeps": ["@types/vscode"]
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "@tsconfig/node18/tsconfig.json",
|
||||
"extends": "@tsconfig/node20/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "node",
|
||||
|
@ -1,81 +0,0 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @typedef {import('@yarnpkg/types').Yarn.Constraints.Context} Context
|
||||
* @typedef {import('@yarnpkg/types').Yarn.Constraints.Workspace} Workspace
|
||||
*/
|
||||
|
||||
/**
|
||||
* This rule will enforce that a workspace MUST depend on the same version of a dependency as the one used by the other workspaces
|
||||
* @param {Context} context
|
||||
*/
|
||||
const enforceConsistentDependenciesAcrossTheProject = ({ Yarn }) => {
|
||||
for (const dependency of Yarn.dependencies()) {
|
||||
if (dependency.type === "peerDependencies") continue;
|
||||
|
||||
for (const otherDependency of Yarn.dependencies({
|
||||
ident: dependency.ident,
|
||||
})) {
|
||||
if (otherDependency.type === "peerDependencies") continue;
|
||||
|
||||
if (
|
||||
(dependency.type === "devDependencies" ||
|
||||
otherDependency.type === "devDependencies") &&
|
||||
Yarn.workspace({ ident: otherDependency.ident })
|
||||
)
|
||||
continue;
|
||||
|
||||
dependency.update(otherDependency.range);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Context} context
|
||||
* @param {Record<string, ((workspace: Workspace) => any) | string>} fields
|
||||
*/
|
||||
const enforceFieldsOnAllWorkspaces = ({ Yarn }, fields) => {
|
||||
for (const workspace of Yarn.workspaces()) {
|
||||
for (const [field, value] of Object.entries(fields)) {
|
||||
workspace.set(
|
||||
field,
|
||||
typeof value === "function" ? value(workspace) : value,
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Context} context
|
||||
*/
|
||||
const enforcePublishingConfig = ({ Yarn }) => {
|
||||
for (const workspace of Yarn.workspaces()) {
|
||||
if (workspace.manifest.private) continue;
|
||||
|
||||
workspace.set("publishConfig", {
|
||||
access: "public",
|
||||
provenance: true,
|
||||
registry: "https://registry.npmjs.org",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/** @type {import('@yarnpkg/types').Yarn.Config} */
|
||||
module.exports = {
|
||||
constraints: async (context) => {
|
||||
enforceFieldsOnAllWorkspaces(context, {
|
||||
"bugs.url": "https://github.com/catppuccin/vscode/issues",
|
||||
homepage: ({ cwd }) => {
|
||||
if (cwd === ".") return;
|
||||
return `https://github.com/catppuccin/vscode/tree/main/${cwd}#readme`;
|
||||
},
|
||||
license: "MIT",
|
||||
"repository.directory": (workspace) => workspace.cwd,
|
||||
"repository.type": "git",
|
||||
"repository.url": "https://github.com/catppuccin/vscode.git",
|
||||
"sponsor.url": "https://opencollective.com/catppuccin",
|
||||
});
|
||||
enforceConsistentDependenciesAcrossTheProject(context);
|
||||
enforcePublishingConfig(context);
|
||||
},
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user