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(cli): [STENCIL-33] Writing and Reading the Ionic config file #2963

Merged

Conversation

splitinfinities
Copy link
Contributor

Adds ability to allow writing and reading to the ~/.ionic/config.json file. When reading, if the file doesn't exist, readConfig will automatically create the file.

Satisfies ADR-2

src/cli/ionic-config.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@rwaskiewicz rwaskiewicz left a comment

Choose a reason for hiding this comment

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

One overarching question - can we get these helper functions covered by (unit) tests please? LMK if you have any questions on that, although I hardly consider myself an expert 😉

src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/telemetry/helpers.ts Outdated Show resolved Hide resolved
@splitinfinities
Copy link
Contributor Author

@rwaskiewicz Added 6 tests for these new methods.
Screen Shot 2021-07-14 at 12 22 33 PM

src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/telemetry/helpers.ts Outdated Show resolved Hide resolved
src/cli/telemetry/test/helpers.spec.ts Outdated Show resolved Hide resolved
src/cli/telemetry/test/helpers.spec.ts Show resolved Hide resolved
src/cli/test/ionic-config.spec.ts Outdated Show resolved Hide resolved
src/cli/telemetry/test/helpers.spec.ts Outdated Show resolved Hide resolved
src/cli/telemetry/helpers.ts Outdated Show resolved Hide resolved
src/cli/telemetry/helpers.ts Outdated Show resolved Hide resolved
…gleton to help facilitate accessing features during the CLI's lifecycle.
@splitinfinities
Copy link
Contributor Author

@rwaskiewicz and @ltm if you could take a peek at the new changes in 2dd693f regarding using the abstracted system calls that help us work in Deno or Node I'd really appreciate it! I'm going to bring these over to the STENCIL 12 PR in the meantime.

src/cli/ionic-config.ts Outdated Show resolved Hide resolved
src/cli/telemetry/helpers.ts Outdated Show resolved Hide resolved
src/cli/telemetry/test/helpers.spec.ts Outdated Show resolved Hide resolved
src/cli/telemetry/test/helpers.spec.ts Outdated Show resolved Hide resolved
src/cli/state/stencil-cli-config.ts Outdated Show resolved Hide resolved
src/cli/state/stencil-cli-config.ts Outdated Show resolved Hide resolved
src/cli/state/test/stencil-cli-config.spec.ts Outdated Show resolved Hide resolved
src/cli/state/test/stencil-cli-config.spec.ts Outdated Show resolved Hide resolved
src/cli/telemetry/test/helpers.spec.ts Outdated Show resolved Hide resolved
src/cli/test/ionic-config.spec.ts Outdated Show resolved Hide resolved
@splitinfinities splitinfinities force-pushed the chore/telemetry/STENCIL-33-writing-and-reading-config branch from 2888409 to 8a40ef6 Compare July 21, 2021 14:48
src/cli/ionic-config.ts Outdated Show resolved Hide resolved
Comment on lines 30 to 33
tty: process.stdout.isTTY ? true : false,
ci:
['CI', 'BUILD_ID', 'BUILD_NUMBER', 'BITBUCKET_COMMIT', 'CODEBUILD_BUILD_ARN'].filter(v => !!process.env[v])
.length > 0 || process.argv.includes('--ci'),
Copy link
Contributor

Choose a reason for hiding this comment

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

process is a Node built-in, so you'd have to access these through the compiler system. You should be able to replace process.env[v] with CompilerSystem.getEnvironmentVar(v)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, hmm... I'm going to need to do a couple changes here in that case.

@splitinfinities splitinfinities merged commit f981812 into master Jul 23, 2021
rwaskiewicz pushed a commit that referenced this pull request Aug 17, 2021
)

- Adds ability to CLI to allow writing and reading to the ~/.ionic/config.json file. When reading, if the file doesn't exist, readConfig will automatically create the file. Satisfies ADR-2
@rwaskiewicz rwaskiewicz deleted the chore/telemetry/STENCIL-33-writing-and-reading-config branch October 6, 2021 15:54
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

Successfully merging this pull request may close these issues.

3 participants