Skip to content

Commit

Permalink
headlamp-build: Add package.json for scripts from Makefile
Browse files Browse the repository at this point in the history
This is to simplify using Headlamp so that people do not need to
have installed gnu Make. Which isn't on Windows, and isn't on
some Mac/unix systems.

Just starting with the start script, the rest can come later.

This package is not intended to be published, and so the name is
not important at this stage.

Signed-off-by: René Dudfield <renedudfield@microsoft.com>
  • Loading branch information
illume committed Nov 15, 2024
1 parent d24fc9f commit 75e7f8b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
const { spawn } = require('child_process');

const serverProcess = spawn('cd ../ && make backend && make run-backend', [], {
const serverProcess = spawn('cd ../ && npm run build:backend && npm run backend', [], {
stdio: 'inherit',
shell: true,
});
Expand Down
10 changes: 10 additions & 0 deletions docs/development/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ These are the required dependencies to get started. Other dependencies are pulle
- [Make](https://www.gnu.org/software/make/) (GNU). Often installed by default. On Windows this can be installed with the "chocolatey" package manager that is installed with node.
- [Kubernetes](https://kubernetes.io/), we suggest [minikube](https://minikube.sigs.k8s.io/docs/) as one good K8s installation for testing locally. Other k8s installations are supported (see [platforms](../platforms.md).

## Run the app

`npm start`

This will run back the backend, the frontend in development mode, and the app in development mode.

This is the quickest way to get started and see if everything is working. It may take a while to get going the first time as it installs things and warms up.

See below for running the frontend and backend separately to work in the web browser which is more convenient than developing in the app.

## Build the code

Headlamp is composed of a `backend` and a `frontend`.
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@headlamp-k8s/headlamp-build",
"version": "0.0.1",
"description": "Use 'npm start' to get going quickly. See contrib guide docs for more info. For building and running Headlamp without Make.",
"directories": {
"doc": "docs"
},
"scripts": {
"start": "cd app && npm start",
"backend": "npm install && cross-env HEADLAMP_BACKEND_TOKEN=headlamp HEADLAMP_CONFIG_ENABLE_HELM=true HEADLAMP_CONFIG_ENABLE_DYNAMIC_CLUSTERS=true ./backend/headlamp-server -dev -proxy-urls https://artifacthub.io/* -enable-dynamic-clusters",
"build:backend": "cd backend && go build -o ./headlamp-server${SERVER_EXE_EXT} ./cmd"
},
"repository": {
"type": "git",
"url": "git+https://github.com/headlamp-k8s/headlamp.git"
},
"keywords": [
"headlamp",
"kubernetes"
],
"author": "Headlamp devs",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/headlamp-k8s/headlamp/issues"
},
"homepage": "https://github.com/headlamp-k8s/headlamp#readme"
}

0 comments on commit 75e7f8b

Please sign in to comment.