use tsx, update dependencies

This commit is contained in:
Joseph Garrone 2024-06-15 11:21:09 +02:00
parent a6c22f9c8c
commit cd455eb5a6
6 changed files with 593 additions and 489 deletions

View file

@ -14,7 +14,7 @@
"_format": "prettier '**/*.{ts,tsx,json,md}'", "_format": "prettier '**/*.{ts,tsx,json,md}'",
"format": "npm run _format -- --write", "format": "npm run _format -- --write",
"format:check": "npm run _format -- --list-different", "format:check": "npm run _format -- --list-different",
"link-in-app": "ts-node --skipProject scripts/link-in-app.ts" "link-in-app": "tsx scripts/link-in-app.ts"
}, },
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
@ -47,18 +47,18 @@
"homepage": "https://github.com/#{USER_OR_ORG}#/#{REPO_NAME}#", "homepage": "https://github.com/#{USER_OR_ORG}#/#{REPO_NAME}#",
"devDependencies": { "devDependencies": {
"@types/node": "^20.2.1", "@types/node": "^20.2.1",
"typescript": "^5.0.4", "typescript": "^5.4.5",
"@typescript-eslint/eslint-plugin": "^5.59.6", "@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6", "@typescript-eslint/parser": "^5.59.6",
"eslint": "^8.41.0", "eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",
"husky": "^4.3.8", "husky": "^4.3.8",
"lint-staged": "^11.1.1", "lint-staged": "^11.1.1",
"prettier": "^2.8.8", "prettier": "^3.3.2",
"vitest": "^0.31.1", "vitest": "^1.6.0",
"ts-node": "^10.9.1", "tsx": "^4.15.5",
"react": "^18.2.0", "react": "^18.3.1",
"@types/react": "^18.2.6" "@types/react": "^18.3.3"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View file

@ -3,10 +3,12 @@ import { join as pathJoin, relative as pathRelative } from "path";
import * as fs from "fs"; import * as fs from "fs";
import * as os from "os"; import * as os from "os";
const singletonDependencies: string[] = [ const singletonDependencies: string[] = ["react", "@types/react"];
//"react",
//"@types/react" // For example [ "@emotion" ] it's more convenient than
]; // having to list every sub emotion packages (@emotion/css @emotion/utils ...)
// in singletonDependencies
const namespaceSingletonDependencies: string[] = [];
const rootDirPath = pathJoin(__dirname, ".."); const rootDirPath = pathJoin(__dirname, "..");
@ -37,23 +39,16 @@ const rootDirPath = pathJoin(__dirname, "..");
); );
} }
const commonThirdPartyDeps = (() => { const commonThirdPartyDeps = [
// For example [ "@emotion" ] it's more convenient than ...namespaceSingletonDependencies
// having to list every sub emotion packages (@emotion/css @emotion/utils ...) .map(namespaceModuleName =>
// in singletonDependencies fs
const namespaceSingletonDependencies: string[] = []; .readdirSync(pathJoin(rootDirPath, "node_modules", namespaceModuleName))
.map(submoduleName => `${namespaceModuleName}/${submoduleName}`)
return [ )
...namespaceSingletonDependencies .reduce((prev, curr) => [...prev, ...curr], []),
.map(namespaceModuleName => ...singletonDependencies
fs ];
.readdirSync(pathJoin(rootDirPath, "node_modules", namespaceModuleName))
.map(submoduleName => `${namespaceModuleName}/${submoduleName}`)
)
.reduce((prev, curr) => [...prev, ...curr], []),
...singletonDependencies
];
})();
const yarnGlobalDirPath = pathJoin(rootDirPath, ".yarn_home"); const yarnGlobalDirPath = pathJoin(rootDirPath, ".yarn_home");

View file

@ -1,7 +1,5 @@
export function MyReactComponent() { export function MyReactComponent() {
return <div>My React Component</div>; return <div>My React Component</div>;
} }
export default MyReactComponent; export default MyReactComponent;

View file

@ -2,4 +2,4 @@
export function capitalize<S extends string>(str: S): Capitalize<S> { export function capitalize<S extends string>(str: S): Capitalize<S> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
return (str.charAt(0).toUpperCase() + str.slice(1)) as any; return (str.charAt(0).toUpperCase() + str.slice(1)) as any;
} }

View file

@ -1 +1 @@
export * from "./capitalize"; export * from "./capitalize";

1021
yarn.lock

File diff suppressed because it is too large Load diff