Closed
Description
Is your feature request related to a problem? Please describe.
I try to generate non-public clients outside the repository. I noticed some issues with the generated clients. The current generated scripts
in package.json
:
"scripts": {
"clean": "npm run remove-definitions && npm run remove-dist",
"build-documentation": "npm run clean && typedoc ./",
"prepublishOnly": "yarn build",
"pretest": "yarn build:cjs",
"remove-definitions": "rimraf ./types",
"remove-dist": "rimraf ./dist",
"remove-documentation": "rimraf ./docs",
"test": "yarn build && jest --coverage --passWithNoTests",
"build:cjs": "tsc -p tsconfig.json",
"build:es": "tsc -p tsconfig.es.json",
"build": "yarn build:cjs && yarn build:es"
},
- Some commands using npm, some yarn. It looks like no yarn specific feature is used so I think npm works for everybody while yarn introduces another dependency. it would be great if it's a) consistent and b) it works without yarn or at least support both (like https://stackoverflow.com/questions/41647961/package-json-scripts-that-work-with-npm-and-yarn )
clean
does not clean the documentation. I would expect after clean everything is gonebuild-documentation
cleans everything (except docs) which looks unnecessarybuild-documentation
should be named with colon:build:documentation
prepublishOnly
should run tests and generate documentation to ensure everything works before publishingpretest
buildscjs
buttest
executes a full build anyway sopretest
is not necessary- for faster iteration it would be great if tests are executed with ts-jest preset to test the TS directly without
build
. - No tests included in the generated client. Is jest even needed?
the generatedjest.config.js
includes../../jest.config.base.js
which is not generated. It would be better if the client is self-contained. The shared jest config only contains one value which looks pretty standard. Should that be skipped to avoid a dependency to the mono-repo?- The different
remove-*
targets look inconsistent withbuild:
tasks. Maybe change toremove:dist
with colon? - In addition
files: ["dist", "types"]
would be cleaner than the current.npmignore
as mentioned in fix(codgen): only publish types and dist folder to npm #1615
Edit 2021-05-22: Item 2., 3., 5., and 8. are already solved in the meanwhile.
Describe the solution you'd like
I suggest the following instead:
"scripts": {
"build": "npm run build:cjs && npm run build:es && npm run build:documentation",
"build:cjs": "tsc -p tsconfig.json",
"build:documentation": "typedoc ./",
"build:es": "tsc -p tsconfig.es.json",
"clean": "npm run clean:definitions && npm run clean:dist && npm run clean:documentation",
"clean:definitions": "rimraf ./types",
"clean:dist": "rimraf ./dist",
"clean:documentation": "rimraf ./docs",
"prepublishOnly": "npm run build"
}
I'm happy to create a pull-request with the change but I couldn't find where the file comes from.