@codapult/cli 0.7.0 → 0.7.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.
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type ProjectEnvOptions } from '../utils/project-env.js';
|
|
2
|
-
|
|
2
|
+
interface PluginsAddCommandOptions extends ProjectEnvOptions {
|
|
3
3
|
from?: string;
|
|
4
4
|
ci?: boolean;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
|
+
export declare function pluginsAddCommand(name: string, options?: PluginsAddCommandOptions): Promise<void>;
|
|
6
7
|
export declare function pluginsRemoveCommand(name: string, options?: ProjectEnvOptions): Promise<void>;
|
|
7
8
|
export declare function pluginsMigrateCommand(name: string | undefined, options: {
|
|
8
9
|
push?: boolean;
|
|
9
10
|
}): Promise<void>;
|
|
10
11
|
export declare function pluginsListCommand(): void;
|
|
12
|
+
export {};
|
package/dist/commands/plugins.js
CHANGED
|
@@ -16,9 +16,6 @@ function execQuiet(cmd, cwd) {
|
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
// codapult plugins add <name>
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
19
|
export async function pluginsAddCommand(name, options = {}) {
|
|
23
20
|
const root = findProjectRoot();
|
|
24
21
|
if (!root) {
|
|
@@ -43,10 +40,10 @@ export async function pluginsAddCommand(name, options = {}) {
|
|
|
43
40
|
if (!result) {
|
|
44
41
|
fail(`Plugin "${name}" not found.`);
|
|
45
42
|
dim('Searched for codapult-plugin.json in:');
|
|
43
|
+
dim(` .codapult/plugins/codapult-plugin-${name}/`);
|
|
46
44
|
dim(` ../codapult-plugin-${name}/`);
|
|
47
45
|
dim(` ../codapult-${name}/`);
|
|
48
46
|
dim(` ../${name}/`);
|
|
49
|
-
dim(` .codapult/plugins/codapult-plugin-${name}/`);
|
|
50
47
|
if (!options.from) {
|
|
51
48
|
dim('');
|
|
52
49
|
dim('Tip: use --from <git-url> to install from a remote repository.');
|
|
@@ -159,14 +156,6 @@ export async function pluginsAddCommand(name, options = {}) {
|
|
|
159
156
|
success(`Environment variables added to ${ENV_FILE_NAME}`);
|
|
160
157
|
}
|
|
161
158
|
}
|
|
162
|
-
if (options.ci) {
|
|
163
|
-
heading('Done!');
|
|
164
|
-
success(`Plugin "${manifest.name}" installed (CI mode).`);
|
|
165
|
-
dim('Skipped: pnpm install, db:push, env patching, optional deps.');
|
|
166
|
-
dim('Run pnpm install separately after this command.');
|
|
167
|
-
console.log();
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
159
|
// 10. pnpm install
|
|
171
160
|
info('Installing dependencies...');
|
|
172
161
|
if (!execQuiet('pnpm install --no-frozen-lockfile', root)) {
|
|
@@ -175,6 +164,14 @@ export async function pluginsAddCommand(name, options = {}) {
|
|
|
175
164
|
else {
|
|
176
165
|
success('Dependencies installed');
|
|
177
166
|
}
|
|
167
|
+
if (options.ci) {
|
|
168
|
+
heading('Done!');
|
|
169
|
+
success(`Plugin "${manifest.name}" installed (CI mode).`);
|
|
170
|
+
dim('Skipped: db:push, env patching, optional deps.');
|
|
171
|
+
dim('Run pnpm install separately after this command.');
|
|
172
|
+
console.log();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
178
175
|
// 11. pnpm db:push
|
|
179
176
|
if (manifest.install.schemaTables) {
|
|
180
177
|
info('Applying database schema...');
|
package/dist/utils/manifest.js
CHANGED
|
@@ -24,12 +24,12 @@ export function resolveManifest(projectRoot, nameOrPath) {
|
|
|
24
24
|
candidates.push(resolved);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
// 2.
|
|
28
|
-
const parentDir = resolve(projectRoot, '..');
|
|
29
|
-
candidates.push(join(parentDir, `codapult-plugin-${nameOrPath}`), join(parentDir, `codapult-${nameOrPath}`), join(parentDir, nameOrPath));
|
|
30
|
-
// 3. Local cache (.codapult/plugins/codapult-plugin-<name>, ../<name>)
|
|
27
|
+
// 2. Local cache (.codapult/plugins/codapult-plugin-<name>, ../<name>)
|
|
31
28
|
const cacheDir = join(projectRoot, '.codapult', 'plugins');
|
|
32
29
|
candidates.push(join(cacheDir, `codapult-plugin-${nameOrPath}`), join(cacheDir, `codapult-${nameOrPath}`), join(cacheDir, nameOrPath));
|
|
30
|
+
// 3. Sibling directories (../codapult-plugin-<name>, ../codapult-<name>, ../<name>)
|
|
31
|
+
const parentDir = resolve(projectRoot, '..');
|
|
32
|
+
candidates.push(join(parentDir, `codapult-plugin-${nameOrPath}`), join(parentDir, `codapult-${nameOrPath}`), join(parentDir, nameOrPath));
|
|
33
33
|
for (const dir of candidates) {
|
|
34
34
|
if (!isWithinAllowedScope(dir, projectRoot))
|
|
35
35
|
continue;
|
|
@@ -75,7 +75,7 @@ describe('resolveManifest', () => {
|
|
|
75
75
|
expect(result).not.toBeNull();
|
|
76
76
|
expect(result.pluginDir).toContain('.codapult/plugins/codapult-plugin-cached');
|
|
77
77
|
});
|
|
78
|
-
it('prefers
|
|
78
|
+
it('prefers .codapult/plugins/ cache over sibling directory', () => {
|
|
79
79
|
mockedExists.mockImplementation((p) => {
|
|
80
80
|
const path = p;
|
|
81
81
|
return (path === '/codapult-plugin-both/codapult-plugin.json' ||
|
|
@@ -84,7 +84,7 @@ describe('resolveManifest', () => {
|
|
|
84
84
|
mockedRead.mockReturnValue(validManifest);
|
|
85
85
|
const result = resolveManifest(ROOT, 'both');
|
|
86
86
|
expect(result).not.toBeNull();
|
|
87
|
-
expect(result.pluginDir).toBe('/codapult-plugin-both');
|
|
87
|
+
expect(result.pluginDir).toBe('/project/.codapult/plugins/codapult-plugin-both');
|
|
88
88
|
});
|
|
89
89
|
it('returns null for invalid JSON manifest', () => {
|
|
90
90
|
mockedExists.mockReturnValue(true);
|