add upload script
This commit is contained in:
parent
6496f2d0ab
commit
4300c092cf
4 changed files with 35 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
dist/
|
||||
node_modules/
|
||||
node_modules/
|
||||
.env
|
||||
|
|
@ -8,7 +8,8 @@
|
|||
"build": "npx spack",
|
||||
"lint": "npx eslint src/",
|
||||
"prepare": "husky install",
|
||||
"test": "yarn lint"
|
||||
"test": "yarn lint",
|
||||
"push": "node ./upload.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/screeps": "^3.3.0"
|
||||
|
|
@ -18,6 +19,7 @@
|
|||
"@swc/core": "^1.3.23",
|
||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||
"@typescript-eslint/parser": "^5.47.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"eslint": "^8.30.0",
|
||||
"husky": "^8.0.0",
|
||||
"typescript": "^4.9.4"
|
||||
|
|
|
|||
25
upload.js
Normal file
25
upload.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
require('dotenv').config();
|
||||
const fs = require('fs');
|
||||
var https = require('https');
|
||||
|
||||
var data = {
|
||||
branch: 'world',
|
||||
modules: {
|
||||
main: fs.readFileSync('./dist/screeps.js', 'utf-8').toString(),
|
||||
}
|
||||
};
|
||||
|
||||
var req = https.request({
|
||||
hostname: 'screeps.com',
|
||||
port: 443,
|
||||
path: '/api/user/code',
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
'X-Token': process.env.SCREEPS_API_TOKEN
|
||||
}
|
||||
});
|
||||
|
||||
req.write(JSON.stringify(data));
|
||||
req.end();
|
||||
|
|
@ -363,6 +363,11 @@ doctrine@^3.0.0:
|
|||
dependencies:
|
||||
esutils "^2.0.2"
|
||||
|
||||
dotenv@^16.0.3:
|
||||
version "16.0.3"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07"
|
||||
integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==
|
||||
|
||||
escape-string-regexp@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue