@flourish/sdk 3.18.0 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -52,6 +52,7 @@ The main Flourish configuration file for your template. The top-level properties
52
52
  * `credits` Optional credits for data sources, map tiles, etc, in Markdown format
53
53
  * `image_download` Flag to indicate whether image snapshots work for the template (default is `true`)
54
54
  * `svg_download` Flag to indicate whether downloading a snapshot of template as SVG will work (default is `true`)
55
+ * `is_premium` Flag to indicate that this is a premium template, meaning only particular feature bundles give access to it (default is `false`)
55
56
 
56
57
  Other properties are [settings](#settings), [data](#data), [build](#build), and [tour](#tour), which are described below.
57
58
 
package/RELEASE_NOTES.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 3.19.0
2
+ * Add the `is_premium` top level property in template.yml to indicate that this is a premium template
3
+
4
+ # 3.18.1
5
+ * Addresses some technical debt.
6
+
1
7
  # 3.18.0
2
8
  * Support `tag` property in setting
3
9
 
@@ -55,59 +55,48 @@ process.on("unhandledRejection", function(reason, p) {
55
55
  throw reason;
56
56
  });
57
57
 
58
+ const COMMANDS = [
59
+ "help",
60
+ "version",
61
+ "new",
62
+ "build",
63
+ "run",
64
+ "register",
65
+ "login",
66
+ "logout",
67
+ "whoami",
68
+ "assign-version-number",
69
+ "publish",
70
+ "delete",
71
+ "upgrade",
72
+ "list",
73
+ "history"
74
+ ];
75
+
58
76
  function main() {
59
77
  const args = minimist(process.argv.slice(2), OPTS);
60
78
 
79
+ if (args._[0] === "is" && args._[1] === "the") {
80
+ return log.victory("Word!");
81
+ }
82
+
61
83
  // minimist unhelpfully treats numeric strings as numbers;
62
84
  // which means we have to turn them back into strings.
63
- args._ = args._.map(x => "" + x);
64
-
65
- let command = args._[0];
66
-
67
- const server_opts = {
68
- host: args.host,
69
- user: args.user,
70
- password: args.password,
71
- };
85
+ args._ = args._.map(String);
72
86
 
87
+ let [command] = args._;
73
88
  if (args.version) command = "version";
74
89
  else if (args.help) command = "help";
75
90
 
76
- switch (command) {
77
- case "help":
78
- case "version":
79
-
80
- case "new":
81
- case "build":
82
- case "run":
83
-
84
- case "register":
85
- case "login":
86
- case "logout":
87
-
88
- case "whoami":
89
-
90
- case "assign-version-number":
91
- case "publish":
92
- case "delete":
93
- case "upgrade":
94
- case "list":
95
- case "history":
96
- require("../lib/cmd/" + command)(args, server_opts);
97
- break;
98
-
99
- case "is":
100
- if (args._[1] === "the") {
101
- log.victory("Word!");
102
- break;
103
- }
104
-
105
- default:
106
- log.die("Unknown command '" + command + "'. Type 'flourish help' for help.");
91
+ if (!command) {
92
+ return log.die("No command specified. Type ‘flourish help’ for help.");
93
+ }
107
94
 
108
- case undefined:
109
- log.die("No command specified. Type flourish help for help.");
95
+ if (!COMMANDS.includes(command)) {
96
+ return log.die(`Unknown command '${command}'. Type 'flourish help' for help.`);
110
97
  }
98
+
99
+ require("../lib/cmd/" + command).command(args);
111
100
  }
112
101
 
113
102
  main();
@@ -5,7 +5,7 @@ const semver = require("@flourish/semver");
5
5
  const log = require("../log"),
6
6
  sdk = require("../sdk");
7
7
 
8
- function assign_version_number(args, server_opts) {
8
+ exports.command = function assign_version_number(args) {
9
9
  let template_id_promise, template_version;
10
10
  if (args._.length == 2) {
11
11
  // Assume the supplied argument is a version number, and try to get the id from the current directory
@@ -27,7 +27,7 @@ function assign_version_number(args, server_opts) {
27
27
 
28
28
  template_id_promise.then(template_id => {
29
29
  if (args.as) template_id = args.as + "/" + template_id;
30
- return sdk.request(server_opts, "template/assign-version-number", { id: template_id, version: template_version })
30
+ return sdk.request(args, "template/assign-version-number", { id: template_id, version: template_version })
31
31
  .then(() => {
32
32
  log.success(`Assigned version number ${template_version} to template ${template_id}`);
33
33
  });
@@ -36,14 +36,12 @@ function assign_version_number(args, server_opts) {
36
36
  if (args.debug) log.die("Failed to assign version number", error.message, error.stack);
37
37
  else log.die("Failed to assign version number", error.message);
38
38
  });
39
- }
39
+ };
40
40
 
41
- assign_version_number.help = `
41
+ exports.help = `
42
42
  flourish assign-version-number [template-id] version
43
43
 
44
44
  Assign a version number to a template that does not have one yet.
45
45
  If template-id is omitted, uses the id of the template in the
46
46
  current directory.
47
47
  `;
48
-
49
- module.exports = assign_version_number;
package/lib/cmd/build.js CHANGED
@@ -5,7 +5,7 @@ var fs = require("fs"),
5
5
  log = require("../log"),
6
6
  sdk = require("../sdk");
7
7
 
8
- function build(args) {
8
+ exports.command = function build(args) {
9
9
  const template_dir = ".";
10
10
  if (!fs.existsSync("template.yml")) {
11
11
  log.die("No template.yml file found in the current directory");
@@ -20,7 +20,7 @@ function build(args) {
20
20
  }
21
21
 
22
22
  sdk.buildRules(template_dir)
23
- .then((rules) => {
23
+ .then(async rules => {
24
24
  const script_by_key = new Map();
25
25
  for (const rule of rules) script_by_key.set(rule.key, rule.script);
26
26
 
@@ -32,17 +32,15 @@ function build(args) {
32
32
  scripts_to_run.push(script_by_key.get(key));
33
33
  }
34
34
 
35
- let p = Promise.resolve();
36
- for (let script of scripts_to_run) {
37
- p = p.then(() => sdk.runBuildCommand(template_dir, script, args.env));
35
+ for (const script of scripts_to_run) {
36
+ await sdk.runBuildCommand(template_dir, script, args.env);
38
37
  }
39
- return p;
40
38
  })
41
39
  .then(() => log.victory("Done!"))
42
40
  .catch((error) => log.die("Failed to build template", error.message, error.stack));
43
- }
41
+ };
44
42
 
45
- build.help = `
43
+ exports.help = `
46
44
  flourish build [options] [build rules...]
47
45
 
48
46
  Build the template in the current directory.
@@ -61,5 +59,3 @@ Options:
61
59
  Set the NODE_ENV environment variable to the specified value before running
62
60
  the build script.
63
61
  `;
64
-
65
- module.exports = build;
package/lib/cmd/delete.js CHANGED
@@ -3,7 +3,7 @@
3
3
  var log = require("../log"),
4
4
  sdk = require("../sdk");
5
5
 
6
- function _delete(args, server_opts) {
6
+ exports.command = function _delete(args) {
7
7
  let template_id = args._[1],
8
8
  template_version = args._[2];
9
9
 
@@ -14,7 +14,7 @@ function _delete(args, server_opts) {
14
14
  template_id = args.as + "/" + template_id;
15
15
  }
16
16
 
17
- sdk.request(server_opts, "template/delete", { id: template_id, version: template_version, force: !!args.force })
17
+ sdk.request(args, "template/delete", { id: template_id, version: template_version, force: !!args.force })
18
18
  .then(() => {
19
19
  if (template_version) {
20
20
  log.success(`Deleted template ${template_id} version ${template_version}`);
@@ -27,9 +27,9 @@ function _delete(args, server_opts) {
27
27
  if (args.debug) log.die("Failed to delete template", error.message, error.stack);
28
28
  else log.die("Failed to delete template", error.message);
29
29
  });
30
- }
30
+ };
31
31
 
32
- _delete.help = `
32
+ exports.help = `
33
33
  flourish delete [--force] template_id version
34
34
 
35
35
  Deletes the specified template from the server, assuming it has previously
@@ -44,5 +44,3 @@ If the template is in use by users other than you, it will not be possible
44
44
  to delete it. If you have used it, you can pass the --force flag to delete
45
45
  the template and associated visualisations.
46
46
  `;
47
-
48
- module.exports = _delete;
package/lib/cmd/help.js CHANGED
@@ -4,7 +4,7 @@ var path = require("path"),
4
4
 
5
5
  log = require("../log");
6
6
 
7
- function help(args) {
7
+ exports.command = function help(args) {
8
8
  const topic = args._[args._[0] === "help" ? 1 : 0] || "help";
9
9
 
10
10
  if (topic.indexOf(path.sep) == -1
@@ -18,9 +18,9 @@ function help(args) {
18
18
  log.die("No such help topic: " + topic);
19
19
  }
20
20
  }
21
- }
21
+ };
22
22
 
23
- help.help = `
23
+ exports.help = `
24
24
  Commands:
25
25
  flourish assign-version-number [template id] version
26
26
  flourish build [build rules...]
@@ -43,5 +43,3 @@ Type “flourish help [command]” for more on a particular command.
43
43
  To get started, use “flourish new” to create a new template and
44
44
  “flourish run” to run it.
45
45
  `;
46
-
47
- module.exports = help;
@@ -9,7 +9,7 @@ function byVersion(a, b) {
9
9
  return semver.cmp(semver.parse(a.version), semver.parse(b.version));
10
10
  }
11
11
 
12
- function history(args, server_opts) {
12
+ exports.command = function history(args) {
13
13
  const username_template_id = args._[1];
14
14
  if (!username_template_id) {
15
15
  log.die("Please specify a template id. E.g. flourish history my-template");
@@ -28,7 +28,7 @@ function history(args, server_opts) {
28
28
  else if (username_template_id) {
29
29
  template_id = username_template_id;
30
30
  }
31
- sdk.request(server_opts, "template/history", { username, id: template_id })
31
+ sdk.request(args, "template/history", { username, id: template_id })
32
32
  .then((result) => {
33
33
  const template_versions = result.sort(byVersion);
34
34
 
@@ -40,9 +40,9 @@ function history(args, server_opts) {
40
40
  }
41
41
  })
42
42
  .catch((error) => log.die("Failed to list template history", error.message, error.stack));
43
- }
43
+ };
44
44
 
45
- history.help = `
45
+ exports.help = `
46
46
  flourish history [template id]
47
47
 
48
48
  List the version numbers of a published template.
@@ -55,5 +55,3 @@ With the --full option, prints all the template metadata in JSON format.
55
55
 
56
56
  This command requires you to be logged in to an account.
57
57
  `;
58
-
59
- module.exports = history;
package/lib/cmd/list.js CHANGED
@@ -16,7 +16,7 @@ function byExternalIdAndVersion(a, b) {
16
16
  return semver.cmp(semver.parse(a.version), semver.parse(b.version));
17
17
  }
18
18
 
19
- function list(args, server_opts) {
19
+ exports.command = function list(args) {
20
20
  const username_template_id = args._[1];
21
21
  let username = args.as,
22
22
  template_id;
@@ -33,7 +33,7 @@ function list(args, server_opts) {
33
33
  else if (username_template_id) {
34
34
  template_id = username_template_id;
35
35
  }
36
- sdk.request(server_opts, "template/list", { username })
36
+ sdk.request(args, "template/list", { username })
37
37
  .then((result) => {
38
38
  let templates = result.templates;
39
39
 
@@ -55,9 +55,9 @@ function list(args, server_opts) {
55
55
  }
56
56
  })
57
57
  .catch((error) => log.die("Failed to list templates", error.message, error.stack));
58
- }
58
+ };
59
59
 
60
- list.help = `
60
+ exports.help = `
61
61
  flourish list [template id]
62
62
 
63
63
  List the ids and versions of your published templates.
@@ -69,5 +69,3 @@ With the --full option, prints all the template metadata in JSON format.
69
69
 
70
70
  This command requires you to be logged in to an account.
71
71
  `;
72
-
73
- module.exports = list;
package/lib/cmd/login.js CHANGED
@@ -7,7 +7,7 @@ var readline = require("readline"),
7
7
  log = require("../log"),
8
8
  sdk = require("../sdk");
9
9
 
10
- function login(args, server_opts) {
10
+ exports.command = function login(args) {
11
11
  function getEmail() {
12
12
  return new Promise(function(resolve, reject) {
13
13
  // If an email address was given on the command-line, use that
@@ -35,14 +35,14 @@ function login(args, server_opts) {
35
35
  }
36
36
 
37
37
  function login(email, password) {
38
- return sdk.request(server_opts, "user/login", { email: email, password: password })
38
+ return sdk.request(args, "user/login", { email: email, password: password })
39
39
  .then((response) => {
40
40
  const sdk_token = response.sdk_token || response.api_token;
41
41
  if (!sdk_token) {
42
42
  log.die("Unexpected response from server", JSON.stringify(response));
43
43
  }
44
44
 
45
- sdk.setSdkToken(server_opts, sdk_token)
45
+ sdk.setSdkToken(args, sdk_token)
46
46
  .then(() => log.victory("Logged in as " + email))
47
47
  .catch((error) => log.die("Failed to save SDK token", error.message));
48
48
  });
@@ -52,9 +52,9 @@ function login(args, server_opts) {
52
52
  .then((email) => Promise.all([email, getPassword()]))
53
53
  .then(([email, password]) => login(email, password))
54
54
  .catch((error) => log.die("Unexpected error", error.message, error.stack));
55
- }
55
+ };
56
56
 
57
- login.help = `
57
+ exports.help = `
58
58
  flourish login [email_address]
59
59
 
60
60
  Log in to Flourish. You will be prompted for a password.
@@ -65,5 +65,3 @@ When you have logged in successfully, your access token will be recorded
65
65
  in the file .flourish_sdk in your HOME or USERPROFILE directory. Subsequent
66
66
  flourish commands will use this token to authenticate with the server.
67
67
  `;
68
-
69
- module.exports = login;
package/lib/cmd/logout.js CHANGED
@@ -3,17 +3,15 @@
3
3
  var log = require("../log"),
4
4
  sdk = require("../sdk");
5
5
 
6
- function logout() {
6
+ exports.command = function logout() {
7
7
  sdk.deleteSdkTokens()
8
8
  .then(() => log.victory("Deleted all SDK tokens"))
9
9
  .catch((error) => log.die(error));
10
- }
10
+ };
11
11
 
12
- logout.help = `
12
+ exports.help = `
13
13
  flourish logout
14
14
 
15
15
  Deletes the .flourish_sdk file from your HOME or USERPROFILE directory. You
16
16
  will not be able to communicate with the server until you “flourish login”
17
17
  `;
18
-
19
- module.exports = logout;
package/lib/cmd/new.js CHANGED
@@ -7,7 +7,7 @@ var cross_spawn = require("cross-spawn"),
7
7
 
8
8
  log = require("../log");
9
9
 
10
- function _new(args) {
10
+ exports.command = function _new(args) {
11
11
  const new_template_path = args._[1];
12
12
  if (!new_template_path) {
13
13
  log.die("Please specify a directory name for the new template. E.g. flourish new my_template");
@@ -46,9 +46,9 @@ function _new(args) {
46
46
  "Try running it by hand");
47
47
  }
48
48
  });
49
- }
49
+ };
50
50
 
51
- _new.help = `
51
+ exports.help = `
52
52
  flourish new directory_name
53
53
 
54
54
  Creates a new skeleton Flourish template in the named directory,
@@ -58,5 +58,3 @@ The skeleton template has an example build configuration that uses
58
58
  Less to compile stylesheets and Rollup to bundle JavaScript code.
59
59
  You can run it in the SDK using “flourish run”.
60
60
  `;
61
-
62
- module.exports = _new;
@@ -48,6 +48,7 @@ function zipUpTemplate(template_dir, config) {
48
48
  categories: config.categories,
49
49
  joinable_data: config.joinable_data,
50
50
  tour: JSON.stringify(config.tour),
51
+ is_premium: config.is_premium,
51
52
  }), { name: "metadata.json" });
52
53
  if (config.settings) zip.append(JSON.stringify(config.settings), { name: "settings.js" });
53
54
  if (config.data) zip.append(JSON.stringify(config.data), { name: "data.json" });
@@ -110,7 +111,7 @@ async function uploadTemplate(server_opts, template_id, external_version, zip_fi
110
111
  return sdk.request(server_opts, "template/publish", body);
111
112
  }
112
113
 
113
- function publish(args, server_opts) {
114
+ exports.command = function publish(args) {
114
115
  const template_dir = args._[1] || ".";
115
116
 
116
117
  (args.build ? sdk.buildTemplate(template_dir, "production", "publish") : Promise.resolve())
@@ -139,11 +140,11 @@ function publish(args, server_opts) {
139
140
  log.success("Preparing template with id " + template_id + " for upload.");
140
141
 
141
142
  return zipUpTemplate(template_dir, config)
142
- .then((zip_filename) => uploadTemplate(server_opts, template_id, external_version, zip_filename))
143
- .then(() => sdk.request(server_opts, "user/whoami", {}))
143
+ .then((zip_filename) => uploadTemplate(args, template_id, external_version, zip_filename))
144
+ .then(() => sdk.request(args, "user/whoami", {}))
144
145
  .then((user_info) => {
145
146
  let protocol = "https";
146
- if (server_opts.host.match(/^(localhost|127\.0\.0\.1|.*\.local)(:\d+)?$/)) {
147
+ if (args.host.match(/^(localhost|127\.0\.0\.1|.*\.local)(:\d+)?$/)) {
147
148
  protocol = "http";
148
149
  }
149
150
 
@@ -156,12 +157,12 @@ function publish(args, server_opts) {
156
157
  }
157
158
  if (!external_version) {
158
159
  log.victory("Upload successful!",
159
- `Your template is available at ${protocol}://${server_opts.host}/@${template_path}`);
160
+ `Your template is available at ${protocol}://${args.host}/@${template_path}`);
160
161
  }
161
162
  else {
162
163
  const dt = new Date();
163
164
  log.victory(`Uploaded version ${external_version} on ${dt.toDateString()} at ${dt.toTimeString()}`,
164
- `Your template is available at ${protocol}://${server_opts.host}/@${template_path}/${external_version}`);
165
+ `Your template is available at ${protocol}://${args.host}/@${template_path}/${external_version}`);
165
166
  }
166
167
  warnings.forEach(warning => log.warn(warning));
167
168
  });
@@ -170,9 +171,9 @@ function publish(args, server_opts) {
170
171
  if (args.debug) log.die("Failed to upload template", error.message, error.stack);
171
172
  else log.die("Failed to upload template", error.message);
172
173
  });
173
- }
174
+ };
174
175
 
175
- publish.help = `
176
+ exports.help = `
176
177
  flourish publish [--patch] [--prerelease] [--release] [directory_name]
177
178
 
178
179
  Build and publish the template in the named directory, or in the current
@@ -192,5 +193,3 @@ Options:
192
193
  --release
193
194
  Remove the prerelease tag before publishing.
194
195
  `;
195
-
196
- module.exports = publish;
@@ -7,7 +7,7 @@ var readline = require("readline"),
7
7
  log = require("../log"),
8
8
  sdk = require("../sdk");
9
9
 
10
- function register(args, server_opts) {
10
+ exports.command = function register(args) {
11
11
  const questions = [
12
12
  { text: "Username: ", prop: "username" },
13
13
  { text: "Name: ", prop: "display_name" },
@@ -96,7 +96,7 @@ function register(args, server_opts) {
96
96
  }
97
97
 
98
98
  function register(answers) {
99
- return sdk.request(server_opts, "user/register", answers)
99
+ return sdk.request(args, "user/register", answers)
100
100
  .then((response) => {
101
101
  const sdk_token = response.sdk_token || response.api_token;
102
102
  if (!sdk_token) {
@@ -110,13 +110,13 @@ function register(args, server_opts) {
110
110
  .then((answers) => Promise.all([answers, getPassword()]))
111
111
  .then(([answers, password]) => Promise.all([answers, password, agreeTerms()]))
112
112
  .then(([answers, password, _]) => register(Object.assign(answers, { password })))
113
- .then((sdk_token) => sdk.setSdkToken(server_opts, sdk_token))
113
+ .then((sdk_token) => sdk.setSdkToken(args, sdk_token))
114
114
 
115
115
  .then(() => log.victory("Account registered successfully!"))
116
116
  .catch((error) => log.die(error.message));
117
- }
117
+ };
118
118
 
119
- register.help = `
119
+ exports.help = `
120
120
  flourish register
121
121
 
122
122
  Prompt for information and register an account with Flourish.
@@ -125,5 +125,3 @@ You will automatically be logged in to your new account.
125
125
  This account can be used on https://flourish.studio/ as well
126
126
  as in the SDK.
127
127
  `;
128
-
129
- module.exports = register;
package/lib/cmd/run.js CHANGED
@@ -8,7 +8,7 @@ var fs = require("fs"),
8
8
 
9
9
  server = require("../../server");
10
10
 
11
- function run(args) {
11
+ exports.command = function run(args) {
12
12
  const template_dir = args._[1] || ".";
13
13
  const port = +args.port;
14
14
 
@@ -61,9 +61,9 @@ function run(args) {
61
61
  });
62
62
  }
63
63
  });
64
- }
64
+ };
65
65
 
66
- run.help = `
66
+ exports.help = `
67
67
  flourish run [-o|--open] [--no-build] [--port=1685] [directory_name]
68
68
 
69
69
  Builds the template and runs the SDK server. If directory_name is omitted it
@@ -88,5 +88,3 @@ Options:
88
88
  --no-build
89
89
  Skip the build process
90
90
  `;
91
-
92
- module.exports = run;
@@ -48,7 +48,7 @@ function deleteIfExists(file_path) {
48
48
  });
49
49
  }
50
50
 
51
- function upgrade(template_dir) {
51
+ exports.upgrade = function upgrade(template_dir) {
52
52
  function loadSettings() {
53
53
  return loadFile([template_dir, "settings.js"], {})
54
54
  .then((contents) => {
@@ -78,16 +78,15 @@ function upgrade(template_dir) {
78
78
  return Promise.all([
79
79
  loadMetadata(),
80
80
  loadSettings(),
81
- loadTemplateDataBindings(),
82
- sdk.getSDKMajorVersion(),
81
+ loadTemplateDataBindings()
83
82
  ])
84
- .then(([metadata, settings, data_bindings, sdk_version]) => {
83
+ .then(([metadata, settings, data_bindings]) => {
85
84
  const o = {
86
85
  id: metadata.id,
87
86
  name: metadata.name,
88
87
  author: metadata.author,
89
88
 
90
- sdk_version,
89
+ sdk_version: sdk.SDK_MAJOR_VERSION,
91
90
 
92
91
  settings: settings
93
92
  };
@@ -127,7 +126,6 @@ function upgrade(template_dir) {
127
126
  .then(() => resolve(true), reject);
128
127
  });
129
128
  });
130
- }
129
+ };
131
130
 
132
- upgrade.title = "Convert configuration files to YAML format";
133
- module.exports = upgrade;
131
+ exports.title = "Convert configuration files to YAML format";
@@ -15,7 +15,7 @@ function convert(html) {
15
15
  });
16
16
  }
17
17
 
18
- function upgrade(template_dir) {
18
+ exports.upgrade = function upgrade(template_dir) {
19
19
  return new Promise(function(resolve, reject) {
20
20
  fs.stat(template_dir, function(error, stat) {
21
21
  if (error) reject(new Error(`Could not access ${template_dir}: ${error.message}`));
@@ -38,7 +38,6 @@ function upgrade(template_dir) {
38
38
  });
39
39
  });
40
40
  });
41
- }
41
+ };
42
42
 
43
- upgrade.title = "Convert index.html to mustache-free format";
44
- module.exports = upgrade;
43
+ exports.title = "Convert index.html to mustache-free format";
@@ -15,7 +15,7 @@ function addBuildRules(config) {
15
15
  return config;
16
16
  }
17
17
 
18
- function upgrade(template_dir) {
18
+ exports.upgrade = function upgrade(template_dir) {
19
19
  return new Promise(function(resolve, reject) {
20
20
  fs.stat(template_dir, function(error, stat) {
21
21
  if (error) reject(new Error(`Could not access ${template_dir}: ${error.message}`));
@@ -30,7 +30,6 @@ function upgrade(template_dir) {
30
30
  .then(resolve, reject);
31
31
  });
32
32
  });
33
- }
33
+ };
34
34
 
35
- upgrade.title = "Add build rules to template.yml";
36
- module.exports = upgrade;
35
+ exports.title = "Add build rules to template.yml";
@@ -3,7 +3,7 @@
3
3
  var fs = require("fs"),
4
4
  sdk = require("../../sdk");
5
5
 
6
- function upgrade(template_dir) {
6
+ exports.upgrade = function upgrade(template_dir) {
7
7
  return new Promise(function(resolve, reject) {
8
8
  fs.stat(template_dir, function(error, stat) {
9
9
  if (error) return reject(new Error(`Could not access ${template_dir}: ${error.message}`));
@@ -20,7 +20,6 @@ function upgrade(template_dir) {
20
20
  .then(resolve, reject);
21
21
  });
22
22
  });
23
- }
23
+ };
24
24
 
25
- upgrade.title = "Remove autoheight config from template.yml";
26
- module.exports = upgrade;
25
+ exports.title = "Remove autoheight config from template.yml";