@galacean/cli 0.1.1 → 2.0.0-alpha.1
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 +18 -53
- package/bin/galacean.js +3 -0
- package/dist/assets/basis_encoder.js +28 -0
- package/dist/assets/basis_encoder.wasm +0 -0
- package/dist/cli.bundle.cjs +157493 -0
- package/package.json +45 -61
- package/bin/dev +0 -17
- package/bin/dev.cmd +0 -3
- package/bin/run +0 -5
- package/bin/run.cmd +0 -3
- package/dist/commands/generate.d.ts +0 -10
- package/dist/commands/generate.js +0 -22
- package/dist/generators/plugin.d.ts +0 -33
- package/dist/generators/plugin.js +0 -176
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -5
- package/oclif.manifest.json +0 -22
package/package.json
CHANGED
|
@@ -1,72 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"author": "Kbscript @MrKou47",
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
|
+
"main": "dist/cli.bundle.cjs",
|
|
6
5
|
"bin": {
|
|
7
|
-
"galacean": "
|
|
6
|
+
"galacean": "bin/galacean.js"
|
|
8
7
|
},
|
|
9
|
-
"homepage": "https://github.com/galacean/cli",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"main": "dist/index.js",
|
|
12
|
-
"repository": "galacean/cli",
|
|
13
|
-
"files": [
|
|
14
|
-
"/bin",
|
|
15
|
-
"/dist",
|
|
16
|
-
"/npm-shrinkwrap.json",
|
|
17
|
-
"/oclif.manifest.json"
|
|
18
|
-
],
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@oclif/core": "^4.0.2",
|
|
21
|
-
"@oclif/plugin-help": "^6.1.0",
|
|
22
|
-
"@oclif/plugin-plugins": "^2.4.7",
|
|
23
|
-
"yeoman-environment": "^3.19.3",
|
|
24
|
-
"yeoman-generator": "^5.9.0"
|
|
25
|
-
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@oclif/test": "^2.4.0",
|
|
28
|
-
"@types/chai": "^4",
|
|
29
|
-
"@types/mocha": "^9.0.0",
|
|
30
|
-
"@types/node": "^16.18.39",
|
|
31
|
-
"@types/yeoman-generator": "^5.2.11",
|
|
32
|
-
"chai": "^4",
|
|
33
|
-
"eslint": "^7.32.0",
|
|
34
|
-
"eslint-config-oclif": "^4",
|
|
35
|
-
"eslint-config-oclif-typescript": "^1.0.3",
|
|
36
|
-
"mocha": "^9",
|
|
37
|
-
"oclif": "^3.10.0",
|
|
38
|
-
"shx": "^0.3.3",
|
|
39
|
-
"ts-node": "^10.9.1",
|
|
40
|
-
"tslib": "^2.6.1",
|
|
41
|
-
"typescript": "^4.9.5"
|
|
42
|
-
},
|
|
43
|
-
"oclif": {
|
|
44
|
-
"bin": "galacean",
|
|
45
|
-
"dirname": "galacean",
|
|
46
|
-
"commands": "./dist/commands",
|
|
47
|
-
"plugins": [
|
|
48
|
-
"@oclif/plugin-help"
|
|
49
|
-
]
|
|
50
|
-
},
|
|
51
|
-
"packageManager": "pnpm@8.6.2",
|
|
52
8
|
"engines": {
|
|
53
|
-
"node": ">=
|
|
9
|
+
"node": ">=20"
|
|
54
10
|
},
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/cli.bundle.cjs",
|
|
13
|
+
"dist/assets",
|
|
14
|
+
"bin/galacean.js",
|
|
15
|
+
"README.md"
|
|
60
16
|
],
|
|
61
|
-
"types": "dist/index.d.ts",
|
|
62
17
|
"publishConfig": {
|
|
63
|
-
"registry": "https://registry.npmjs.org"
|
|
18
|
+
"registry": "https://registry.npmjs.org/",
|
|
19
|
+
"main": "dist/cli.bundle.cjs",
|
|
20
|
+
"bin": {
|
|
21
|
+
"galacean": "bin/galacean.js"
|
|
22
|
+
}
|
|
64
23
|
},
|
|
65
24
|
"scripts": {
|
|
66
|
-
"build": "
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
25
|
+
"build": "node build.mjs",
|
|
26
|
+
"build:tsc": "tsc -p tsconfig.build.json",
|
|
27
|
+
"prepublishOnly": "node build.mjs",
|
|
28
|
+
"update:basis-assets": "node scripts/update-basis-assets.mjs",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:watch": "vitest"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"chokidar": "^4.0.3",
|
|
34
|
+
"commander": "^14.0.3",
|
|
35
|
+
"ktx-parse": "^0.7.1",
|
|
36
|
+
"sharp": "^0.33.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@editor/ai": "workspace:^",
|
|
40
|
+
"@editor/asset-bundle-utils": "workspace:*",
|
|
41
|
+
"@editor/builder": "workspace:*",
|
|
42
|
+
"@editor/constants": "workspace:*",
|
|
43
|
+
"@editor/editor-api": "workspace:*",
|
|
44
|
+
"@editor/model": "workspace:*",
|
|
45
|
+
"@editor/storage": "workspace:*",
|
|
46
|
+
"@editor/vfs": "workspace:*",
|
|
47
|
+
"@galacean/tools-color-dilation": "workspace:*",
|
|
48
|
+
"@galacean/tools-ktx2-encoder": "workspace:*",
|
|
49
|
+
"@gltf-transform/core": "^4.1.0",
|
|
50
|
+
"@gltf-transform/extensions": "^4.1.0",
|
|
51
|
+
"@types/node": "^22.10.2",
|
|
52
|
+
"config": "workspace:*",
|
|
53
|
+
"tsconfig": "workspace:*",
|
|
54
|
+
"vitest": "^3.1.0"
|
|
71
55
|
}
|
|
72
|
-
}
|
|
56
|
+
}
|
package/bin/dev
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const oclif = require('@oclif/core')
|
|
4
|
-
|
|
5
|
-
const path = require('path')
|
|
6
|
-
const project = path.join(__dirname, '..', 'tsconfig.json')
|
|
7
|
-
|
|
8
|
-
// In dev mode -> use ts-node and dev plugins
|
|
9
|
-
process.env.NODE_ENV = 'development'
|
|
10
|
-
|
|
11
|
-
require('ts-node').register({ project })
|
|
12
|
-
|
|
13
|
-
// In dev mode, always show stack traces
|
|
14
|
-
oclif.settings.debug = true;
|
|
15
|
-
|
|
16
|
-
// Start the CLI
|
|
17
|
-
oclif.run().then(oclif.flush).catch(oclif.Errors.handle)
|
package/bin/dev.cmd
DELETED
package/bin/run
DELETED
package/bin/run.cmd
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
export default class Generate extends Command {
|
|
3
|
-
static description: string;
|
|
4
|
-
static flags: {};
|
|
5
|
-
static args: {
|
|
6
|
-
name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
-
};
|
|
8
|
-
protected generate(type?: string, generatorOptions?: Record<string, unknown>): Promise<void>;
|
|
9
|
-
run(): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@oclif/core");
|
|
4
|
-
const yeoman_environment_1 = require("yeoman-environment");
|
|
5
|
-
class Generate extends core_1.Command {
|
|
6
|
-
async generate(type = 'plugin', generatorOptions = {}) {
|
|
7
|
-
const env = (0, yeoman_environment_1.createEnv)();
|
|
8
|
-
env.register(require.resolve(`../generators/${type}`), `galacean:${type}`);
|
|
9
|
-
await env.run(`galacean:${type}`, generatorOptions);
|
|
10
|
-
}
|
|
11
|
-
async run() {
|
|
12
|
-
const { args } = await this.parse(Generate);
|
|
13
|
-
await this.generate('plugin', { name: args.name, force: true });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.default = Generate;
|
|
17
|
-
Generate.description = `generate a new Galacean Editor plugin
|
|
18
|
-
This will clone the specific folder in 'galacean/galacean-editor-plugin-examples' and update package properties`;
|
|
19
|
-
Generate.flags = {};
|
|
20
|
-
Generate.args = {
|
|
21
|
-
name: core_1.Args.string({ required: true, description: 'directory name of new plugin' }),
|
|
22
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import * as Generator from 'yeoman-generator';
|
|
2
|
-
export default class PluginGenerator extends Generator {
|
|
3
|
-
options: {
|
|
4
|
-
force: boolean;
|
|
5
|
-
};
|
|
6
|
-
exampleRepoUrl: string;
|
|
7
|
-
name: string;
|
|
8
|
-
pjson: any;
|
|
9
|
-
githubUser: string;
|
|
10
|
-
answers: {
|
|
11
|
-
name: string;
|
|
12
|
-
bin: string;
|
|
13
|
-
description: string;
|
|
14
|
-
version: string;
|
|
15
|
-
github: {
|
|
16
|
-
repo: string;
|
|
17
|
-
user: string;
|
|
18
|
-
};
|
|
19
|
-
author: string;
|
|
20
|
-
files: string;
|
|
21
|
-
license: string;
|
|
22
|
-
galacean: string;
|
|
23
|
-
pkg: string;
|
|
24
|
-
typescript: boolean;
|
|
25
|
-
eslint: boolean;
|
|
26
|
-
};
|
|
27
|
-
repository?: string;
|
|
28
|
-
constructor(args: string | string[], opts: Generator.GeneratorOptions);
|
|
29
|
-
prompting(): Promise<void>;
|
|
30
|
-
writing(): void;
|
|
31
|
-
end(): void;
|
|
32
|
-
private _gitignore;
|
|
33
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const child_process_1 = require("child_process");
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const _ = require("lodash");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const nodeDebug = require("debug");
|
|
8
|
-
const Generator = require("yeoman-generator");
|
|
9
|
-
const debug = nodeDebug('galacean-plugin-generator');
|
|
10
|
-
const { version } = require('../../package.json');
|
|
11
|
-
class PluginGenerator extends Generator {
|
|
12
|
-
constructor(args, opts) {
|
|
13
|
-
super(args, opts);
|
|
14
|
-
this.exampleRepoUrl = 'git@github.com:galacean/galacean-editor-plugin-examples.git';
|
|
15
|
-
this.githubUser = '';
|
|
16
|
-
this.name = opts.name;
|
|
17
|
-
this.options.force = opts.force;
|
|
18
|
-
}
|
|
19
|
-
async prompting() {
|
|
20
|
-
this.log(`Galacean Editor Plugin Generator. version: ${version}`);
|
|
21
|
-
const { pluginType } = await this.prompt([
|
|
22
|
-
{
|
|
23
|
-
type: 'list',
|
|
24
|
-
name: 'pluginType',
|
|
25
|
-
message: 'Select a plugin type',
|
|
26
|
-
choices: [
|
|
27
|
-
{ name: 'Basic', value: 'basic' },
|
|
28
|
-
{ name: 'React', value: 'react' },
|
|
29
|
-
],
|
|
30
|
-
default: 'blank',
|
|
31
|
-
},
|
|
32
|
-
]);
|
|
33
|
-
const targetDir = path.resolve(this.name);
|
|
34
|
-
(0, child_process_1.execSync)(`git clone ${this.exampleRepoUrl} "${targetDir}" --depth=1`);
|
|
35
|
-
for (const f of fs.readdirSync(path.resolve(this.name)).filter(file => file !== pluginType)) {
|
|
36
|
-
const p = `${path.resolve(this.name, f)}`;
|
|
37
|
-
this.log(p);
|
|
38
|
-
fs.rmSync(p, { recursive: true, force: true });
|
|
39
|
-
}
|
|
40
|
-
(0, child_process_1.execSync)(`mv ${path.resolve(this.name, pluginType, '*')} ${path.resolve(this.name)}`);
|
|
41
|
-
fs.rmSync(`${path.resolve(this.name, pluginType)}`, { recursive: true, force: true });
|
|
42
|
-
this.destinationRoot(path.resolve(this.name));
|
|
43
|
-
this.env.cwd = this.destinationPath();
|
|
44
|
-
try {
|
|
45
|
-
this.githubUser = await this.user.github.username();
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
debug(error);
|
|
49
|
-
}
|
|
50
|
-
this.pjson = {
|
|
51
|
-
name: '',
|
|
52
|
-
version: '',
|
|
53
|
-
description: '',
|
|
54
|
-
author: '',
|
|
55
|
-
bin: {},
|
|
56
|
-
homepage: '',
|
|
57
|
-
license: '',
|
|
58
|
-
main: '',
|
|
59
|
-
repository: '',
|
|
60
|
-
files: [],
|
|
61
|
-
dependencies: {},
|
|
62
|
-
devDependencies: {},
|
|
63
|
-
galacean: '',
|
|
64
|
-
scripts: {},
|
|
65
|
-
engines: {},
|
|
66
|
-
...this.fs.readJSON(path.join(this.env.cwd, 'package.json'), {}),
|
|
67
|
-
};
|
|
68
|
-
let repository = this.destinationRoot().split(path.sep).slice(-2).join('/');
|
|
69
|
-
if (this.githubUser) {
|
|
70
|
-
repository = `${this.githubUser}/${repository.split('/')[1]}`;
|
|
71
|
-
}
|
|
72
|
-
const defaults = {
|
|
73
|
-
...this.pjson,
|
|
74
|
-
name: (this.name || this.determineAppname()).replace(/ /g, '-'),
|
|
75
|
-
version: '0.0.0',
|
|
76
|
-
license: 'MIT',
|
|
77
|
-
author: this.githubUser ? `${this.user.git.name()} @${this.githubUser}` : this.user.git.name(),
|
|
78
|
-
dependencies: {},
|
|
79
|
-
repository,
|
|
80
|
-
engines: {
|
|
81
|
-
node: '>=12.0.0',
|
|
82
|
-
...this.pjson.engines,
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
this.repository = defaults.repository;
|
|
86
|
-
if (this.repository && this.repository.url) {
|
|
87
|
-
this.repository = this.repository.url;
|
|
88
|
-
}
|
|
89
|
-
this.answers = await this.prompt([
|
|
90
|
-
{
|
|
91
|
-
type: 'input',
|
|
92
|
-
name: 'name',
|
|
93
|
-
message: 'plugin package name',
|
|
94
|
-
default: defaults.name,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
type: 'input',
|
|
98
|
-
name: 'description',
|
|
99
|
-
message: 'description',
|
|
100
|
-
default: defaults.description,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
type: 'input',
|
|
104
|
-
name: 'author',
|
|
105
|
-
message: 'author',
|
|
106
|
-
default: defaults.author,
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
type: 'input',
|
|
110
|
-
name: 'galacean',
|
|
111
|
-
message: 'The minimum version of Galacean that this plugin supports',
|
|
112
|
-
default: defaults.galacean,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
type: 'input',
|
|
116
|
-
name: 'license',
|
|
117
|
-
message: 'license',
|
|
118
|
-
default: defaults.license,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
type: 'input',
|
|
122
|
-
name: 'github.user',
|
|
123
|
-
message: 'Who is the GitHub owner of repository (https://github.com/OWNER/repo)',
|
|
124
|
-
default: repository.split('/').slice(0, -1).pop(),
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
type: 'input',
|
|
128
|
-
name: 'github.repo',
|
|
129
|
-
message: 'What is the GitHub name of repository (https://github.com/owner/REPO)',
|
|
130
|
-
default: (answers) => (answers.name || this.pjson.repository || this.pjson.name).split('/').pop(),
|
|
131
|
-
},
|
|
132
|
-
]);
|
|
133
|
-
debug(this.answers);
|
|
134
|
-
this.pjson.name = this.answers.name || defaults.name;
|
|
135
|
-
this.pjson.description = this.answers.description || defaults.description;
|
|
136
|
-
this.pjson.version = this.answers.version || defaults.version;
|
|
137
|
-
this.pjson.engines.node = defaults.engines.node;
|
|
138
|
-
this.pjson.author = this.answers.author || defaults.author;
|
|
139
|
-
this.pjson.files = this.answers.files || defaults.files || '/lib';
|
|
140
|
-
this.pjson.license = this.answers.license || defaults.license;
|
|
141
|
-
// eslint-disable-next-line no-multi-assign
|
|
142
|
-
this.repository = this.pjson.repository = this.answers.github ? `${this.answers.github.user}/${this.answers.github.repo}` : defaults.repository;
|
|
143
|
-
this.pjson.homepage = `https://github.com/${this.repository}`;
|
|
144
|
-
this.pjson.bugs = `https://github.com/${this.repository}/issues`;
|
|
145
|
-
}
|
|
146
|
-
writing() {
|
|
147
|
-
this.pjson.files = _.uniq((this.pjson.files || []).sort());
|
|
148
|
-
this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson);
|
|
149
|
-
this.fs.write(this.destinationPath('.gitignore'), this._gitignore());
|
|
150
|
-
this.fs.delete(this.destinationPath('LICENSE'));
|
|
151
|
-
}
|
|
152
|
-
end() {
|
|
153
|
-
var _a;
|
|
154
|
-
if ((_a = this.pjson.scripts) === null || _a === void 0 ? void 0 : _a.build) {
|
|
155
|
-
this.spawnCommandSync(this.env.options.nodePackageManager, ['run', 'build'], { cwd: this.env.cwd });
|
|
156
|
-
}
|
|
157
|
-
this.log(`\nCreated ${this.pjson.name} in ${this.destinationRoot()}`);
|
|
158
|
-
}
|
|
159
|
-
_gitignore() {
|
|
160
|
-
const existing = this.fs.exists(this.destinationPath('.gitignore')) ? this.fs.read(this.destinationPath('.gitignore')).split('\n') : [];
|
|
161
|
-
return _([
|
|
162
|
-
'*-debug.log',
|
|
163
|
-
'*-error.log',
|
|
164
|
-
'node_modules',
|
|
165
|
-
'/tmp',
|
|
166
|
-
'/dist',
|
|
167
|
-
'/lib',
|
|
168
|
-
])
|
|
169
|
-
.concat(existing)
|
|
170
|
-
.compact()
|
|
171
|
-
.uniq()
|
|
172
|
-
.sort()
|
|
173
|
-
.join('\n') + '\n';
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
exports.default = PluginGenerator;
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { run } from '@oclif/core';
|
package/dist/index.js
DELETED
package/oclif.manifest.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.1.1",
|
|
3
|
-
"commands": {
|
|
4
|
-
"generate": {
|
|
5
|
-
"id": "generate",
|
|
6
|
-
"description": "generate a new Galacean Editor plugin\nThis will clone the specific folder in 'galacean/galacean-editor-plugin-examples' and update package properties",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"pluginName": "@galacean/cli",
|
|
9
|
-
"pluginAlias": "@galacean/cli",
|
|
10
|
-
"pluginType": "core",
|
|
11
|
-
"aliases": [],
|
|
12
|
-
"flags": {},
|
|
13
|
-
"args": {
|
|
14
|
-
"name": {
|
|
15
|
-
"name": "name",
|
|
16
|
-
"description": "directory name of new plugin",
|
|
17
|
-
"required": true
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|