Skip to content

chore: adjust CLI to meet FSP Spec - #2491

Merged
gvc merged 7 commits into
mainfrom
adjust-commands-to-spec
Oct 8, 2024
Merged

gvc merged 7 commits into
mainfrom
adjust-commands-to-spec

Conversation

@gvc

@gvc gvc commented Oct 4, 2024 •

Copy link
Copy Markdown
Contributor

What's the purpose of this pull request?

To work with the Platform CLI, the FastStore CLI commands needs to accept more arguments. I've added such arguments but they are not being used, so this should not affect current behavior in any way.

How to test it?

Install the version generated by the codesandbox and call all commands :)

Starters Deploy Preview

Code | Store (Vercel) | Store (Homebrew)

References

FastStore Platform Spec

@gvc gvc added the contributing Pull request submitted by the community label Oct 4, 2024
@gvc gvc self-assigned this Oct 4, 2024
@gvc
gvc requested a review from a team as a code owner October 4, 2024 12:16
@gvc
gvc requested review from lucasfp13 and renatamottam and removed request for a team October 4, 2024 12:16
@vercel

vercel Bot commented Oct 4, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
faststore-site ⬜️ Ignored (Inspect) Visit Preview Oct 8, 2024 7:46pm

@codesandbox-ci

codesandbox-ci Bot commented Oct 4, 2024 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Comment thread packages/cli/src/commands/dev.ts Resolved
Comment thread packages/cli/src/commands/start.ts Resolved
@gvc
gvc merged commit d88a361 into main Oct 8, 2024
@gvc
gvc deleted the adjust-commands-to-spec branch October 8, 2024 19:55
hellofanny added a commit that referenced this pull request Aug 10, 2026
## What's the purpose of this pull request?

Restores the `account, path, port` positional argument order on the
`faststore dev` command, matching `build` (`account, path`), `serve`
(`account, path, port`) and the [FastStore Platform
Spec](https://github.com/vtex/faststore-platform/blob/main/docs/specification.md).

The inversion was an unintended side effect of the oclif migration in
#3111: `static args` went from an array to an object, and since
positional order now follows key order, `path` ended up ahead of
`account` — on `dev` only. `build` and `serve` were migrated in the same
commit and kept the original order (introduced deliberately in #2491 to
comply with the spec).

The impact is on the FastStore Platform CLI, which calls the module
commands positionally:

```ts
// vtex/faststore-platform packages/cli/src/commands/dev.ts
return dev.run([account, path, port?.toString() ?? ''])
```

With the current v4 order, the account name lands in `args.path`, so
`getBasePath()` resolves the base path to a directory named after the
account. `build.run([account, path])` and `serve.run([account, path,
port])` are unaffected because those commands kept the correct order.

## Is this a breaking change?

No known consumer depends on the current v4 order:

- **Stores:** a code search for `"faststore dev"` in `package.json`
across GitHub returns 50+ stores, all using `"dev": "faststore dev"`
with no positional arguments. Since all three args are optional, those
are unaffected.
- **Programmatic callers:** searching for `loadedCli` across the `vtex`
org returns only `vtex/faststore-platform`, which already uses the spec
order for `dev`, `build` and `serve`.
- **This monorepo:** nothing invokes `faststore dev` with positional
arguments. `@faststore/core`'s `dev` script is `next dev`, and the
internal spawns inside `dev.ts` target `generate-types`, `cache-graphql`
and `generate-i18n` with an explicit `basePath`.
- **CI/CD:** pipelines run `build` and `serve`, never `dev`.

Passing a path as the single positional (`faststore dev ./store`) never
worked on v3 either, since `account` has always been the first argument
there.

`account` remains a noop — `run()` only reads `args.path` and
`args.port` — so this changes nothing beyond the positional mapping.

## How to test it?

Install the version generated by the codesandbox check in a monorepo
store and run `fsp dev <account>`. The dev server should start at the
module path declared in `faststore.json` instead of failing to resolve a
directory named after the account.

For a single store, `yarn dev` (i.e. `faststore dev` with no arguments)
should behave exactly as before.

## References

- Spec:
https://github.com/vtex/faststore-platform/blob/main/docs/specification.md
- Order introduced in #2491
- Order accidentally inverted in #3111


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Updated the `faststore dev` command documentation to list `ACCOUNT`
before `PATH`.
* Revised the command usage, heading, index, and argument descriptions.

* **Bug Fixes**
* Corrected positional argument ordering for the `faststore dev`
command: `ACCOUNT`, `PATH`, then `PORT`.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributing Pull request submitted by the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants