sandstone-cli 0.6.2 → 0.6.4

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.2 linux-x64 node-v16.19.1
22
+ sandstone-cli/0.6.4 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.2/src/commands/build.ts)_
87
+ _See code: [src/commands/build.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.4/src/commands/build.ts)_
88
88
 
89
89
  ## `sand create PROJECT-NAME`
90
90
 
@@ -95,11 +95,11 @@ USAGE
95
95
  $ sand create PROJECT-NAME
96
96
 
97
97
  ARGUMENTS
98
- PROJECT-NAME Name of the project folder. This is not the name of the data pack.
98
+ PROJECT-NAME Name of the project folder. This is not the name of the output pack(s).
99
99
 
100
100
  OPTIONS
101
101
  -c, --client-path=client-path The client path to write packs at.
102
- -d, --pack-name=pack-name The name of the data pack.
102
+ -d, --pack-name=pack-name The name of the pack(s).
103
103
  -h, --help show CLI help
104
104
  -n, --namespace=namespace The default namespace that will be used.
105
105
 
@@ -108,6 +108,10 @@ OPTIONS
108
108
 
109
109
  -s, --server-path=server-path The server path to write the server-side packs at. Not compatible with --world.
110
110
 
111
+ -t, --library Whether the project will be a library for use in other Sandstone projects.
112
+
113
+ -v, --version=version What version of Sandstone you'd like to create a project for.
114
+
111
115
  -w, --world=world The world to save the packs in. Not compatible with --save-root or --server
112
116
 
113
117
  --npm Use npm.
@@ -118,7 +122,7 @@ EXAMPLE
118
122
  $ sand create my-pack
119
123
  ```
120
124
 
121
- _See code: [src/commands/create.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.2/src/commands/create.ts)_
125
+ _See code: [src/commands/create.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.4/src/commands/create.ts)_
122
126
 
123
127
  ## `sand help [COMMAND]`
124
128
 
@@ -160,7 +164,7 @@ EXAMPLES
160
164
  $ sand update --cli --sandstone --skip
161
165
  ```
162
166
 
163
- _See code: [src/commands/update.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.2/src/commands/update.ts)_
167
+ _See code: [src/commands/update.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.4/src/commands/update.ts)_
164
168
 
165
169
  ## `sand watch PATH CONFIG-PATH`
166
170
 
@@ -212,5 +216,5 @@ EXAMPLES
212
216
  $ sand watch --verbose --dry
213
217
  ```
214
218
 
215
- _See code: [src/commands/watch.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.2/src/commands/watch.ts)_
219
+ _See code: [src/commands/watch.ts](https://github.com/TheMrZZ/sandstone-cli/blob/v0.6.4/src/commands/watch.ts)_
216
220
  <!-- commandsstop -->
@@ -193,10 +193,11 @@ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandsto
193
193
  if (namespace) {
194
194
  process.env.NAMESPACE = namespace;
195
195
  }
196
- const { onConflict } = sandstoneConfig;
197
- if (onConflict) {
198
- for (const resource of Object.entries(onConflict)) {
199
- process.env[`${resource[0].toUpperCase()}_CONFLICT_STRATEGY`] = resource[1];
196
+ for (const [k, pack] of Object.entries(sandstoneConfig.packs)) {
197
+ if (pack.onConflict) {
198
+ for (const resource of Object.entries(pack.onConflict)) {
199
+ process.env[`${resource[0].toUpperCase()}_CONFLICT_STRATEGY`] = resource[1];
200
+ }
200
201
  }
201
202
  }
202
203
  // JSON indentation
@@ -357,38 +358,46 @@ async function _buildProject(cliOptions, { absProjectFolder, rootFolder, sandsto
357
358
  });
358
359
  async function handleResources(packType) {
359
360
  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);
361
+ let exists = false;
362
+ try {
363
+ await fs_extra_1.default.access(working);
364
+ exists = true;
365
+ }
366
+ catch (e) { }
367
+ if (exists) {
368
+ for await (const file of (0, klaw_1.default)(path_1.default.join(rootFolder, 'resources', packType), { filter: (_path) => {
369
+ const relativePath = path_1.default.join(packType, _path.split(working)[1]);
370
+ let pathPass = true;
371
+ if (fileExclusions && fileExclusions.existing) {
372
+ for (const exclude of fileExclusions.existing) {
373
+ pathPass = Array.isArray(exclude) ? !exclude[0].test(relativePath) : !exclude.test(relativePath);
374
+ }
366
375
  }
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);
376
+ return pathPass;
377
+ } })) {
378
+ const relativePath = path_1.default.join(packType, file.path.split(working)[1]);
379
+ try {
380
+ let content = await fs_extra_1.default.readFile(file.path);
381
+ if (fileHandlers) {
382
+ for (const handler of fileHandlers) {
383
+ if (handler.path.test(relativePath)) {
384
+ content = await handler.callback(content);
385
+ }
377
386
  }
378
387
  }
388
+ // We hash the relative path alongside the content to ensure unique hash.
389
+ const hashValue = hash(content + relativePath);
390
+ // Add to new cache.
391
+ newCache[relativePath] = hashValue;
392
+ if (cache[relativePath] !== hashValue) {
393
+ // Not in cache: write to disk
394
+ const realPath = path_1.default.join(outputFolder, relativePath);
395
+ await mkDir(path_1.default.dirname(realPath));
396
+ await fs_extra_1.default.writeFile(realPath, content);
397
+ }
379
398
  }
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
- }
399
+ catch (e) { }
390
400
  }
391
- catch (e) { }
392
401
  }
393
402
  }
394
403
  async function archiveOutput(packType) {
@@ -6,6 +6,8 @@ export default class Create extends Command {
6
6
  help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
7
7
  yarn: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
8
8
  npm: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
9
+ library: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
+ version: flags.IOptionFlag<string | undefined>;
9
11
  'pack-name': flags.IOptionFlag<string | undefined>;
10
12
  namespace: flags.IOptionFlag<string | undefined>;
11
13
  'save-root': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const command_1 = require("@oclif/command");
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const child_process_1 = require("child_process");
9
- const fs_1 = __importDefault(require("fs"));
10
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
11
10
  const inquirer_1 = __importDefault(require("inquirer"));
12
11
  const path_1 = __importDefault(require("path"));
13
12
  const util_1 = __importDefault(require("util"));
14
- const package_template_json_1 = __importDefault(require("../package.template.json"));
15
13
  const utils_1 = require("../utils");
16
14
  const nanoid_1 = require("nanoid");
17
15
  function toJson(obj, pretty = false) {
18
16
  return util_1.default.inspect(obj, {
19
- depth: +Infinity,
17
+ depth: Number(Infinity),
20
18
  colors: false,
21
- breakLength: +Infinity,
19
+ breakLength: Number(Infinity),
22
20
  compact: !pretty,
23
- maxArrayLength: +Infinity,
21
+ maxArrayLength: Number(Infinity),
24
22
  });
25
23
  }
26
24
  class Create extends command_1.Command {
@@ -28,70 +26,94 @@ class Create extends command_1.Command {
28
26
  const { args, flags } = this.parse(Create);
29
27
  const projectPath = path_1.default.resolve(args['project-name']);
30
28
  const projectName = path_1.default.basename(projectPath);
31
- const packName = await (0, utils_1.getFlagOrPrompt)(flags, 'pack-name', {
32
- message: 'Name of your data pack (can be changed later) >',
29
+ const projectType = Boolean(await (0, utils_1.getFlagOrPrompt)(flags, 'library', {
30
+ message: 'Whether your project will be a library for use in other Sandstone projects >',
33
31
  type: 'input',
34
- default: projectName,
32
+ default: false,
33
+ })) === true ? 'library' : 'pack';
34
+ const versions = [['0.13.6', '0.5.4'], ['0.14.0-alpha.13', '0.5.4'], ['0.14.0-alpha.19', '0.6.2']];
35
+ const stableIndex = 0;
36
+ const { sandstoneVersion } = await inquirer_1.default.prompt({
37
+ name: 'sandstoneVersion',
38
+ type: 'list',
39
+ message: 'Which version of Sandstone do you want to use? These are the only supported versions for new projects.',
40
+ choices: versions.map((version) => ({
41
+ name: version[0].includes('alpha') ? `Alpha Version ${version[0].split('.')[3]} for release ${version[0].split('.')[1]}` : `Major Version 0.${version[0].split('.')[1]}`,
42
+ value: version,
43
+ short: version[0],
44
+ })),
45
+ default: stableIndex,
35
46
  });
47
+ let packName = '';
48
+ let namespace = '';
49
+ if (projectType === 'pack') {
50
+ packName = await (0, utils_1.getFlagOrPrompt)(flags, 'pack-name', {
51
+ message: 'Name of your output pack(s) (can be changed later) >',
52
+ type: 'input',
53
+ default: projectName,
54
+ });
55
+ namespace = await (0, utils_1.getFlagOrPrompt)(flags, 'namespace', {
56
+ message: 'Default namespace (can be changed later) >',
57
+ default: 'default',
58
+ });
59
+ }
36
60
  // Find the save directory
37
61
  const saveOptions = {};
38
- if (flags['save-root']) {
39
- saveOptions.root = true;
40
- }
41
- else if (flags.world) {
42
- saveOptions.world = flags.world;
43
- }
44
- else if (flags['server-path']) {
45
- saveOptions.serverPath = flags['server-path'];
46
- }
47
- else { // TODO: Add support for ssh
48
- // User didn't specify a way to save the file. Ask them.
49
- const { saveChoice } = await inquirer_1.default.prompt({
50
- name: 'saveChoice',
51
- type: 'list',
52
- message: 'Where do you want your packs to be saved (can be changed later)?',
53
- choices: [{
54
- name: 'In the root client (.minecraft) folder',
55
- value: 'root',
56
- short: 'Client folder',
57
- }, {
58
- name: 'In a world',
59
- value: 'world',
60
- short: 'World',
61
- }, {
62
- name: 'In a server',
63
- value: 'server-path',
64
- short: 'Server path',
65
- }],
66
- });
67
- if (saveChoice === 'root') {
62
+ if (sandstoneVersion[0].includes('alpha') && Number(sandstoneVersion[0].split('.')[3]) >= 19) {
63
+ if (flags['save-root']) {
68
64
  saveOptions.root = true;
69
65
  }
70
- else if (saveChoice === 'world') {
71
- const { world } = await inquirer_1.default.prompt({
72
- name: 'World',
73
- message: 'What world do you want to save the packs in? >',
66
+ else if (flags.world) {
67
+ saveOptions.world = flags.world;
68
+ }
69
+ else if (flags['server-path']) {
70
+ saveOptions.serverPath = flags['server-path'];
71
+ }
72
+ else { // TODO: Add support for ssh
73
+ // User didn't specify a way to save the file. Ask them.
74
+ const { saveChoice } = await inquirer_1.default.prompt({
75
+ name: 'saveChoice',
74
76
  type: 'list',
75
- choices: utils_1.getWorldsList,
77
+ message: 'Where do you want your pack(s) to be saved (can be changed later)?',
78
+ choices: [{
79
+ name: 'In the root client (.minecraft) folder',
80
+ value: 'root',
81
+ short: 'Client folder',
82
+ }, {
83
+ name: 'In a world',
84
+ value: 'world',
85
+ short: 'World',
86
+ }, {
87
+ name: 'In a server',
88
+ value: 'server-path',
89
+ short: 'Server path',
90
+ }],
76
91
  });
77
- saveOptions.world = world;
92
+ if (saveChoice === 'root') {
93
+ saveOptions.root = true;
94
+ }
95
+ else if (saveChoice === 'world') {
96
+ const { world } = await inquirer_1.default.prompt({
97
+ name: 'World',
98
+ message: 'What world do you want to save the packs in? >',
99
+ type: 'list',
100
+ choices: utils_1.getWorldsList,
101
+ });
102
+ saveOptions.world = world;
103
+ }
104
+ else { // TODO: Add native folder selector
105
+ const { serverPath } = await inquirer_1.default.prompt({
106
+ name: 'Server path',
107
+ message: 'Where is the server to save the packs in? Relative paths are accepted. >',
108
+ type: 'input',
109
+ });
110
+ saveOptions.serverPath = serverPath;
111
+ }
78
112
  }
79
- else { // TODO: Add native folder selector
80
- const { serverPath } = await inquirer_1.default.prompt({
81
- name: 'Server path',
82
- message: 'Where is the server to save the packs in? Relative paths are accepted. >',
83
- type: 'input',
84
- });
85
- saveOptions.serverPath = serverPath;
113
+ if (flags['client-path']) {
114
+ saveOptions.clientPath = flags['client-path'];
86
115
  }
87
116
  }
88
- if (flags['client-path']) {
89
- saveOptions.clientPath = flags['client-path'];
90
- }
91
- const namespace = await (0, utils_1.getFlagOrPrompt)(flags, 'namespace', {
92
- message: 'Default namespace (can be changed later) >',
93
- default: 'default',
94
- });
95
117
  let useYarn = flags.yarn;
96
118
  if (!flags.yarn && !flags.npm && (0, utils_1.hasYarn)()) {
97
119
  useYarn = (await inquirer_1.default.prompt({
@@ -101,57 +123,39 @@ class Create extends command_1.Command {
101
123
  choices: ['npm', 'yarn'],
102
124
  })).useYarn === 'yarn';
103
125
  }
104
- fs_1.default.mkdirSync(projectPath);
126
+ fs_extra_1.default.mkdirSync(projectPath);
105
127
  // Create project & install dependencies
106
- this.log((0, chalk_1.default) `Installing {rgb(229,193,0) sandstone}, {rgb(229,193,0) sandstone-cli} and {cyan typescript} using {cyan ${useYarn ? 'yarn' : 'npm'}}.`);
107
- if (useYarn) {
108
- /** Init the package, skipping the interactive prompt */
109
- (0, child_process_1.execSync)('yarn init --yes', { cwd: projectPath });
110
- /** Install dependencies */
111
- (0, child_process_1.execSync)('yarn add sandstone', { cwd: projectPath });
112
- (0, child_process_1.execSync)('yarn add --dev typescript @types/node sandstone-cli', { cwd: projectPath });
128
+ this.log((0, chalk_1.default) `Installing {rgb(229,193,0) sandstone@${sandstoneVersion[0]}}, {rgb(229,193,0) sandstone-cli@${sandstoneVersion[1]}} and {cyan typescript} using {cyan ${useYarn ? 'yarn' : 'npm'}}.`);
129
+ const exec = (cmd) => (0, child_process_1.execSync)(cmd, { cwd: projectPath });
130
+ exec('git clone https://github.com/sandstone-mc/sandstone-template.git .');
131
+ exec(`git checkout ${projectType}-${sandstoneVersion[0]}`);
132
+ exec('rm -rf .git');
133
+ exec(`${useYarn ? 'yarn' : 'npm'} install`);
134
+ // TODO: Make profiles for either packs or libraries
135
+ const configPath = path_1.default.join(projectPath, `${projectType === 'library' ? 'test/' : ''}sandstone.config.ts`);
136
+ // Merge with the config values
137
+ let templateConfig = await fs_extra_1.default.readFile(configPath, 'utf8');
138
+ templateConfig = templateConfig.replace('packUid: \'kZZpDK67\'', `packUid: ${toJson((0, nanoid_1.nanoid)(8))}`);
139
+ let _name = packName;
140
+ let _namespace = namespace;
141
+ if (projectType === 'library') {
142
+ _name += '-testing';
143
+ _namespace += '_test';
113
144
  }
114
- else {
115
- /** Init the package, skipping the interactive prompt */
116
- (0, child_process_1.execSync)('npm init --yes', { cwd: projectPath });
117
- /** Install dependencies */
118
- (0, child_process_1.execSync)('npm install sandstone', { cwd: projectPath });
119
- (0, child_process_1.execSync)('npm install --save-dev typescript @types/node sandstone-cli', { cwd: projectPath });
145
+ templateConfig = templateConfig.replace('name: \'template\'', `name: ${toJson(_name)}`);
146
+ templateConfig = templateConfig.replace('namespace: \'default\'', `namespace: ${toJson(_namespace)}`);
147
+ // TODO: packFormat
148
+ const opts = toJson(Object.fromEntries(Object.entries(saveOptions).filter(([_, value]) => value !== undefined)));
149
+ if (opts !== '{}') {
150
+ templateConfig = templateConfig.replace('saveOptions: {}', `saveOptions: ${opts}`);
120
151
  }
121
- // TODO: Make profiles for either packs or libraries
122
- // Merge with the package.json template
123
- const generatedPackage = JSON.parse(fs_1.default.readFileSync(path_1.default.join(projectPath, 'package.json')).toString());
124
- /** Remove the `main` property */
125
- const { main: _, ...newPackage } = { ...generatedPackage, ...package_template_json_1.default };
126
- // Rewrite package.json
127
- fs_1.default.writeFileSync(path_1.default.join(projectPath, 'package.json'), JSON.stringify(newPackage, null, 2));
128
- // Add files from template
129
- const templateFolder = path_1.default.join(__dirname, '../template/');
130
- await fs_extra_1.default.copy(templateFolder, projectPath);
131
- // Write the sandstone.json file
132
- fs_1.default.writeFileSync(path_1.default.join(projectPath, 'sandstone.config.ts'), `import type { DatapackConfig, SandstoneConfig } from 'sandstone'
133
-
134
- export default {
135
- name: ${toJson(packName)},
136
- packs: {
137
- datapack: {
138
- description: ${toJson(['A ', { text: 'Sandstone', color: 'gold' }, ' data pack.'])},
139
- packFormat: ${11},
140
- } as DatapackConfig
141
- },
142
- namespace: ${toJson(namespace)},
143
- packUid: ${toJson((0, nanoid_1.nanoid)(8))},
144
- saveOptions: ${toJson(Object.fromEntries(Object.entries(saveOptions).filter(([_, value]) => value !== undefined)))},
145
- onConflict: {
146
- default: 'warn',
147
- },
148
- } as SandstoneConfig
149
- `);
152
+ // Rewrite config
153
+ fs_extra_1.default.writeFileSync(configPath, templateConfig);
150
154
  const prefix = useYarn ? 'yarn' : 'npm run';
151
155
  this.log((0, chalk_1.default) `{green Success!} Created "${projectName}" at "${projectPath}"`);
152
156
  this.log('Inside that directory, you can run several commands:\n');
153
- this.log((0, chalk_1.default) ` {cyan ${prefix} build}:\n Builds the data pack. {cyan ⛏}\n`);
154
- this.log((0, chalk_1.default) ` {cyan ${prefix} watch}:\n Builds the data pack, and rebuild on each file change. {cyan ⛏}\n`);
157
+ this.log((0, chalk_1.default) ` {cyan ${prefix} build}:\n Builds the packs. {cyan ⛏}\n`);
158
+ this.log((0, chalk_1.default) ` {cyan ${prefix} watch}:\n Builds the packs, and rebuilds on each file change. {cyan ⛏}\n`);
155
159
  this.log('We suggest that you begin by typing:\n');
156
160
  this.log((0, chalk_1.default) ` {cyan cd} ${projectName}\n {cyan ${prefix} watch}`);
157
161
  }
@@ -165,7 +169,9 @@ Create.flags = {
165
169
  help: command_1.flags.help({ char: 'h' }),
166
170
  yarn: command_1.flags.boolean({ description: 'Use yarn instead of npm.', env: 'USE_YARN', exclusive: ['npm'] }),
167
171
  npm: command_1.flags.boolean({ description: 'Use npm.', env: 'USE_NPM', exclusive: ['yarn'] }),
168
- 'pack-name': command_1.flags.string({ char: 'd', env: 'PACK_NAME', description: 'The name of the data pack.' }),
172
+ library: command_1.flags.boolean({ char: 't', env: 'LIBRARY', description: 'Whether the project will be a library for use in other Sandstone projects.' }),
173
+ version: command_1.flags.string({ char: 'v', env: 'SANDSTONE_VERSION', description: 'What version of Sandstone you\'d like to create a project for.' }),
174
+ 'pack-name': command_1.flags.string({ char: 'd', env: 'PACK_NAME', description: 'The name of the pack(s).' }),
169
175
  namespace: command_1.flags.string({ char: 'n', env: 'NAMESPACE', description: 'The default namespace that will be used.' }),
170
176
  'save-root': command_1.flags.boolean({ char: 'r', env: 'SAVE_ROOT', description: 'Save the data pack & resource pack in the .minecraft/datapacks & .minecraft/resource_packs folders. Not compatible with --world.', exclusive: ['world'] }),
171
177
  world: command_1.flags.string({ char: 'w', env: 'WORLD', description: 'The world to save the packs in. Not compatible with --save-root or --server', exclusive: ['save-root', 'server'] }),
@@ -174,6 +180,6 @@ Create.flags = {
174
180
  };
175
181
  Create.args = [{
176
182
  name: 'project-name',
177
- description: 'Name of the project folder. This is not the name of the data pack.',
183
+ description: 'Name of the project folder. This is not the name of the output pack(s).',
178
184
  required: true,
179
185
  }];
@@ -1 +1 @@
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":"."}]}}}
1
+ {"version":"0.6.4","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},"library":{"name":"library","type":"boolean","char":"t","description":"Whether the project will be a library for use in other Sandstone projects.","allowNo":false},"version":{"name":"version","type":"option","char":"v","description":"What version of Sandstone you'd like to create a project for."},"pack-name":{"name":"pack-name","type":"option","char":"d","description":"The name of the pack(s)."},"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 output pack(s).","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.2",
4
+ "version": "0.6.4",
5
5
  "contributors": [
6
6
  {
7
7
  "name": "TheMrZZ - Florian ERNST",
@@ -24,7 +24,7 @@
24
24
  "@oclif/plugin-warn-if-update-available": "^1.7.0",
25
25
  "@types/adm-zip": "^0.5.0",
26
26
  "@types/delete-empty": "^3.0.2",
27
- "@types/node": "^18.14.0",
27
+ "@types/node": "^18.14.2",
28
28
  "@types/semver": "^7.3.4",
29
29
  "adm-zip": "^0.5.10",
30
30
  "chalk": "^4.1.0",
@@ -96,7 +96,7 @@
96
96
  "postpack": "rimraf oclif.manifest.json",
97
97
  "posttest": "eslint . --ext .ts --config .eslintrc",
98
98
  "prepack": "npm run build",
99
- "build": "rimraf lib && tsc -b && node ./copyTemplate.js && oclif-dev manifest && oclif-dev readme",
99
+ "build": "rimraf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
100
100
  "watch": "npm run build && chokidar \"src/**/*\" -c \"npm run build\"",
101
101
  "test": "echo NO TESTS",
102
102
  "version": "oclif-dev readme && git add README.md"
@@ -1,10 +0,0 @@
1
- {
2
- "description": "A data pack created with Sandstone",
3
- "engines": {
4
- "node": ">=12.9.0"
5
- },
6
- "scripts": {
7
- "watch": "sand watch",
8
- "build": "sand build"
9
- }
10
- }
@@ -1,20 +0,0 @@
1
- # Sandstone project
2
-
3
- To build the packs, run:
4
- ```ts
5
- npm run build
6
- // or
7
- yarn build
8
- // or
9
- sand build
10
- ```
11
-
12
- To automatically rebuild the packs on each change, run:
13
- ```ts
14
- npm run watch
15
- // or
16
- yarn watch
17
- // or
18
- sand watch
19
- ```
20
-
@@ -1,18 +0,0 @@
1
- /**
2
- * This file is just an example.
3
- * You can delete it!
4
- */
5
-
6
- import { MCFunction, tellraw } from 'sandstone'
7
-
8
- MCFunction('display_message', () => {
9
- tellraw('@a', [
10
- '\n========= Congratulations! =========\n\n',
11
- { text: ' Sandstone', color: 'gold', bold: true }, ' is ', { text: 'successfully installed.\n\n', color: 'green' },
12
- ' Add files to the ', { text: 'src', underlined: true }, ' folder\n',
13
- ' and start creating your data pack!\n',
14
- '==============', { text: '🏹', color: '#D2691E' }, { text: '⚔', color: '#45ACA5' }, { text: '⛏', color: '#FFD700' }, '==============',
15
- ])
16
- }, {
17
- runOnLoad: true,
18
- })
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "declaration": true,
4
- "module": "commonjs",
5
- "moduleResolution": "node",
6
- // We target a minimum Node version of 12.9.0: https://stackoverflow.com/a/59787575
7
- "target": "es2019",
8
- "lib": [
9
- "es2020"
10
- ],
11
- "strict": false,
12
- "esModuleInterop": false,
13
- "resolveJsonModule": true,
14
- "allowSyntheticDefaultImports": false,
15
- "noEmit": true,
16
- "skipLibCheck": true,
17
- "outDir": "build"
18
- },
19
- "include": [
20
- "src"
21
- ],
22
- }