Skip to content

Commit

Permalink
🔀 Merge branch 'github-actions-test'
Browse files Browse the repository at this point in the history
  • Loading branch information
o4kapuk committed Nov 18, 2023
2 parents c765f04 + 32c36a4 commit bca4e62
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 12 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build npm package
on: push
jobs:
build:
if: contains(github.event.head_commit.message, '🔖')
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to use GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: '10.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@screeps'
- name: Install
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish (github)
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: '10.x'
registry-url: 'https://registry.npmjs.org'
scope: '@screeps'
- name: Publish (npmjs)
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
node_modules
.idea
.run
.github
build/config.gypi
src/local-config.js
dist/core
13 changes: 7 additions & 6 deletions package-lock.json

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

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{
"name": "@screeps/engine",
"version": "4.2.16",
"version": "4.2.17-rc1",
"bin": {
"screeps-engine-main": "dist/main.js",
"screeps-engine-runner": "dist/runner.js",
"screeps-engine-processor": "dist/processor.js"
},
"main": "dist/index.js",
"scripts": {
"test": "cross-env DRIVER_MODULE=@screeps/driver jasmine"
"test": "cross-env DRIVER_MODULE=@screeps/driver jasmine",
"prepublish": "gulp"
},
"dependencies": {
"@screeps/pathfinding": "^0.4.16",
"@screeps/pathfinding": "^0.4.17",
"bulk-require": "^0.2.1",
"cross-env": "^5.2.0",
"lodash": "3.10.1",
Expand Down Expand Up @@ -41,5 +42,8 @@
"transform-es2015-destructuring",
"transform-strict-mode"
]
},
"browser": {
"@screeps/core": "@screeps/simcore"
}
}
5 changes: 3 additions & 2 deletions src/game/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
C = driver.constants,
map = require('./map'),
market = require('./market'),
customPrototypes = require('./custom-prototypes');
customPrototypes = require('./custom-prototypes'),
system = { Function: { bind: Function.bind } };

var findCacheFn = {
[C.FIND_CREEPS]: (i) => !i.spawning,
Expand Down Expand Up @@ -505,7 +506,7 @@
!_.isObject(runCodeCache[userId].globals.require.cache.main) || !_.isFunction(
runCodeCache[userId].globals.require.cache.main.loop)) {

runCodeCache[userId].globals.require = requireFn.bind(runCodeCache[userId]);
runCodeCache[userId].globals.require = system.Function.bind.call(requireFn, runCodeCache[userId]);
runCodeCache[userId].globals.require.cache = {lodash: runCodeCache[userId].globals._};
runCodeCache[userId].globals.require.timestamp = runCodeCache[userId].runtimeData.userCodeTimestamp;
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ catch(e) {}
exports.getDriver = function getDriver() {
driver = typeof process != 'undefined' && process.env.DRIVER_MODULE ?
require(process.env.DRIVER_MODULE) :
require('./core/index');
require('@screeps/core');
loadDriver();
return driver;
};
Expand Down

0 comments on commit bca4e62

Please sign in to comment.