Skip to content

Commit

Permalink
feat(ts): adds some static paths and renames .bin to script (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed Apr 5, 2024
1 parent 4148a5c commit 45a9d78
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 16 deletions.
23 changes: 21 additions & 2 deletions ts/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,30 @@
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"plugins": ["@typescript-eslint", "simple-import-sort"],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{ "ignoreRestSiblings": true }
{
"ignoreRestSiblings": true
}
],
"simple-import-sort/imports": [
"error",
{
"groups": [
["^(@|src|@src)?\\w"],
[
"^(src|main|core|arc-storybook|viz|design-system|placement|reporting|onboarding)(/.*|$)",
"^\\u0000",
"^\\.\\.(?!/?$)",
"^\\.\\./?$",
"^\\./(?=.*/)(?!/?$)",
"^\\.(?!/?$)",
"^\\./?$"
]
]
}
]
}
}
10 changes: 10 additions & 0 deletions ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.2.0",
"eslint": "^8.57.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
Expand All @@ -20,7 +21,7 @@
"npm run format"
],
"package.json": [
".bin/remove-exports.ts",
"script/remove-exports.ts",
"sort-json package.json"
],
"tsconfig.build.json": [
Expand All @@ -37,7 +38,7 @@
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,json}' --config ./.prettierrc",
"lint": "eslint src",
"lint:fix": "npm run lint -- --fix",
"postbuild": ".bin/generate-exports.ts",
"postbuild": "script/generate-exports.ts",
"prepare": "cd .. && husky ts/.husky"
},
"types": "dist/index.d.ts",
Expand Down
16 changes: 15 additions & 1 deletion ts/.bin/generate-exports.ts → ts/script/generate-exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as path from 'path';

const distDir = path.resolve(__dirname, '../dist/generated');
const files = fs.readdirSync(distDir);
const TYPE_REGISTRY_PATH = './dist/generated/typeRegistry';
const paths = files.reduce(
(acc, file) => {
const match = file.match(/index.(.*)\.d\.ts/);
Expand All @@ -20,7 +21,20 @@ const paths = files.reduce(

return acc;
},
{ package: {}, tsconfig: {} },
{
package: {
'./': './dist/index.js',
'./typeRegistry': `${TYPE_REGISTRY_PATH}.js`,
'./akash/deployment/v1beta3/query':
'./dist/generated/akash/deployment/v1beta3/query.js',
},
tsconfig: {
'@akashnetwork/akash-api/typeRegistry': [TYPE_REGISTRY_PATH],
'@akashnetwork/akash-api/akash/deployment/v1beta3/query': [
'./dist/generated/akash/deployment/v1beta3/query',
],
},
},
);

const tsconfigPaths = path.resolve(__dirname, '../tsconfig.paths.json');
Expand Down
File renamed without changes.
22 changes: 11 additions & 11 deletions ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"outDir": "./dist",
"forceConsistentCasingInFileNames": true,
"incremental": true,
"strictNullChecks": false,
"module": "commonjs",
"noFallthroughCasesInSwitch": false,
"noImplicitAny": false,
"outDir": "./dist",
"removeComments": true,
"skipLibCheck": true,
"strict": true,
"strictBindCallApply": false,
"noFallthroughCasesInSwitch": false
"strictNullChecks": false,
"target": "es2017"
}
}

0 comments on commit 45a9d78

Please sign in to comment.