@objectql/cli 1.6.0 → 1.7.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/CHANGELOG.md +22 -0
- package/IMPLEMENTATION_SUMMARY.md +437 -0
- package/README.md +385 -7
- package/USAGE_EXAMPLES.md +804 -0
- package/__tests__/commands.test.ts +153 -0
- package/dist/commands/i18n.d.ts +27 -0
- package/dist/commands/i18n.js +280 -0
- package/dist/commands/i18n.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.js +202 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate.d.ts +26 -0
- package/dist/commands/migrate.js +301 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/new.d.ts +7 -0
- package/dist/commands/new.js +279 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/studio.js +70 -9
- package/dist/commands/studio.js.map +1 -1
- package/dist/index.js +130 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/commands/i18n.ts +303 -0
- package/src/commands/init.ts +191 -0
- package/src/commands/migrate.ts +314 -0
- package/src/commands/new.ts +268 -0
- package/src/commands/studio.ts +75 -10
- package/src/index.ts +131 -2
- package/tsconfig.tsbuildinfo +1 -1
package/src/index.ts
CHANGED
|
@@ -3,14 +3,51 @@ import { generateTypes } from './commands/generate';
|
|
|
3
3
|
import { startRepl } from './commands/repl';
|
|
4
4
|
import { serve } from './commands/serve';
|
|
5
5
|
import { startStudio } from './commands/studio';
|
|
6
|
+
import { initProject } from './commands/init';
|
|
7
|
+
import { newMetadata } from './commands/new';
|
|
8
|
+
import { i18nExtract, i18nInit, i18nValidate } from './commands/i18n';
|
|
9
|
+
import { migrate, migrateCreate, migrateStatus } from './commands/migrate';
|
|
6
10
|
|
|
7
11
|
const program = new Command();
|
|
8
12
|
|
|
9
13
|
program
|
|
10
14
|
.name('objectql')
|
|
11
15
|
.description('ObjectQL CLI tool')
|
|
12
|
-
.version('
|
|
16
|
+
.version('1.5.0');
|
|
13
17
|
|
|
18
|
+
// Init command - Create new project
|
|
19
|
+
program
|
|
20
|
+
.command('init')
|
|
21
|
+
.description('Create a new ObjectQL project from template')
|
|
22
|
+
.option('-t, --template <template>', 'Template to use (basic, express-api, enterprise)', 'basic')
|
|
23
|
+
.option('-n, --name <name>', 'Project name')
|
|
24
|
+
.option('-d, --dir <path>', 'Target directory')
|
|
25
|
+
.option('--skip-install', 'Skip dependency installation')
|
|
26
|
+
.option('--skip-git', 'Skip git initialization')
|
|
27
|
+
.action(async (options) => {
|
|
28
|
+
try {
|
|
29
|
+
await initProject(options);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error(error);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// New command - Generate metadata files
|
|
37
|
+
program
|
|
38
|
+
.command('new <type> <name>')
|
|
39
|
+
.description('Generate a new metadata file (object, view, form, etc.)')
|
|
40
|
+
.option('-d, --dir <path>', 'Output directory', '.')
|
|
41
|
+
.action(async (type, name, options) => {
|
|
42
|
+
try {
|
|
43
|
+
await newMetadata({ type, name, dir: options.dir });
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error(error);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Generate command - Generate TypeScript types
|
|
14
51
|
program
|
|
15
52
|
.command('generate')
|
|
16
53
|
.alias('g')
|
|
@@ -26,6 +63,96 @@ program
|
|
|
26
63
|
}
|
|
27
64
|
});
|
|
28
65
|
|
|
66
|
+
// I18n commands
|
|
67
|
+
const i18nCmd = program
|
|
68
|
+
.command('i18n')
|
|
69
|
+
.description('Internationalization commands');
|
|
70
|
+
|
|
71
|
+
i18nCmd
|
|
72
|
+
.command('extract')
|
|
73
|
+
.description('Extract translatable strings from metadata files')
|
|
74
|
+
.option('-s, --source <path>', 'Source directory', '.')
|
|
75
|
+
.option('-o, --output <path>', 'Output directory', './src/i18n')
|
|
76
|
+
.option('-l, --lang <lang>', 'Language code', 'en')
|
|
77
|
+
.action(async (options) => {
|
|
78
|
+
try {
|
|
79
|
+
await i18nExtract(options);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error(error);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
i18nCmd
|
|
87
|
+
.command('init <lang>')
|
|
88
|
+
.description('Initialize i18n for a new language')
|
|
89
|
+
.option('-b, --base-dir <path>', 'Base i18n directory', './src/i18n')
|
|
90
|
+
.action(async (lang, options) => {
|
|
91
|
+
try {
|
|
92
|
+
await i18nInit({ lang, baseDir: options.baseDir });
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.error(error);
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
i18nCmd
|
|
100
|
+
.command('validate <lang>')
|
|
101
|
+
.description('Validate translation completeness')
|
|
102
|
+
.option('-b, --base-dir <path>', 'Base i18n directory', './src/i18n')
|
|
103
|
+
.option('--base-lang <lang>', 'Base language to compare against', 'en')
|
|
104
|
+
.action(async (lang, options) => {
|
|
105
|
+
try {
|
|
106
|
+
await i18nValidate({ lang, baseDir: options.baseDir, baseLang: options.baseLang });
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error(error);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Migration commands
|
|
114
|
+
const migrateCmd = program
|
|
115
|
+
.command('migrate')
|
|
116
|
+
.description('Run pending database migrations')
|
|
117
|
+
.option('-c, --config <path>', 'Path to objectql.config.ts/js')
|
|
118
|
+
.option('-d, --dir <path>', 'Migrations directory', './migrations')
|
|
119
|
+
.action(async (options) => {
|
|
120
|
+
try {
|
|
121
|
+
await migrate(options);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error(error);
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
migrateCmd
|
|
129
|
+
.command('create <name>')
|
|
130
|
+
.description('Create a new migration file')
|
|
131
|
+
.option('-d, --dir <path>', 'Migrations directory', './migrations')
|
|
132
|
+
.action(async (name, options) => {
|
|
133
|
+
try {
|
|
134
|
+
await migrateCreate({ name, dir: options.dir });
|
|
135
|
+
} catch (error) {
|
|
136
|
+
console.error(error);
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
migrateCmd
|
|
142
|
+
.command('status')
|
|
143
|
+
.description('Show migration status')
|
|
144
|
+
.option('-c, --config <path>', 'Path to objectql.config.ts/js')
|
|
145
|
+
.option('-d, --dir <path>', 'Migrations directory', './migrations')
|
|
146
|
+
.action(async (options) => {
|
|
147
|
+
try {
|
|
148
|
+
await migrateStatus(options);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.error(error);
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// REPL command
|
|
29
156
|
program
|
|
30
157
|
.command('repl')
|
|
31
158
|
.alias('r')
|
|
@@ -35,6 +162,7 @@ program
|
|
|
35
162
|
await startRepl(options.config);
|
|
36
163
|
});
|
|
37
164
|
|
|
165
|
+
// Serve command
|
|
38
166
|
program
|
|
39
167
|
.command('serve')
|
|
40
168
|
.alias('s')
|
|
@@ -45,11 +173,12 @@ program
|
|
|
45
173
|
await serve({ port: parseInt(options.port), dir: options.dir });
|
|
46
174
|
});
|
|
47
175
|
|
|
176
|
+
// Studio command
|
|
48
177
|
program
|
|
49
178
|
.command('studio')
|
|
50
179
|
.alias('ui')
|
|
51
180
|
.description('Start the ObjectQL Studio')
|
|
52
|
-
.option('-p, --port <number>', 'Port to listen on', '
|
|
181
|
+
.option('-p, --port <number>', 'Port to listen on', '5555')
|
|
53
182
|
.option('-d, --dir <path>', 'Directory containing schema', '.')
|
|
54
183
|
.option('--no-open', 'Do not open browser automatically')
|
|
55
184
|
.action(async (options) => {
|