Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix schemastore package #2474

Merged
merged 4 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions js/npm/package_json/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ ts_project(
"@npm//@schemastore/package",
"@npm//@types/node",
"@npm//commander",
"//ts"
],
)
19 changes: 18 additions & 1 deletion js/npm/package_json/gen_pkgjson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ const depTypes = {
isDev: (v: string) => v.startsWith('@types'),
};

// Should be mostly identical to guard.must(guard.isDefined)
// re-implemented here because I don't want to fuck around
// with rules_nodejs's insane binary runtime.
//
// If you're in the future and I've finally ported to rules_js,
// you can remove this code and replace
// it with an import of ts/guard

function mustDefined<T>(v: T | undefined): T {
if (v === undefined) throw new Error('Must be defined.');

return v;
}

const labelToNpmPackage = (label: string): string => {
/*
Eventually, I should actually test this,
Expand Down Expand Up @@ -115,7 +129,10 @@ const main = async () => {
devDeps = new Map<string, string>();

for (const [pkgName, pkgVersion] of our_deps) {
[runDeps, devDeps][+depTypes.isDev(pkgName)].set(pkgName, pkgVersion);
[runDeps, devDeps][+depTypes.isDev(pkgName)].set(
pkgName,
mustDefined(pkgVersion)
);
}

const template = JSON.parse((await fs.readFile(opts.merge)).toString());
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@pulumi/aws": "5.31.0",
"@pulumi/awsx": "1.0.2",
"@pulumi/pulumi": "3.58.0",
"@schemastore/package": "0.0.6",
"@schemastore/package": "0.0.8",
"@swc/cli": "0.1.62",
"@testing-library/react": "14.0.0",
"@types/cross-spawn": "6.0.2",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3218,10 +3218,10 @@
colors "~1.2.1"
string-argv "~0.3.1"

"@schemastore/package@0.0.6":
version "0.0.6"
resolved "https://registry.yarnpkg.com/@schemastore/package/-/package-0.0.6.tgz#9a76713da1c7551293b7e72e4f387f802bfd5d81"
integrity sha512-uNloNHoyHttSSdeuEkkSC+mdxJXMKlcUPOMb//qhQbIQijXg8x54VmAw3jm6GJZQ5DBtIqGBd66zEQCDCChQVA==
"@schemastore/package@0.0.8":
version "0.0.8"
resolved "https://registry.yarnpkg.com/@schemastore/package/-/package-0.0.8.tgz#1c1de8ea094c1551c951990ece087af6d41fad22"
integrity sha512-1jMrmFLUZBeQ7zdxe3ez1LSLYrUH4eY3gAPisW1rbNZ62zoYy8sudo9fXSS182s8f7p6TRy7wD6ybZvz9SUT1Q==

"@seald-io/binary-search-tree@^1.0.3":
version "1.0.3"
Expand Down