kamilkisiela / bob

Build tool used in libraries maintained by The Guild
48 stars 12 forks source link

TypeScript config validation #74

Open n1ru4l opened 2 years ago

n1ru4l commented 2 years ago

Bob should probably check the tsconfig.json file within the projects and then yell at you in case you are doing something you probably should not do.

In a lot of projects we use the tsconfig.json and tsconfig.build.json pattern, tsconfig.build.json could potentially be completely life within bob.

n1ru4l commented 2 years ago

I actually think we can completely drop the tsconfig.build.json. bob can run tsc with the existing tsconfig and overwrite specific parameters.

n1ru4l commented 2 years ago

In addition, bob should bootstrap the TypeScript config and generate the paths config based on the packages exports map within the mono repository.

"paths": {
      "@graphql-codegen/cli": ["packages/graphql-codegen-cli/src/index.ts"],
      "@graphql-codegen/core": ["packages/graphql-codegen-core/src/index.ts"],
      "@graphql-codegen/flow": ["packages/plugins/flow/flow/src/index.ts"],
      "@graphql-codegen/flow-operations": ["packages/plugins/flow/operations/src/index.ts"],
      "@graphql-codegen/flow-resolvers": ["packages/plugins/flow/resolvers/src/index.ts"],
      "@graphql-codegen/java-apollo-android": ["packages/plugins/java/apollo-android/src/index.ts"],
      "@graphql-codegen/java-common": ["packages/plugins/java/common/src/index.ts"],
      "@graphql-codegen/java": ["packages/plugins/java/java/src/index.ts"],
      "@graphql-codegen/kotlin": ["packages/plugins/java/kotlin/src/index.ts"],
      "@graphql-codegen/java-resolvers": ["packages/plugins/java/resolvers/src/index.ts"],
      "@graphql-codegen/add": ["packages/plugins/other/add/src/index.ts"],
      "@graphql-codegen/fragment-matcher": ["packages/plugins/other/fragment-matcher/src/index.ts"],
      "@graphql-codegen/urql-introspection": ["packages/plugins/other/urql-introspection/src/index.ts"],
      "@graphql-codegen/introspection": ["packages/plugins/other/introspection/src/index.ts"],
      "@graphql-codegen/schema-ast": ["packages/plugins/other/schema-ast/src/index.ts"],
      "@graphql-codegen/time": ["packages/plugins/other/time/src/index.ts"],
      "@graphql-codegen/visitor-plugin-common": ["packages/plugins/other/visitor-plugin-common/src/index.ts"],
      "@graphql-codegen/typescript-apollo-angular": ["packages/plugins/typescript/apollo-angular/src/index.ts"],
      "@graphql-codegen/typescript-document-nodes": ["packages/plugins/typescript/document-nodes/src/index.ts"],
      "@graphql-codegen/typescript-enum-array": ["packages/plugins/typescript/enum-array/src/index.ts"],
      "@graphql-codegen/typescript-generic-sdk": ["packages/plugins/typescript/generic-sdk/src/index.ts"],
      "@graphql-codegen/typescript-graphql-files-modules": [
        "packages/plugins/typescript/graphql-files-modules/src/index.ts"
      ],
      "@graphql-codegen/typescript-graphql-request": ["packages/plugins/typescript/graphql-request/src/index.ts"],
      "@graphql-codegen/typescript-mongodb": ["packages/plugins/typescript/mongodb/src/index.ts"],
      "@graphql-codegen/typescript-oclif": ["packages/plugins/typescript/oclif/src/index.ts"],
      "@graphql-codegen/typescript-operations": ["packages/plugins/typescript/operations/src/index.ts"],
      "@graphql-codegen/typescript-react-offix": ["packages/plugins/typescript/react-apollo-offix/src/index.ts"],
      "@graphql-codegen/typescript-react-apollo": ["packages/plugins/typescript/react-apollo/src/index.ts"],
      "@graphql-codegen/typescript-resolvers": ["packages/plugins/typescript/resolvers/src/index.ts"],
      "@graphql-codegen/typescript-stencil-apollo": ["packages/plugins/typescript/stencil-apollo/src/index.ts"],
      "@graphql-codegen/typescript-type-graphql": ["packages/plugins/typescript/type-graphql/src/index.ts"],
      "@graphql-codegen/typed-document-node": ["packages/plugins/typescript/typed-document-node/src/index.ts"],
      "@graphql-codegen/gql-tag-operations": ["packages/plugins/typescript/gql-tag-operations/src/index.ts"],
      "@graphql-codegen/typescript": ["packages/plugins/typescript/typescript/src/index.ts"],
      "@graphql-codegen/typescript-urql": ["packages/plugins/typescript/urql/src/index.ts"],
      "@graphql-codegen/typescript-vue-urql": ["packages/plugins/typescript/urql/src/index.ts"],
      "@graphql-codegen/typescript-vue-apollo": ["packages/plugins/typescript/vue-apollo/src/index.ts"],
      "@graphql-codegen/typescript-vue-apollo-smart-ops": [
        "packages/plugins/typescript/vue-apollo-smart-ops/src/index.ts"
      ],
      "@graphql-codegen/c-sharp": ["packages/plugins/c-sharp/c-sharp/src/index.ts"],
      "@graphql-codegen/c-sharp-apollo": ["packages/plugins/c-sharp/apollo-dot-net/src/index.ts"],
      "@graphql-codegen/import-types-preset": ["packages/presets/import-types/src/index.ts"],
      "@graphql-codegen/near-operation-file-preset": ["packages/presets/near-operation-file/src/index.ts"],
      "@graphql-codegen/gql-tag-operations-preset": ["packages/presets/gql-tag-operations-preset/src/index.ts"],
      "@graphql-codegen/testing": ["packages/utils/graphql-codegen-testing/src/index.ts"],
      "@graphql-codegen/plugin-helpers": ["packages/utils/plugins-helpers/src/index.ts"],
      "@graphql-codegen/typescript-apollo-client-helpers": [
        "packages/plugins/typescript/apollo-client-helpers/src/index.ts"
      ],
      "@graphql-codegen/typescript-react-query": ["packages/plugins/typescript/react-query/src/index.ts"],
      "@graphql-codegen/typescript-msw": ["packages/plugins/typescript/msw/src/index.ts"],
      "@graphql-cli/codegen": ["packages/graphql-cli-codegen-plugin/src/index.ts"]
    }
ardatan commented 2 years ago

@n1ru4l I agree. Bob can generate paths map by looking at the package.json files in the "workspace".

Urigo commented 2 years ago

I wonder if this issue is the best place for it but should we also use tsconfig bases centralized recommendations repo in our configs and have Bob validate that we do?