Use prepare instead of build as script

The prepare script runs before publishing a package, after installation
of a package from source, and when running npm install without
arguments in the repository.  These are the times where a build of the
web interface files are required to make the web interface work and
removes a manual step from using the package(s). The "build" script on
the other hand is never automatically invoked by npm.
This commit is contained in:
Hornwitser committed 2022-06-05 16:13:53 +02:00
1 parent 2973485321
commit 4d5597a1da
10 files changed
+9 -13

No files matched your search

-1
View File
@@ -25,7 +25,6 @@ jobs:
- run: wget -q -O factorio.tar.gz https://www.factorio.com/get-download/latest/headless/linux64 && tar -xf factorio.tar.gz && rm factorio.tar.gz
- run: node packages/lib/build_mod --source-dir packages/slave/lua/clusterio_lib --output-dir temp/test/sharedMods
- run: wget -q -O temp/test/sharedMods/subspace_storage_1.99.8.zip -L https://github.com/clusterio/subspace_storage/releases/download/1.99.6/subspace_storage_1.99.8.zip
- run: pnpm run -r --if-present build
- name: Run tests
if: ${{ matrix.node-version != '12.x' }}
run: pnpm test
-2
View File
@@ -24,8 +24,6 @@ RUN pnpm install
COPY --from=subspace_storage_builder /subspace_storage/dist/ /clusterio/sharedMods/
# Build submodules (web UI, libraries, plugins etc)
RUN pnpm run -r --if-present build
# Build Lua library mod
RUN node packages/lib/build_mod --build --source-dir packages/slave/lua/clusterio_lib \
&& mv dist/* sharedMods/ \
+2 -3
View File
@@ -50,10 +50,9 @@ Do not run `git pull upstream` it will mess thing up!
### Setting up the Development Environment
The project is organized into several packages that are all tied together using pnpm's workspace feature.
In order to get the development environment up and running you will need to run the following commands:
In order to get the development environment up and running you will need to run the following command:
pnpm install
pnpm run -r --if-present build
This installs dependencies needed by tests and links the packages up so they work from the git work tree.
To start a cluster from the repo you will first need to initialize it, this can be done using the installer:
@@ -87,7 +86,7 @@ For web development on the master there are also the following flags:
These options can be combined and multiple plugins can be actived for dev mode.
Keep in mind if you're working on external plugins the `--dev-plugin` option is likely to only work if the plugin is placed inside the `external_plugins` directory and its dependencies are installed with pnpm as part of the clusterio repository workspace.
Note that webpack is configured to delete the web interface build when using these options, so you will have to run `pnpm run -r --if-present build` before you start the master without these flags again.
Note that webpack is configured to delete the web interface build when using these options, so you will have to run `pnpm run -r --if-present prepare` before you start the master without these flags again.
### Starting a Feature Branch
+1 -1
View File
@@ -6,7 +6,7 @@
"version": "2.0.0-alpha.12",
"main": "master.js",
"scripts": {
"build": "webpack-cli --env production",
"prepare": "webpack-cli --env production",
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
+1 -1
View File
@@ -7,7 +7,7 @@
"license": "MIT",
"repository": "clusterio/clusterio",
"scripts": {
"build": "webpack-cli --env production",
"prepare": "webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {
+1 -1
View File
@@ -7,7 +7,7 @@
"license": "MIT",
"repository": "clusterio/factorioClusterio",
"scripts": {
"build": "webpack-cli --env production",
"prepare": "webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {
+1 -1
View File
@@ -7,7 +7,7 @@
"license": "MIT",
"repository": "clusterio/clusterio",
"scripts": {
"build": "webpack-cli --env production",
"prepare": "webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {
+1 -1
View File
@@ -7,7 +7,7 @@
"license": "MIT",
"repository": "clusterio/clusterio",
"scripts": {
"build": "webpack-cli --env production",
"prepare": "webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {
+1 -1
View File
@@ -7,7 +7,7 @@
"license": "MIT",
"repository": "clusterio/clusterio",
"scripts": {
"build": "webpack-cli --env production",
"prepare": "webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {
+1 -1
View File
@@ -7,7 +7,7 @@
"license": "MIT",
"repository": "clusterio/clusterio",
"scripts": {
"build": "webpack-cli --env production",
"prepare": "webpack-cli --env production",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {