Skip to content

Commit

Permalink
feat: stringify (basic + minify) (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kit-p authored Dec 4, 2022
1 parent 6b9bc1b commit 933436f
Show file tree
Hide file tree
Showing 20 changed files with 912 additions and 53 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "after-used",
"argsIgnorePattern": "^_"
}
]
],
"@typescript-eslint/no-explicit-any": "off"
},
"ignorePatterns": ["node_modules", "dist"]
"ignorePatterns": ["node_modules", "dist", "coverage", "test/dataset"]
}
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm exec commitlint --edit
pnpm exec commitlint --edit ${1}
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm exec pretty-quick --staged
pnpm run lint && pnpm exec pretty-quick --staged
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
dist
coverage
test/dataset
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"editor.formatOnSave": true,
"diffEditor.ignoreTrimWhitespace": false,
"git.alwaysSignOff": true,
"git.branchProtection": ["main"]
"git.branchProtection": ["main"],
"typescript.tsdk": "node_modules/typescript/lib"
}
3 changes: 3 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ const config = {
preset: "ts-jest",
testEnvironment: "node",
roots: ["test"],
transform: {
"^.+\\.(c|m)?(t|j)sx?$": ["@swc/jest"],
},
};

export default config;
9 changes: 9 additions & 0 deletions jest.filter.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = (testPaths) => {
const allowedPaths = testPaths
.filter((test) => !test.includes(".perf.test"))
.map((test) => ({ test }));

return {
filtered: allowedPaths,
};
};
9 changes: 9 additions & 0 deletions jest.perf.filter.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = (testPaths) => {
const allowedPaths = testPaths
.filter((test) => test.includes(".perf.test"))
.map((test) => ({ test }));

return {
filtered: allowedPaths,
};
};
18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
},
"scripts": {
"prepare": "husky install",
"test": "jest --coverage",
"test": "jest --coverage --filter \"./jest.filter.cjs\"",
"test:perf": "jest --filter \"./jest.perf.filter.cjs\"",
"lint": "concurrently \"pnpm:lint:*\"",
"lint:types": "tsc --noEmit",
"lint:js": "eslint src",
"build": "concurrently \"pnpm:build:*\"",
"build:types": "tsc -d --emitDeclarationOnly",
Expand All @@ -48,13 +50,24 @@
"url": "https://github.com/kit-p/json-kit/issues"
},
"homepage": "https://github.com/kit-p/json-kit/",
"packageManager": "pnpm@7.17.0",
"dependencies": {
"bson": "^4.7.0",
"lodash.clonedeep": "^4.5.0"
},
"devDependencies": {
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@jest/globals": "^29.3.1",
"@rollup/browser": "^3.4.0",
"@rollup/plugin-commonjs": "^23.0.3",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-typescript": "^9.0.2",
"@semantic-release/npm": "^9.0.1",
"@swc/core": "^1.3.21",
"@swc/jest": "^0.2.23",
"@types/jest": "^29.2.3",
"@types/lodash.clonedeep": "^4.5.7",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"concurrently": "^7.6.0",
Expand All @@ -69,6 +82,5 @@
"ts-jest": "^29.0.3",
"tslib": "^2.4.1",
"typescript": "^4.9.3"
},
"packageManager": "pnpm@7.17.0"
}
}
Loading

0 comments on commit 933436f

Please sign in to comment.