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

Feature: Basic CLI #24

Merged
merged 14 commits into from
Aug 19, 2022
Merged

Feature: Basic CLI #24

merged 14 commits into from
Aug 19, 2022

Conversation

oscar60310
Copy link
Contributor

@oscar60310 oscar60310 commented Jul 26, 2022

Description

Add CLI package and implement basic commands.

  • Implement commands: version, init, start, build, and serve.
    image
  • Update package.json for all packages.
    • add repo, license, and description fields.
    • update dependency policies
  • Setup build and publish script (nx build xxx, nx publish xxx)

Testing

Use command nx install cli to build and install Vulcan from local, then run vulcan init to create new project.

@oscar60310 oscar60310 changed the base branch from develop to feature/extension-loader August 8, 2022 08:07
@oscar60310 oscar60310 force-pushed the feature/cli branch 4 times, most recently from 0c3d144 to dc8b897 Compare August 12, 2022 07:19
@oscar60310 oscar60310 force-pushed the feature/extension-loader branch from 58c8aa4 to 9bad6f1 Compare August 12, 2022 07:35
@oscar60310 oscar60310 force-pushed the feature/cli branch 8 times, most recently from 140e5a7 to 074e8de Compare August 16, 2022 04:44
@oscar60310 oscar60310 changed the title [WIP] Feature: CLI Feature: CLI Aug 17, 2022
@oscar60310 oscar60310 changed the title Feature: CLI Feature: Basic CLI Aug 17, 2022
@oscar60310 oscar60310 requested a review from kokokuo August 17, 2022 02:01
@oscar60310 oscar60310 marked this pull request as ready for review August 17, 2022 02:01
Base automatically changed from feature/extension-loader to develop August 17, 2022 06:45
@oscar60310 oscar60310 force-pushed the feature/cli branch 3 times, most recently from 33841c6 to e39b53b Compare August 18, 2022 01:38
@oscar60310 oscar60310 changed the base branch from develop to chore/init-ci August 18, 2022 01:38
@codecov-commenter
Copy link

Codecov Report

Merging #24 (e39b53b) into chore/init-ci (ed9a2d1) will decrease coverage by 0.31%.
The diff coverage is 87.25%.

@@                Coverage Diff                @@
##           chore/init-ci      #24      +/-   ##
=================================================
- Coverage          91.60%   91.28%   -0.32%     
=================================================
  Files                188      199      +11     
  Lines               2383     2594     +211     
  Branches             271      277       +6     
=================================================
+ Hits                2183     2368     +185     
- Misses               160      181      +21     
- Partials              40       45       +5     
Impacted Files Coverage Δ
.../template-engine/code-loader/inMemoryCodeLoader.ts 100.00% <ø> (ø)
packages/cli/src/commands/version.ts 55.55% <55.55%> (ø)
packages/cli/src/commands/init.ts 83.33% <83.33%> (ø)
packages/cli/src/utils/shutdown.ts 87.50% <87.50%> (ø)
packages/cli/src/cli.ts 91.66% <91.66%> (ø)
packages/cli/src/commands/build.ts 92.30% <92.30%> (ø)
packages/build/src/lib/vulcanBuilder.ts 100.00% <100.00%> (ø)
packages/cli/src/commands/index.ts 100.00% <100.00%> (ø)
packages/cli/src/commands/serve.ts 100.00% <100.00%> (ø)
packages/cli/src/commands/start.ts 100.00% <100.00%> (ø)
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Base automatically changed from chore/init-ci to develop August 18, 2022 07:47
Copy link
Contributor

@kokokuo kokokuo left a comment

Choose a reason for hiding this comment

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

Thanks for adding cli package, LGTM 👍

@@ -0,0 +1,13 @@
import { execSync } from 'child_process';

if (process.env.READY_FOR_PUBLISH !== 'true') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Great for adding READY_FOR_PUBLISH to prevent unnecessary enter publish 👍

"assets": ["packages/build/*.md"]
}
"assets": ["packages/build/*.md"],
"buildableProjectDepsInPackageJsonType": "dependencies"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the property buildableProjectDepsInPackageJsonType could the nx automatically add dependencies and buildable libraries so that we could publish a library with all dependencies ? (nrwl/nx#4620)

if it is true, maybe you could add the comment to let others know the purpose so that we could remind it to add when we create new nx packages and would like to publish in the future?

Copy link
Contributor Author

@oscar60310 oscar60310 Aug 19, 2022

Choose a reason for hiding this comment

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

https://nx.dev/packages/js/executors/tsc
The property updateBuildableProjectDepsInPackageJson control whether to add dependencies to package.json or not, its default value is true.

The setting here enforces the generator put these dependencies to "dependencies" but not "peerDependencies", I'll add some comments to tell the reason

Update: We can't add comments in JSON file 🤣

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @oscar60310 for answering my question, it was really helpful for me to understand its importance in the project.

That's fine. 😄 Still thanks for sharing the message, if there, I will memo it in my note.

config: string;
}

const defaultConfig: BuildCommandOptions = {
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: maybe you could rename to defaultOptions because the options contain config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll update them.

import * as jsYAML from 'js-yaml';
import { promises as fs } from 'fs';
import * as path from 'path';
import * as ora from 'ora';
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, the cool package for showing running/loading style 😲

port: number;
}

const defaultConfig: ServeCommandOptions = {
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Same suggestion rename like above build

@oscar60310
Copy link
Contributor Author

Hi @kokokuo All issues have been fixed besides the project.json comments~ thanks!

@kokokuo kokokuo merged commit dc2cf86 into develop Aug 19, 2022
@kokokuo kokokuo deleted the feature/cli branch August 19, 2022 11:22
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