@tapestry-mud/cli 0.3.11 → 0.4.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/bin/tapestry.js CHANGED
@@ -255,7 +255,7 @@ program
255
255
 
256
256
  program
257
257
  .command('validate')
258
- .description('Validate tapestry.yaml in the current directory')
258
+ .description('Validate pack.yaml in the current directory')
259
259
  .action(() => {
260
260
  try {
261
261
  validate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapestry-mud/cli",
3
- "version": "0.3.11",
3
+ "version": "0.4.0",
4
4
  "description": "CLI for the Tapestry MUD engine",
5
5
  "bin": {
6
6
  "tapestry": "./bin/tapestry.js"
@@ -3,6 +3,7 @@
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
  const { generatePackFiles } = require('../scaffold/templates');
6
+ const { PACK_MANIFEST } = require('../lib/manifest');
6
7
 
7
8
  function parseName(name) {
8
9
  const scopedMatch = name.match(/^@([a-z0-9-]+)\/([a-z0-9-]+)$/);
@@ -59,7 +60,7 @@ function createPack(name, cwd) {
59
60
  console.log(` ${file.path}`);
60
61
  }
61
62
  }
62
- console.log('\nEdit tapestry.yaml, then run: tapestry validate');
63
+ console.log(`\nEdit ${PACK_MANIFEST}, then run: tapestry validate`);
63
64
  }
64
65
  }
65
66
 
@@ -10,6 +10,7 @@ const { fetchTarball, DEFAULT_REGISTRY } = require('../lib/registry-client');
10
10
  const { verifyIntegrity, saveTarball, extractTarball } = require('../lib/tarball');
11
11
  const { addPackageToBoot } = require('../lib/boot');
12
12
  const { loadToken } = require('../lib/auth');
13
+ const { PACK_MANIFEST } = require('../lib/manifest');
13
14
 
14
15
  function packInstallPath(cwd, packageName) {
15
16
  const parts = packageName.split('/');
@@ -37,7 +38,7 @@ async function installResolved(cwd, resolved, token) {
37
38
  const destDir = packInstallPath(cwd, packageName);
38
39
 
39
40
  if (fs.existsSync(destDir)) {
40
- const installedManifestPath = path.join(destDir, 'tapestry.yaml');
41
+ const installedManifestPath = path.join(destDir, PACK_MANIFEST);
41
42
  if (fs.existsSync(installedManifestPath)) {
42
43
  const installed = readYaml(installedManifestPath);
43
44
  if (installed.version === info.version) {
@@ -67,7 +68,7 @@ async function installResolved(cwd, resolved, token) {
67
68
  }
68
69
  }
69
70
 
70
- const packManifest = readYaml(path.join(destDir, 'tapestry.yaml'));
71
+ const packManifest = readYaml(path.join(destDir, PACK_MANIFEST));
71
72
  addPackageToBoot(cwd, packageName, packManifest);
72
73
  }
73
74
  }
@@ -5,6 +5,7 @@ const path = require('path');
5
5
  const { readLock } = require('../lib/lock-file');
6
6
  const { readBoot } = require('../lib/boot');
7
7
  const { readYaml } = require('../util/yaml');
8
+ const { PACK_MANIFEST } = require('../lib/manifest');
8
9
 
9
10
  function packInstallPath(cwd, packageName) {
10
11
  const parts = packageName.split('/');
@@ -32,7 +33,7 @@ async function list({ cwd = process.cwd() } = {}) {
32
33
  const enabled = boot.packs[pkgName]?.enabled !== false ? 'enabled' : 'disabled';
33
34
 
34
35
  let type = '';
35
- const packManifestPath = path.join(packInstallPath(cwd, pkgName), 'tapestry.yaml');
36
+ const packManifestPath = path.join(packInstallPath(cwd, pkgName), PACK_MANIFEST);
36
37
  if (fs.existsSync(packManifestPath)) {
37
38
  try {
38
39
  type = readYaml(packManifestPath).type || '';
@@ -3,12 +3,13 @@
3
3
  const path = require('path');
4
4
  const { readYaml } = require('../util/yaml');
5
5
  const { buildTarball, computeIntegrity } = require('../lib/tarball-builder');
6
+ const { PACK_MANIFEST } = require('../lib/manifest');
6
7
  const { validate } = require('./validate');
7
8
 
8
9
  async function pack({ cwd = process.cwd() } = {}) {
9
10
  validate({ cwd });
10
11
 
11
- const manifest = readYaml(path.join(cwd, 'tapestry.yaml'));
12
+ const manifest = readYaml(path.join(cwd, PACK_MANIFEST));
12
13
  const shortName = manifest.name.split('/')[1];
13
14
  const outputPath = path.join(cwd, `${shortName}-${manifest.version}.tgz`);
14
15
 
@@ -8,13 +8,14 @@ const FormData = require('form-data');
8
8
  const { readYaml } = require('../util/yaml');
9
9
  const { validate } = require('./validate');
10
10
  const { buildTarball, computeIntegrity } = require('../lib/tarball-builder');
11
+ const { PACK_MANIFEST } = require('../lib/manifest');
11
12
  const { requireToken } = require('../lib/auth');
12
13
  const { DEFAULT_REGISTRY, throwIfError } = require('../lib/registry-client');
13
14
 
14
15
  async function publish({ cwd = process.cwd(), registryUrl = DEFAULT_REGISTRY } = {}) {
15
16
  validate({ cwd });
16
17
 
17
- const manifest = readYaml(path.join(cwd, 'tapestry.yaml'));
18
+ const manifest = readYaml(path.join(cwd, PACK_MANIFEST));
18
19
  const token = requireToken();
19
20
 
20
21
  const shortName = manifest.name.split('/')[1];
@@ -9,6 +9,7 @@ const { readLock, writeLock } = require('../lib/lock-file');
9
9
  const { fetchTarball, DEFAULT_REGISTRY } = require('../lib/registry-client');
10
10
  const { verifyIntegrity, saveTarball, extractTarball } = require('../lib/tarball');
11
11
  const { addPackageToBoot } = require('../lib/boot');
12
+ const { PACK_MANIFEST } = require('../lib/manifest');
12
13
 
13
14
  function packInstallPath(cwd, packageName) {
14
15
  const parts = packageName.split('/');
@@ -69,7 +70,7 @@ async function update(packageArg, { cwd = process.cwd(), registryUrl = DEFAULT_R
69
70
  }
70
71
  }
71
72
 
72
- const packManifest = readYaml(path.join(destDir, 'tapestry.yaml'));
73
+ const packManifest = readYaml(path.join(destDir, PACK_MANIFEST));
73
74
  addPackageToBoot(cwd, packageName, packManifest);
74
75
  }
75
76
 
@@ -4,11 +4,20 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const { readYaml } = require('../util/yaml');
6
6
  const { validatePackageManifest } = require('../schema/manifest');
7
+ const { PACK_MANIFEST } = require('../lib/manifest');
7
8
 
8
9
  function validate({ cwd = process.cwd() } = {}) {
9
- const manifestPath = path.join(cwd, 'tapestry.yaml');
10
+ const manifestPath = path.join(cwd, PACK_MANIFEST);
10
11
  if (!fs.existsSync(manifestPath)) {
11
- throw new Error('No tapestry.yaml found in current directory');
12
+ const serverPath = path.join(cwd, 'tapestry.yaml');
13
+ if (fs.existsSync(serverPath)) {
14
+ throw new Error(
15
+ `No ${PACK_MANIFEST} found in current directory. ` +
16
+ `The tapestry.yaml here is a server manifest. ` +
17
+ `Pack validation requires ${PACK_MANIFEST}.`
18
+ );
19
+ }
20
+ throw new Error(`No ${PACK_MANIFEST} found in current directory`);
12
21
  }
13
22
 
14
23
  const data = readYaml(manifestPath);
@@ -18,7 +27,11 @@ function validate({ cwd = process.cwd() } = {}) {
18
27
  if (!result.success) {
19
28
  for (const issue of result.error.issues) {
20
29
  const fieldPath = issue.path.join('.') || 'root';
21
- console.log(` error: ${fieldPath} - ${issue.message}`);
30
+ let message = issue.message;
31
+ if (fieldPath === 'engine' && data.engine && typeof data.engine === 'object') {
32
+ message += `. engine must be a version constraint string in pack manifests (e.g. '>=0.0.1'). Object format is for server manifests (tapestry.yaml).`;
33
+ }
34
+ console.log(` error: ${fieldPath} - ${message}`);
22
35
  }
23
36
  throw new Error(`${result.error.issues.length} validation error(s)`);
24
37
  }
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const PACK_MANIFEST = 'pack.yaml';
4
+
5
+ module.exports = { PACK_MANIFEST };
@@ -404,7 +404,7 @@ see_also: [help, commands]
404
404
 
405
405
  function generatePackFiles({ scopedName, shortName }) {
406
406
  return [
407
- { path: 'tapestry.yaml', content: manifestTemplate(scopedName) },
407
+ { path: 'pack.yaml', content: manifestTemplate(scopedName) },
408
408
  { path: 'tags.yml', content: tagsTemplate() },
409
409
  { path: 'areas/example-area/area.yaml', content: areaTemplate() },
410
410
  { path: 'areas/example-area/rooms/town-square.yaml', content: roomTemplate(shortName) },