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

feat(jsii-config): jsii-config #981

Merged
merged 8 commits into from
Nov 18, 2019
Merged

Conversation

MrArnoldPalmer
Copy link
Contributor

@MrArnoldPalmer MrArnoldPalmer commented Nov 13, 2019

jsii-config-optimized

Defines jsii-config CLI application for configuring a jsii package's jsii options inside package.json. These options dictate what target languages and language specific packaging options jsii uses when building.

The application uses inquirer for interactive prompts and yargs for argument parsing.

jsii-config will help configure packages with or without an existing jsii configuration in package.json. If the object does exist, the default values of fields that are prompted will be the existing values. This allows users to just hit 'enter' until they get to the options they wish to change and modify only those.

After the user inputs all of the values for the relevant prompts, they are asked to confirm the config. If the user selects 'yes', the config is written to package.json, if they select 'no', they will be prompted to fill out the fields again, however, the default values will now be what they previously entered. This is done so the user will only need to change the specific fields that need it.

Fixes #904


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@MrArnoldPalmer MrArnoldPalmer added the pr/work-in-progress This PR is a draft and needs further work. label Nov 13, 2019
@MrArnoldPalmer
Copy link
Contributor Author

MrArnoldPalmer commented Nov 13, 2019

I have been experimenting with integration level tests using nodes child_process tools. I haven't found a great way of doing this without a bunch of custom helper code and even with that it feels very brittle.

If anyone has suggestions regarding that let me know.

Found a couple small issues for next revision.

  • Metadata fields in existing jsii config are lost
  • Lost validate functions in a revision, adding these back for basic validation and error messaging on free form input types
  • Fix .npmignore and clean up .gitignore
  • Add readme/documentation

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

eladb
eladb previously approved these changes Nov 13, 2019
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome. Mostly stylistic comments.

I think that the next (immediate) iteration of this should be to also take care of other package.json fields that jsii cares about (and/or are best practices):

  1. Add build script that calls jsii
  2. Add watch script that calls jsii -w
  3. Ensure that main and types exist
  4. Ensure that repository exists
  5. Define stability
  6. Ensure that license is defined

Basically, it would be nice to be able to take a typescript project and run:

$ npx jsii-config

And it will convert it to a jsii project.

packages/jsii-config/lib/index.ts Outdated Show resolved Hide resolved
packages/jsii-config/lib/index.ts Outdated Show resolved Hide resolved
packages/jsii-config/lib/index.ts Outdated Show resolved Hide resolved
packages/jsii-config/lib/prompt.ts Outdated Show resolved Hide resolved
packages/jsii-config/lib/questions.ts Outdated Show resolved Hide resolved
packages/jsii-config/lib/schema.ts Outdated Show resolved Hide resolved
packages/jsii-config/lib/schema.ts Outdated Show resolved Hide resolved
packages/jsii-config/lib/schema.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed eladb’s stale review November 13, 2019 21:39

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Defines jsii-config CLI application for configuring a jsii package's
`jsii` options inside package.json. These options dictate what target
languages and language specific packaging options jsii uses when
building.

The application uses [inquirer](https://www.npmjs.com/package/inquirer)
for interactive prompts and [yargs](https://www.npmjs.com/package/yargs)
for argument parsing.

jsii-config will help configure packages with or without an existing
jsii configuration in package.json. If the object does exist, the
default values of fields that are prompted will be the existing values.
This allows users to just hit 'enter' until they get to the options they
wish to change and modify only those.

After the user inputs all of the values for the relevant prompts, they
are asked to confirm the config. If the user selects 'yes', the config
is written to package.json, if they select 'no', they will be prompted
to fill out the fields again, however, the default values will now be
what they previously entered. This is done so the user will only need to
change the specific fields that need it.

Fixes aws#904
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Adds the jsii configuration interfaces to jsii-spec module. This serves
as single global spec for jsii-configuration in package.json.

Move argument parsing and file/cli output to bin/jsii-config. This makes
it so the lib modules are less focused on the actual CLI interface. This
does however decrease unit test coverage which now only asserts that the
new configuration is correct and not that it was also written to the
package.json.
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Makes the information shown to users when prompting for a value more
clear. Adds details regarding the versionFormat field and its options.
@MrArnoldPalmer MrArnoldPalmer added feature-request A feature should be added or improved. and removed pr/work-in-progress This PR is a draft and needs further work. labels Nov 16, 2019
@MrArnoldPalmer MrArnoldPalmer marked this pull request as ready for review November 16, 2019 01:03
@MrArnoldPalmer MrArnoldPalmer requested a review from a team as a code owner November 16, 2019 01:03
@MrArnoldPalmer MrArnoldPalmer requested review from eladb and removed request for skinny85, rix0rrr and shivlaks November 16, 2019 01:03
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Removes existing snapshot tests since the logic is covered explicitly in
other test cases and they were flaky across platforms. This was due to
the object being asserted against contained non-serializable values.
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@eladb eladb changed the title feat(jsii-config): Adds jsii-config Package feat(jsii-config): jsii-config Nov 18, 2019
eladb
eladb previously approved these changes Nov 18, 2019
@mergify mergify bot dismissed eladb’s stale review November 18, 2019 16:43

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@MrArnoldPalmer MrArnoldPalmer requested a review from eladb November 18, 2019 16:59
@eladb eladb merged commit 2bbf576 into aws:master Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jsii-config
3 participants