@galacean/cli 0.0.1-1 → 0.0.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 CHANGED
@@ -1,66 +1,40 @@
1
- Galacean CLI
2
- =================
1
+ # Project Diff
3
2
 
4
- The all-in-one Galacean CLI that helps you build Galacean applications.
3
+ ## Usage
5
4
 
6
- <!-- toc -->
7
- * [Usage](#usage)
8
- * [Commands](#commands)
9
- <!-- tocstop -->
10
- # Usage
11
- <!-- usage -->
12
- ```sh-session
13
- $ npm install -g @galacean/cli
14
- $ galacean COMMAND
15
- running command...
16
- $ galacean (--version)
17
- @galacean/cli/0.0.1-1 darwin-x64 node-v16.17.0
18
- $ galacean --help [COMMAND]
19
- USAGE
20
- $ galacean COMMAND
21
- ...
22
- ```
23
- <!-- usagestop -->
24
- # Commands
25
- <!-- commands -->
26
- * [`galacean generate NAME`](#galacean-generate-name)
27
- * [`galacean help [COMMANDS]`](#galacean-help-commands)
28
-
29
- ## `galacean generate NAME`
30
-
31
- generate a new Galacean Editor plugin
5
+ ```bash
6
+ $ npm i -g @galacean/@galacean/cli
32
7
 
8
+ galacean diff <project1-url> <project2-url>
33
9
  ```
34
- USAGE
35
- $ galacean generate NAME
36
10
 
37
- ARGUMENTS
38
- NAME directory name of new plugin
11
+ 执行命令后会在命令文件夹下生成『项目 diff.md』文件,可以打开查看 diff 数据。
39
12
 
40
- DESCRIPTION
41
- generate a new Galacean Editor plugin
42
- This will clone the specific folder in 'galacean/galacean-editor-plugin-examples' and update package properties
43
- ```
44
13
 
45
- _See code: [dist/commands/generate.ts](https://github.com/galacean/cli/blob/v0.0.1-1/dist/commands/generate.ts)_
46
14
 
47
- ## `galacean help [COMMANDS]`
15
+ ## 测试 case
48
16
 
49
- Display help for galacean.
17
+ project: https://local.alipay.net:4000/#/project/24400002
50
18
 
51
- ```
52
- USAGE
53
- $ galacean help [COMMANDS] [-n]
19
+ - 资产
54
20
 
55
- ARGUMENTS
56
- COMMANDS Command to show help for.
21
+ - [ ] 资产新增
22
+ - https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*3htQQZ8Fa0sAAAAAAAAAAAAADnN-AQ/project.json https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*smcAQqM3oy0AAAAAAAAAAAAADnN-AQ/project.json
23
+ - [ ] 资产移除
24
+ - https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*smcAQqM3oy0AAAAAAAAAAAAADnN-AQ/project.json https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*3htQQZ8Fa0sAAAAAAAAAAAAADnN-AQ/project.json
57
25
 
58
- FLAGS
59
- -n, --nested-commands Include all nested commands in the output.
26
+ - 场景
60
27
 
61
- DESCRIPTION
62
- Display help for galacean.
63
- ```
28
+ - Entity
29
+ - [x] Entity 新增
30
+ - https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*vuobSqCRjRcAAAAAAAAAAAAADnN-AQ/project.json https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*px25TbJo7CYAAAAAAAAAAAAADnN-AQ/project.json
31
+ - [x] Entity 移除
32
+ - https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*px25TbJo7CYAAAAAAAAAAAAADnN-AQ/project.json https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*vuobSqCRjRcAAAAAAAAAAAAADnN-AQ/project.json
33
+ - 组件
34
+ - [ ] 组件新增
35
+ - https://mdn.alipayobjects.com/oasis_be/afts/file/A*R9kHQZQhOtUAAAAAAAAAAAAADkp5AQ/project.json https://mdn.alipayobjects.com/oasis_be/afts/file/A*yB3uQKIU6HUAAAAAAAAAAAAADkp5AQ/project.json
36
+ - [ ] 组件移除
37
+ - https://mdn.alipayobjects.com/oasis_be/afts/file/A*yB3uQKIU6HUAAAAAAAAAAAAADkp5AQ/project.json https://mdn.alipayobjects.com/oasis_be/afts/file/A*R9kHQZQhOtUAAAAAAAAAAAAADkp5AQ/project.json
64
38
 
65
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.14/src/commands/help.ts)_
66
- <!-- commandsstop -->
39
+ - 复合 case
40
+ - https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*Y9y2R784BXUAAAAAAAAAAAAADnN-AQ/project.json https://mmtcdp.stable.alipay.net/oasis_be/afts/file/A*OsYURKUVT9YAAAAAAAAAAAAADnN-AQ/project.json
package/bin/cli.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "../lib/cli.js";
package/package.json CHANGED
@@ -1,73 +1,41 @@
1
1
  {
2
2
  "name": "@galacean/cli",
3
- "version": "0.0.1-1",
4
- "description": "All-in-one cli tool that help you using Galacean Framework.",
5
- "author": "Kbscript @MrKou47",
3
+ "version": "0.0.1",
4
+ "main": "index.js",
5
+ "type": "module",
6
+ "author": {
7
+ "name": "gz65555",
8
+ "email": "gz65555@gmail.com"
9
+ },
10
+ "scripts": {
11
+ "dev": "tsc -w",
12
+ "build": "tsc"
13
+ },
6
14
  "bin": {
7
- "galacean": "./bin/run"
15
+ "galacean": "./bin/cli.js"
8
16
  },
9
- "homepage": "https://github.com/galacean/cli",
10
- "license": "MIT",
11
- "main": "dist/index.js",
12
- "repository": "galacean/cli",
13
17
  "files": [
14
- "/bin",
15
- "/dist",
16
- "/npm-shrinkwrap.json",
17
- "/oclif.manifest.json"
18
+ "dist",
19
+ "bin"
18
20
  ],
19
- "dependencies": {
20
- "@oclif/core": "^2",
21
- "@oclif/plugin-help": "^5",
22
- "@oclif/plugin-plugins": "^2.4.7",
23
- "yeoman-environment": "^3.19.3",
24
- "yeoman-generator": "^5.9.0"
25
- },
21
+ "types": "types",
22
+ "license": "MIT",
26
23
  "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"
24
+ "@types/fs-extra": "^9.0.12",
25
+ "@types/inquirer": "^7.3.3",
26
+ "prettier": "^2.3.2",
27
+ "typescript": "^5"
42
28
  },
43
- "oclif": {
44
- "bin": "galacean",
45
- "dirname": "galacean",
46
- "commands": "./dist/commands",
47
- "plugins": [
48
- "@oclif/plugin-help"
49
- ]
50
- },
51
- "scripts": {
52
- "build": "shx rm -rf dist && tsc -b",
53
- "lint": "eslint . --ext .ts --config .eslintrc",
54
- "postpack": "shx rm -f oclif.manifest.json",
55
- "posttest": "npm run lint",
56
- "prepack": "npm run build && oclif manifest && oclif readme",
57
- "test": "mocha --forbid-only \"test/**/*.test.ts\"",
58
- "version": "oclif readme && git add README.md"
59
- },
60
- "engines": {
61
- "node": ">=12.0.0"
62
- },
63
- "bugs": "https://github.com/galacean/cli/issues",
64
- "keywords": [
65
- "galacean",
66
- "cli",
67
- "plugin"
68
- ],
69
- "types": "dist/index.d.ts",
70
- "publishConfig": {
71
- "registry": "https://registry.npmjs.org"
29
+ "dependencies": {
30
+ "@types/lodash": "^4.14.202",
31
+ "@types/lodash-es": "^4.17.12",
32
+ "cac": "^6.7.3",
33
+ "chalk": "^5.3.0",
34
+ "fs-extra": "^10.0.0",
35
+ "inquirer": "^8.1.2",
36
+ "json-diff-ts": "^2.2.1",
37
+ "lodash": "^4.17.21",
38
+ "lodash-es": "^4.17.21",
39
+ "node-fetch": "^3.3.2"
72
40
  }
73
41
  }
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
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- node "%~dp0\dev" %*
package/bin/run DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const oclif = require('@oclif/core')
4
-
5
- oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle'))
package/bin/run.cmd DELETED
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- node "%~dp0\run" %*
@@ -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/parser").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 = 'https://github.com/galacean/galacean-editor-plugin-examples';
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
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.run = void 0;
4
- var core_1 = require("@oclif/core");
5
- Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
@@ -1,22 +0,0 @@
1
- {
2
- "version": "0.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
- }