Skip to content

Commit

Permalink
fix: revert code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTenno committed Aug 24, 2024
1 parent ab8a67a commit 89bc1a2
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 96 deletions.
4 changes: 4 additions & 0 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": ["@babel/plugin-transform-class-properties", "@babel/plugin-transform-private-methods"],
"presets": ["@babel/preset-env"]
}
10 changes: 10 additions & 0 deletions .commitlintrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"body-max-line-length": [
0
]
}
}
4 changes: 4 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parserOptions:
requireConfigFile: false
extends:
- '@wfcd'
9 changes: 9 additions & 0 deletions .lintstagedrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'*.js':
- eslint --cache --fix
- npm test
package*.json:
- prettier --write
- npm dedupe
- npx sort-package-json
'*.{json,yml,yaml}':
- prettier --write
3 changes: 3 additions & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
slow: 10000
spec: test/**/*.spec.mjs
timeout: 10000
20 changes: 4 additions & 16 deletions build/parser.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import cloneDeep from 'lodash.clonedeep';
import { lastResourceName } from 'warframe-worldstate-data/utilities';

import dedupe from './dedupe.mjs';
import hashManager from './hashManager.mjs';
Expand Down Expand Up @@ -532,40 +531,29 @@ class Parser {
str
.replace('/', '')
.replace(/[ /*]/g, '-')
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
.replace(/[:<>[\]?!"]/g, '')
.toLowerCase();
const imageStub = image.textureLocation;
const ext = imageStub.split('.')[imageStub.split('.').length - 1].replace(/\?!.*/, '').replace(/!.*$/, ''); // .png, .jpg, etc

if (item.name === 'Blueprint') {
item.imageName = 'blueprint.png';
return;
}

// Turn any separators into dashes and remove characters that would break
// the filesystem.
item.imageName = encode(lastResourceName(item.uniqueName));
item.imageName = encode(item.name);

// Components usually have the same generic images, so we should remove the
// parent name here. Note that there's a difference between prime/non-prime
// components, so we'll keep the prime in the name.
if (item.parent) {
// Matching by uniqueName so only need to remove the first half, thanks DE for being consistent here
item.imageName = item.imageName.replace(/^[^-]+-/, '');

// since 'prime' is part of the uniqueName we no longer need to add it but I left code that will
// add it if it doesn't exist, I tested this one so yes it works
// if (item.name.includes('Prime')) item.imageName = item.imageName.replace(/^(?!prime-)/, 'prime-');
item.imageName = item.imageName.replace(`${encode(item.parent)}-`, '');
if (item.name.includes('Prime')) item.imageName = `prime-${item.imageName}`;
}

// Relics should use the same image based on type, as they all use the same.
// The resulting format looks like `axi-intact`, `axi-radiant`
if (item.type === 'Relic') {
item.imageName = encode(item.name).replace(/-(.*?)-/, '-'); // Remove second word (type)
item.imageName = item.imageName.replace(/-(.*?)-/, '-'); // Remove second word (type)
}

// doesn't look like it's needed anymore because we now match by uniqueName instead of name
// Some items have the same name - so add their uniqueName as an identifier
if (previous && item.name === previous.name) {
item.imageName += `-${encode(item.uniqueName)}`;
Expand Down
3 changes: 3 additions & 0 deletions clean-package.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"remove": ["prettier"]
}
10 changes: 10 additions & 0 deletions nyc.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
branches: 100,
'check-coverage': true,
exclude: ['test/*', 'build/*', 'config/*', 'data/*', 'docker/*', 'index.d.ts'],
functions: 100,
lines: 100,
reporter: ['lcov', 'text'],
'skip-full': true,
statements: 100,
};
81 changes: 1 addition & 80 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,73 +45,7 @@
"validate",
"test"
],
"commitlint": {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"body-max-line-length": [
0
]
}
},
"lint-staged": {
"*.js": [
"eslint --cache --fix",
"npm test"
],
"package*.json": [
"prettier --write",
"npm dedupe",
"npx sort-package-json"
],
"*.{json,yml,yaml}": [
"prettier --write"
]
},
"babel": {
"plugins": [
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-private-methods"
],
"presets": [
"@babel/preset-env"
]
},
"prettier": "@wfcd/eslint-config/prettier",
"eslintConfig": {
"parserOptions": {
"requireConfigFile": false
},
"extends": [
"@wfcd"
]
},
"mocha": {
"slow": 10000,
"spec": "test/**/*.spec.mjs",
"timeout": 10000
},
"nyc": {
"branches": 100,
"check-coverage": true,
"exclude": [
"test/*",
"build/*",
"config/*",
"data/*",
"docker/*",
"index.d.ts"
],
"functions": 100,
"lines": 100,
"reporter": [
"lcov",
"text"
],
"skip-full": true,
"statements": 100
},
"devDependencies": {
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
Expand Down Expand Up @@ -153,18 +87,5 @@
},
"peerDependencies": {
"warframe-worldstate-data": "^2"
},
"clean-package": {
"remove": [
"mocha",
"devDependencies",
"eslintIgnore",
"eslintConfig",
"scripts",
"clean-package",
"nyc",
"babel",
"prettier"
]
}
}
}

0 comments on commit 89bc1a2

Please sign in to comment.