sandstone-cli 0.6.1 → 0.6.2

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
@@ -19,7 +19,7 @@ $ npm install -g sandstone-cli
19
19
  $ sand COMMAND
20
20
  running command...
21
21
  $ sand (-v|--version|version)
22
- sandstone-cli/0.6.1 linux-x64 node-v16.19.0
22
+ sandstone-cli/0.6.2 linux-x64 node-v16.19.1
23
23
  $ sand --help [COMMAND]
24
24
  USAGE
25
25
  $ sand COMMAND
@@ -84,7 +84,7 @@ EXAMPLES
84
84
  $ sand build --verbose --dry
85
85
  ```
86
86
 
87
- _See code: [src/commands/build.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.1/src/commands/build.ts)_
87
+ _See code: [src/commands/build.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.2/src/commands/build.ts)_
88
88
 
89
89
  ## `sand create PROJECT-NAME`
90
90
 
@@ -118,7 +118,7 @@ EXAMPLE
118
118
  $ sand create my-pack
119
119
  ```
120
120
 
121
- _See code: [src/commands/create.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.1/src/commands/create.ts)_
121
+ _See code: [src/commands/create.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.2/src/commands/create.ts)_
122
122
 
123
123
  ## `sand help [COMMAND]`
124
124
 
@@ -160,7 +160,7 @@ EXAMPLES
160
160
  $ sand update --cli --sandstone --skip
161
161
  ```
162
162
 
163
- _See code: [src/commands/update.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.1/src/commands/update.ts)_
163
+ _See code: [src/commands/update.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.2/src/commands/update.ts)_
164
164
 
165
165
  ## `sand watch PATH CONFIG-PATH`
166
166
 
@@ -212,5 +212,5 @@ EXAMPLES
212
212
  $ sand watch --verbose --dry
213
213
  ```
214
214
 
215
- _See code: [src/commands/watch.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.1/src/commands/watch.ts)_
215
+ _See code: [src/commands/watch.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.2/src/commands/watch.ts)_
216
216
  <!-- commandsstop -->
@@ -23,4 +23,4 @@ export declare type BuildOptions = {
23
23
  *
24
24
  * @param changedFiles The files that changed since the last build.
25
25
  */
26
- export declare function buildProject(options: BuildOptions, folders: ProjectFolders, resourceTypes: string[], changedFiles?: string[]): Promise<void>;
26
+ export declare function buildProject(options: BuildOptions, folders: ProjectFolders, changedFiles?: string[]): Promise<void>;
@@ -34,6 +34,7 @@ const madge_1 = __importDefault(require("madge"));
34
34
  const graph_1 = require("./graph");
35
35
  const chalk_1 = __importDefault(require("chalk"));
36
36
  const adm_zip_1 = __importDefault(require("adm-zip"));
37
+ const delete_empty_1 = __importDefault(require("delete-empty"));
37
38
  const pe = new pretty_error_1.default();
38
39
  // Return the hash of a string
39
40
  function hash(stringToHash) {
@@ -54,7 +55,7 @@ async function mkDir(dirPath) {
54
55
  // Directory already exists
55
56
  }
56
57
  }
57
- let cache = {};
58
+ let cache;
58
59
  const dependenciesCache = new graph_1.DependencyGraph({});
59
60
  const fileResources = new Map();
60
61
  function getNewModules(dependenciesGraph, rawFiles, projectFolder) {
@@ -79,7 +80,7 @@ function diffMap(map1, map2) {
79
80
  return new Map([...map1.entries()].filter(([key, value]) => !map2.has(key)));
80
81
  }
81
82
  function diffResources(tree1, tree2) {
82
- return tree1.diff(tree2);
83
+ return diffSet(tree1, tree2);
83
84
  }
84
85
  /**
85
86
  *
@@ -131,8 +132,8 @@ async function getClientPath() {
131
132
  *
132
133
  * @param projectFolder The folder of the project. It needs a sandstone.config.ts, and it or one of its parent needs a package.json.
133
134
  */
134
- async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandstoneConfigFolder }, resourceTypes, changedFiles) {
135
- var _a, _b, _c, _d, _e;
135
+ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandstoneConfigFolder }, changedFiles) {
136
+ var _a, _b, _c, _d, _e, _f, _g;
136
137
  const sandstoneLocation = path_1.default.join(rootFolder, 'node_modules/sandstone/');
137
138
  // First, read sandstone.config.ts to get all properties
138
139
  const sandstoneConfig = require(path_1.default.join(sandstoneConfigFolder, 'sandstone.config.ts')).default;
@@ -183,6 +184,7 @@ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandsto
183
184
  else {
184
185
  process.env.SANDSTONE_ENV = 'development';
185
186
  }
187
+ process.env.WORKING_DIR = absProjectFolder;
186
188
  if (sandstoneConfig.packUid) {
187
189
  process.env.PACK_UID = sandstoneConfig.packUid;
188
190
  }
@@ -193,13 +195,8 @@ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandsto
193
195
  }
194
196
  const { onConflict } = sandstoneConfig;
195
197
  if (onConflict) {
196
- if (onConflict.default) {
197
- process.env[`GENERAL_CONFLICT_STRATEGY`] = onConflict.default;
198
- }
199
- for (const resource of resourceTypes) {
200
- if (onConflict[resource]) {
201
- process.env[`${resource.toUpperCase()}_CONFLICT_STRATEGY`] = onConflict[resource];
202
- }
198
+ for (const resource of Object.entries(onConflict)) {
199
+ process.env[`${resource[0].toUpperCase()}_CONFLICT_STRATEGY`] = resource[1];
203
200
  }
204
201
  }
205
202
  // JSON indentation
@@ -296,40 +293,115 @@ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandsto
296
293
  // Setup the cache if it doesn't exist.
297
294
  // This cache is here to avoid writing files on disk when they did not change.
298
295
  const newCache = {};
296
+ const cacheFile = path_1.default.join(rootFolder, '.sandstone', 'cache.json');
299
297
  if (cache === undefined) {
300
- cache = {};
298
+ let oldCache;
299
+ try {
300
+ const fileRead = await fs_extra_1.default.readFile(cacheFile, 'utf8');
301
+ if (fileRead) {
302
+ oldCache = JSON.parse(fileRead);
303
+ }
304
+ }
305
+ catch { }
306
+ if (oldCache) {
307
+ cache = oldCache;
308
+ }
309
+ else {
310
+ cache = {};
311
+ }
301
312
  }
302
313
  // Save the pack
303
314
  // Run the beforeSave script (TODO: This is where sandstone-server will remove restart env vars)
304
315
  await ((_c = scripts === null || scripts === void 0 ? void 0 : scripts.beforeSave) === null || _c === void 0 ? void 0 : _c.call(scripts));
316
+ const excludeOption = (_d = saveOptions.resources) === null || _d === void 0 ? void 0 : _d.exclude;
317
+ const fileExclusions = excludeOption ? {
318
+ generated: (excludeOption.generated || excludeOption),
319
+ existing: (excludeOption.existing || excludeOption)
320
+ } : false;
321
+ const fileHandlers = ((_e = saveOptions.resources) === null || _e === void 0 ? void 0 : _e.handle) || false;
305
322
  const packTypes = await sandstonePack.save({
306
323
  // Additional parameters
307
- dryRun: cliOptions.dry,
324
+ dry: cliOptions.dry,
308
325
  verbose: cliOptions.verbose,
309
- fileHandler: (_d = saveOptions.customFileHandler) !== null && _d !== void 0 ? _d : (async ({ relativePath, content, contentSummary }) => {
310
- // We hash the relative path alongside the content to ensure unique hash.
311
- const hashValue = hash(contentSummary + relativePath);
312
- // Add to new cache.
313
- newCache[relativePath] = hashValue;
314
- if (cache[relativePath] === hashValue) {
315
- // Already in cache - skip
316
- return;
326
+ fileHandler: (_f = saveOptions.customFileHandler) !== null && _f !== void 0 ? _f : (async (relativePath, content) => {
327
+ let pathPass = true;
328
+ if (fileExclusions && fileExclusions.generated) {
329
+ for (const exclude of fileExclusions.generated) {
330
+ if (!Array.isArray(exclude)) {
331
+ pathPass = !exclude.test(relativePath);
332
+ }
333
+ }
334
+ }
335
+ if (fileHandlers) {
336
+ for (const handler of fileHandlers) {
337
+ if (handler.path.test(relativePath)) {
338
+ content = await handler.callback(content);
339
+ }
340
+ }
341
+ }
342
+ if (pathPass) {
343
+ // We hash the relative path alongside the content to ensure unique hash.
344
+ const hashValue = hash(content + relativePath);
345
+ // Add to new cache.
346
+ newCache[relativePath] = hashValue;
347
+ if (cache[relativePath] === hashValue) {
348
+ // Already in cache - skip
349
+ return;
350
+ }
351
+ // Not in cache: write to disk
352
+ const realPath = path_1.default.join(outputFolder, relativePath);
353
+ await mkDir(path_1.default.dirname(realPath));
354
+ return await fs_extra_1.default.writeFile(realPath, content);
317
355
  }
318
- // Not in cache: write to disk
319
- const realPath = path_1.default.join(rootFolder, relativePath);
320
- await mkDir(path_1.default.dirname(realPath));
321
- return await fs_extra_1.default.writeFile(realPath, content);
322
356
  })
323
357
  });
324
- async function archiveOutput(packType, outputPath) {
358
+ async function handleResources(packType) {
359
+ const working = path_1.default.join(rootFolder, 'resources', packType);
360
+ for await (const file of (0, klaw_1.default)(path_1.default.join(rootFolder, 'resources', packType), { filter: (_path) => {
361
+ const relativePath = path_1.default.join(packType, _path.split(working)[1]);
362
+ let pathPass = true;
363
+ if (fileExclusions && fileExclusions.existing) {
364
+ for (const exclude of fileExclusions.existing) {
365
+ pathPass = Array.isArray(exclude) ? !exclude[0].test(relativePath) : !exclude.test(relativePath);
366
+ }
367
+ }
368
+ return pathPass;
369
+ } })) {
370
+ const relativePath = path_1.default.join(packType, file.path.split(working)[1]);
371
+ try {
372
+ let content = await fs_extra_1.default.readFile(file.path);
373
+ if (fileHandlers) {
374
+ for (const handler of fileHandlers) {
375
+ if (handler.path.test(relativePath)) {
376
+ content = await handler.callback(content);
377
+ }
378
+ }
379
+ }
380
+ // We hash the relative path alongside the content to ensure unique hash.
381
+ const hashValue = hash(content + relativePath);
382
+ // Add to new cache.
383
+ newCache[relativePath] = hashValue;
384
+ if (cache[relativePath] !== hashValue) {
385
+ // Not in cache: write to disk
386
+ const realPath = path_1.default.join(outputFolder, relativePath);
387
+ await mkDir(path_1.default.dirname(realPath));
388
+ await fs_extra_1.default.writeFile(realPath, content);
389
+ }
390
+ }
391
+ catch (e) { }
392
+ }
393
+ }
394
+ async function archiveOutput(packType) {
395
+ const outputPath = path_1.default.join(rootFolder, '.sandstone/output/archives', `${packName}_${packType.type}`);
325
396
  const archive = new adm_zip_1.default();
326
397
  await archive.addLocalFolderPromise(outputPath, {});
327
398
  await archive.writeZipPromise(`${outputPath}.zip`, { overwrite: true });
328
399
  }
329
400
  // TODO: implement linking to make the cache more useful when not archiving.
330
401
  if (!cliOptions.production) {
331
- for (const packType of packTypes) {
332
- const outputPath = path_1.default.join(rootFolder, '.sandstone/output/archives', `${packName}_${packType.type}`);
402
+ for await (const _packType of packTypes) {
403
+ const packType = _packType[1];
404
+ const outputPath = path_1.default.join(rootFolder, '.sandstone/output', packType.type);
333
405
  if (packType.handleOutput) {
334
406
  await packType.handleOutput('output', async (relativePath, encoding = 'utf8') => await fs_extra_1.default.readFile(path_1.default.join(outputPath, relativePath), encoding), async (relativePath, contents) => {
335
407
  if (contents === undefined) {
@@ -340,8 +412,9 @@ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandsto
340
412
  }
341
413
  });
342
414
  }
415
+ handleResources(packType.type);
343
416
  if (packType.archiveOutput) {
344
- archiveOutput(packType, outputPath);
417
+ archiveOutput(packType);
345
418
  }
346
419
  // Handle client
347
420
  if (!(server && packType.networkSides === 'server')) {
@@ -405,7 +478,7 @@ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandsto
405
478
  }
406
479
  }
407
480
  else {
408
- for (const packType of packTypes) {
481
+ for await (const packType of packTypes) {
409
482
  const outputPath = path_1.default.join(rootFolder, '.sandstone/output/archives', `${packName}_${packType.type}`);
410
483
  if (packType.handleOutput) {
411
484
  await packType.handleOutput('output', async (relativePath, encoding = 'utf8') => await fs_extra_1.default.readFile(path_1.default.join(outputPath, relativePath), encoding), async (relativePath, contents) => {
@@ -417,19 +490,25 @@ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandsto
417
490
  }
418
491
  });
419
492
  }
493
+ handleResources(packType.type);
420
494
  if (packType.archiveOutput) {
421
- archiveOutput(packType, outputPath);
495
+ archiveOutput(packType);
422
496
  }
423
497
  }
424
498
  }
425
499
  // Delete old files that aren't cached anymore
426
500
  const oldFilesNames = new Set(Object.keys(cache));
427
501
  Object.keys(newCache).forEach(name => oldFilesNames.delete(name));
428
- await Promise.allSettled([...oldFilesNames.values()].map(name => (0, util_1.promisify)(fs_extra_1.default.rm)(path_1.default.join(outputFolder, name))));
502
+ await Promise.allSettled([...oldFilesNames.values()].map(name => {
503
+ return (0, util_1.promisify)(fs_extra_1.default.rm)(path_1.default.join(outputFolder, name));
504
+ }));
505
+ await (0, delete_empty_1.default)(outputFolder);
429
506
  // Override old cache
430
507
  cache = newCache;
508
+ // Write the cache to disk
509
+ await fs_extra_1.default.writeFile(cacheFile, JSON.stringify(cache));
431
510
  // Run the afterAll script
432
- await ((_e = scripts === null || scripts === void 0 ? void 0 : scripts.afterAll) === null || _e === void 0 ? void 0 : _e.call(scripts));
511
+ await ((_g = scripts === null || scripts === void 0 ? void 0 : scripts.afterAll) === null || _g === void 0 ? void 0 : _g.call(scripts));
433
512
  }
434
513
  /**
435
514
  * Build the project. Will log errors and never throw any.
@@ -440,12 +519,12 @@ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandsto
440
519
  *
441
520
  * @param changedFiles The files that changed since the last build.
442
521
  */
443
- async function buildProject(options, folders, resourceTypes, changedFiles) {
522
+ async function buildProject(options, folders, changedFiles) {
444
523
  try {
445
- await _buildProject(options, folders, resourceTypes, changedFiles);
524
+ await _buildProject(options, folders, changedFiles);
446
525
  }
447
526
  catch (err) {
448
- logError(err);
527
+ console.log(err);
449
528
  }
450
529
  }
451
530
  exports.buildProject = buildProject;
@@ -454,6 +533,7 @@ function logError(err, file) {
454
533
  if (file) {
455
534
  console.error(' ' + chalk_1.default.bgRed.white('BuildError') + chalk_1.default.gray(':'), `While loading "${file}", the following error happened:\n`);
456
535
  }
536
+ debugger;
457
537
  console.error(pe.render(err));
458
538
  }
459
539
  }
@@ -18,7 +18,7 @@ class Build extends command_1.Command {
18
18
  transpileOnly: !flags.strictErrors,
19
19
  project: tsConfigPath,
20
20
  });
21
- (0, buildProject_1.buildProject)(flags, folders, utils_1.datapackResources);
21
+ (0, buildProject_1.buildProject)(flags, folders);
22
22
  }
23
23
  }
24
24
  exports.default = Build;
@@ -129,7 +129,7 @@ class Create extends command_1.Command {
129
129
  const templateFolder = path_1.default.join(__dirname, '../template/');
130
130
  await fs_extra_1.default.copy(templateFolder, projectPath);
131
131
  // Write the sandstone.json file
132
- fs_1.default.writeFileSync(path_1.default.join(projectPath, 'sandstone.config.ts'), `import type { SandstoneConfig } from 'sandstone'
132
+ fs_1.default.writeFileSync(path_1.default.join(projectPath, 'sandstone.config.ts'), `import type { DatapackConfig, SandstoneConfig } from 'sandstone'
133
133
 
134
134
  export default {
135
135
  name: ${toJson(packName)},
@@ -137,7 +137,7 @@ export default {
137
137
  datapack: {
138
138
  description: ${toJson(['A ', { text: 'Sandstone', color: 'gold' }, ' data pack.'])},
139
139
  packFormat: ${11},
140
- }
140
+ } as DatapackConfig
141
141
  },
142
142
  namespace: ${toJson(namespace)},
143
143
  packUid: ${toJson((0, nanoid_1.nanoid)(8))},
@@ -37,7 +37,7 @@ class Watch extends command_1.Command {
37
37
  return;
38
38
  }
39
39
  alreadyBuilding = true;
40
- await (0, buildProject_1.buildProject)(flags, folders, utils_1.datapackResources, paths);
40
+ await (0, buildProject_1.buildProject)(flags, folders, paths);
41
41
  client === null || client === void 0 ? void 0 : client.write('chat', { message: '/reload' });
42
42
  alreadyBuilding = false;
43
43
  if (needRebuild) {
package/lib/utils.d.ts CHANGED
@@ -28,4 +28,3 @@ export declare type ProjectFolders = {
28
28
  sandstoneConfigFolder: string;
29
29
  };
30
30
  export declare function getProjectFolders(projectFolder: string): ProjectFolders;
31
- export declare const datapackResources: string[];
package/lib/utils.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.datapackResources = exports.getProjectFolders = exports.getFileFolder = exports.getWorldPath = exports.getWorldsList = exports.getMinecraftPath = exports.hasYarn = exports.getFlagOrPrompt = void 0;
6
+ exports.getProjectFolders = exports.getFileFolder = exports.getWorldPath = exports.getWorldsList = exports.getMinecraftPath = exports.hasYarn = exports.getFlagOrPrompt = void 0;
7
7
  const inquirer_1 = __importDefault(require("inquirer"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const os_1 = __importDefault(require("os"));
@@ -119,4 +119,3 @@ function getProjectFolders(projectFolder) {
119
119
  };
120
120
  }
121
121
  exports.getProjectFolders = getProjectFolders;
122
- exports.datapackResources = ['mcfunction', 'advancement', 'item_modifier', 'loot_table', 'predicate', 'recipe', 'tag', 'trim_material', 'trim_pattern'];
@@ -1 +1 @@
1
- {"version":"0.6.1","commands":{"build":{"id":"build","description":"Build the packs. ⛏","pluginName":"sandstone-cli","pluginType":"core","aliases":[],"examples":["$ sand build","$ sand build --verbose","$ sand build --verbose --dry"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"dry":{"name":"dry","type":"boolean","char":"d","description":"Do not save the pack. Mostly useful with `verbose`.","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Log all resulting resources: functions, advancements...","allowNo":false},"namespace":{"name":"namespace","type":"option","description":"The default namespace. Override the value specified in the configuration file."},"world":{"name":"world","type":"option","description":"The world to save the data pack in. Override the value specified in the configuration file."},"root":{"name":"root","type":"boolean","description":"Save the data pack & resource pack in the .minecraft/datapacks & .minecraft/resource_packs folders. Override the value specified in the configuration file.","allowNo":false},"clientPath":{"name":"clientPath","type":"option","description":"Path of the client folder. Override the value specified in the configuration file."},"serverPath":{"name":"serverPath","type":"option","description":"Path of the server folder. Override the value specified in the configuration file."},"name":{"name":"name","type":"option","description":"Name of the data pack. Override the value specified in the configuration file."},"description":{"name":"description","type":"option","description":"Description of the data pack. Override the value specified in the configuration file."},"formatVersion":{"name":"formatVersion","type":"option","description":"Pack format version. Override the value specified in the configuration file."},"fullTrace":{"name":"fullTrace","type":"boolean","description":"Show the full stack trace on errors.","allowNo":false},"strictErrors":{"name":"strictErrors","type":"boolean","description":"Stop data pack compilation on type errors.","allowNo":false},"production":{"name":"production","type":"boolean","char":"p","description":"Runs Sandstone in production mode. This sets process.env.SANDSTONE_ENV to \"production\".","allowNo":false},"autoReload":{"name":"autoReload","type":"option","description":"Automatically reload your data pack in-game. Requires to open the world to LAN with cheats enabled, and to specify the port.","helpValue":"port"}},"args":[{"name":"path","description":"Path of the folder containing source files.","required":true,"default":"./src"},{"name":"config-path","description":"Path of the sandstone.config.ts folder.","required":true,"default":"."}]},"create":{"id":"create","description":"Create a new Sandstone project.","pluginName":"sandstone-cli","pluginType":"core","aliases":[],"examples":["$ sand create my-pack"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"yarn":{"name":"yarn","type":"boolean","description":"Use yarn instead of npm.","allowNo":false},"npm":{"name":"npm","type":"boolean","description":"Use npm.","allowNo":false},"pack-name":{"name":"pack-name","type":"option","char":"d","description":"The name of the data pack."},"namespace":{"name":"namespace","type":"option","char":"n","description":"The default namespace that will be used."},"save-root":{"name":"save-root","type":"boolean","char":"r","description":"Save the data pack & resource pack in the .minecraft/datapacks & .minecraft/resource_packs folders. Not compatible with --world.","allowNo":false},"world":{"name":"world","type":"option","char":"w","description":"The world to save the packs in. Not compatible with --save-root or --server"},"server-path":{"name":"server-path","type":"option","char":"s","description":"The server path to write the server-side packs at. Not compatible with --world."},"client-path":{"name":"client-path","type":"option","char":"c","description":"The client path to write packs at."}},"args":[{"name":"project-name","description":"Name of the project folder. This is not the name of the data pack.","required":true}]},"update":{"id":"update","description":"Update Sandstone & Sandstone-CLI.","pluginName":"sandstone-cli","pluginType":"core","aliases":[],"examples":["$ sand update","$ sand update --cli","$ sand update --sandstone","$ sand update --cli --sandstone --skip"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"cli":{"name":"cli","type":"boolean","description":"Update the Sandstone CLI without asking.","allowNo":false},"sandstone":{"name":"sandstone","type":"boolean","description":"Update the current Sandstone version without asking.","allowNo":false},"skip":{"name":"skip","type":"boolean","description":"Skip all interactive prompts and refuse them.","allowNo":false},"yarn":{"name":"yarn","type":"boolean","description":"Use yarn to install the updates.","allowNo":false},"npm":{"name":"npm","type":"boolean","description":"Use npm to install the updates.","allowNo":false}},"args":[]},"watch":{"id":"watch","description":"Build the packs, and rebuild them on file change. ⛏","pluginName":"sandstone-cli","pluginType":"core","aliases":[],"examples":["$ sand watch","$ sand watch --verbose","$ sand watch --verbose --dry"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"dry":{"name":"dry","type":"boolean","char":"d","description":"Do not save the pack. Mostly useful with `verbose`.","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Log all resulting resources: functions, advancements...","allowNo":false},"namespace":{"name":"namespace","type":"option","description":"The default namespace. Override the value specified in the configuration file."},"world":{"name":"world","type":"option","description":"The world to save the data pack in. Override the value specified in the configuration file."},"root":{"name":"root","type":"boolean","description":"Save the data pack & resource pack in the .minecraft/datapacks & .minecraft/resource_packs folders. Override the value specified in the configuration file.","allowNo":false},"clientPath":{"name":"clientPath","type":"option","description":"Path of the client folder. Override the value specified in the configuration file."},"serverPath":{"name":"serverPath","type":"option","description":"Path of the server folder. Override the value specified in the configuration file."},"name":{"name":"name","type":"option","description":"Name of the data pack. Override the value specified in the configuration file."},"description":{"name":"description","type":"option","description":"Description of the data pack. Override the value specified in the configuration file."},"formatVersion":{"name":"formatVersion","type":"option","description":"Pack format version. Override the value specified in the configuration file."},"fullTrace":{"name":"fullTrace","type":"boolean","description":"Show the full stack trace on errors.","allowNo":false},"strictErrors":{"name":"strictErrors","type":"boolean","description":"Stop data pack compilation on type errors.","allowNo":false},"production":{"name":"production","type":"boolean","char":"p","description":"Runs Sandstone in production mode. This sets process.env.SANDSTONE_ENV to \"production\".","allowNo":false},"autoReload":{"name":"autoReload","type":"option","description":"Automatically reload your data pack in-game. Requires to open the world to LAN with cheats enabled, and to specify the port.","helpValue":"port"}},"args":[{"name":"path","description":"Path of the folder containing source files.","required":true,"default":"./src"},{"name":"config-path","description":"Path of the sandstone.config.ts folder.","required":true,"default":"."}]}}}
1
+ {"version":"0.6.2","commands":{"build":{"id":"build","description":"Build the packs. ⛏","pluginName":"sandstone-cli","pluginType":"core","aliases":[],"examples":["$ sand build","$ sand build --verbose","$ sand build --verbose --dry"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"dry":{"name":"dry","type":"boolean","char":"d","description":"Do not save the pack. Mostly useful with `verbose`.","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Log all resulting resources: functions, advancements...","allowNo":false},"namespace":{"name":"namespace","type":"option","description":"The default namespace. Override the value specified in the configuration file."},"world":{"name":"world","type":"option","description":"The world to save the data pack in. Override the value specified in the configuration file."},"root":{"name":"root","type":"boolean","description":"Save the data pack & resource pack in the .minecraft/datapacks & .minecraft/resource_packs folders. Override the value specified in the configuration file.","allowNo":false},"clientPath":{"name":"clientPath","type":"option","description":"Path of the client folder. Override the value specified in the configuration file."},"serverPath":{"name":"serverPath","type":"option","description":"Path of the server folder. Override the value specified in the configuration file."},"name":{"name":"name","type":"option","description":"Name of the data pack. Override the value specified in the configuration file."},"description":{"name":"description","type":"option","description":"Description of the data pack. Override the value specified in the configuration file."},"formatVersion":{"name":"formatVersion","type":"option","description":"Pack format version. Override the value specified in the configuration file."},"fullTrace":{"name":"fullTrace","type":"boolean","description":"Show the full stack trace on errors.","allowNo":false},"strictErrors":{"name":"strictErrors","type":"boolean","description":"Stop data pack compilation on type errors.","allowNo":false},"production":{"name":"production","type":"boolean","char":"p","description":"Runs Sandstone in production mode. This sets process.env.SANDSTONE_ENV to \"production\".","allowNo":false},"autoReload":{"name":"autoReload","type":"option","description":"Automatically reload your data pack in-game. Requires to open the world to LAN with cheats enabled, and to specify the port.","helpValue":"port"}},"args":[{"name":"path","description":"Path of the folder containing source files.","required":true,"default":"./src"},{"name":"config-path","description":"Path of the sandstone.config.ts folder.","required":true,"default":"."}]},"create":{"id":"create","description":"Create a new Sandstone project.","pluginName":"sandstone-cli","pluginType":"core","aliases":[],"examples":["$ sand create my-pack"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"yarn":{"name":"yarn","type":"boolean","description":"Use yarn instead of npm.","allowNo":false},"npm":{"name":"npm","type":"boolean","description":"Use npm.","allowNo":false},"pack-name":{"name":"pack-name","type":"option","char":"d","description":"The name of the data pack."},"namespace":{"name":"namespace","type":"option","char":"n","description":"The default namespace that will be used."},"save-root":{"name":"save-root","type":"boolean","char":"r","description":"Save the data pack & resource pack in the .minecraft/datapacks & .minecraft/resource_packs folders. Not compatible with --world.","allowNo":false},"world":{"name":"world","type":"option","char":"w","description":"The world to save the packs in. Not compatible with --save-root or --server"},"server-path":{"name":"server-path","type":"option","char":"s","description":"The server path to write the server-side packs at. Not compatible with --world."},"client-path":{"name":"client-path","type":"option","char":"c","description":"The client path to write packs at."}},"args":[{"name":"project-name","description":"Name of the project folder. This is not the name of the data pack.","required":true}]},"update":{"id":"update","description":"Update Sandstone & Sandstone-CLI.","pluginName":"sandstone-cli","pluginType":"core","aliases":[],"examples":["$ sand update","$ sand update --cli","$ sand update --sandstone","$ sand update --cli --sandstone --skip"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"cli":{"name":"cli","type":"boolean","description":"Update the Sandstone CLI without asking.","allowNo":false},"sandstone":{"name":"sandstone","type":"boolean","description":"Update the current Sandstone version without asking.","allowNo":false},"skip":{"name":"skip","type":"boolean","description":"Skip all interactive prompts and refuse them.","allowNo":false},"yarn":{"name":"yarn","type":"boolean","description":"Use yarn to install the updates.","allowNo":false},"npm":{"name":"npm","type":"boolean","description":"Use npm to install the updates.","allowNo":false}},"args":[]},"watch":{"id":"watch","description":"Build the packs, and rebuild them on file change. ⛏","pluginName":"sandstone-cli","pluginType":"core","aliases":[],"examples":["$ sand watch","$ sand watch --verbose","$ sand watch --verbose --dry"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"dry":{"name":"dry","type":"boolean","char":"d","description":"Do not save the pack. Mostly useful with `verbose`.","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Log all resulting resources: functions, advancements...","allowNo":false},"namespace":{"name":"namespace","type":"option","description":"The default namespace. Override the value specified in the configuration file."},"world":{"name":"world","type":"option","description":"The world to save the data pack in. Override the value specified in the configuration file."},"root":{"name":"root","type":"boolean","description":"Save the data pack & resource pack in the .minecraft/datapacks & .minecraft/resource_packs folders. Override the value specified in the configuration file.","allowNo":false},"clientPath":{"name":"clientPath","type":"option","description":"Path of the client folder. Override the value specified in the configuration file."},"serverPath":{"name":"serverPath","type":"option","description":"Path of the server folder. Override the value specified in the configuration file."},"name":{"name":"name","type":"option","description":"Name of the data pack. Override the value specified in the configuration file."},"description":{"name":"description","type":"option","description":"Description of the data pack. Override the value specified in the configuration file."},"formatVersion":{"name":"formatVersion","type":"option","description":"Pack format version. Override the value specified in the configuration file."},"fullTrace":{"name":"fullTrace","type":"boolean","description":"Show the full stack trace on errors.","allowNo":false},"strictErrors":{"name":"strictErrors","type":"boolean","description":"Stop data pack compilation on type errors.","allowNo":false},"production":{"name":"production","type":"boolean","char":"p","description":"Runs Sandstone in production mode. This sets process.env.SANDSTONE_ENV to \"production\".","allowNo":false},"autoReload":{"name":"autoReload","type":"option","description":"Automatically reload your data pack in-game. Requires to open the world to LAN with cheats enabled, and to specify the port.","helpValue":"port"}},"args":[{"name":"path","description":"Path of the folder containing source files.","required":true,"default":"./src"},{"name":"config-path","description":"Path of the sandstone.config.ts folder.","required":true,"default":"."}]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sandstone-cli",
3
3
  "description": "The CLI for Sandstone - the data pack creation library.",
4
- "version": "0.6.1",
4
+ "version": "0.6.2",
5
5
  "contributors": [
6
6
  {
7
7
  "name": "TheMrZZ - Florian ERNST",
@@ -23,11 +23,13 @@
23
23
  "@oclif/plugin-help": "^3",
24
24
  "@oclif/plugin-warn-if-update-available": "^1.7.0",
25
25
  "@types/adm-zip": "^0.5.0",
26
- "@types/node": "^18.11.18",
26
+ "@types/delete-empty": "^3.0.2",
27
+ "@types/node": "^18.14.0",
27
28
  "@types/semver": "^7.3.4",
28
29
  "adm-zip": "^0.5.10",
29
30
  "chalk": "^4.1.0",
30
31
  "chokidar": "^3.4.3",
32
+ "delete-empty": "^3.0.0",
31
33
  "fs-extra": "^9.0.1",
32
34
  "inquirer": "^7.3.3",
33
35
  "klaw": "^3.0.0",