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

Enable building api code upon start #380

Closed
janirapo opened this issue Jan 28, 2022 · 1 comment
Closed

Enable building api code upon start #380

janirapo opened this issue Jan 28, 2022 · 1 comment
Labels
good first issue Good for newcomers scope: cli Issues happened a the ./src/cli level status: release-blocker Issues blocking a major release type: enhancement New feature or request

Comments

@janirapo
Copy link

I have setup my api using TypeScript and I am unable to startup both the frontend and the api at the same time using the swa start command, because the TypeScript code needs to be built before you can run it as JavaScript.

Instead of running func start in the api folder you should provide a way to run e.g. npm start within that folder, so that the developer can setup prestart tasks that build the code before trying to run it. My suggestion would be to add parameter --run-api, so that you could use --run-api="npm start", which would run the command in the api folder.

An alternative way could be to provide a way to run a pre-start task, so that you can build the api by separate parameter at beforehand. E.g. --build-api="npm run build", which would run the command within the api folder.

@manekinekko manekinekko added good first issue Good for newcomers scope: cli Issues happened a the ./src/cli level type: enhancement New feature or request labels Feb 8, 2022
@JeffreyCA
Copy link

As a workaround I modified the build script of the root package.json so it builds both the front-end and API when you run npm run build from the root dir.

"scripts": {
    ...
    "build": "npm run build --prefix api && react-scripts build",
    ...
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers scope: cli Issues happened a the ./src/cli level status: release-blocker Issues blocking a major release type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants