stripe-cli icon indicating copy to clipboard operation
stripe-cli copied to clipboard

stripe-samples server code gets put in wrong directory

Open paulasjes-stripe opened this issue 4 years ago • 3 comments

When using the cli to clone the React sample, you pick the backend language you'd like to use and it does its thing. However it appears to be missing a subdirectory when copying the server files. The server files exist in ./server rather than ./server/{LANGUAGE}.

Here's what happens when I pick Node as the language and try to run the project out of the box.

yarn start
yarn run v1.15.2
$ concurrently "yarn client" "yarn server"
$ cd client && yarn start
$ cd server/node && yarn start
[1] /bin/sh: line 0: cd: server/node: No such file or directory
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[1] yarn server exited with code 1
$ react-scripts start
[0] /bin/sh: react-scripts: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[0] yarn client exited with code 127
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The Node files do exist in ./server but should be in ./server/node.

paulasjes-stripe avatar Mar 19 '20 08:03 paulasjes-stripe

Removing the language folder is intentional behavior, we didn't want to clone extra directory information.

@adreyfus-stripe and I had been working to update all the samples to work on the relative path but might have missed this one.

tomer-stripe avatar Mar 19 '20 15:03 tomer-stripe

@tomer-stripe Paul has a point though, the run instructions for samples created with the CLI vs cloned from GitHub diverge, and we need to have the whole STATIC_DIR charade and have the CLI rewrite it.

I wonder if it's more confusion than value. How strongly do you feel about this? I'd be in favour of keeping the folder structure the same as on GitHub.

Also this reminds me, we should somehow output the run instructions in the CLI. Maybe we can reuse your man pages work to render the server's README.md file?

thorsten-stripe avatar Mar 20 '20 09:03 thorsten-stripe

My ideal is that the samples fully convey the proper "end-state" for the sample, which would be to remove extra-depth folder structure. It's pretty weird for the CLI to remove every other language but still maintain that nested behavior. If we leave that, it doesn't seem farfetched for people to try to remove the unnecessary nesting and then hit the same issues regardless so I'd prefer if we could do it for them automatically.

tomer-stripe avatar Mar 23 '20 15:03 tomer-stripe