vcpm 0.2.2 → 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/README.md CHANGED
@@ -1,25 +1,147 @@
1
+ ![logo.png](logo.png)
2
+
1
3
  # VCPM - Voxel Core Project Manager
2
4
 
3
- CLI util for managing voxel core content packs, with vcpm we can start new project and build it for release
5
+ CLI util for managing voxel core content packs, with vcpm we can start
6
+ new project and build it for release
4
7
 
5
- ## Instalation
8
+ [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
9
+ [![Version](https://img.shields.io/npm/v/vcpm.svg)](https://npmjs.org/package/vcpm)
10
+ [![Downloads/week](https://img.shields.io/npm/dw/vcpm.svg)](https://npmjs.org/package/vcpm)
11
+ [![License](https://img.shields.io/github/license/TraumDE/vcpm?)](https://github.com/TraumDE/vcpm/blob/main/LICENSE)
6
12
 
7
- ```
13
+ - [Installation](#installation)
14
+ - [Usage](#usage)
15
+ - [Commands](#commands)
16
+ - [Roadmap](#roadmap)
17
+ - [Support Shells](#support-shells)
18
+ - [Support OS](#support-os)
19
+
20
+ ## Installation
21
+
22
+ ### With NPM
23
+ ```bash
8
24
  npm i -g vcpm
9
25
  ```
26
+ ### Standalone
27
+ #### Windows
28
+ - [Windows-arm64 (.exe)](https://github.com/TraumDE/vcpm/releases/download/0.4.0/vcpm-v0.4.0-ef8c1e4-arm64.exe)
29
+ - [Windows-x64 (.exe)](https://github.com/TraumDE/vcpm/releases/download/0.4.0/vcpm-v0.4.0-ef8c1e4-x64.exe)
30
+ #### Linux
31
+ - [Deb-amd64 (.deb)](https://github.com/TraumDE/vcpm/releases/download/0.4.0/vcpm_0.4.0.ef8c1e4-1_amd64.deb)
32
+ - [Deb-arm64 (.deb)](https://github.com/TraumDE/vcpm/releases/download/0.4.0/vcpm_0.4.0.ef8c1e4-1_arm64.deb)
33
+
34
+ #### MacOS
35
+ - [MacOS-x64 (.pkg)](https://github.com/TraumDE/vcpm/releases/download/0.4.0/vcpm-v0.4.0-ef8c1e4-x64.pkg)
36
+ - [MacOS-arm64 (.pkg)](https://github.com/TraumDE/vcpm/releases/download/0.4.0/vcpm-v0.4.0-ef8c1e4-arm64.pkg)
37
+
38
+ Other releases can be found in latest release [here](https://github.com/TraumDE/vcpm/releases/latest)
10
39
 
11
40
  ## Usage
12
41
 
13
- ### Build
42
+ ### Run command
43
+
44
+ ```Bash
45
+ vcpm COMMAND
14
46
  ```
15
- vcpm build
47
+
48
+ ### Check version
49
+
50
+ ```Bash
51
+ vcpm --version | -v
16
52
  ```
17
- Creates a zip archive for production use, removing in production build all files and folders which starts on dot, and remove type declarations folder.
18
53
 
19
- ### Development Build
54
+ ### Help with command
55
+
56
+ ```Bash
57
+ vcpm COMMAND --help
20
58
  ```
21
- vcpm build -d | -dev
59
+
60
+ ## Commands
61
+
62
+ - [`vcpm build`](#vcpm-build)
63
+ - [`vcpm autocomplete`](#vcpm-autocomplete)
64
+
65
+ ### `vcpm build`
66
+
67
+ Build project
68
+
69
+ ```Bash
70
+ USAGE
71
+ $ vcpm build [-d]
72
+
73
+ FLAGS
74
+ -d, --dev build in development mode
75
+
76
+ DESCRIPTION
77
+ build project
22
78
  ```
23
- Creates a zip archive for development use, without removing any files or folders.
24
79
 
25
- Archive format [pack_id]\_[version].zip
80
+ _See code: [src/commands/build/index.ts](https://github.com/TraumDE/vcpm/blob/main/src/commands/build/index.ts)_
81
+
82
+ ### `vcpm autocomplete`
83
+
84
+ Display autocomplete installation instructions.
85
+
86
+ ```Bash
87
+ USAGE
88
+ $ vcpm autocomplete [SHELL] [-r]
89
+
90
+ ARGUMENTS
91
+ [SHELL] (zsh|bash|powershell) Shell type
92
+
93
+ FLAGS
94
+ -r, --refresh-cache Refresh cache (ignores displaying instructions)
95
+
96
+ DESCRIPTION
97
+ Display autocomplete installation instructions.
98
+
99
+ EXAMPLES
100
+ $ vcpm autocomplete
101
+
102
+ $ vcpm autocomplete bash
103
+
104
+ $ vcpm autocomplete zsh
105
+
106
+ $ vcpm autocomplete powershell
107
+
108
+ $ vcpm autocomplete --refresh-cache
109
+ ```
110
+
111
+ ## Roadmap
112
+
113
+ ### Plans
114
+
115
+ - [ ] Made standalone verison
116
+ - [ ] Package management function
117
+ - [ ] Create new project command
118
+ - [ ] More features coming soon
119
+ - [ ] Project Website
120
+
121
+ ### Ready
122
+
123
+ - [x] Building project for production and development
124
+ - [x] Autocomplete for crossplaforms
125
+
126
+ ## Support Shells
127
+
128
+ - [x] Bash
129
+ - [x] Zsh
130
+ - [x] Powershell 7+
131
+ - [x] Fish (Without Autocomplete)
132
+ - [x] CMD (Without Autocomplete)
133
+ - [x] Powershell < 7 (Without Autocomplete)
134
+
135
+ ## Support OS
136
+
137
+ ### Windows
138
+
139
+ - Windows 11 ❓ - 0.2.2 (need update)
140
+
141
+ ### Linux
142
+
143
+ - Arch Linux ✅ - 0.3.0
144
+
145
+ ### MacOS
146
+
147
+ No tests on MacOS
package/bin/dev.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
package/bin/dev.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({development: true, dir: import.meta.url})
package/bin/run.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({dir: import.meta.url})
@@ -0,0 +1,12 @@
1
+ import { Command } from '@oclif/core';
2
+ export declare class Build extends Command {
3
+ static description: string;
4
+ static flags: {
5
+ dev: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
+ };
7
+ run(): Promise<void>;
8
+ private addFile;
9
+ private build;
10
+ private fileExists;
11
+ private readPackage;
12
+ }
@@ -0,0 +1,74 @@
1
+ import { Command, Flags } from '@oclif/core';
2
+ import { BlobReader, BlobWriter, ZipWriter } from '@zip.js/zip.js';
3
+ import { glob } from 'glob';
4
+ import { Buffer } from 'node:buffer';
5
+ import { promises as fs } from 'node:fs';
6
+ export class Build extends Command {
7
+ static description = 'Build project';
8
+ static flags = {
9
+ dev: Flags.boolean({ char: 'd', description: 'Build in development mode' }),
10
+ };
11
+ async run() {
12
+ await this.build();
13
+ }
14
+ async addFile(file, zipWriter) {
15
+ const relativePath = file.relative();
16
+ await zipWriter.add(relativePath, new BlobReader(new Blob([new Uint8Array(await fs.readFile(relativePath))])));
17
+ }
18
+ async build() {
19
+ const packageInfo = await this.readPackage();
20
+ const { flags } = await this.parse(Build);
21
+ this.log('Start building...');
22
+ if (await this.fileExists('dist')) {
23
+ this.log('Remove previous build...');
24
+ await fs.rm('dist', { force: true, recursive: true });
25
+ }
26
+ await fs.mkdir('dist');
27
+ const files = await glob('**/*', {
28
+ cwd: process.cwd(),
29
+ dot: true,
30
+ ignore: flags.dev ? [] : ['**/.*', '**/.*/**', 'dist/**/*', 'modules/types/**/*'],
31
+ nodir: true,
32
+ withFileTypes: true,
33
+ });
34
+ const zipFileWriter = new BlobWriter('application/zip');
35
+ const zipWriter = new ZipWriter(zipFileWriter);
36
+ const filePromises = files.map((file) => this.addFile(file, zipWriter));
37
+ await Promise.all(filePromises);
38
+ const zipBlob = await zipWriter.close();
39
+ const buffer = Buffer.from(await zipBlob.arrayBuffer());
40
+ await fs.writeFile(`dist/${packageInfo.id}_${packageInfo.version}${flags.dev ? '_dev' : ''}.zip`, buffer);
41
+ if (flags.dev) {
42
+ this.log('Development build completed!');
43
+ }
44
+ else {
45
+ this.log('Production build completed!');
46
+ }
47
+ }
48
+ async fileExists(file) {
49
+ try {
50
+ await fs.access(file, fs.constants.F_OK);
51
+ return true;
52
+ }
53
+ catch {
54
+ return false;
55
+ }
56
+ }
57
+ async readPackage() {
58
+ if (!(await this.fileExists('package.json'))) {
59
+ this.error('package.json file does not exist', {
60
+ code: 'ENOENT',
61
+ });
62
+ }
63
+ const packageJsonParsed = JSON.parse(await fs.readFile('package.json', 'utf8'));
64
+ if (!packageJsonParsed.id && !packageJsonParsed.version) {
65
+ this.error('Its not voxel core content pack', {
66
+ code: 'EINVAL',
67
+ });
68
+ }
69
+ return {
70
+ id: packageJsonParsed.id,
71
+ version: packageJsonParsed.version,
72
+ };
73
+ }
74
+ }
@@ -0,0 +1 @@
1
+ export { run } from '@oclif/core';
package/dist/index.js CHANGED
@@ -1,19 +1 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const commander_1 = require("commander");
8
- const build_1 = __importDefault(require("./commands/build"));
9
- const program = new commander_1.Command();
10
- program
11
- .name("vcpm")
12
- .description("VCPM - Voxel Core Project Manager. Is unoficall CLI util for managing content packs")
13
- .version("0.1.0");
14
- program
15
- .command("build")
16
- .description("Build project for production")
17
- .option("-d, --dev", "Build project for development", false)
18
- .action(build_1.default);
19
- program.parse();
1
+ export { run } from '@oclif/core';
@@ -0,0 +1 @@
1
+ export * from './package-info.js';
@@ -1,18 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./packInfo"), exports);
18
- __exportStar(require("./buildOptions"), exports);
1
+ export * from './package-info.js';
@@ -0,0 +1,4 @@
1
+ export interface PackageInfo {
2
+ id: string;
3
+ version: string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ {
2
+ "commands": {
3
+ "build": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "Build project",
7
+ "flags": {
8
+ "dev": {
9
+ "char": "d",
10
+ "description": "Build in development mode",
11
+ "name": "dev",
12
+ "allowNo": false,
13
+ "type": "boolean"
14
+ }
15
+ },
16
+ "hasDynamicHelp": false,
17
+ "hiddenAliases": [],
18
+ "id": "build",
19
+ "pluginAlias": "vcpm",
20
+ "pluginName": "vcpm",
21
+ "pluginType": "core",
22
+ "strict": true,
23
+ "enableJsonFlag": false,
24
+ "isESM": true,
25
+ "relativePath": [
26
+ "dist",
27
+ "commands",
28
+ "build",
29
+ "index.js"
30
+ ]
31
+ }
32
+ },
33
+ "version": "0.4.0"
34
+ }
package/package.json CHANGED
@@ -1,39 +1,81 @@
1
1
  {
2
2
  "name": "vcpm",
3
- "version": "0.2.2",
4
- "description": "VCPM - Voxel Core Project Manager. Is unoficall CLI util for managing content packs",
5
- "main": "dist/index.js",
6
- "preferGlobal": "true",
7
- "bin": "./dist/index.js",
3
+ "description": "VCPM - Voxel Core Project Manager",
4
+ "version": "0.4.0",
5
+ "author": "Eugene301|TraumDE",
6
+ "bin": "./bin/run.js",
7
+ "bugs": "https://github.com/TraumDE/vcpm/issues",
8
+ "dependencies": {
9
+ "@oclif/core": "^4",
10
+ "@oclif/plugin-autocomplete": "^3.2.39",
11
+ "@zip.js/zip.js": "^2.8.15",
12
+ "glob": "^13.0.0"
13
+ },
14
+ "devDependencies": {
15
+ "@eslint/compat": "^1",
16
+ "@oclif/prettier-config": "^0.2.1",
17
+ "@oclif/test": "^4",
18
+ "@types/chai": "^4",
19
+ "@types/mocha": "^10",
20
+ "@types/node": "^18",
21
+ "chai": "^4",
22
+ "eslint": "^9",
23
+ "eslint-config-oclif": "^6",
24
+ "eslint-config-prettier": "^10",
25
+ "mocha": "^10",
26
+ "oclif": "^4",
27
+ "shx": "^0.3.3",
28
+ "ts-node": "^10",
29
+ "typescript": "^5"
30
+ },
31
+ "engines": {
32
+ "node": ">=18.4.0"
33
+ },
8
34
  "files": [
9
- "dist/",
10
- "README.md",
11
- "LICENSE"
35
+ "./bin",
36
+ "./dist",
37
+ "./oclif.manifest.json"
12
38
  ],
13
- "scripts": {
14
- "build": "tsc",
15
- "dev": "ts-node src/index.ts"
16
- },
39
+ "homepage": "https://github.com/TraumDE/vcpm",
17
40
  "keywords": [
18
- "Voxel Core",
41
+ "oclif",
19
42
  "CLI",
20
- "Utility"
43
+ "VCPM",
44
+ "Voxel Core Project Manager",
45
+ "Voxel Core",
46
+ "Utility",
47
+ "Util"
21
48
  ],
22
- "repository": {
23
- "type": "git",
24
- "url": "https://github.com/TraumDE/vcpm.git"
25
- },
26
- "author": "Eugene301|TraumDE",
27
49
  "license": "MIT",
28
- "packageManager": "yarn@4.12.0",
29
- "devDependencies": {
30
- "@types/archiver": "^7",
31
- "@types/node": "^25.0.3",
32
- "ts-node": "^10.9.2",
33
- "typescript": "^5.9.3"
50
+ "main": "dist/index.js",
51
+ "type": "module",
52
+ "oclif": {
53
+ "macos": {
54
+ "identifier": "com.voxelcorepackagemanager.cli"
55
+ },
56
+ "bin": "vcpm",
57
+ "dirname": "vcpm",
58
+ "commands": "./dist/commands",
59
+ "plugins": [
60
+ "@oclif/plugin-autocomplete"
61
+ ],
62
+ "topicSeparator": " ",
63
+ "topics": {
64
+ "hello": {
65
+ "description": "Say hello to the world and others"
66
+ }
67
+ }
34
68
  },
35
- "dependencies": {
36
- "archiver": "^7.0.1",
37
- "commander": "^14.0.2"
38
- }
69
+ "repository": "TraumDE/vcpm",
70
+ "scripts": {
71
+ "build": "shx rm -rf dist && tsc -b",
72
+ "lint": "eslint",
73
+ "postpack": "shx rm -f oclif.manifest.json",
74
+ "posttest": "yarn lint",
75
+ "prepack": "oclif manifest && oclif readme",
76
+ "test": "mocha --forbid-only \"test/**/*.test.ts\"",
77
+ "version": "oclif readme && git add README.md"
78
+ },
79
+ "types": "dist/index.d.ts",
80
+ "packageManager": "yarn@4.12.0"
39
81
  }
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const process_1 = require("process");
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = require("path");
9
- const archiver_1 = __importDefault(require("archiver"));
10
- const isExists = (path) => {
11
- return fs_1.default.existsSync((0, path_1.join)((0, process_1.cwd)(), path));
12
- };
13
- const getPackData = () => {
14
- const jsonData = JSON.parse(fs_1.default.readFileSync((0, path_1.join)((0, process_1.cwd)(), "package.json"), "utf-8"));
15
- return {
16
- id: jsonData.id,
17
- version: jsonData.version,
18
- };
19
- };
20
- const createDistZip = (isDev) => {
21
- if (!isExists("package.json")) {
22
- console.log("Not found package.json!");
23
- return;
24
- }
25
- const packData = getPackData();
26
- const distPath = `dist/${packData.id}_${packData.version}.zip`;
27
- if (isExists(distPath)) {
28
- fs_1.default.rmSync(distPath);
29
- }
30
- const output = fs_1.default.createWriteStream(distPath);
31
- const archive = (0, archiver_1.default)("zip", { zlib: { level: 9 } });
32
- archive.pipe(output);
33
- archive.glob("**/*", {
34
- cwd: ".",
35
- ignore: isDev ? [] : ["**/.*/**", "**/.*", "modules/types/**", "dist/**"],
36
- dot: true,
37
- });
38
- archive.finalize();
39
- if (isDev) {
40
- console.log("Project builded for development!");
41
- }
42
- else {
43
- console.log("Project builded for production!");
44
- }
45
- };
46
- const checkDistFolder = () => {
47
- if (!isExists("dist")) {
48
- fs_1.default.mkdirSync("dist");
49
- }
50
- };
51
- exports.default = (options) => {
52
- checkDistFolder();
53
- createDistZip(options.dev);
54
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });