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

"postbuild" commnad can't work in Windows #669

Open
KaminoRyo opened this issue Dec 22, 2023 · 3 comments
Open

"postbuild" commnad can't work in Windows #669

KaminoRyo opened this issue Dec 22, 2023 · 3 comments

Comments

@KaminoRyo
Copy link

Hi, I try to run basic-starter-api-gateway-v2-typescript example.
However, the postbuild command uses the cp command and does not work on Windows.
If you don't want to depend on the OS, would it be better to create a copy script file with node.js and run it....

@KaminoRyo KaminoRyo changed the title "npm run build" commnad can't work in Windows "postbuild" commnad can't work in Windows Dec 22, 2023
@brettstack
Copy link
Collaborator

I'll take a look

@KaminoRyo
Copy link
Author

Umm...I use powershell (VSCode's terminal) and run npm run setupcommand.
I didn't know that, but cp command can be used in Powershell (an alias for the Copy-Item command is set).
However, It doesn't seem to work with npm commands.

Log

❯ npm run setup     

> basic-starter-api-gateway-v2-typescript@2.1.1 setup
> npm install && (cross-var aws s3api get-bucket-location --bucket $npm_package_config_s3BucketName --region $npm_package_config_region || npm run create-bucket) && npm run package-deploy


up to date, audited 436 packages in 4s

37 packages are looking for funding
  run `npm fund` for details

18 vulnerabilities (7 moderate, 11 high)

To address issues that do not require attention, run:
  npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
{
    "LocationConstraint": "ap-northeast-1"
}


> basic-starter-api-gateway-v2-typescript@2.1.1 package-deploy
> npm run build && npm run sam:build && npm run sam:deploy


> basic-starter-api-gateway-v2-typescript@2.1.1 build
> tsc


> basic-starter-api-gateway-v2-typescript@2.1.1 postbuild
> cp -R src/views dist/ && cp package*json dist/ && cp src/code-genie-logo.png dist/

'cp' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。 
(English: 'cp' is an internal or external command,
It is not recognized as an operational program or batch file.)

@KaminoRyo
Copy link
Author

I've looked into it, but there doesn't seem to be an easy way to solve the problem without relying on external libraries or creating script files. npm command uses cmd.exe(command-prompt) in Windows.....
Probably on Windows the postbuild command will look like this.

    "postbuild": "echo d | xcopy /Y /E src\\views\\ dist\\views & xcopy /Y package*json dist\\ & xcopy /Y src\\code-genie-logo.png dist\\ ",

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

No branches or pull requests

2 participants