First development of the deploy action (#6)
Some checks failed
Lint / pre-commit Linting (push) Has been cancelled
Some checks failed
Lint / pre-commit Linting (push) Has been cancelled
Deploy js code to an instance of screeps. Some debugging tools are implemented. Reviewed-on: #6 Co-authored-by: Philipp Horstenkamp <philipp@horstenkamp.de> Co-committed-by: Philipp Horstenkamp <philipp@horstenkamp.de>
This commit is contained in:
10
node_modules/expand-template/.travis.yml
generated
vendored
Normal file
10
node_modules/expand-template/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
sudo: false
|
||||
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- 4
|
||||
- 6
|
||||
- 8
|
||||
- 9
|
||||
- 10
|
43
node_modules/expand-template/README.md
generated
vendored
Normal file
43
node_modules/expand-template/README.md
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
# expand-template
|
||||
|
||||
> Expand placeholders in a template string.
|
||||
|
||||
[](https://www.npmjs.com/package/expand-template)
|
||||
[](https://travis-ci.org/ralphtheninja/expand-template)
|
||||
[](https://david-dm.org/ralptheninja/expand-template)
|
||||
[](https://standardjs.com)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm i expand-template -S
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Default functionality expands templates using `{}` as separators for string placeholders.
|
||||
|
||||
```js
|
||||
var expand = require('expand-template')()
|
||||
var template = '{foo}/{foo}/{bar}/{bar}'
|
||||
console.log(expand(template, {
|
||||
foo: 'BAR',
|
||||
bar: 'FOO'
|
||||
}))
|
||||
// -> BAR/BAR/FOO/FOO
|
||||
```
|
||||
|
||||
Custom separators:
|
||||
|
||||
```js
|
||||
var expand = require('expand-template')({ sep: '[]' })
|
||||
var template = '[foo]/[foo]/[bar]/[bar]'
|
||||
console.log(expand(template, {
|
||||
foo: 'BAR',
|
||||
bar: 'FOO'
|
||||
}))
|
||||
// -> BAR/BAR/FOO/FOO
|
||||
```
|
||||
|
||||
## License
|
||||
All code, unless stated otherwise, is dual-licensed under [`WTFPL`](http://www.wtfpl.net/txt/copying/) and [`MIT`](https://opensource.org/licenses/MIT).
|
25
node_modules/expand-template/index.js
generated
vendored
Normal file
25
node_modules/expand-template/index.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
module.exports = function (opts) {
|
||||
var sep = opts ? opts.sep : '{}'
|
||||
var len = sep.length
|
||||
|
||||
var whitespace = '\\s*'
|
||||
var left = escape(sep.substring(0, len / 2)) + whitespace
|
||||
var right = whitespace + escape(sep.substring(len / 2, len))
|
||||
|
||||
return function (template, values) {
|
||||
Object.keys(values).forEach(function (key) {
|
||||
template = template.replace(regExp(key), values[key])
|
||||
})
|
||||
return template
|
||||
}
|
||||
|
||||
function escape (s) {
|
||||
return [].map.call(s, function (char) {
|
||||
return '\\' + char
|
||||
}).join('')
|
||||
}
|
||||
|
||||
function regExp (key) {
|
||||
return new RegExp(left + key + right, 'g')
|
||||
}
|
||||
}
|
26
node_modules/expand-template/package.json
generated
vendored
Normal file
26
node_modules/expand-template/package.json
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "expand-template",
|
||||
"version": "1.1.1",
|
||||
"description": "Expand placeholders in a template string",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ralphtheninja/expand-template.git"
|
||||
},
|
||||
"homepage": "https://github.com/ralphtheninja/expand-template",
|
||||
"scripts": {
|
||||
"test": "tape test.js && standard"
|
||||
},
|
||||
"keywords": [
|
||||
"template",
|
||||
"expand",
|
||||
"replace"
|
||||
],
|
||||
"author": "LM <ralphtheninja@riseup.net>",
|
||||
"license": "WTFPL",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"standard": "^11.0.0",
|
||||
"tape": "^4.2.2"
|
||||
}
|
||||
}
|
47
node_modules/expand-template/test.js
generated
vendored
Normal file
47
node_modules/expand-template/test.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
var test = require('tape')
|
||||
var Expand = require('./')
|
||||
|
||||
test('default expands {} placeholders', function (t) {
|
||||
var expand = Expand()
|
||||
t.equal(typeof expand, 'function', 'is a function')
|
||||
t.equal(expand('{foo}/{bar}', {
|
||||
foo: 'BAR', bar: 'FOO'
|
||||
}), 'BAR/FOO')
|
||||
t.equal(expand('{foo}{foo}{foo}', {
|
||||
foo: 'FOO'
|
||||
}), 'FOOFOOFOO', 'expands one placeholder many times')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('support for custom separators', function (t) {
|
||||
var expand = Expand({ sep: '[]' })
|
||||
t.equal(expand('[foo]/[bar]', {
|
||||
foo: 'BAR', bar: 'FOO'
|
||||
}), 'BAR/FOO')
|
||||
t.equal(expand('[foo][foo][foo]', {
|
||||
foo: 'FOO'
|
||||
}), 'FOOFOOFOO', 'expands one placeholder many times')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('support for longer custom separators', function (t) {
|
||||
var expand = Expand({ sep: '[[]]' })
|
||||
t.equal(expand('[[foo]]/[[bar]]', {
|
||||
foo: 'BAR', bar: 'FOO'
|
||||
}), 'BAR/FOO')
|
||||
t.equal(expand('[[foo]][[foo]][[foo]]', {
|
||||
foo: 'FOO'
|
||||
}), 'FOOFOOFOO', 'expands one placeholder many times')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('whitespace-insensitive', function (t) {
|
||||
var expand = Expand({ sep: '[]' })
|
||||
t.equal(expand('[ foo ]/[ bar ]', {
|
||||
foo: 'BAR', bar: 'FOO'
|
||||
}), 'BAR/FOO')
|
||||
t.equal(expand('[ foo ][ foo ][ foo]', {
|
||||
foo: 'FOO'
|
||||
}), 'FOOFOOFOO', 'expands one placeholder many times')
|
||||
t.end()
|
||||
})
|
Reference in New Issue
Block a user