Update electron package from 31.3.0 to 37.2.3, with Chromium 138 and
Node.js 22.17. Also follow the electron-packager -> @electron/packager
rename and upgrade the package.
* Handle directories in mod protocol handler
Previously we would return an error about a file not existing, which kinda makes sense, considering a directory isn't a file.
Now with this commit, if the url resolve to a directory, it will return a json array with the relative paths of the file in that directory.
* Make directory index work with ASAR archives
Also fix directory index having higher priority than normal requests and
simplify URL handling.
---------
Co-authored-by: Даниїл Григор'єв <dengr1065@gmail.com>
Remove the behavior of automatically opening developer tools when
launched with --dev command line switch. As --hide-devtools switch is
now unused, remove it as well.
Add a --watch command line flag to be used in tandem with --load-mod.
Chokidar is used to detect file updates, and a page reload is triggered
when there are any changes to watched mod files. Only mods loaded via
--load-mod are affected.
This implementation has a minor issue with how cache is cleared -
removing disk cache is a bit too aggressive - but the only alternative I
could find is to use a non-persistent Electron session, which would get
rid of disk cache entirely (this is not a concern).
Keep track of the storage ID in each renderer Storage instance and pass
it to the IPC bridge. Jobs are dispatched to the relevant handler (only
saves/ for now) and all (de)compression is handled there.
Add dedicated fs-job types to read or write and (de)compress data
from/to the file picked by the user. Remove redundant utility functions
that used web APIs instead.
Also fix a few issues in Electron code. This is not as polished yet, UI
from old mod support was reused for now and is likely broken. Mods can
be loaded, but there isn't much QoL around the support for now.
Only load the mod with highest priority for now. Proper behavior would
be to keep metadata for all duplicates and load the first that isn't
disabled. This allows easy mod source switching (for example, user mods
and development mods)
* Switch to npm in electron/
May change resolved package versions.
* Remove redundant electron-notarize dependency
The number of dependencies stays the same. Only direct mention in
package.json is removed.
* Assume Node.js 22.x and clean up dependencies
Targeting Node.js 22.x allows using the new fs.glob* functions, which
can replace the glob module. It is still downloaded as there are other
packages using it, but is no longer included in devDependencies.
Also remove @types/filesystem, as this API is not used anywhere in the
code, it is non-standard and some of it was removed from Chromium. Was
likely used with Cordova for YORG.io 3 mobile support.
* Update linting stack
Install the latest versions of the following packages:
- @eslint/js (^9.24.0)
- eslint (^9.24.0)
- typescript-eslint (^8.29.1)
and remove packages that are no longer used:
- @types/eslint__js
- yarn
Config files were not modified.
* Switch root package to npm
npm is able to resolve packages using yarn.lock as a resolution hint.
Note that files other than those included in this commit are
intentionally kept outdated, as they may need a bigger change.
Yarn seems to complain due to my hand-edited package.json, but
TypeScript packages are out of sync if I let it update the electron one.
To avoid these issues, update both packages.
Re-use the same openExternalUrl logic meant for frame navigation to
handle window.open calls as well. Possibly a partial solution, as the
ability to open new windows might be useful for mods.
When the game attempts to create the settings file but its directory
does not exist yet, an early error occurs. In reality, there is no way
for the directory to be created without user intervention. This change
makes sure the directory is created before any attempt to write a file
is done. Errors related to directory creation and/or file writes are
still reported as usual.
Unfortunately we have to keep a second copy for now. The lockfile
specifies the same version as used in the root package to avoid issues.
This may be replaced with Node.js type stripping in the future.
README.md is updated to include the correct command for testing the
Electron wrapper.
* Migrate Electron wrapper to ESM
Use ESM syntax for main process, move some fs usages to fs.promises,
switch to import.meta.url/import.meta.dirname to handle file paths;
clean up redundant code.
* Add TypeScript support to Electron wrapper
The support is very basic, tsc is used to transpile code. Build scripts
are modified to not copy any Electron code other than preload.cjs and
use an extremely cursed setup to call the TypeScript compiler.
* [TS] Rename platform/storage
* Rewrite Electron wrapper
MVP, missing some features from the old wrapper and most planned
features. Some of the functionality hasn't been verified.
Minimal set of changes, not a refactor yet. Make shapez store all of
its data in a single directory whose path is provided by Electron APIs.
Useless checks and web preferences are removed and app.isPackaged is
used to detect whether the app should try to load a localhost URL.
Prettier only takes the root .gitignore into account, which leads to
formatting of auto-generated files. Moving ignore patterns into the root
.gitignore file makes Prettier follow them and cleans up the workspace.
Many configuration files in this repository were created a long time
ago, then were modified as problems occurred. Now that there is
TypeScript support, it makes sense to clean up this mess, at least by
making small steps. This configuration is based on strict settings, but
most of these are currently disabled - otherwise it would be too hard to
work with existing JavaScript code. The downside of this change is
pollution of files with warnings and errors, even though they are valid.
- ESLint/TypeScript upgraded
- TS configuration is now shared between arbitrary Node scripts, Gulp
files and the Electron wrapper
- A few eslint-disable comments are removed
* Update Electron dependencies
This will break some mods and a few things were deprecated, but the
Electron wrapper will be replaced anyway.
* Add macOS and arm64 packaging tasks
As @chunkybanana has tested the general approach to building shapez on
macOS, I can now add these tasks. Aside from that, now there are tasks
to build for the 64-bit ARM variant of each system and a task that
builds packages for all platforms and architectures at once. A bug where
localConfig wasn't created when building for the first time was also
fixed.
* Remove deprecated TSLint config
* Remove jsconfig.json
jsconfig.json is an alternative name for tsconfig.json that has allowJs
set to true. Since the directory already contains a tsconfig.json file,
this file does nothing.
* Remove Gitpod configuration
Gitpod is not as useful in CE because we're focusing on standalone.
Also, the configuration was added just to promote the service and there
are other similar services which may be preferred by the user.
* Remove Travis CI configuration
Travis CI is not used in shapez anymore in favor of GitHub Actions. In
addition to that, CI setup for the community edition will be done once
the codebase is in a better condition.
* Remove CONTRIBUTORS and CONTRIBUTING.md
The contributors file is out of date and unneeded as GitHub now shows
all collaborators anyway - however it could be still used in the future
to show a list of contributors in the game. CONTRIBUTING.md contains the
text of CLA, which is not enforced in this repository.
* Replace VSC workspaces with regular settings files
VSCode workspaces don't provide much benefit in a source tree like
shapez. This commit also adds EditorConfig and ESLint VSCode extensions
to the recommended extensions list.
* Remove CI workflow for building the game
It hasn't been updated in a while and we don't need it for now. Once the
codebase is in a more managable state, a new workflow will be added.
* Remove some unused resources
There are still many resources left, but they will be removed along with
the relevant code later.
* initial modloader draft
* modloader features
* Refactor mods to use signals
* Add support for modifying and registering new transltions
* Minor adjustments
* Support for string building ids for mods
* Initial support for adding new buildings
* Refactor how mods are loaded to resolve circular dependencies and prepare for future mod loading
* Lazy Load mods to make sure all dependencies are loaded
* Expose all exported members automatically to mods
* Fix duplicate exports
* Allow loading mods from standalone
* update changelog
* Fix mods folder incorrect path
* Fix modloading in standalone
* Fix sprites not getting replaced, update demo mod
* Load dev mod via raw loader
* Improve mod developing so mods are directly ready to be deployed, load mods from local file server
* Proper mods ui
* Allow mods to register game systems and draw stuff
* Change mods path
* Fix sprites not loading
* Minor adjustments, closes#1333
* Add support for loading atlases via mods
* Add support for loading mods from external sources in DEV
* Add confirmation when loading mods
* Fix circular dependency
* Minor Keybindings refactor, add support for keybindings to mods, add support for dialogs to mods
* Add some mod signals
* refactor game loading states
* Make shapez exports global
* Start to make mods safer
* Refactor file system electron event handling
* Properly isolate electron renderer process
* Update to latest electron
* Show errors when loading mods
* Update confirm dialgo
* Minor restructure, start to add mod examples
* Allow adding custom themesw
* Add more examples and allow defining custom item processor operations
* Add interface to register new buildings
* Fixed typescript type errors (#1335)
* Refactor building registry, make it easier for mods to add new buildings
* Allow overriding existing methods
* Add more examples and more features
* More mod examples
* Make mod loading simpler
* Add example how to add custom drawings
* Remove unused code
* Minor modloader adjustments
* Support for rotation variants in mods (was broken previously)
* Allow mods to replace builtin sub shapes
* Add helper methods to extend classes
* Fix menu bar on mac os
* Remember window state
* Add support for paste signals
* Add example how to add custom components and systems
* Support for mod settings
* Add example for adding a new item type
* Update class extensions
* Minor adjustments
* Fix typo
* Add notification blocks mod example
* Add small tutorial
* Update readme
* Add better instructions
* Update JSDoc for Replacing Methods (#1336)
* upgraded types for overriding methods
* updated comments
Co-authored-by: Edward Badel <you@example.com>
* Direction lock now indicates when there is a building inbetween
* Fix mod examples
* Fix linter error
* Game state register (#1341)
* Added a gamestate register helper
Added a gamestate register helper
* Update mod_interface.js
* export build options
* Fix runBeforeMethod and runAfterMethod
* Minor game system code cleanup
* Belt path drawing optimization
* Fix belt path optimization
* Belt drawing improvements, again
* Do not render belts in statics disabled view
* Allow external URL to load more than one mod (#1337)
* Allow external URL to load more than one mod
Instead of loading the text returned from the remote server, load a JSON object with a `mods` field, containing strings of all the mods. This lets us work on more than one mod at a time or without separate repos. This will break tooling such as `create-shapezio-mod` though.
* Update modloader.js
* Prettier fixes
* Added link to create-shapezio-mod npm page (#1339)
Added link to create-shapezio-mod npm page: https://www.npmjs.com/package/create-shapezio-mod
* allow command line switch to load more than one mod (#1342)
* Fixed class handle type (#1345)
* Fixed class handle type
* Fixed import game state
* Minor adjustments
* Refactor item acceptor to allow only single direction slots
* Allow specifying minimumGameVersion
* Add sandbox example
* Replaced concatenated strings with template literals (#1347)
* Mod improvements
* Make wired pins component optional on the storage
* Fix mod examples
* Bind `this` for method overriding JSDoc (#1352)
* fix entity debugger reaching HTML elements (#1353)
* Store mods in savegame and show warning when it differs
* Closes#1357
* Fix All Shapez Exports Being Const (#1358)
* Allowed setting of variables inside webpack modules
* remove console log
* Fix stringification of things inside of eval
Co-authored-by: Edward Badel <you@example.com>
* Fix building placer intersection warning
* Add example for storing data in the savegame
* Fix double painter bug (#1349)
* Add example on how to extend builtin buildings
* update readme
* Disable steam achievements when playing with mods
* Update translations
Co-authored-by: Thomas (DJ1TJOO) <44841260+DJ1TJOO@users.noreply.github.com>
Co-authored-by: Bagel03 <70449196+Bagel03@users.noreply.github.com>
Co-authored-by: Edward Badel <you@example.com>
Co-authored-by: Emerald Block <69981203+EmeraldBlock@users.noreply.github.com>
Co-authored-by: saile515 <63782477+saile515@users.noreply.github.com>
Co-authored-by: Sense101 <67970865+Sense101@users.noreply.github.com>
* Puzzle mode (#1135)
* Add mode button to main menu
* [WIP] Add mode menu. Add factory-based gameMode creation
* Add savefile migration, serialize, deserialize
* Add hidden HUD elements, zone, and zoom, boundary constraints
* Clean up lint issues
* Add building, HUD exclusion, building exclusion, and refactor
- [WIP] Add ConstantProducer building that combines ConstantSignal
and ItemProducer functionality. Currently using temp assets.
- Add pre-placement check to the zone
- Use Rectangles for zone and boundary
- Simplify zone drawing
- Account for exclusion in savegame data
- [WIP] Add puzzle play and edit buttons in puzzle mode menu
* [WIP] Add building, component, and systems for producing and
accepting user-specified items and checking goal criteria
* Add ingame puzzle mode UI elements
- Add minimal menus in puzzle mode for back, next navigation
- Add lower menu for changing zone dimenensions
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
* Performance optimizations (#1154)
* 1.3.1 preparations
* Minor fixes, update translations
* Fix achievements not working
* Lots of belt optimizations, ~15% performance boost
* Puzzle mode, part 1
* Puzzle mode, part 2
* Fix missing import
* Puzzle mode, part 3
* Fix typo
* Puzzle mode, part 4
* Puzzle Mode fixes: Correct zone restrictions and more (#1155)
* Hide Puzzle Editor Controls in regular game mode, fix typo
* Disallow shrinking zone if there are buildings
* Fix multi-tile buildings for shrinking
* Puzzle mode, Refactor hud
* Puzzle mode
* Fixed typo in latest puzzle commit (#1156)
* Allow completing puzzles
* Puzzle mode, almost done
* Bump version to 1.4.0
* Fixes
* [puzzle] Prevent pipette cheats (miners, emitters) (#1158)
* Puzzle mode, almost done
* Allow clearing belts with 'B'
* Multiple users for the puzzle dlc
* Bump api key
* Minor adjustments
* Update
* Minor fixes
* Fix throughput
* Fix belts
* Minor puzzle adjustments
* New difficulty
* Minor puzzle improvements
* Fix belt path
* Update translations
* Added a button to return to the menu after a puzzle is completed (#1170)
* added another button to return to the menu
* improved menu return
* fixed continue button to not go back to menu
* [Puzzle] Added ability to lock buildings in the puzzle editor! (#1164)
* initial test
* tried to get it to work
* added icon
* added test exclusion
* reverted css
* completed flow for building locking
* added lock option
* finalized look and changed locked building to same sprite
* removed unused art
* added clearing every goal acceptor on lock to prevent creating impossible puzzles
* heavily improved validation and prevented autocompletion
* validation only checks every 100 ticks to improve performance
* validation only checks every 100 ticks to improve performance
* removed clearing goal acceptors as it isn't needed because of validation
* Add soundtrack, puzzle dlc fixes
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
Co-authored-by: dengr1065 <dengr1065@gmail.com>
Co-authored-by: Sense101 <67970865+Sense101@users.noreply.github.com>
* Changed electron fs-job to invoke, for simplefying storage
(And it helps for the modloader)
* Reverted some unneeded chages
* Uploaded wrong file
* Removed uneeded promise