serverless-express
serverless-express copied to clipboard
"postbuild" commnad can't work in Windows
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....
I'll take a look
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
> [email protected] 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"
}
> [email protected] package-deploy
> npm run build && npm run sam:build && npm run sam:deploy
> [email protected] build
> tsc
> [email protected] 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.)
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\\ ",