diff --git a/samples/js/README.md b/samples/js/README.md new file mode 100644 index 0000000000..73bcbb3ea6 --- /dev/null +++ b/samples/js/README.md @@ -0,0 +1,27 @@ +# JS Samples + +This directory has a `package.json` and a `node_modules directory`. This is so that we do not have +to do the slow `npm install` in every sample. Instead each sample have no dependencies and the +dependencies are added to the shared parent directory. If we instead had complete standalone samples +in every subdirectory it would would mean that we have to have n copies of all the node modules we +depend on. This takes a long time to install and it takes up a lot of disk space. + +## Running a sample + +First run `npm install` in this directory, then in the subdirectory. + +``` +cd samples/js +npm install +cd fs +npm install +``` + +Then to run the sample: + +``` +node . +``` + +You only need to do the `npm install` calls once. After that you can use `npm run build` or +`npm run start` for dev mode. diff --git a/samples/js/bar-chart/README.md b/samples/js/bar-chart/README.md index c1a2b697ef..3f70728f5a 100644 --- a/samples/js/bar-chart/README.md +++ b/samples/js/bar-chart/README.md @@ -7,8 +7,10 @@ This renders noms data as a bar chart using Plotly (https://plot.ly/javascript/) ## Build ``` +pushd .. +npm install +popd npm install -npm run build ``` ## Run diff --git a/samples/js/counter/README.md b/samples/js/counter/README.md index 6a4fac841b..48a7f9fc29 100644 --- a/samples/js/counter/README.md +++ b/samples/js/counter/README.md @@ -8,7 +8,12 @@ counter uses noms/js to read and write a simple incrementing counter. ``` noms serve ldb:/tmp/noms & cd ../../samples/js/counter +pushd .. +npm install +popd npm install -npm run build node . http://localhost:8000:counter ``` + +You only need to do the `npm install` calls once. After that you can use `npm run build` or +`npm run start` for dev mode.