pokit 0.0.6 → 0.0.7
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/bin/pok.ts +16 -15
- package/package.json +1 -1
package/bin/pok.ts
CHANGED
|
@@ -56,10 +56,10 @@ function findConfigFileSimple(startDir: string): { configPath: string; configDir
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
async function main() {
|
|
59
|
-
const
|
|
59
|
+
const processCwd = process.cwd();
|
|
60
60
|
|
|
61
61
|
// Step 1: Find config file using simple inline search
|
|
62
|
-
const configResult = findConfigFileSimple(
|
|
62
|
+
const configResult = findConfigFileSimple(processCwd);
|
|
63
63
|
|
|
64
64
|
if (!configResult) {
|
|
65
65
|
console.error(`Error: No pok configuration found.
|
|
@@ -74,8 +74,9 @@ Run \`pok init\` to create a pok.config.ts file.
|
|
|
74
74
|
// Step 2: Dynamically resolve @pokit/config from the project directory
|
|
75
75
|
let configModule: {
|
|
76
76
|
validateConfig: (config: unknown, configPath: string) => {
|
|
77
|
+
appDir: string;
|
|
78
|
+
cwd: string;
|
|
77
79
|
commandsDir: string;
|
|
78
|
-
projectRoot?: string;
|
|
79
80
|
appName?: string;
|
|
80
81
|
reporterAdapter: string;
|
|
81
82
|
prompter: string;
|
|
@@ -109,10 +110,10 @@ Run \`pok init\` to create a pok.config.ts file.
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
// Step 4: Resolve paths relative to config file location
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
// appDir is relative to configDir, commandsDir is relative to appDir
|
|
114
|
+
const appDir = path.resolve(configDir, config.appDir);
|
|
115
|
+
const commandsDir = path.resolve(appDir, config.commandsDir);
|
|
116
|
+
const cwd = path.resolve(configDir, config.cwd);
|
|
116
117
|
|
|
117
118
|
// Verify commands directory exists
|
|
118
119
|
if (!fs.existsSync(commandsDir)) {
|
|
@@ -121,27 +122,27 @@ Run \`pok init\` to create a pok.config.ts file.
|
|
|
121
122
|
process.exit(1);
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
// Step 5: Resolve @pokit/core from
|
|
125
|
+
// Step 5: Resolve @pokit/core from appDir (where packages are installed)
|
|
125
126
|
let corePath: string;
|
|
126
127
|
try {
|
|
127
|
-
corePath = await resolve('@pokit/core',
|
|
128
|
+
corePath = await resolve('@pokit/core', appDir);
|
|
128
129
|
} catch {
|
|
129
130
|
console.error(
|
|
130
|
-
`Error: @pokit/core is not installed in ${
|
|
131
|
+
`Error: @pokit/core is not installed in ${appDir}\n\n` +
|
|
131
132
|
'Install it with:\n' +
|
|
132
133
|
' bun add @pokit/core\n'
|
|
133
134
|
);
|
|
134
135
|
process.exit(1);
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
// Step 6: Dynamically import adapters from
|
|
138
|
+
// Step 6: Dynamically import adapters from appDir
|
|
138
139
|
let createReporterAdapter: (options?: { output?: unknown }) => unknown;
|
|
139
140
|
let createPrompter: () => unknown;
|
|
140
141
|
let createTabs: (() => unknown) | undefined;
|
|
141
142
|
|
|
142
143
|
// Import reporter adapter
|
|
143
144
|
try {
|
|
144
|
-
const reporterPath = await resolve(config.reporterAdapter,
|
|
145
|
+
const reporterPath = await resolve(config.reporterAdapter, appDir);
|
|
145
146
|
const reporterModule = await import(reporterPath);
|
|
146
147
|
createReporterAdapter = reporterModule.createReporterAdapter;
|
|
147
148
|
} catch {
|
|
@@ -155,7 +156,7 @@ Run \`pok init\` to create a pok.config.ts file.
|
|
|
155
156
|
|
|
156
157
|
// Import prompter
|
|
157
158
|
try {
|
|
158
|
-
const prompterPath = await resolve(config.prompter,
|
|
159
|
+
const prompterPath = await resolve(config.prompter, appDir);
|
|
159
160
|
const prompterModule = await import(prompterPath);
|
|
160
161
|
createPrompter = prompterModule.createPrompter;
|
|
161
162
|
} catch {
|
|
@@ -170,7 +171,7 @@ Run \`pok init\` to create a pok.config.ts file.
|
|
|
170
171
|
// Import tabs adapter if configured
|
|
171
172
|
if (config.tabs) {
|
|
172
173
|
try {
|
|
173
|
-
const tabsPath = await resolve(config.tabs,
|
|
174
|
+
const tabsPath = await resolve(config.tabs, appDir);
|
|
174
175
|
const tabsModule = await import(tabsPath);
|
|
175
176
|
createTabs = tabsModule.createTabs;
|
|
176
177
|
} catch {
|
|
@@ -188,7 +189,7 @@ Run \`pok init\` to create a pok.config.ts file.
|
|
|
188
189
|
|
|
189
190
|
await runCli(process.argv.slice(2), {
|
|
190
191
|
commandsDir,
|
|
191
|
-
projectRoot,
|
|
192
|
+
projectRoot: cwd, // core uses projectRoot, config uses cwd
|
|
192
193
|
appName: config.appName,
|
|
193
194
|
version: config.version,
|
|
194
195
|
reporterAdapter: createReporterAdapter(),
|