@tscircuit/cli 0.1.1784 → 0.1.1785
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/main.js +26 -7
- package/dist/lib/index.js +26 -7
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -118506,7 +118506,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
118506
118506
|
// lib/getVersion.ts
|
|
118507
118507
|
import { createRequire as createRequire2 } from "node:module";
|
|
118508
118508
|
// package.json
|
|
118509
|
-
var version = "0.1.
|
|
118509
|
+
var version = "0.1.1784";
|
|
118510
118510
|
var package_default = {
|
|
118511
118511
|
name: "@tscircuit/cli",
|
|
118512
118512
|
version,
|
|
@@ -130942,6 +130942,18 @@ var import_jszip = __toESM2(require_lib4(), 1);
|
|
|
130942
130942
|
import fs29 from "node:fs";
|
|
130943
130943
|
import path31 from "node:path";
|
|
130944
130944
|
import crypto3 from "node:crypto";
|
|
130945
|
+
|
|
130946
|
+
// lib/shared/kicad-pcm-license.ts
|
|
130947
|
+
var KICAD_PCM_SCHEMA_VERSION = 2;
|
|
130948
|
+
var KICAD_PCM_SCHEMA_URL = "https://go.kicad.org/pcm/schemas/v2";
|
|
130949
|
+
var isValidKicadPcmV2License = (license) => typeof license === "string" && license.trim().length > 0;
|
|
130950
|
+
function assertValidKicadPcmV2License(license) {
|
|
130951
|
+
if (!isValidKicadPcmV2License(license)) {
|
|
130952
|
+
throw new Error(`Invalid KiCad PCM v2 license "(empty)". License must be a non-empty string allowed by ${KICAD_PCM_SCHEMA_URL}`);
|
|
130953
|
+
}
|
|
130954
|
+
}
|
|
130955
|
+
|
|
130956
|
+
// lib/shared/generate-pcm-assets.ts
|
|
130945
130957
|
async function generatePcmAssets(options) {
|
|
130946
130958
|
const {
|
|
130947
130959
|
packageName,
|
|
@@ -130949,17 +130961,19 @@ async function generatePcmAssets(options) {
|
|
|
130949
130961
|
author,
|
|
130950
130962
|
description = "",
|
|
130951
130963
|
descriptionFull = `Visit https://tscircuit.com/${author}/${packageName} for more information.`,
|
|
130952
|
-
license
|
|
130964
|
+
license,
|
|
130953
130965
|
kicadLibraryPath,
|
|
130954
130966
|
outputDir,
|
|
130955
130967
|
baseUrl,
|
|
130956
130968
|
displayName = `${author}/${packageName}`
|
|
130957
130969
|
} = options;
|
|
130970
|
+
assertValidKicadPcmV2License(license);
|
|
130971
|
+
const normalizedLicense = license.trim();
|
|
130958
130972
|
const identifier = `com.tscircuit.${author}.${packageName}`.toLowerCase().replace(/[^a-z0-9.-]/g, "-").slice(0, 50);
|
|
130959
130973
|
fs29.mkdirSync(outputDir, { recursive: true });
|
|
130960
130974
|
console.log("Creating metadata.json...");
|
|
130961
130975
|
const metadata = {
|
|
130962
|
-
$schema:
|
|
130976
|
+
$schema: KICAD_PCM_SCHEMA_URL,
|
|
130963
130977
|
name: displayName,
|
|
130964
130978
|
description: description.slice(0, 500),
|
|
130965
130979
|
description_full: descriptionFull.slice(0, 5000),
|
|
@@ -130971,7 +130985,7 @@ async function generatePcmAssets(options) {
|
|
|
130971
130985
|
web: `https://tscircuit.com/${author}`
|
|
130972
130986
|
}
|
|
130973
130987
|
},
|
|
130974
|
-
license,
|
|
130988
|
+
license: normalizedLicense,
|
|
130975
130989
|
resources: {},
|
|
130976
130990
|
versions: [
|
|
130977
130991
|
{
|
|
@@ -131006,7 +131020,7 @@ async function generatePcmAssets(options) {
|
|
|
131006
131020
|
web: `https://tscircuit.com/${author}`
|
|
131007
131021
|
}
|
|
131008
131022
|
},
|
|
131009
|
-
license,
|
|
131023
|
+
license: normalizedLicense,
|
|
131010
131024
|
resources: {},
|
|
131011
131025
|
versions: [
|
|
131012
131026
|
{
|
|
@@ -131028,7 +131042,8 @@ async function generatePcmAssets(options) {
|
|
|
131028
131042
|
const packagesJsonSha256 = crypto3.createHash("sha256").update(packagesJsonBuffer).digest("hex");
|
|
131029
131043
|
const packagesJsonUrl = baseUrl ? `${baseUrl}/pcm/packages.json` : "./packages.json";
|
|
131030
131044
|
const repositoryJson = {
|
|
131031
|
-
$schema:
|
|
131045
|
+
$schema: KICAD_PCM_SCHEMA_URL,
|
|
131046
|
+
schema_version: KICAD_PCM_SCHEMA_VERSION,
|
|
131032
131047
|
name: displayName,
|
|
131033
131048
|
maintainer: {
|
|
131034
131049
|
name: author,
|
|
@@ -131125,6 +131140,8 @@ async function buildKicadPcm({
|
|
|
131125
131140
|
const version2 = packageJson.version || "1.0.0";
|
|
131126
131141
|
const author = getPackageAuthor(packageJson.name || "") || "tscircuit";
|
|
131127
131142
|
const description = packageJson.description || "";
|
|
131143
|
+
assertValidKicadPcmV2License(packageJson.license);
|
|
131144
|
+
const license = packageJson.license.trim();
|
|
131128
131145
|
const libraryName = kicadLibraryNameOption ?? resolveKicadLibraryName({ projectDir });
|
|
131129
131146
|
const kicadLibOutputDir = path32.join(distDir, "kicad-library-pcm");
|
|
131130
131147
|
const kicadPcmPackageId = `com_tscircuit_${author}_${packageName}`.replace(/\./g, "_");
|
|
@@ -131146,6 +131163,7 @@ async function buildKicadPcm({
|
|
|
131146
131163
|
version: version2,
|
|
131147
131164
|
author,
|
|
131148
131165
|
description,
|
|
131166
|
+
license,
|
|
131149
131167
|
kicadLibraryPath: kicadLibOutputDir,
|
|
131150
131168
|
outputDir: pcmOutputDir,
|
|
131151
131169
|
baseUrl,
|
|
@@ -291610,7 +291628,8 @@ Publish completed with ${uploadResults.succeeded.length} files uploaded and ${up
|
|
|
291610
291628
|
await ky4.post("package_releases/update", {
|
|
291611
291629
|
json: {
|
|
291612
291630
|
package_name_with_version: `${scopedPackageName}@${releaseVersion}`,
|
|
291613
|
-
ready_to_build: true
|
|
291631
|
+
ready_to_build: true,
|
|
291632
|
+
...typeof packageJson.license === "string" && packageJson.license.trim() ? { license: packageJson.license.trim() } : {}
|
|
291614
291633
|
}
|
|
291615
291634
|
});
|
|
291616
291635
|
onSuccess([
|
package/dist/lib/index.js
CHANGED
|
@@ -65757,7 +65757,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
|
|
|
65757
65757
|
}));
|
|
65758
65758
|
};
|
|
65759
65759
|
// package.json
|
|
65760
|
-
var version = "0.1.
|
|
65760
|
+
var version = "0.1.1784";
|
|
65761
65761
|
var package_default = {
|
|
65762
65762
|
name: "@tscircuit/cli",
|
|
65763
65763
|
version,
|
|
@@ -75016,6 +75016,18 @@ var import_jszip = __toESM2(require_lib3(), 1);
|
|
|
75016
75016
|
import fs8 from "node:fs";
|
|
75017
75017
|
import path10 from "node:path";
|
|
75018
75018
|
import crypto3 from "node:crypto";
|
|
75019
|
+
|
|
75020
|
+
// lib/shared/kicad-pcm-license.ts
|
|
75021
|
+
var KICAD_PCM_SCHEMA_VERSION = 2;
|
|
75022
|
+
var KICAD_PCM_SCHEMA_URL = "https://go.kicad.org/pcm/schemas/v2";
|
|
75023
|
+
var isValidKicadPcmV2License = (license) => typeof license === "string" && license.trim().length > 0;
|
|
75024
|
+
function assertValidKicadPcmV2License(license) {
|
|
75025
|
+
if (!isValidKicadPcmV2License(license)) {
|
|
75026
|
+
throw new Error(`Invalid KiCad PCM v2 license "(empty)". License must be a non-empty string allowed by ${KICAD_PCM_SCHEMA_URL}`);
|
|
75027
|
+
}
|
|
75028
|
+
}
|
|
75029
|
+
|
|
75030
|
+
// lib/shared/generate-pcm-assets.ts
|
|
75019
75031
|
async function generatePcmAssets(options) {
|
|
75020
75032
|
const {
|
|
75021
75033
|
packageName,
|
|
@@ -75023,17 +75035,19 @@ async function generatePcmAssets(options) {
|
|
|
75023
75035
|
author,
|
|
75024
75036
|
description = "",
|
|
75025
75037
|
descriptionFull = `Visit https://tscircuit.com/${author}/${packageName} for more information.`,
|
|
75026
|
-
license
|
|
75038
|
+
license,
|
|
75027
75039
|
kicadLibraryPath,
|
|
75028
75040
|
outputDir,
|
|
75029
75041
|
baseUrl,
|
|
75030
75042
|
displayName = `${author}/${packageName}`
|
|
75031
75043
|
} = options;
|
|
75044
|
+
assertValidKicadPcmV2License(license);
|
|
75045
|
+
const normalizedLicense = license.trim();
|
|
75032
75046
|
const identifier = `com.tscircuit.${author}.${packageName}`.toLowerCase().replace(/[^a-z0-9.-]/g, "-").slice(0, 50);
|
|
75033
75047
|
fs8.mkdirSync(outputDir, { recursive: true });
|
|
75034
75048
|
console.log("Creating metadata.json...");
|
|
75035
75049
|
const metadata = {
|
|
75036
|
-
$schema:
|
|
75050
|
+
$schema: KICAD_PCM_SCHEMA_URL,
|
|
75037
75051
|
name: displayName,
|
|
75038
75052
|
description: description.slice(0, 500),
|
|
75039
75053
|
description_full: descriptionFull.slice(0, 5000),
|
|
@@ -75045,7 +75059,7 @@ async function generatePcmAssets(options) {
|
|
|
75045
75059
|
web: `https://tscircuit.com/${author}`
|
|
75046
75060
|
}
|
|
75047
75061
|
},
|
|
75048
|
-
license,
|
|
75062
|
+
license: normalizedLicense,
|
|
75049
75063
|
resources: {},
|
|
75050
75064
|
versions: [
|
|
75051
75065
|
{
|
|
@@ -75080,7 +75094,7 @@ async function generatePcmAssets(options) {
|
|
|
75080
75094
|
web: `https://tscircuit.com/${author}`
|
|
75081
75095
|
}
|
|
75082
75096
|
},
|
|
75083
|
-
license,
|
|
75097
|
+
license: normalizedLicense,
|
|
75084
75098
|
resources: {},
|
|
75085
75099
|
versions: [
|
|
75086
75100
|
{
|
|
@@ -75102,7 +75116,8 @@ async function generatePcmAssets(options) {
|
|
|
75102
75116
|
const packagesJsonSha256 = crypto3.createHash("sha256").update(packagesJsonBuffer).digest("hex");
|
|
75103
75117
|
const packagesJsonUrl = baseUrl ? `${baseUrl}/pcm/packages.json` : "./packages.json";
|
|
75104
75118
|
const repositoryJson = {
|
|
75105
|
-
$schema:
|
|
75119
|
+
$schema: KICAD_PCM_SCHEMA_URL,
|
|
75120
|
+
schema_version: KICAD_PCM_SCHEMA_VERSION,
|
|
75106
75121
|
name: displayName,
|
|
75107
75122
|
maintainer: {
|
|
75108
75123
|
name: author,
|
|
@@ -75407,6 +75422,8 @@ async function buildKicadPcm({
|
|
|
75407
75422
|
const version2 = packageJson.version || "1.0.0";
|
|
75408
75423
|
const author = getPackageAuthor(packageJson.name || "") || "tscircuit";
|
|
75409
75424
|
const description = packageJson.description || "";
|
|
75425
|
+
assertValidKicadPcmV2License(packageJson.license);
|
|
75426
|
+
const license = packageJson.license.trim();
|
|
75410
75427
|
const libraryName = kicadLibraryNameOption ?? resolveKicadLibraryName({ projectDir });
|
|
75411
75428
|
const kicadLibOutputDir = path13.join(distDir, "kicad-library-pcm");
|
|
75412
75429
|
const kicadPcmPackageId = `com_tscircuit_${author}_${packageName}`.replace(/\./g, "_");
|
|
@@ -75428,6 +75445,7 @@ async function buildKicadPcm({
|
|
|
75428
75445
|
version: version2,
|
|
75429
75446
|
author,
|
|
75430
75447
|
description,
|
|
75448
|
+
license,
|
|
75431
75449
|
kicadLibraryPath: kicadLibOutputDir,
|
|
75432
75450
|
outputDir: pcmOutputDir,
|
|
75433
75451
|
baseUrl,
|
|
@@ -80145,7 +80163,8 @@ Publish completed with ${uploadResults.succeeded.length} files uploaded and ${up
|
|
|
80145
80163
|
await ky2.post("package_releases/update", {
|
|
80146
80164
|
json: {
|
|
80147
80165
|
package_name_with_version: `${scopedPackageName}@${releaseVersion}`,
|
|
80148
|
-
ready_to_build: true
|
|
80166
|
+
ready_to_build: true,
|
|
80167
|
+
...typeof packageJson.license === "string" && packageJson.license.trim() ? { license: packageJson.license.trim() } : {}
|
|
80149
80168
|
}
|
|
80150
80169
|
});
|
|
80151
80170
|
onSuccess([
|