Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving Options and CLI #15

Open
aminya opened this issue May 4, 2021 · 2 comments
Open

Improving Options and CLI #15

aminya opened this issue May 4, 2021 · 2 comments

Comments

@aminya
Copy link
Collaborator

aminya commented May 4, 2021

In this issue, I want to discuss things related to options and CLI. As we already discussed, I think we can improve the options and also make cmake-ts CLI more ergonomic.

Here are the suggestions:

  • Building with no package.json configuration. It should be possible to use cmake-ts with zero configuration. We already provide default values for many of the options.

The following should build with the default config if no option is specified in the package.json

cmake-ts
  • Adding a path entry to the CLI. Currently, cwd is used to find package.json. We can make this configuration by accepting a path to the project
cmake-ts ./path/to/project

By default process.cwd should be considered if the path is not specified

  • A flag should be passed to the CLI to specify the build type instead of the package.json entry. This removes the need for adding buildType to package.json or having to modify package.json for debugging/testing.
cmake-ts --buildType Debug
  • Allowing building only a certain configuration from CLI. We should allow selecting a certain configuration that is specified in package.json. For that, we need to add a name entry so the user can refer to it later from the CLI. This is useful during the development stage as the user only wants to test a certain config.
cmake-ts --configurationName MyConfig
  • When the previous option is added, we should remove/rename --nativeonly and --osonly. The user can specify the config for that native building to their package.json. If we want to keep them, we should rename them to --defaultConfig and --currentConfig that are more explanatory. As discussed in Add a runtime package similar to node-gyp-build for loading prebuilds or builds #16 --currentConfig can be useful in unknown envs.

  • Allow passing extra options to Cmake. We should make it possible to pass configs/env variables to Cmake from Cmake-ts CLI.

cmake-ts --globalCMakeOptions "CMAKE_CXX_FLAGS"="-Og"

or

cmake-ts --envVariables "Sanitizers"="true"

Commander package handles these pretty good

@aminya
Copy link
Collaborator Author

aminya commented May 8, 2021

Some more points about the docs:

  • The readme adds comments to the package.json, which prevents copy-pasting.
  • The documentation should have a minimal version, which uses most of the default options. Currently, the readme has some options (e.g. toolchain-file) that most people will not need to use, and if they do they will face some errors.

@aminya
Copy link
Collaborator Author

aminya commented May 8, 2021

We also need to support the CMAKE_TS env variables inside Cmake files. Using CMAKE_JS is nice for backward compatibility, but not supporting CMAKE_TS is confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant