-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Describe the bug
There is a bug related to the run command in the create-polyglot repository. When invoking the run command (e.g., create-polyglot dev
), certain services may not start correctly or expected behavior is not observed, especially for Node and frontend services. The runDev
function in bin/lib/dev.js
and the runner logic in scripts/dev-basic.cjs
handle the service startup, but issues can occur if required directories or files are missing, or if script definitions are not present in the service's package.json
.
To Reproduce
Steps to reproduce the behavior:
- Initialize a polyglot workspace.
- Add a service (e.g., Node, Python, etc.).
- Run
create-polyglot dev
to start services locally. - Observe if any services fail to start or expected logs/errors occur (e.g., "No auto-runnable Node/Frontend services found.", missing
polyglot.json
, or missingservices/
directory).
Expected behavior
All specified services should start successfully and pass health checks, with logs indicating successful startup.
Screenshots
N/A
Desktop (please complete the following information):
- OS: [e.g. Linux, macOS, Windows]
- Browser [N/A]
- Version [N/A]
Smartphone (please complete the following information):
- Device: [N/A]
- OS: [N/A]
- Browser [N/A]
- Version [N/A]
Additional context
Relevant code snippets:
export async function runDev({ docker=false } = {}) {
const cwd = process.cwd();
const configPath = path.join(cwd, 'polyglot.json');
if (!fs.existsSync(configPath)) {
console.error(chalk.red('polyglot.json not found. Run inside a generated workspace.'));
process.exit(1);
}
const cfg = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
const servicesDir = path.join(cwd, 'services');
if (!fs.existsSync(servicesDir)) {
console.error(chalk.red('services/ directory not found.'));
process.exit(1);
}
// ...
}
const servicesDir = path.join(root, 'services');
if (!fs.existsSync(servicesDir)) {
console.error('No services directory found.');
process.exit(1);
}
const services = fs.readdirSync(servicesDir);
if (services.length === 0) {
console.log('No Node-based services with package.json to run.');
process.exit(0);
}
it('starts node service and performs health check', async () => {
const repoRoot = process.cwd();
const cliPath = path.join(repoRoot, 'bin/index.js');
await execa('node', [cliPath, 'init', projName, '--services', 'node', '--no-install', '--yes'], { cwd: tmpDir, env: { ...process.env, CI: 'true' } });
// ...
});
These code locations are relevant for debugging and fixing issues with service startup via the run command.