Commit c32acfdd authored by nanahira's avatar nanahira

fix constant thing

parent 295bab2e
Pipeline #43131 passed with stages
in 7 minutes and 50 seconds
......@@ -60,9 +60,10 @@ const normalizeProtoName = (name) => name
const buildProtoMap = (registry, classPrefix) => {
const out = {};
for (const [id, cls] of registry.protos.entries()) {
const rawName = cls.name.startsWith(classPrefix)
? cls.name.slice(classPrefix.length)
: cls.name;
const className = cls.name.replace(/^_+/, "");
const rawName = className.startsWith(classPrefix)
? className.slice(classPrefix.length)
: className;
const name = normalizeProtoName(toConstantName(rawName));
out[String(id)] = name;
}
......@@ -136,6 +137,6 @@ const loadConstants = () => {
};
exports.loadConstants = loadConstants;
exports.default = exports.loadConstants;
if (require.main === module) {
if (typeof require !== "undefined" && require.main === module) {
console.log(JSON.stringify((0, exports.loadConstants)(), null, 2));
}
......@@ -100,9 +100,10 @@ const buildProtoMap = (
) => {
const out: Record<string, string> = {};
for (const [id, cls] of registry.protos.entries()) {
const rawName = cls.name.startsWith(classPrefix)
? cls.name.slice(classPrefix.length)
: cls.name;
const className = cls.name.replace(/^_+/, "");
const rawName = className.startsWith(classPrefix)
? className.slice(classPrefix.length)
: className;
const name = normalizeProtoName(toConstantName(rawName));
out[String(id)] = name;
}
......@@ -172,6 +173,6 @@ export const loadConstants = () => {
export default loadConstants;
if (require.main === module) {
if (typeof require !== "undefined" && require.main === module) {
console.log(JSON.stringify(loadConstants(), null, 2));
}
......@@ -31,7 +31,7 @@
"underscore.string": "^3.3.6",
"ws": "^8.9.0",
"ygopro-deck-encode": "^1.0.15",
"ygopro-msg-encode": "^1.1.8",
"ygopro-msg-encode": "^1.1.9",
"ygopro-yrp-encode": "^1.0.1"
},
"devDependencies": {
......@@ -1439,7 +1439,6 @@
"resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.6.1.tgz",
"integrity": "sha512-UxC0Yv1Y4WRJiGQxQkP0hfdL0/5/6YvdfOOClRgJ0qppSarkhneSa6UvkMkms0AkdGimSH3Ikqm+6mkMmX7vGA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@ioredis/commands": "^1.1.1",
"cluster-key-slot": "^1.1.0",
......@@ -3009,9 +3008,9 @@
"license": "MIT"
},
"node_modules/ygopro-msg-encode": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/ygopro-msg-encode/-/ygopro-msg-encode-1.1.8.tgz",
"integrity": "sha512-KrGUuyRLftmiD51KNRs/IRInsw+Xz/ISlCTmg+2W+6VLD6MtO9qF9SgBI78tXJ4/zsxifYekSDYfMuzJf2PuUA==",
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/ygopro-msg-encode/-/ygopro-msg-encode-1.1.9.tgz",
"integrity": "sha512-sY/jveNdcN25pcTsf8MpC0hvZnNQ2vTpIjuVhP3zjAZw8Uw8+8kEqTZSFEnnpS4QAmu3QYSEaFH1Rb0CfG2jFA==",
"license": "MIT",
"dependencies": {
"typed-reflector": "^1.0.14",
......@@ -4045,7 +4044,6 @@
"version": "5.6.1",
"resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.6.1.tgz",
"integrity": "sha512-UxC0Yv1Y4WRJiGQxQkP0hfdL0/5/6YvdfOOClRgJ0qppSarkhneSa6UvkMkms0AkdGimSH3Ikqm+6mkMmX7vGA==",
"peer": true,
"requires": {
"@ioredis/commands": "^1.1.1",
"cluster-key-slot": "^1.1.0",
......@@ -5235,9 +5233,9 @@
"integrity": "sha512-NMvgWuC3SKant50RDu0bHa3QIRlwBhdTR3bNDrMpNthTTQmCCq8i2HZaWFiCmYIBi9fR3W9CkFIgK6hI4d+PzQ=="
},
"ygopro-msg-encode": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/ygopro-msg-encode/-/ygopro-msg-encode-1.1.8.tgz",
"integrity": "sha512-KrGUuyRLftmiD51KNRs/IRInsw+Xz/ISlCTmg+2W+6VLD6MtO9qF9SgBI78tXJ4/zsxifYekSDYfMuzJf2PuUA==",
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/ygopro-msg-encode/-/ygopro-msg-encode-1.1.9.tgz",
"integrity": "sha512-sY/jveNdcN25pcTsf8MpC0hvZnNQ2vTpIjuVhP3zjAZw8Uw8+8kEqTZSFEnnpS4QAmu3QYSEaFH1Rb0CfG2jFA==",
"requires": {
"typed-reflector": "^1.0.14",
"ygopro-deck-encode": "^1.0.15",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment