Skip to content

Commit

Permalink
v2.5.4
Browse files Browse the repository at this point in the history
- updated cycles
- added link to custom typed.js to speech box
- switched from uglify-js to terser
  • Loading branch information
ChapelR committed Jun 27, 2020
1 parent 4100ada commit 20f9bb4
Show file tree
Hide file tree
Showing 28 changed files with 121 additions and 43 deletions.
8 changes: 4 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// build me

var jetpack = require('fs-jetpack'),
uglify = require('uglify-js');
Terser = require('terser');

function build () {
var jsFiles = jetpack.find('./scripts', {
Expand All @@ -11,11 +11,11 @@ function build () {

jsFiles.forEach( function (file) {
var source = jetpack.read(file),
path = file.split(/[\\\/]/g),
name = path.pop().split('.').join('.min.'),
path = file.split(/[\\\/]/g),
name = path.pop().split('.').join('.min.'),
result, ret;

result = uglify.minify(source);
result = Terser.minify(source);

console.log(result.error);

Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Chapel's Custom Macro Collection (v2.5.3)
## Chapel's Custom Macro Collection (v2.5.4)

- [Try the demo!](https://macros.twinelab.net/demo)
- [Downloads](./download ':ignore')
Expand All @@ -8,7 +8,7 @@
### Documentation
- **Gameplay Systems and Mechanics**
- [The Simple Inventory System](./simple-inventory.md)
- [The Cycles System](./cycles-system.md)
- [The Cycles System](./cycles-system.md) *updated*
- [The Playtime System](./playtime-system.md)
- **Interface and Style**
- [The Dialog API Macro Set](./dialog-api-macro-set.md)
Expand All @@ -26,7 +26,7 @@
- [The Message Macro](./message-macro.md)
- [The Typing Simulation Macro](./type-sim.md)
- **Grammar and Language**
- [The Pronoun Templates](./pronoun-templates.md) *updated*
- [The Pronoun Templates](./pronoun-templates.md)
- [The Articles (A/An) Macros](./articles.md)
- **Utilities and Other**
- [The Done Macro](./done-macro.md)
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
> [!NOTE]
> I'm going to start keeping a changelog for these macros because keeping track of them is becoming a nightmare. The overall version numbers are not really helpful for tracking what's happening on a macro-by-macro basis, but I'm trying to stick to major version bumps meaning breaking changes in any macro, or complete refactors of the whole collection, like what v2.0.0 was. Minor version updates indicate new macros have been added. Patch version updates means individual macro updates and bug fixes, or documentation, website, or demo updates.
### June 27, 2020 (v2.5.4)

- **[Update]** Added `Cycle.check()` and `cycle#check()` methods to the cycles system.
- **[Docs]** Added link to custom `typed.js` module code (from Thomas M. Edwards) to the speech box system docs.
- **[Meta]** Replaced Uglify with Terser for JS minification.

### March 31, 2020 (v2.5.3)

- **[Update]** Several improvements to the pronoun macros:
Expand Down
44 changes: 44 additions & 0 deletions docs/cycles-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ Of particular note to authors:

- [`Cycle.add()`](#method-cycleadd)
- [`Cycle.get()`](#method-cycleget)
- [`Cycle.check()`](#method-cyclecheck)

#### Method: `Cycle.add()`

Expand Down Expand Up @@ -256,6 +257,27 @@ Returns the `Cycle` instance with the given name, or `null` if it doesn't exist.
var cycle = Cycle.get('blah');
```

#### Method: `Cycle.check()`

**Returns**: boolean.

**Syntax**: `Cycle.check(name, phase)`

Returns a whether the indicated `Cycle` instance is at the indicated phase

**Arguments**:

- `name`: The name of a previously defined cycle, by the [`<<newcycle>>` macro](#macro-ltltnewcyclegtgt) or the [`Cycle` API](#javascript-api).
- `phase`: The string name of one of the phases in this cycle.

**Usage**:

```
<<if Cycle.check('time', 'afternoon')>>
It's afternoon!
<</if>>
```

#### Method: `Cycle.del()`

**Returns**: boolean.
Expand Down Expand Up @@ -284,6 +306,7 @@ Cycle.get('blah'); // null
Deletes all registered cycles.

**Usage**:

```javascript
Cycle.add('blah', { phases : ['hey', 'hello'] });
Cycle.clear();
Expand All @@ -297,6 +320,7 @@ These are the methods of the `Cycle` instance. Methods that return the `Cycle` i
Of particular note to authors:

- [`cycle#current()`](#method-cyclecurrent)
- [`cycle#check()`](#method-instance-cyclecheck)
- [`cycle#update()`](#method-cycleupdate)

#### Method: `cycle#current()`
Expand All @@ -317,6 +341,26 @@ Cycle.get('blah').current();
<<= Cycle.get('blah').current().toUpperFirst()>>
```

#### Method (Instance): `cycle#check()`

**Returns**: boolean.

**Syntax**: `<cycle>.check(phase)`

Returns whether the cycle is at the indicated phase.

**Arguments**:

- `phase`: The string name of one of the phases in this cycle.

**Usage**:

```
<<if Cycle.get('time').check('afternoon')>>
It's afternoon.
<</if>>
```

#### Method: `cycle#update()`

**Returns**: This instance (chainable).
Expand Down
3 changes: 3 additions & 0 deletions docs/speech-box-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ The default look and styling is very bare bones, and meant to be a basic startin
> [!NOTE]
> Unlike most of my macros, this code relies on CSS files as well as JavaScript! Be sure to download and install the relevant CSS files as well!
> [!WARNING]
> If you want to use this system with the `typed.js` integration module, you'll need to use this custom JavaScript in place of that provided by the module: https://gist.github.com/tmedwards/4921bdcd7bfbb955530c135ee3feff83
**THE CODE:** [Minified JS](https://github.com/ChapelR/custom-macros-for-sugarcube-2/blob/master/scripts/minified/speech.min.js). [Pretty JS](https://github.com/ChapelR/custom-macros-for-sugarcube-2/blob/master/scripts/speech.js). [Minified CSS](https://github.com/ChapelR/custom-macros-for-sugarcube-2/blob/master/scripts/minified/speech.min.css). [Pretty CSS](https://github.com/ChapelR/custom-macros-for-sugarcube-2/blob/master/scripts/speech.css).
**DEMO:** [Available](http://macros.twinelab.net/demo?macro=speech).
**GUIDE:** Not available.
Expand Down
43 changes: 30 additions & 13 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-macros-for-sugarcube-2",
"version": "2.5.3",
"version": "2.5.4",
"description": "Collection of custom macros and systems for Twine/SugarCube2.",
"main": "build.js",
"directories": {
Expand All @@ -26,7 +26,7 @@
"homepage": "https://github.com/ChapelR/custom-macros-for-sugarcube-2#readme",
"devDependencies": {
"fs-jetpack": "^1.3.1",
"jshint": "^2.11.0",
"uglify-js": "^3.7.6"
"jshint": "^2.11.1",
"terser": "^4.8.0"
}
}
8 changes: 8 additions & 0 deletions scripts/cycles.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@
}
return false;
},
check : function (name, phase) {
if (Cycle.has(name)) {
return Cycle.get(name).check(phase);
}
},
clear : function (name) {
var got = _get();
got = {};
Expand Down Expand Up @@ -248,6 +253,9 @@
this.increment = set;
}
return this.increment;
},
check : function (phase) {
return this.current() === phase;
}
});

Expand Down
2 changes: 1 addition & 1 deletion scripts/minified/articles.min.js

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

2 changes: 1 addition & 1 deletion scripts/minified/continue.min.js

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

2 changes: 1 addition & 1 deletion scripts/minified/css-macro.min.js

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

Loading

0 comments on commit 20f9bb4

Please sign in to comment.