mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 15:04:52 +09:00
Replace npm and lerna with pnpm
Save disk space, time and sanity by replacing npm and lerna with pnpm. This is more performant and doesn't have developer experience ruining bugs like npm link removing all previous links before creating the requested one.
This commit is contained in:
1 parent
1e4292876c
commit
2973485321
12 files changed
+45
-44
No files matched your search
@@ -21,18 +21,17 @@ jobs:
|
|||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
- run: npm i --no-optional
|
- run: pnpm i --no-optional
|
||||||
- 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: 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: npx lerna bootstrap --hoist
|
|
||||||
- run: node packages/lib/build_mod --source-dir packages/slave/lua/clusterio_lib --output-dir temp/test/sharedMods
|
- 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: 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: npx lerna run build
|
- run: pnpm run -r --if-present build
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
if: ${{ matrix.node-version != '12.x' }}
|
if: ${{ matrix.node-version != '12.x' }}
|
||||||
run: npm test
|
run: pnpm test
|
||||||
- name: Run coverage
|
- name: Run coverage
|
||||||
if: ${{ matrix.node-version == '12.x' }}
|
if: ${{ matrix.node-version == '12.x' }}
|
||||||
run: npm run ci-cover
|
run: pnpm run ci-cover
|
||||||
- name : Upload coverage to Codecov
|
- name : Upload coverage to Codecov
|
||||||
if: ${{ matrix.node-version == '12.x' }}
|
if: ${{ matrix.node-version == '12.x' }}
|
||||||
uses: codecov/codecov-action@v2
|
uses: codecov/codecov-action@v2
|
||||||
@@ -46,6 +45,5 @@ jobs:
|
|||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
- run: npm i --no-optional
|
- run: pnpm i --no-optional
|
||||||
- run: npx lerna bootstrap --hoist
|
- run: pnpm run lint
|
||||||
- run: npm run lint
|
|
||||||
+1
-1
@@ -38,7 +38,7 @@ Factorio*
|
|||||||
/config-master.json
|
/config-master.json
|
||||||
/config-control.json
|
/config-control.json
|
||||||
/config-slave.json
|
/config-slave.json
|
||||||
package-lock.json
|
pnpm-lock.yaml
|
||||||
mod_cache.json
|
mod_cache.json
|
||||||
static/export
|
static/export
|
||||||
saves
|
saves
|
||||||
|
|||||||
+6
-9
@@ -15,18 +15,17 @@ RUN wget -q -O factorio.tar.gz https://www.factorio.com/get-download/latest/head
|
|||||||
# Copy project files into the container
|
# Copy project files into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN npm install \
|
RUN pnpm install
|
||||||
&& npx lerna bootstrap --hoist
|
|
||||||
|
|
||||||
# Install plugins. This is intended as a reasonable default, enabling plugins to make for fun gameplay.
|
# Install plugins. This is intended as a reasonable default, enabling plugins to make for fun gameplay.
|
||||||
# If you want a different set of plugins, consider using this as the base image for your own.
|
# If you want a different set of plugins, consider using this as the base image for your own.
|
||||||
#RUN npm install @clusterio/plugin-subspace_storage
|
#RUN pnpm install @clusterio/plugin-subspace_storage
|
||||||
#RUN npx clusteriomaster plugin add @clusterio/plugin-subspace_storage
|
#RUN npx clusteriomaster plugin add @clusterio/plugin-subspace_storage
|
||||||
|
|
||||||
COPY --from=subspace_storage_builder /subspace_storage/dist/ /clusterio/sharedMods/
|
COPY --from=subspace_storage_builder /subspace_storage/dist/ /clusterio/sharedMods/
|
||||||
|
|
||||||
# Build submodules (web UI, libraries, plugins etc)
|
# Build submodules (web UI, libraries, plugins etc)
|
||||||
RUN npx lerna run build
|
RUN pnpm run -r --if-present build
|
||||||
# Build Lua library mod
|
# Build Lua library mod
|
||||||
RUN node packages/lib/build_mod --build --source-dir packages/slave/lua/clusterio_lib \
|
RUN node packages/lib/build_mod --build --source-dir packages/slave/lua/clusterio_lib \
|
||||||
&& mv dist/* sharedMods/ \
|
&& mv dist/* sharedMods/ \
|
||||||
@@ -46,8 +45,7 @@ COPY --from=clusterio_builder /clusterio /clusterio
|
|||||||
WORKDIR /clusterio
|
WORKDIR /clusterio
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN npm install --production
|
RUN pnpm install --production
|
||||||
RUN npx lerna bootstrap -- --production --no-optional
|
|
||||||
LABEL maintainer "danielv@danielv.no"
|
LABEL maintainer "danielv@danielv.no"
|
||||||
|
|
||||||
FROM frolvlad/alpine-glibc AS clusterio_testing
|
FROM frolvlad/alpine-glibc AS clusterio_testing
|
||||||
@@ -58,6 +56,5 @@ COPY --from=clusterio_builder /clusterio /clusterio
|
|||||||
WORKDIR /clusterio
|
WORKDIR /clusterio
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN npm install
|
RUN pnpm install
|
||||||
RUN npx lerna bootstrap
|
RUN pnpm install chalk semver
|
||||||
RUN npm install chalk semver
|
|
||||||
+10
-8
@@ -49,12 +49,11 @@ Do not run `git pull upstream` it will mess thing up!
|
|||||||
|
|
||||||
### Setting up the Development Environment
|
### Setting up the Development Environment
|
||||||
|
|
||||||
The project is organized into several packages that are all managed through Lerna.
|
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 commands:
|
||||||
|
|
||||||
npm install
|
pnpm install
|
||||||
npx lerna bootstrap --hoist
|
pnpm run -r --if-present build
|
||||||
npx lerna run build
|
|
||||||
|
|
||||||
This installs dependencies needed by tests and links the packages up so they work from the git work tree.
|
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:
|
To start a cluster from the repo you will first need to initialize it, this can be done using the installer:
|
||||||
@@ -80,14 +79,15 @@ Note that to use `clusterioctl` you will have to create a control config first:
|
|||||||
|
|
||||||
Once you've set up the cluster you can use `node packages/master run` to run the master server and `node packages/slave run` to run the slave which connects to the master server.
|
Once you've set up the cluster you can use `node packages/master run` to run the master server and `node packages/slave run` to run the slave which connects to the master server.
|
||||||
|
|
||||||
For web development on the master there are also the following flags.
|
For web development on the master there are also the following flags:
|
||||||
|
|
||||||
`--dev` - Recompile the `web_ui` package on the fly providing live reloading of it.
|
`--dev` - Recompile the `web_ui` package on the fly providing live reloading of it.
|
||||||
|
|
||||||
`--dev-plugin [name]` - Recompile the web module for the given plugin on the fly proving live reloading of it.
|
`--dev-plugin [name]` - Recompile the web module for the given plugin on the fly proving live reloading of it.
|
||||||
|
|
||||||
These options can be combined and multiple plugins can be actived for dev mode.
|
These options can be combined and multiple plugins can be actived for dev mode.
|
||||||
Note that webpack is configured to delete the web interface build when using these options, so you will have to run `npx lerna run build` before you start the master without these flags again.
|
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.
|
||||||
|
|
||||||
|
|
||||||
### Starting a Feature Branch
|
### Starting a Feature Branch
|
||||||
@@ -113,8 +113,8 @@ But it's nice to have its name be somewhat descriptive of what it implements.
|
|||||||
There's automated tests and linting setup for the project.
|
There's automated tests and linting setup for the project.
|
||||||
Please do add tests for any code you add and run both:
|
Please do add tests for any code you add and run both:
|
||||||
|
|
||||||
npm run test
|
pnpm run test
|
||||||
npm run lint
|
pnpm run lint
|
||||||
|
|
||||||
To check that your changes pass the integration tests as well as the ESLint rules set up for the project.
|
To check that your changes pass the integration tests as well as the ESLint rules set up for the project.
|
||||||
|
|
||||||
@@ -272,6 +272,8 @@ Headings use the `# heading` format.
|
|||||||
|
|
||||||
## Pushing releases to npm
|
## Pushing releases to npm
|
||||||
|
|
||||||
|
***Warning: This workflow is outdated due to lerna having been removed from the project.****
|
||||||
|
|
||||||
The releases are done by creating a new release tag with lerna and then uploading that with lerna.
|
The releases are done by creating a new release tag with lerna and then uploading that with lerna.
|
||||||
You will need commit access to the repository as well publish access to the @clusterio org on npm to do this.
|
You will need commit access to the repository as well publish access to the @clusterio org on npm to do this.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
||||||
|
!README.md
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# External plugins directory
|
||||||
|
|
||||||
|
Plugins placed here will have their npm dependencies incorporated in the shared pnpm storage for this repository when `pnpm install` is invoked.
|
||||||
|
Use this to enable `--dev-plugin` to work with plugins developed outside of the Clusterio repository.
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"packages": [
|
|
||||||
"packages/*",
|
|
||||||
"plugins/*",
|
|
||||||
"test"
|
|
||||||
],
|
|
||||||
"version": "2.0.0-alpha.12"
|
|
||||||
}
|
|
||||||
+4
-5
@@ -3,10 +3,10 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha --check-leaks -R spec --exclude \"**/node_modules/**\" --recursive test plugins/global_chat/test plugins/research_sync/test plugins/statistics_exporter/test plugins/subspace_storage/test plugins/player_auth/test",
|
"test": "mocha --check-leaks -R spec --exclude \"**/node_modules/**\" --recursive test plugins/global_chat/test plugins/research_sync/test plugins/statistics_exporter/test plugins/subspace_storage/test plugins/player_auth/test",
|
||||||
"fast-test": "FAST_TEST=y npm test",
|
"fast-test": "FAST_TEST=y pnpm test",
|
||||||
"cover": "nyc npm test",
|
"cover": "nyc pnpm test",
|
||||||
"fast-cover": "FAST_TEST=y nyc npm test",
|
"fast-cover": "FAST_TEST=y nyc pnpm test",
|
||||||
"ci-cover": "nyc --reporter=lcovonly npm run-script test",
|
"ci-cover": "nyc --reporter=lcovonly pnpm run-script test",
|
||||||
"lint": "eslint \"*.js\" packages plugins test",
|
"lint": "eslint \"*.js\" packages plugins test",
|
||||||
"docs": "jsdoc --configure docs/jsdoc.json",
|
"docs": "jsdoc --configure docs/jsdoc.json",
|
||||||
"bundle-dependencies": "bundle-dependencies"
|
"bundle-dependencies": "bundle-dependencies"
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
"eslint": "^7.25.0",
|
"eslint": "^7.25.0",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"jsdoc": "^3.6.6",
|
"jsdoc": "^3.6.6",
|
||||||
"lerna": "^4.0.0",
|
|
||||||
"mocha": "^8.4.0",
|
"mocha": "^8.4.0",
|
||||||
"nyc": "^15.1.0"
|
"nyc": "^15.1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ajv": "^6.12.6",
|
"ajv": "^6.12.6",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
|
"fast-deep-equal": "^3.1.3",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"isomorphic-ws": "^4.0.1",
|
"isomorphic-ws": "^4.0.1",
|
||||||
"jimp": "^0.12.1",
|
"jimp": "^0.12.1",
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
"jsonwebtoken": "^8.2.1",
|
"jsonwebtoken": "^8.2.1",
|
||||||
"jszip": "^3.2.2",
|
"jszip": "^3.2.2",
|
||||||
"set-blocking": "^2.0.0",
|
"set-blocking": "^2.0.0",
|
||||||
|
"webpack-cli": "^4.9.2",
|
||||||
"winston": "^3.3.3",
|
"winston": "^3.3.3",
|
||||||
"winston-daily-rotate-file": "^4.5.5",
|
"winston-daily-rotate-file": "^4.5.5",
|
||||||
"ws": "^7.2.3",
|
"ws": "^7.2.3",
|
||||||
@@ -34,13 +35,11 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@clusterio/web_ui": "^2.0.0-alpha.12",
|
"@clusterio/web_ui": "^2.0.0-alpha.12",
|
||||||
"fast-deep-equal": "^3.1.3",
|
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
"react-router-dom": "^5.2.0",
|
"react-router-dom": "^5.2.0",
|
||||||
"webpack": "^5.36.2",
|
"webpack": "^5.73.0",
|
||||||
"webpack-cli": "^4.7.0",
|
"webpack-dev-middleware": "^5.3.1",
|
||||||
"webpack-dev-middleware": "^4.1.0",
|
|
||||||
"webpack-merge": "^5.2.0"
|
"webpack-merge": "^5.2.0"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -38,7 +38,8 @@
|
|||||||
"stream-browserify": "^3.0.0",
|
"stream-browserify": "^3.0.0",
|
||||||
"style-loader": "^2.0.0",
|
"style-loader": "^2.0.0",
|
||||||
"util": "^0.12.3",
|
"util": "^0.12.3",
|
||||||
"webpack": "^5.36.2"
|
"webpack": "^5.73.0",
|
||||||
|
"webpack-cli": "^4.9.2"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
packages:
|
||||||
|
- "packages/*"
|
||||||
|
- "plugins/*"
|
||||||
|
- "external_plugins/*"
|
||||||
|
- "test/"
|
||||||
Reference in new issue
Block a user