@quarry-systems/drift-cli 0.0.1 → 0.1.1-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/package.json +2 -2
- package/src/bin/drift.d.ts +7 -0
- package/src/bin/drift.js +20 -0
- package/src/bin/drift.js.map +1 -0
- package/src/commands/plugin/build.d.ts +5 -0
- package/src/commands/plugin/build.js +68 -0
- package/src/commands/plugin/build.js.map +1 -0
- package/src/commands/plugin/dev.d.ts +5 -0
- package/src/commands/plugin/dev.js +53 -0
- package/src/commands/plugin/dev.js.map +1 -0
- package/src/commands/plugin/doctor.d.ts +5 -0
- package/src/commands/plugin/doctor.js +146 -0
- package/src/commands/plugin/doctor.js.map +1 -0
- package/src/commands/plugin/index.d.ts +5 -0
- package/src/commands/plugin/index.js +28 -0
- package/src/commands/plugin/index.js.map +1 -0
- package/src/commands/plugin/info.d.ts +5 -0
- package/src/commands/plugin/info.js +60 -0
- package/src/commands/plugin/info.js.map +1 -0
- package/src/commands/plugin/init.d.ts +5 -0
- package/src/commands/plugin/init.js +346 -0
- package/src/commands/plugin/init.js.map +1 -0
- package/src/commands/plugin/list.d.ts +5 -0
- package/src/commands/plugin/list.js +48 -0
- package/src/commands/plugin/list.js.map +1 -0
- package/src/commands/plugin/pack.d.ts +5 -0
- package/src/commands/plugin/pack.js +70 -0
- package/src/commands/plugin/pack.js.map +1 -0
- package/src/commands/plugin/search.d.ts +5 -0
- package/src/commands/plugin/search.js +46 -0
- package/src/commands/plugin/search.js.map +1 -0
- package/src/commands/plugin/test.d.ts +5 -0
- package/src/commands/plugin/test.js +32 -0
- package/src/commands/plugin/test.js.map +1 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -0
- package/src/lib/drift-cli.d.ts +1 -0
- package/src/lib/drift-cli.js +7 -0
- package/src/lib/drift-cli.js.map +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quarry-systems/drift-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1-alpha.1",
|
|
4
4
|
"description": "CLI tool for Drift plugin development",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/semver": "^7.5.0"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
|
-
"
|
|
37
|
+
"src",
|
|
38
38
|
"README.md",
|
|
39
39
|
"LICENSE.md",
|
|
40
40
|
"CHANGELOG.md"
|
package/src/bin/drift.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Drift CLI - Plugin development toolkit
|
|
5
|
+
*
|
|
6
|
+
* Main entry point for the drift command-line interface.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const commander_1 = require("commander");
|
|
10
|
+
const plugin_1 = require("../commands/plugin");
|
|
11
|
+
const program = new commander_1.Command();
|
|
12
|
+
program
|
|
13
|
+
.name('drift')
|
|
14
|
+
.description('Drift plugin development toolkit')
|
|
15
|
+
.version('0.0.1');
|
|
16
|
+
// Register plugin command
|
|
17
|
+
program.addCommand(plugin_1.pluginCommand);
|
|
18
|
+
// Parse arguments
|
|
19
|
+
program.parse(process.argv);
|
|
20
|
+
//# sourceMappingURL=drift.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift.js","sourceRoot":"","sources":["../../../../../../libs/drift/drift-cli/src/bin/drift.ts"],"names":[],"mappings":";;AAEA;;;;GAIG;;AAEH,yCAAoC;AACpC,+CAAmD;AAEnD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,kCAAkC,CAAC;KAC/C,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,0BAA0B;AAC1B,OAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;AAElC,kBAAkB;AAClB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* drift plugin build - Build plugin for distribution
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildCommand = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
10
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
11
|
+
const execa_1 = tslib_1.__importDefault(require("execa"));
|
|
12
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
13
|
+
const path = tslib_1.__importStar(require("path"));
|
|
14
|
+
exports.buildCommand = new commander_1.Command('build')
|
|
15
|
+
.description('Build plugin for distribution')
|
|
16
|
+
.option('--no-validate', 'Skip validation')
|
|
17
|
+
.action(async (options) => {
|
|
18
|
+
console.log(chalk_1.default.bold.blue('\n📦 Building plugin...\n'));
|
|
19
|
+
// Validate package.json
|
|
20
|
+
if (options.validate !== false) {
|
|
21
|
+
const spinner = (0, ora_1.default)('Validating package.json...').start();
|
|
22
|
+
try {
|
|
23
|
+
const pkg = await fs.readJSON(path.join(process.cwd(), 'package.json'));
|
|
24
|
+
// Check for drift-core in dependencies (should be in peerDependencies)
|
|
25
|
+
if (pkg.dependencies?.['@quarry-systems/drift-core']) {
|
|
26
|
+
spinner.fail('Validation failed');
|
|
27
|
+
console.log(chalk_1.default.red('\n❌ drift-core must be in peerDependencies, not dependencies\n') +
|
|
28
|
+
chalk_1.default.yellow('Fix: Move @quarry-systems/drift-core to peerDependencies in package.json'));
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
// Check for drift-core in peerDependencies
|
|
32
|
+
if (!pkg.peerDependencies?.['@quarry-systems/drift-core']) {
|
|
33
|
+
spinner.fail('Validation failed');
|
|
34
|
+
console.log(chalk_1.default.red('\n❌ drift-core must be declared as a peerDependency\n') +
|
|
35
|
+
chalk_1.default.yellow('Add to package.json:\n') +
|
|
36
|
+
chalk_1.default.cyan(' "peerDependencies": {\n') +
|
|
37
|
+
chalk_1.default.cyan(' "@quarry-systems/drift-core": "^0.6.0"\n') +
|
|
38
|
+
chalk_1.default.cyan(' }'));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
spinner.succeed('Validation passed');
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
spinner.fail('Validation failed');
|
|
45
|
+
console.error(chalk_1.default.red(error));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Build
|
|
50
|
+
const buildSpinner = (0, ora_1.default)('Building TypeScript...').start();
|
|
51
|
+
try {
|
|
52
|
+
await (0, execa_1.default)('npm', ['run', 'build'], { stdio: 'pipe' });
|
|
53
|
+
buildSpinner.succeed('Build successful');
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
buildSpinner.fail('Build failed');
|
|
57
|
+
console.error(chalk_1.default.red(error));
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
// Check for type declarations
|
|
61
|
+
const distPath = path.join(process.cwd(), 'dist');
|
|
62
|
+
const hasTypes = (await fs.readdir(distPath)).some(file => file.endsWith('.d.ts'));
|
|
63
|
+
if (!hasTypes) {
|
|
64
|
+
console.log(chalk_1.default.yellow('\n⚠️ No type declarations found. Consider adding "declaration": true to tsconfig.json'));
|
|
65
|
+
}
|
|
66
|
+
console.log(chalk_1.default.green.bold('\n✅ Build complete!\n'));
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|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AAE,MAAM,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAEnF,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,wFAAwF,CAAC,CAAC,CAAC;IACtH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* drift plugin dev - Development mode with watch and rebuild
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.devCommand = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
10
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
11
|
+
const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
|
|
12
|
+
const execa_1 = tslib_1.__importDefault(require("execa"));
|
|
13
|
+
exports.devCommand = new commander_1.Command('dev')
|
|
14
|
+
.description('Start development mode with file watching')
|
|
15
|
+
.action(async () => {
|
|
16
|
+
console.log(chalk_1.default.blue('Starting development mode...\n'));
|
|
17
|
+
// Initial build
|
|
18
|
+
const buildSpinner = (0, ora_1.default)('Building plugin...').start();
|
|
19
|
+
try {
|
|
20
|
+
await (0, execa_1.default)('npm', ['run', 'build']);
|
|
21
|
+
buildSpinner.succeed('Initial build successful');
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
buildSpinner.fail('Build failed');
|
|
25
|
+
console.error(chalk_1.default.red(error));
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
// Watch for changes
|
|
29
|
+
console.log(chalk_1.default.green('✓ Watching for changes...\n'));
|
|
30
|
+
const watcher = chokidar_1.default.watch('src/**/*.ts', {
|
|
31
|
+
ignoreInitial: true,
|
|
32
|
+
ignored: '**/*.test.ts',
|
|
33
|
+
});
|
|
34
|
+
watcher.on('change', async (path) => {
|
|
35
|
+
console.log(chalk_1.default.yellow(`\nFile changed: ${path}`));
|
|
36
|
+
const spinner = (0, ora_1.default)('Rebuilding...').start();
|
|
37
|
+
try {
|
|
38
|
+
await (0, execa_1.default)('npm', ['run', 'build']);
|
|
39
|
+
spinner.succeed('Build successful');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
spinner.fail('Build failed');
|
|
43
|
+
console.error(chalk_1.default.red(error));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
// Keep process alive
|
|
47
|
+
process.on('SIGINT', () => {
|
|
48
|
+
console.log(chalk_1.default.yellow('\n\nStopping development mode...'));
|
|
49
|
+
watcher.close();
|
|
50
|
+
process.exit(0);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../../../../libs/drift/drift-cli/src/commands/plugin/dev.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,yCAAoC;AACpC,0DAA0B;AAC1B,sDAAsB;AACtB,gEAAgC;AAChC,0DAA0B;AAEb,QAAA,UAAU,GAAG,IAAI,mBAAO,CAAC,KAAK,CAAC;KACzC,WAAW,CAAC,2CAA2C,CAAC;KACxD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAE1D,gBAAgB;IAChB,MAAM,YAA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;QAClC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,qBAAqB;IACrB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,kCAAkC,CAAC,CAAC,CAAC;QAC9D,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* drift plugin doctor - Run diagnostic checks
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.doctorCommand = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
10
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
11
|
+
const path = tslib_1.__importStar(require("path"));
|
|
12
|
+
exports.doctorCommand = new commander_1.Command('doctor')
|
|
13
|
+
.description('Run diagnostic checks on plugin')
|
|
14
|
+
.action(async () => {
|
|
15
|
+
console.log(chalk_1.default.bold('🔍 Running plugin diagnostics...\n'));
|
|
16
|
+
const checks = [];
|
|
17
|
+
// Check Node.js version
|
|
18
|
+
const nodeVersion = process.version;
|
|
19
|
+
const nodeMajor = parseInt(nodeVersion.slice(1).split('.')[0]);
|
|
20
|
+
checks.push({
|
|
21
|
+
name: 'Node.js version',
|
|
22
|
+
status: nodeMajor >= 18 ? 'pass' : 'fail',
|
|
23
|
+
message: nodeMajor < 18 ? `Node.js ${nodeVersion} is too old, requires >=18.0.0` : undefined,
|
|
24
|
+
});
|
|
25
|
+
// Check for package.json
|
|
26
|
+
const pkgPath = path.join(process.cwd(), 'package.json');
|
|
27
|
+
if (!await fs.pathExists(pkgPath)) {
|
|
28
|
+
checks.push({
|
|
29
|
+
name: 'package.json',
|
|
30
|
+
status: 'fail',
|
|
31
|
+
message: 'package.json not found',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
checks.push({ name: 'package.json', status: 'pass' });
|
|
36
|
+
// Check peer dependencies
|
|
37
|
+
const pkg = await fs.readJSON(pkgPath);
|
|
38
|
+
if (!pkg.peerDependencies?.['@quarry-systems/drift-core']) {
|
|
39
|
+
checks.push({
|
|
40
|
+
name: 'Peer dependencies',
|
|
41
|
+
status: 'fail',
|
|
42
|
+
message: 'drift-core must be in peerDependencies',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else if (pkg.dependencies?.['@quarry-systems/drift-core']) {
|
|
46
|
+
checks.push({
|
|
47
|
+
name: 'Peer dependencies',
|
|
48
|
+
status: 'fail',
|
|
49
|
+
message: 'drift-core should be in peerDependencies, not dependencies',
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
checks.push({ name: 'Peer dependencies', status: 'pass' });
|
|
54
|
+
}
|
|
55
|
+
// Check for manifest
|
|
56
|
+
const manifestPath = path.join(process.cwd(), 'src', 'plugin.manifest.ts');
|
|
57
|
+
if (!await fs.pathExists(manifestPath)) {
|
|
58
|
+
checks.push({
|
|
59
|
+
name: 'Plugin manifest',
|
|
60
|
+
status: 'warn',
|
|
61
|
+
message: 'plugin.manifest.ts not found (optional in v0.6)',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
checks.push({ name: 'Plugin manifest', status: 'pass' });
|
|
66
|
+
}
|
|
67
|
+
// Check for TypeScript
|
|
68
|
+
const tsconfigPath = path.join(process.cwd(), 'tsconfig.json');
|
|
69
|
+
if (!await fs.pathExists(tsconfigPath)) {
|
|
70
|
+
checks.push({
|
|
71
|
+
name: 'TypeScript config',
|
|
72
|
+
status: 'fail',
|
|
73
|
+
message: 'tsconfig.json not found',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
checks.push({ name: 'TypeScript config', status: 'pass' });
|
|
78
|
+
}
|
|
79
|
+
// Check for build output
|
|
80
|
+
const distPath = path.join(process.cwd(), 'dist');
|
|
81
|
+
if (!await fs.pathExists(distPath)) {
|
|
82
|
+
checks.push({
|
|
83
|
+
name: 'Build output',
|
|
84
|
+
status: 'warn',
|
|
85
|
+
message: 'dist/ not found - run npm run build',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const hasTypes = (await fs.readdir(distPath)).some(file => file.endsWith('.d.ts'));
|
|
90
|
+
if (!hasTypes) {
|
|
91
|
+
checks.push({
|
|
92
|
+
name: 'Type declarations',
|
|
93
|
+
status: 'warn',
|
|
94
|
+
message: 'No .d.ts files found in dist/',
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
checks.push({ name: 'Type declarations', status: 'pass' });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Check .gitignore
|
|
102
|
+
const gitignorePath = path.join(process.cwd(), '.gitignore');
|
|
103
|
+
if (await fs.pathExists(gitignorePath)) {
|
|
104
|
+
const gitignore = await fs.readFile(gitignorePath, 'utf-8');
|
|
105
|
+
if (!gitignore.includes('dist/')) {
|
|
106
|
+
checks.push({
|
|
107
|
+
name: '.gitignore',
|
|
108
|
+
status: 'warn',
|
|
109
|
+
message: 'dist/ should be in .gitignore',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
checks.push({ name: '.gitignore', status: 'pass' });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Print results
|
|
118
|
+
for (const check of checks) {
|
|
119
|
+
if (check.status === 'pass') {
|
|
120
|
+
console.log(chalk_1.default.green(`✓ ${check.name}`));
|
|
121
|
+
}
|
|
122
|
+
else if (check.status === 'warn') {
|
|
123
|
+
console.log(chalk_1.default.yellow(`⚠ ${check.name}: ${check.message}`));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.log(chalk_1.default.red(`✗ ${check.name}: ${check.message}`));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const failures = checks.filter(c => c.status === 'fail');
|
|
130
|
+
const warnings = checks.filter(c => c.status === 'warn');
|
|
131
|
+
console.log();
|
|
132
|
+
if (failures.length === 0) {
|
|
133
|
+
console.log(chalk_1.default.green('✓ All critical checks passed!'));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
console.log(chalk_1.default.red(`✗ ${failures.length} check(s) failed`));
|
|
137
|
+
}
|
|
138
|
+
if (warnings.length > 0) {
|
|
139
|
+
console.log(chalk_1.default.yellow(`⚠ ${warnings.length} warning(s)`));
|
|
140
|
+
}
|
|
141
|
+
console.log();
|
|
142
|
+
if (failures.length > 0) {
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../../../../../../libs/drift/drift-cli/src/commands/plugin/doctor.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,yCAAoC;AACpC,0DAA0B;AAC1B,qDAA+B;AAC/B,mDAA6B;AAShB,QAAA,aAAa,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,iCAAiC,CAAC;KAC9C,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAkB,EAAE,CAAC;IAEjC,wBAAwB;IACxB,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IACpC,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK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AAC,KAAK,QAAQ,CAAC,MAAM,aAAa,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAC;IAEd,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin command - Main plugin development commands
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pluginCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const init_1 = require("./init");
|
|
9
|
+
const dev_1 = require("./dev");
|
|
10
|
+
const test_1 = require("./test");
|
|
11
|
+
const build_1 = require("./build");
|
|
12
|
+
const search_1 = require("./search");
|
|
13
|
+
const info_1 = require("./info");
|
|
14
|
+
const list_1 = require("./list");
|
|
15
|
+
const doctor_1 = require("./doctor");
|
|
16
|
+
const pack_1 = require("./pack");
|
|
17
|
+
exports.pluginCommand = new commander_1.Command('plugin')
|
|
18
|
+
.description('Plugin development commands')
|
|
19
|
+
.addCommand(init_1.initCommand)
|
|
20
|
+
.addCommand(dev_1.devCommand)
|
|
21
|
+
.addCommand(test_1.testCommand)
|
|
22
|
+
.addCommand(build_1.buildCommand)
|
|
23
|
+
.addCommand(search_1.searchCommand)
|
|
24
|
+
.addCommand(info_1.infoCommand)
|
|
25
|
+
.addCommand(list_1.listCommand)
|
|
26
|
+
.addCommand(doctor_1.doctorCommand)
|
|
27
|
+
.addCommand(pack_1.packCommand);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/drift/drift-cli/src/commands/plugin/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,yCAAoC;AACpC,iCAAqC;AACrC,+BAAmC;AACnC,iCAAqC;AACrC,mCAAuC;AACvC,qCAAyC;AACzC,iCAAqC;AACrC,iCAAqC;AACrC,qCAAyC;AACzC,iCAAqC;AAExB,QAAA,aAAa,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,6BAA6B,CAAC;KAC1C,UAAU,CAAC,kBAAW,CAAC;KACvB,UAAU,CAAC,gBAAU,CAAC;KACtB,UAAU,CAAC,kBAAW,CAAC;KACvB,UAAU,CAAC,oBAAY,CAAC;KACxB,UAAU,CAAC,sBAAa,CAAC;KACzB,UAAU,CAAC,kBAAW,CAAC;KACvB,UAAU,CAAC,kBAAW,CAAC;KACvB,UAAU,CAAC,sBAAa,CAAC;KACzB,UAAU,CAAC,kBAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* drift plugin info - Show plugin details
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.infoCommand = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
10
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
11
|
+
exports.infoCommand = new commander_1.Command('info')
|
|
12
|
+
.description('Show plugin details')
|
|
13
|
+
.argument('<name>', 'Plugin name')
|
|
14
|
+
.action(async (name) => {
|
|
15
|
+
const spinner = (0, ora_1.default)(`Fetching info for ${name}...`).start();
|
|
16
|
+
try {
|
|
17
|
+
const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(name)}`);
|
|
18
|
+
if (!response.ok) {
|
|
19
|
+
if (response.status === 404) {
|
|
20
|
+
spinner.fail('Plugin not found');
|
|
21
|
+
console.log(chalk_1.default.yellow(`\nPlugin "${name}" not found on npm\n`));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
throw new Error(`npm registry returned ${response.status}`);
|
|
25
|
+
}
|
|
26
|
+
const data = await response.json();
|
|
27
|
+
const latest = data['dist-tags'].latest;
|
|
28
|
+
const version = data.versions[latest];
|
|
29
|
+
spinner.stop();
|
|
30
|
+
console.log(chalk_1.default.bold.cyan(`\n${data.name}`) + chalk_1.default.gray(` v${latest}`));
|
|
31
|
+
console.log(chalk_1.default.gray(data.description || 'No description'));
|
|
32
|
+
console.log();
|
|
33
|
+
console.log(chalk_1.default.bold('Details:'));
|
|
34
|
+
console.log(` License: ${version.license || 'Unknown'}`);
|
|
35
|
+
console.log(` Author: ${typeof version.author === 'string' ? version.author : version.author?.name || 'Unknown'}`);
|
|
36
|
+
if (data.repository?.url) {
|
|
37
|
+
console.log(` Repository: ${data.repository.url.replace(/^git\+/, '').replace(/\.git$/, '')}`);
|
|
38
|
+
}
|
|
39
|
+
if (data.homepage) {
|
|
40
|
+
console.log(` Homepage: ${data.homepage}`);
|
|
41
|
+
}
|
|
42
|
+
if (version.peerDependencies) {
|
|
43
|
+
console.log();
|
|
44
|
+
console.log(chalk_1.default.bold('Peer Dependencies:'));
|
|
45
|
+
for (const [dep, ver] of Object.entries(version.peerDependencies)) {
|
|
46
|
+
console.log(` ${dep}: ${ver}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
console.log();
|
|
50
|
+
console.log(chalk_1.default.bold('Installation:'));
|
|
51
|
+
console.log(chalk_1.default.cyan(` npm install ${data.name}`));
|
|
52
|
+
console.log();
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
spinner.fail('Failed to fetch plugin info');
|
|
56
|
+
console.error(chalk_1.default.red(error));
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../../../../../../libs/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CAAC;YAClC,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* drift plugin init - Scaffold a new plugin
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.initCommand = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
|
|
10
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
11
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
12
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
13
|
+
const path = tslib_1.__importStar(require("path"));
|
|
14
|
+
const execa_1 = tslib_1.__importDefault(require("execa"));
|
|
15
|
+
exports.initCommand = new commander_1.Command('init')
|
|
16
|
+
.description('Create a new Drift plugin')
|
|
17
|
+
.argument('[name]', 'Plugin name (e.g., @myorg/drift-my-plugin)')
|
|
18
|
+
.action(async (name) => {
|
|
19
|
+
console.log(chalk_1.default.bold.blue('\n🚀 Drift Plugin Generator\n'));
|
|
20
|
+
// Prompt for plugin details
|
|
21
|
+
const answers = await inquirer_1.default.prompt([
|
|
22
|
+
{
|
|
23
|
+
type: 'input',
|
|
24
|
+
name: 'name',
|
|
25
|
+
message: 'Plugin name:',
|
|
26
|
+
default: name,
|
|
27
|
+
validate: (input) => {
|
|
28
|
+
if (!input.startsWith('@')) {
|
|
29
|
+
return 'Plugin name must be scoped (e.g., @myorg/drift-my-plugin)';
|
|
30
|
+
}
|
|
31
|
+
if (!input.includes('drift')) {
|
|
32
|
+
return chalk_1.default.yellow('Warning: Plugin name should include "drift" for discoverability');
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
},
|
|
36
|
+
when: !name,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'input',
|
|
40
|
+
name: 'description',
|
|
41
|
+
message: 'Description:',
|
|
42
|
+
default: 'A Drift plugin',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'input',
|
|
46
|
+
name: 'author',
|
|
47
|
+
message: 'Author:',
|
|
48
|
+
default: '',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'list',
|
|
52
|
+
name: 'license',
|
|
53
|
+
message: 'License:',
|
|
54
|
+
choices: ['MIT', 'Apache-2.0', 'GPL-3.0', 'Proprietary'],
|
|
55
|
+
default: 'MIT',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'list',
|
|
59
|
+
name: 'template',
|
|
60
|
+
message: 'Template:',
|
|
61
|
+
choices: [
|
|
62
|
+
{ name: 'Basic (nodes only)', value: 'basic' },
|
|
63
|
+
{ name: 'Service (custom service)', value: 'service' },
|
|
64
|
+
{ name: 'Full (nodes + services)', value: 'full' },
|
|
65
|
+
],
|
|
66
|
+
default: 'basic',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'confirm',
|
|
70
|
+
name: 'initGit',
|
|
71
|
+
message: 'Initialize git repository?',
|
|
72
|
+
default: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'confirm',
|
|
76
|
+
name: 'installDeps',
|
|
77
|
+
message: 'Install dependencies?',
|
|
78
|
+
default: true,
|
|
79
|
+
},
|
|
80
|
+
]);
|
|
81
|
+
const pluginName = name || answers.name;
|
|
82
|
+
const pluginDir = pluginName.split('/').pop() || pluginName;
|
|
83
|
+
const targetDir = path.join(process.cwd(), pluginDir);
|
|
84
|
+
// Check if directory exists
|
|
85
|
+
if (await fs.pathExists(targetDir)) {
|
|
86
|
+
console.log(chalk_1.default.red(`\n❌ Directory ${pluginDir} already exists`));
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
const spinner = (0, ora_1.default)('Creating plugin structure...').start();
|
|
90
|
+
try {
|
|
91
|
+
// Create plugin directory structure
|
|
92
|
+
await fs.ensureDir(targetDir);
|
|
93
|
+
await fs.ensureDir(path.join(targetDir, 'src'));
|
|
94
|
+
await fs.ensureDir(path.join(targetDir, 'src', 'nodes'));
|
|
95
|
+
await fs.ensureDir(path.join(targetDir, 'src', 'services'));
|
|
96
|
+
await fs.ensureDir(path.join(targetDir, 'examples'));
|
|
97
|
+
// Create package.json
|
|
98
|
+
const packageJson = {
|
|
99
|
+
name: pluginName,
|
|
100
|
+
version: '0.0.1',
|
|
101
|
+
description: answers.description,
|
|
102
|
+
author: answers.author,
|
|
103
|
+
license: answers.license,
|
|
104
|
+
main: './dist/index.js',
|
|
105
|
+
types: './dist/index.d.ts',
|
|
106
|
+
files: ['dist', 'README.md', 'LICENSE'],
|
|
107
|
+
scripts: {
|
|
108
|
+
build: 'tsc',
|
|
109
|
+
test: 'vitest run',
|
|
110
|
+
'test:watch': 'vitest',
|
|
111
|
+
'test:coverage': 'vitest run --coverage',
|
|
112
|
+
dev: 'tsc --watch',
|
|
113
|
+
},
|
|
114
|
+
keywords: ['drift', 'mcg', 'plugin'],
|
|
115
|
+
peerDependencies: {
|
|
116
|
+
'@quarry-systems/drift-core': '^0.6.0',
|
|
117
|
+
'@quarry-systems/drift-contracts': '^0.6.0',
|
|
118
|
+
},
|
|
119
|
+
devDependencies: {
|
|
120
|
+
'@quarry-systems/drift-core': '^0.6.0',
|
|
121
|
+
'@quarry-systems/drift-contracts': '^0.6.0',
|
|
122
|
+
'@quarry-systems/drift-testing': '^0.6.0',
|
|
123
|
+
typescript: '^5.0.0',
|
|
124
|
+
vitest: '^1.0.0',
|
|
125
|
+
'@vitest/coverage-v8': '^1.0.0',
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
await fs.writeJSON(path.join(targetDir, 'package.json'), packageJson, { spaces: 2 });
|
|
129
|
+
// Create tsconfig.json
|
|
130
|
+
const tsConfig = {
|
|
131
|
+
compilerOptions: {
|
|
132
|
+
target: 'ES2020',
|
|
133
|
+
module: 'commonjs',
|
|
134
|
+
lib: ['ES2020'],
|
|
135
|
+
declaration: true,
|
|
136
|
+
outDir: './dist',
|
|
137
|
+
rootDir: './src',
|
|
138
|
+
strict: true,
|
|
139
|
+
esModuleInterop: true,
|
|
140
|
+
skipLibCheck: true,
|
|
141
|
+
forceConsistentCasingInFileNames: true,
|
|
142
|
+
},
|
|
143
|
+
include: ['src/**/*'],
|
|
144
|
+
exclude: ['node_modules', 'dist', '**/*.test.ts'],
|
|
145
|
+
};
|
|
146
|
+
await fs.writeJSON(path.join(targetDir, 'tsconfig.json'), tsConfig, { spaces: 2 });
|
|
147
|
+
// Create vitest.config.ts
|
|
148
|
+
const vitestConfig = `import { defineConfig } from 'vitest/config';
|
|
149
|
+
|
|
150
|
+
export default defineConfig({
|
|
151
|
+
test: {
|
|
152
|
+
globals: true,
|
|
153
|
+
environment: 'node',
|
|
154
|
+
coverage: {
|
|
155
|
+
provider: 'v8',
|
|
156
|
+
reporter: ['text', 'json', 'html'],
|
|
157
|
+
exclude: ['node_modules/', 'dist/', '**/*.test.ts'],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
`;
|
|
162
|
+
await fs.writeFile(path.join(targetDir, 'vitest.config.ts'), vitestConfig);
|
|
163
|
+
// Create plugin manifest
|
|
164
|
+
const manifest = `import { definePluginManifest } from '@quarry-systems/drift-contracts';
|
|
165
|
+
|
|
166
|
+
export default definePluginManifest({
|
|
167
|
+
name: '${pluginName}',
|
|
168
|
+
version: '0.0.1',
|
|
169
|
+
description: '${answers.description}',
|
|
170
|
+
author: '${answers.author}',
|
|
171
|
+
license: '${answers.license}',
|
|
172
|
+
apiVersion: '1.0',
|
|
173
|
+
type: ['node'],
|
|
174
|
+
capabilities: {
|
|
175
|
+
network: false,
|
|
176
|
+
filesystem: false,
|
|
177
|
+
secrets: false,
|
|
178
|
+
ai: false,
|
|
179
|
+
database: false,
|
|
180
|
+
subprocess: false,
|
|
181
|
+
},
|
|
182
|
+
compatibility: {
|
|
183
|
+
drift: '^0.6.0',
|
|
184
|
+
node: '>=18.0.0',
|
|
185
|
+
},
|
|
186
|
+
provides: {
|
|
187
|
+
nodes: ['exampleNode'],
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
`;
|
|
191
|
+
await fs.writeFile(path.join(targetDir, 'src', 'plugin.manifest.ts'), manifest);
|
|
192
|
+
// Create main index file
|
|
193
|
+
const indexContent = `import type { Plugin } from '@quarry-systems/drift-contracts';
|
|
194
|
+
import manifest from './plugin.manifest';
|
|
195
|
+
import { exampleNode } from './nodes/example-node';
|
|
196
|
+
|
|
197
|
+
export const ${pluginDir.replace(/-/g, '')}Plugin: Plugin = {
|
|
198
|
+
name: manifest.name,
|
|
199
|
+
version: manifest.version,
|
|
200
|
+
apiVersion: manifest.apiVersion,
|
|
201
|
+
manifest,
|
|
202
|
+
nodes: {
|
|
203
|
+
exampleNode,
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export default ${pluginDir.replace(/-/g, '')}Plugin;
|
|
208
|
+
`;
|
|
209
|
+
await fs.writeFile(path.join(targetDir, 'src', 'index.ts'), indexContent);
|
|
210
|
+
// Create example node
|
|
211
|
+
const exampleNode = `import type { NodeHandler, Ctx } from '@quarry-systems/drift-contracts';
|
|
212
|
+
|
|
213
|
+
export const exampleNode: NodeHandler = async (ctx: Ctx) => {
|
|
214
|
+
// Your node logic here
|
|
215
|
+
console.log('Example node executed');
|
|
216
|
+
|
|
217
|
+
return {
|
|
218
|
+
...ctx,
|
|
219
|
+
data: {
|
|
220
|
+
...ctx.data,
|
|
221
|
+
result: 'Hello from example node',
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
`;
|
|
226
|
+
await fs.writeFile(path.join(targetDir, 'src', 'nodes', 'example-node.ts'), exampleNode);
|
|
227
|
+
// Create example test
|
|
228
|
+
const exampleTest = `import { describe, it, expect } from 'vitest';
|
|
229
|
+
import { exampleNode } from './example-node';
|
|
230
|
+
|
|
231
|
+
describe('exampleNode', () => {
|
|
232
|
+
it('should execute successfully', async () => {
|
|
233
|
+
const ctx = {
|
|
234
|
+
data: {},
|
|
235
|
+
meta: {},
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const result = await exampleNode(ctx);
|
|
239
|
+
|
|
240
|
+
expect(result.data.result).toBe('Hello from example node');
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
`;
|
|
244
|
+
await fs.writeFile(path.join(targetDir, 'src', 'nodes', 'example-node.test.ts'), exampleTest);
|
|
245
|
+
// Create README
|
|
246
|
+
const readme = `# ${pluginName}
|
|
247
|
+
|
|
248
|
+
${answers.description}
|
|
249
|
+
|
|
250
|
+
## Installation
|
|
251
|
+
|
|
252
|
+
\`\`\`bash
|
|
253
|
+
npm install ${pluginName}
|
|
254
|
+
\`\`\`
|
|
255
|
+
|
|
256
|
+
## Usage
|
|
257
|
+
|
|
258
|
+
\`\`\`typescript
|
|
259
|
+
import { ManagedCyclicGraph } from '@quarry-systems/drift-core';
|
|
260
|
+
import { ${pluginDir.replace(/-/g, '')}Plugin } from '${pluginName}';
|
|
261
|
+
|
|
262
|
+
const graph = new ManagedCyclicGraph()
|
|
263
|
+
.use(${pluginDir.replace(/-/g, '')}Plugin)
|
|
264
|
+
.node('example', { type: 'exampleNode' })
|
|
265
|
+
.build();
|
|
266
|
+
\`\`\`
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
${answers.license}
|
|
271
|
+
`;
|
|
272
|
+
await fs.writeFile(path.join(targetDir, 'README.md'), readme);
|
|
273
|
+
// Create .gitignore
|
|
274
|
+
const gitignore = `node_modules/
|
|
275
|
+
dist/
|
|
276
|
+
coverage/
|
|
277
|
+
.DS_Store
|
|
278
|
+
*.log
|
|
279
|
+
`;
|
|
280
|
+
await fs.writeFile(path.join(targetDir, '.gitignore'), gitignore);
|
|
281
|
+
// Create LICENSE file
|
|
282
|
+
if (answers.license === 'MIT') {
|
|
283
|
+
const license = `MIT License
|
|
284
|
+
|
|
285
|
+
Copyright (c) ${new Date().getFullYear()} ${answers.author}
|
|
286
|
+
|
|
287
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
288
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
289
|
+
in the Software without restriction, including without limitation the rights
|
|
290
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
291
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
292
|
+
furnished to do so, subject to the following conditions:
|
|
293
|
+
|
|
294
|
+
The above copyright notice and this permission notice shall be included in all
|
|
295
|
+
copies or substantial portions of the Software.
|
|
296
|
+
|
|
297
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
298
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
299
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
300
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
301
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
302
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
303
|
+
SOFTWARE.
|
|
304
|
+
`;
|
|
305
|
+
await fs.writeFile(path.join(targetDir, 'LICENSE'), license);
|
|
306
|
+
}
|
|
307
|
+
spinner.succeed('Plugin structure created');
|
|
308
|
+
// Initialize git
|
|
309
|
+
if (answers.initGit) {
|
|
310
|
+
const gitSpinner = (0, ora_1.default)('Initializing git repository...').start();
|
|
311
|
+
try {
|
|
312
|
+
await (0, execa_1.default)('git', ['init'], { cwd: targetDir });
|
|
313
|
+
await (0, execa_1.default)('git', ['add', '.'], { cwd: targetDir });
|
|
314
|
+
await (0, execa_1.default)('git', ['commit', '-m', 'Initial commit'], { cwd: targetDir });
|
|
315
|
+
gitSpinner.succeed('Git repository initialized');
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
gitSpinner.fail('Failed to initialize git repository');
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// Install dependencies
|
|
322
|
+
if (answers.installDeps) {
|
|
323
|
+
const depsSpinner = (0, ora_1.default)('Installing dependencies...').start();
|
|
324
|
+
try {
|
|
325
|
+
await (0, execa_1.default)('npm', ['install'], { cwd: targetDir });
|
|
326
|
+
depsSpinner.succeed('Dependencies installed');
|
|
327
|
+
}
|
|
328
|
+
catch (error) {
|
|
329
|
+
depsSpinner.fail('Failed to install dependencies');
|
|
330
|
+
console.log(chalk_1.default.yellow('\nYou can install dependencies manually with: npm install'));
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
console.log(chalk_1.default.green.bold('\n✅ Plugin created successfully!\n'));
|
|
334
|
+
console.log(chalk_1.default.cyan('Next steps:'));
|
|
335
|
+
console.log(chalk_1.default.gray(` cd ${pluginDir}`));
|
|
336
|
+
console.log(chalk_1.default.gray(' npm run dev # Start development mode'));
|
|
337
|
+
console.log(chalk_1.default.gray(' npm test # Run tests'));
|
|
338
|
+
console.log(chalk_1.default.gray(' npm run build # Build for distribution\n'));
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
spinner.fail('Failed to create plugin');
|
|
342
|
+
console.error(chalk_1.default.red(error));
|
|
343
|
+
process.exit(1);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../../libs/drift/drift-cli/src/commands/plugin/init.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,yCAAoC;AACpC,gEAAgC;AAChC,0DAA0B;AAC1B,sDAAsB;AACtB,qDAA+B;AAC/B,mDAA6B;AAC7B,0DAA0B;AAYb,QAAA,WAAW,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,2BAA2B,CAAC;KACxC,QAAQ,CAAC,QAAQ,EAAE,4CAA4C,CAAC;KAChE,MAAM,CAAC,KAAK,EAAE,IAAa,EAAE,EAAE;IAC9B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC,CAAC;IAE9D,4BAA4B;IAC5B,MAAM,OAAO,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAgB;QACnD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,cAAc;YACvB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC1B,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC3B,OAAO,2DAA2D,CAAC;gBACrE,CAAC;gBACD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;oBAC7B,OAAO,eAAK,CAAC,MAAM,CAAC,iEAAiE,CAA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C,IAAI,CAAC,+CAA+C,CAAC,CAAC,CAAC;IAC3E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACxC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* drift plugin list - List installed plugins
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.listCommand = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
10
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
11
|
+
const path = tslib_1.__importStar(require("path"));
|
|
12
|
+
exports.listCommand = new commander_1.Command('list')
|
|
13
|
+
.description('List installed Drift plugins')
|
|
14
|
+
.action(async () => {
|
|
15
|
+
try {
|
|
16
|
+
const pkgPath = path.join(process.cwd(), 'package.json');
|
|
17
|
+
if (!await fs.pathExists(pkgPath)) {
|
|
18
|
+
console.log(chalk_1.default.yellow('\nNo package.json found in current directory\n'));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const pkg = await fs.readJSON(pkgPath);
|
|
22
|
+
const allDeps = {
|
|
23
|
+
...pkg.dependencies,
|
|
24
|
+
...pkg.devDependencies,
|
|
25
|
+
};
|
|
26
|
+
// Filter for drift/mcg plugins
|
|
27
|
+
const plugins = Object.entries(allDeps)
|
|
28
|
+
.filter(([name]) => name.includes('drift-') ||
|
|
29
|
+
name.includes('mcg-'))
|
|
30
|
+
.filter(([name]) => !name.includes('drift-core') &&
|
|
31
|
+
!name.includes('drift-contracts') &&
|
|
32
|
+
!name.includes('drift-testing'));
|
|
33
|
+
if (plugins.length === 0) {
|
|
34
|
+
console.log(chalk_1.default.yellow('\nNo Drift plugins installed\n'));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
console.log(chalk_1.default.bold(`\nInstalled Drift plugins (${plugins.length}):\n`));
|
|
38
|
+
for (const [name, version] of plugins) {
|
|
39
|
+
console.log(chalk_1.default.cyan(name) + chalk_1.default.gray(` ${version}`));
|
|
40
|
+
}
|
|
41
|
+
console.log();
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error(chalk_1.default.red('Failed to list plugins:'), error);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../../../libs/drift/drift-cli/src/commands/plugin/list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,yCAAoC;AACpC,0DAA0B;AAC1B,qDAA+B;AAC/B,mDAA6B;AAEhB,QAAA,WAAW,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,8BAA8B,CAAC;KAC3C,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;QAEzD,IAAI,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,gDAAgD,CAAC,CAAC,CAAC;YAC5E,OAAO;QACT,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG;YACd,GAAG,GAAG,CAAC,Y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 -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* drift plugin pack - Validate package before publishing
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.packCommand = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
10
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
11
|
+
const execa_1 = tslib_1.__importDefault(require("execa"));
|
|
12
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
13
|
+
const path = tslib_1.__importStar(require("path"));
|
|
14
|
+
exports.packCommand = new commander_1.Command('pack')
|
|
15
|
+
.description('Validate package before publishing')
|
|
16
|
+
.action(async () => {
|
|
17
|
+
console.log(chalk_1.default.bold('📦 Validating package...\n'));
|
|
18
|
+
// Build first
|
|
19
|
+
const buildSpinner = (0, ora_1.default)('Building plugin...').start();
|
|
20
|
+
try {
|
|
21
|
+
await (0, execa_1.default)('npm', ['run', 'build'], { stdio: 'pipe' });
|
|
22
|
+
buildSpinner.succeed('Build successful');
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
buildSpinner.fail('Build failed');
|
|
26
|
+
console.error(chalk_1.default.red(error));
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
// Run doctor
|
|
30
|
+
const doctorSpinner = (0, ora_1.default)('Running health checks...').start();
|
|
31
|
+
try {
|
|
32
|
+
await (0, execa_1.default)('drift', ['plugin', 'doctor'], { stdio: 'pipe' });
|
|
33
|
+
doctorSpinner.succeed('Health checks passed');
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
doctorSpinner.fail('Health checks failed');
|
|
37
|
+
console.log(chalk_1.default.yellow('\nRun "drift plugin doctor" for details\n'));
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
// Check package.json files field
|
|
41
|
+
const pkg = await fs.readJSON(path.join(process.cwd(), 'package.json'));
|
|
42
|
+
if (!pkg.files || !pkg.files.includes('dist')) {
|
|
43
|
+
console.log(chalk_1.default.yellow('⚠️ package.json should include "files": ["dist"]'));
|
|
44
|
+
}
|
|
45
|
+
// Dry run npm pack
|
|
46
|
+
const packSpinner = (0, ora_1.default)('Checking package contents...').start();
|
|
47
|
+
try {
|
|
48
|
+
const { stdout } = await (0, execa_1.default)('npm', ['pack', '--dry-run']);
|
|
49
|
+
packSpinner.succeed('Package contents validated');
|
|
50
|
+
console.log(chalk_1.default.gray('\nFiles to be published:'));
|
|
51
|
+
console.log(chalk_1.default.gray(stdout));
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
packSpinner.fail('Package validation failed');
|
|
55
|
+
console.error(chalk_1.default.red(error));
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
// Check for common mistakes
|
|
59
|
+
const distPath = path.join(process.cwd(), 'dist');
|
|
60
|
+
const distFiles = await fs.readdir(distPath);
|
|
61
|
+
if (distFiles.some(f => f.includes('.test.') || f.includes('.spec.'))) {
|
|
62
|
+
console.log(chalk_1.default.yellow('\n⚠️ Test files found in dist/ - check your build config'));
|
|
63
|
+
}
|
|
64
|
+
if (!distFiles.some(f => f.endsWith('.d.ts'))) {
|
|
65
|
+
console.log(chalk_1.default.yellow('\n⚠️ No type declarations found - run tsc with declaration: true'));
|
|
66
|
+
}
|
|
67
|
+
console.log(chalk_1.default.green.bold('\n✅ Package ready for publishing'));
|
|
68
|
+
console.log(chalk_1.default.gray('Run: npm publish\n'));
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=pack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../../../../../../../libs/drift/drift-cli/src/commands/plugin/pack.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,yCAAoC;AACpC,0DA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AAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE7C,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,2DAA2D,CAAC,CAAC,CAAC;IACzF,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,mEAAmE,CAAC,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* drift plugin search - Search npm for Drift plugins
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.searchCommand = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
10
|
+
const ora_1 = tslib_1.__importDefault(require("ora"));
|
|
11
|
+
exports.searchCommand = new commander_1.Command('search')
|
|
12
|
+
.description('Search npm for Drift plugins')
|
|
13
|
+
.argument('<keyword>', 'Search keyword')
|
|
14
|
+
.action(async (keyword) => {
|
|
15
|
+
const spinner = (0, ora_1.default)(`Searching for "${keyword}"...`).start();
|
|
16
|
+
try {
|
|
17
|
+
// Search npm registry
|
|
18
|
+
const response = await fetch(`https://registry.npmjs.org/-/v1/search?text=${encodeURIComponent(keyword)}+drift+plugin&size=20`);
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
throw new Error(`npm registry returned ${response.status}`);
|
|
21
|
+
}
|
|
22
|
+
const data = await response.json();
|
|
23
|
+
spinner.stop();
|
|
24
|
+
if (data.objects.length === 0) {
|
|
25
|
+
console.log(chalk_1.default.yellow(`\nNo plugins found matching "${keyword}"\n`));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
console.log(chalk_1.default.bold(`\nFound ${data.objects.length} plugin(s):\n`));
|
|
29
|
+
for (const obj of data.objects) {
|
|
30
|
+
const pkg = obj.package;
|
|
31
|
+
console.log(chalk_1.default.cyan.bold(pkg.name) + chalk_1.default.gray(` v${pkg.version}`));
|
|
32
|
+
console.log(chalk_1.default.gray(` ${pkg.description || 'No description'}`));
|
|
33
|
+
console.log(chalk_1.default.gray(` Downloads: ${obj.score.detail.popularity.toFixed(2)}`));
|
|
34
|
+
if (pkg.links?.repository) {
|
|
35
|
+
console.log(chalk_1.default.gray(` ${pkg.links.repository}`));
|
|
36
|
+
}
|
|
37
|
+
console.log();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
spinner.fail('Search failed');
|
|
42
|
+
console.error(chalk_1.default.red(error));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../../../../libs/drift/drift-cli/src/commands/plugin/search.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,yCAAoC;AACpC,0DAA0B;AAC1B,sDAAsB;AAET,QAAA,aAAa,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,8BAA8B,CAAC;KAC3C,QA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AAC;YACpE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,gBAAgB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClF,IAAI,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC;gBAC1B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;YACvD,CAAC;YACD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* drift plugin test - Run plugin tests
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.testCommand = void 0;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const commander_1 = require("commander");
|
|
9
|
+
const execa_1 = tslib_1.__importDefault(require("execa"));
|
|
10
|
+
exports.testCommand = new commander_1.Command('test')
|
|
11
|
+
.description('Run plugin tests')
|
|
12
|
+
.option('-w, --watch', 'Watch mode')
|
|
13
|
+
.option('-c, --coverage', 'Generate coverage report')
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
const args = ['run'];
|
|
16
|
+
if (options.watch) {
|
|
17
|
+
args.push('test:watch');
|
|
18
|
+
}
|
|
19
|
+
else if (options.coverage) {
|
|
20
|
+
args.push('test:coverage');
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
args.push('test');
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
await (0, execa_1.default)('npm', args, { stdio: 'inherit' });
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../../../libs/drift/drift-cli/src/commands/plugin/test.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,yCAAoC;AACpC,0DAA0B;AAEb,QAAA,WAAW,GAAG,IAAI,mBAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,kBAAkB,CAAC;KAC/B,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC;KACnC,MAAM,CAAC,gBAAgB,EAAE,0BAA0B,CAAC;KACpD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAErB,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;SAAM,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,IAAA,eAAK,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/drift-cli';
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/drift/drift-cli/src/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function driftCli(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift-cli.js","sourceRoot":"","sources":["../../../../../../libs/drift/drift-cli/src/lib/drift-cli.ts"],"names":[],"mappings":";;AAAA,4BAEC;AAFD,SAAgB,QAAQ;IACtB,OAAO,WAAW,CAAC;AACrB,CAAC"}
|