chore: Remove the unused dependencies

This commit is contained in:
BluJ
2023-04-28 08:52:44 -06:00
parent 38eccbaf44
commit 0e86e44bc3
6 changed files with 51 additions and 26 deletions

View File

@@ -12,6 +12,7 @@ lib/test/output.ts: lib/test/makeOutput.ts scripts/oldSpecToBuilder.ts
buildOutput: lib/test/output.ts fmt
echo 'done'
bundle: clean $(TS_FILES) package.json .FORCE node_modules test fmt
npx tsc
cp package.json dist/package.json

View File

@@ -1,6 +1,6 @@
import { writeConvertedFileFromOld } from "../../scripts/oldSpecToBuilder"
import { oldSpecToBuilder } from "../../scripts/oldSpecToBuilder"
writeConvertedFileFromOld(
oldSpecToBuilder(
"./lib/test/output.ts", // Make the location
{
// Put the config here

View File

@@ -7,6 +7,7 @@ import {
import { deepMerge } from "../util"
import { InputSpec, matchInputSpec } from "./output"
import * as _I from "../index"
import { camelCase } from "../../scripts/oldSpecToBuilder"
export type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T
? 1
@@ -127,3 +128,24 @@ describe("Inputs", () => {
).toThrowError()
})
})
describe("camelCase", () => {
test("'EquipmentClass name'", () => {
expect(camelCase("EquipmentClass name")).toEqual("equipmentClassName")
})
test("'Equipment className'", () => {
expect(camelCase("Equipment className")).toEqual("equipmentClassName")
})
test("'equipment class name'", () => {
expect(camelCase("equipment class name")).toEqual("equipmentClassName")
})
test("'Equipment Class Name'", () => {
expect(camelCase("Equipment Class Name")).toEqual("equipmentClassName")
})
test("'hyphen-name-format'", () => {
expect(camelCase("hyphen-name-format")).toEqual("hyphenNameFormat")
})
test("'underscore_name_format'", () => {
expect(camelCase("underscore_name_format")).toEqual("underscoreNameFormat")
})
})

15
package-lock.json generated
View File

@@ -10,14 +10,11 @@
"license": "MIT",
"dependencies": {
"@iarna/toml": "^2.2.5",
"deepmerge": "^4.3.1",
"lodash": "^4.17.21",
"ts-matches": "^5.4.1",
"yaml": "^2.2.1"
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/lodash": "^4.14.191",
"jest": "^29.4.3",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
@@ -1529,12 +1526,6 @@
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true
},
"node_modules/@types/lodash": {
"version": "4.14.192",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.192.tgz",
"integrity": "sha512-km+Vyn3BYm5ytMO13k9KTp27O75rbQ0NFw+U//g+PX7VZyjCioXaRFisqSIJRECljcTv73G3i6BpglNGHgUQ5A==",
"dev": true
},
"node_modules/@types/node": {
"version": "18.15.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.10.tgz",
@@ -2252,6 +2243,7 @@
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
@@ -3572,11 +3564,6 @@
"node": ">=8"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/lodash.memoize": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",

View File

@@ -21,8 +21,6 @@
"homepage": "https://github.com/Start9Labs/start-sdk#readme",
"dependencies": {
"@iarna/toml": "^2.2.5",
"deepmerge": "^4.3.1",
"lodash": "^4.17.21",
"ts-matches": "^5.4.1",
"yaml": "^2.2.1"
},
@@ -34,7 +32,6 @@
},
"devDependencies": {
"@types/jest": "^29.4.0",
"@types/lodash": "^4.14.191",
"jest": "^29.4.3",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",

View File

@@ -1,11 +1,19 @@
import camelCase from "lodash/camelCase"
import * as fs from "fs"
import { string } from "ts-matches"
export async function writeConvertedFileFromOld(
export function camelCase(value: string) {
return value.replace(
/^([A-Z])|[\s-_](\w)/g,
function (match, p1, p2, offset) {
if (p2) return p2.toUpperCase()
return p1.toLowerCase()
},
)
}
export async function oldSpecToBuilder(
file: string,
inputData: Promise<any> | any,
options: Parameters<typeof makeFileContentFromOld>[1],
options?: Parameters<typeof makeFileContentFromOld>[1],
) {
await fs.writeFile(
file,
@@ -14,6 +22,10 @@ export async function writeConvertedFileFromOld(
)
}
function isString(x: unknown): x is string {
return typeof x === "string"
}
export default async function makeFileContentFromOld(
inputData: Promise<any> | any,
{ startSdk = "start-sdk", nested = true } = {},
@@ -145,7 +157,7 @@ export default async function makeFileContentFromOld(
])
const values = Object.fromEntries(
Array.from(allValueNames)
.filter(string.test)
.filter(isString)
.map((key) => [key, value?.spec?.["value-names"]?.[key] || key]),
)
return `Value.select(${JSON.stringify(
@@ -264,7 +276,7 @@ export default async function makeFileContentFromOld(
)
const values = Object.fromEntries(
Array.from(allValueNames)
.filter(string.test)
.filter(isString)
.map((key: string) => [
key,
value?.spec?.["value-names"]?.[key] || key,
@@ -383,3 +395,9 @@ function rangeToTodoComment(range: string | undefined) {
if (!range) return ""
return `/* TODO: Convert range for this value (${range})*/`
}
// oldSpecToBuilder(
// "./config.ts",
// // Put config here
// {},
// )