aztomiq 1.0.3 → 1.0.5
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/aztomiq.js +12 -0
- package/package.json +1 -1
- package/server.js +5 -4
package/bin/aztomiq.js
CHANGED
|
@@ -338,6 +338,18 @@ status: active
|
|
|
338
338
|
`;
|
|
339
339
|
await fs.writeFile(path.join(projectPath, 'src/features/hello-world/index.ejs'), toolEjs);
|
|
340
340
|
|
|
341
|
+
const helloEn = `hello-world:\n title: "Hello World"\n`;
|
|
342
|
+
const helloVi = `hello-world:\n title: "Xin chào"\n`;
|
|
343
|
+
await fs.writeFile(path.join(projectPath, 'src/features/hello-world/locales/en.yaml'), helloEn);
|
|
344
|
+
await fs.writeFile(path.join(projectPath, 'src/features/hello-world/locales/vi.yaml'), helloVi);
|
|
345
|
+
|
|
346
|
+
// 5. Create basic home page
|
|
347
|
+
const indexEjs = `<h1>Welcome to <%= site.title %></h1>
|
|
348
|
+
<p>Start by editing <code>src/pages/index.ejs</code> or creating new tools in <code>src/features/</code>.</p>
|
|
349
|
+
<p>Check out our sample tool: <a href="/hello-world/"><%= t('hello-world.title') %></a></p>
|
|
350
|
+
`;
|
|
351
|
+
await fs.writeFile(path.join(projectPath, 'src/pages/index.ejs'), indexEjs);
|
|
352
|
+
|
|
341
353
|
console.log(`\n✅ Project "${name}" initialized successfully!`);
|
|
342
354
|
console.log(`👉 Next steps:`);
|
|
343
355
|
console.log(` cd ${name}`);
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -11,9 +11,10 @@ const app = express();
|
|
|
11
11
|
const PORT = 3000;
|
|
12
12
|
|
|
13
13
|
// Configuration
|
|
14
|
-
const
|
|
14
|
+
const PROJECT_ROOT = process.env.AZTOMIQ_PROJECT_ROOT || process.cwd();
|
|
15
|
+
const SRC_DIR = path.join(PROJECT_ROOT, 'src');
|
|
15
16
|
const FEATURES_DIR = path.join(SRC_DIR, 'features');
|
|
16
|
-
const DIST_DIR = path.join(
|
|
17
|
+
const DIST_DIR = path.join(PROJECT_ROOT, 'dist-dev');
|
|
17
18
|
|
|
18
19
|
app.use(cors());
|
|
19
20
|
app.use(bodyParser.json());
|
|
@@ -59,7 +60,7 @@ app.post('/api/features/:id', (req, res) => {
|
|
|
59
60
|
console.log(`📝 Updated config for ${id}`);
|
|
60
61
|
|
|
61
62
|
console.log('🔄 Triggering rebuild...');
|
|
62
|
-
exec('
|
|
63
|
+
exec('npx aztomiq build', { cwd: PROJECT_ROOT }, (error, stdout, stderr) => {
|
|
63
64
|
if (error) console.error(`Build error: ${error}`);
|
|
64
65
|
else console.log(`✅ Build complete`);
|
|
65
66
|
});
|
|
@@ -95,7 +96,7 @@ app.post('/api/global', (req, res) => {
|
|
|
95
96
|
console.log(`📝 Updated Global Config`);
|
|
96
97
|
|
|
97
98
|
console.log('🔄 Triggering rebuild...');
|
|
98
|
-
exec('
|
|
99
|
+
exec('npx aztomiq build', { cwd: PROJECT_ROOT }, (error, stdout, stderr) => {
|
|
99
100
|
if (error) console.error(`Build error: ${error}`);
|
|
100
101
|
else console.log(`✅ Build complete`);
|
|
101
102
|
});
|