diff --git a/.yarn/plugins/plugin-list.cjs b/.yarn/plugins/plugin-list.cjs deleted file mode 100644 index 50285423..00000000 --- a/.yarn/plugins/plugin-list.cjs +++ /dev/null @@ -1,126 +0,0 @@ -module.exports = { - name: "plugin-list", - factory: (require) => { - const fs = require("fs"); - const { BaseCommand } = require("@yarnpkg/cli"); - const { Command, Option } = require("clipanion"); - const { parseSyml } = require("@yarnpkg/parsers"); - - class ListCommand extends BaseCommand { - static paths = [["list"]]; - - static usage = Command.Usage({ - description: "Lists installed packages.", - }); - - prod = Option.Boolean("--prod", false); - json = Option.Boolean("--json", false); - - async execute() { - if (!this.prod || !this.json) { - throw new Error( - "This command can only be used with the --prod and --json " + - "args to match the behavior required by VSCE. See: " + - "https://github.com/microsoft/vscode-vsce/blob/main/src/npm.ts", - ); - } - - const packageJsonContents = fs.readFileSync("package.json", "utf-8"); - const { dependencies = {}, resolutions = {} } = - JSON.parse(packageJsonContents); - - const lockContents = fs.readFileSync("yarn.lock", "utf-8"); - const resolved = parseSyml(lockContents); - - const trees = []; - - function addDependency(packageName, versionRange) { - const packageInfo = lookup( - resolved, - getLockFileKey(packageName, versionRange, resolutions), - ); - if (!packageInfo) { - throw new Error( - `Cannot resolve "${packageName}" with version range "${versionRange}"`, - ); - } - - const { version, dependencies } = packageInfo; - const name = `${packageName}@${version}`; - if (trees.find((tree) => tree.name === name)) { - return; // Dependency already added as part of another tree. - } - - if (dependencies) { - const children = Object.entries(dependencies).map( - ([name, range]) => ({ name: `${name}@${range}` }), - ); - trees.push({ name, children }); - - addDependencies(dependencies); - } else { - trees.push({ name, children: [] }); - } - } - - function addDependencies(dependencies) { - for (const [packageName, versionRange] of Object.entries( - dependencies, - )) { - addDependency(packageName, versionRange); - } - } - - addDependencies(dependencies); - - const output = { - type: "tree", - data: { type: "list", trees }, - }; - - this.context.stdout.write(JSON.stringify(output)); - } - } - - return { - commands: [ListCommand], - }; - }, -}; - -function getLockFileKey(packageName, versionSpecifier, resolutions) { - // If the package name is in the resolutions field, use the version from there. - const resolvedVersionSpecifier = resolutions[packageName] ?? versionSpecifier; - - // If the version field contains a URL, don't attempt to use the NPM registry - return resolvedVersionSpecifier.includes(":") - ? `${packageName}@${resolvedVersionSpecifier}` - : `${packageName}@npm:${resolvedVersionSpecifier}`; -} - -/** - * @param resolved All the resolved dependencies as found in the lock file. - * @param dependencyKey Key of the dependency to look up. Can be created using - * `getLockFileKey()`. - */ -function lookup(resolved, dependencyKey) { - const packageInfo = resolved[dependencyKey]; - if (packageInfo) { - return packageInfo; - } - - // Fall back to slower iteration-based lookup for combined keys. - for (const [key, packageInfo] of Object.entries(resolved)) { - // Resolving ranges: "@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5" - const versionRanges = key.split(","); - if (versionRanges.some((key) => key.trim() === dependencyKey)) { - return packageInfo; - } - - // Resolving yarn link resolutions: "@kaoto/kaoto-ui@portal:/home/rmartinez/repos/kaoto-ui::locator=vscode-kaoto%40workspace%3A." - const yarnLinkResolution = key.split("::")[0]; - if (yarnLinkResolution === dependencyKey) { - return packageInfo; - } - } -} diff --git a/.yarnrc.yml b/.yarnrc.yml index 9a53dac5..69d1c717 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -6,11 +6,9 @@ supportedArchitectures: cpu: [x64, arm64] plugins: - - path: .yarn/plugins/plugin-list.cjs - spec: "https://github.com/arendjr/yarn-plugin-list/releases/latest/download/yarn-plugin-list.js" - checksum: 4ae37aa0a6a0d226889f66fb2f7482e321b0c82b8fa8ed2110d8cdfbd482c87542050ded54cb08bf473e4245ef0160668c689c93848416499a975d876a1e18b1 path: .yarn/plugins/yarn-plugin-nixify.cjs - spec: "https://raw.githubusercontent.com/stephank/yarn-plugin-nixify/main/dist/yarn-plugin-nixify.js" + spec: "https://github.com/stephank/yarn-plugin-nixify/raw/85edd52bc260755131e98736aa5588429d275d6a/dist/yarn-plugin-nixify.js" # yarn-plugin-nixify options generateDefaultNix: false diff --git a/build.ts b/build.ts index cb0b14c6..d513d01a 100644 --- a/build.ts +++ b/build.ts @@ -26,10 +26,10 @@ const dev = getFlag("--dev", Boolean); const shortName = buildForADS ? "ads" : "vsc"; const packagePath = `catppuccin-${shortName}-${packageJson.version}.vsix`; - await createVSIX({ useYarn: true, packagePath }); + await createVSIX({ dependencies: false, packagePath }); // restore the original package.json when building for ADS if (buildForADS) await updatePackageJson(); // the upload step in the CI required the path to the vsix file - if (process.env.CI) setOutput("vsixPath", packagePath); + if (process.env.GITHUB_ACTIONS) setOutput("vsixPath", packagePath); })();