@azure-net/cli 1.4.0 → 1.4.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
CHANGED
|
@@ -15,6 +15,12 @@ async function writeIfNotExists(filepath, content) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
async function updateIndexTs(dir) {
|
|
19
|
+
const files = (await fs.readdir(dir)).filter(f => f.endsWith('.ts') && f !== 'index.ts');
|
|
20
|
+
const content = files.map(f => `export * from './${f.replace('.ts', '')}';`).join('\n') + '\n';
|
|
21
|
+
await fs.writeFile(path.join(dir, 'index.ts'), content, 'utf-8');
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
export default async function generateDatasource() {
|
|
19
25
|
const { name } = await prompts({
|
|
20
26
|
type: 'text',
|
|
@@ -28,11 +34,11 @@ export default async function generateDatasource() {
|
|
|
28
34
|
const content = `import { BaseHttpDatasource, HttpService } from '@azure-net/kit';
|
|
29
35
|
|
|
30
36
|
export class ${capital}Datasource extends BaseHttpDatasource {
|
|
31
|
-
// TODO: fill generated class
|
|
32
37
|
constructor() {
|
|
33
|
-
super({ http: new HttpService({ baseUrl: '' }) });
|
|
38
|
+
super({ http: new HttpService({ baseUrl: '' }) }); // TODO: fill generated class
|
|
34
39
|
}
|
|
35
40
|
}`;
|
|
36
41
|
|
|
37
42
|
await writeIfNotExists(filePath, content);
|
|
43
|
+
await updateIndexTs(CORE_DATASOURCES_PATH);
|
|
38
44
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// === generateRepo.js ===
|
|
2
1
|
import prompts from 'prompts';
|
|
3
2
|
import fs from 'fs/promises';
|
|
4
3
|
import path from 'path';
|
|
@@ -16,6 +15,12 @@ async function getAvailableDatasources() {
|
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
|
|
18
|
+
async function updateIndexTs(dir) {
|
|
19
|
+
const files = (await fs.readdir(dir)).filter(f => f.endsWith('.ts') && f !== 'index.ts');
|
|
20
|
+
const content = files.map(f => `export * from './${f.replace('.ts', '')}';`).join('\n') + '\n';
|
|
21
|
+
await fs.writeFile(path.join(dir, 'index.ts'), content, 'utf-8');
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
export default async function generateRepo() {
|
|
20
25
|
const config = await loadUserConfig();
|
|
21
26
|
const datasources = await getAvailableDatasources();
|
|
@@ -59,5 +64,6 @@ export class ${capital}Repo {
|
|
|
59
64
|
|
|
60
65
|
await fs.mkdir(repoDir, { recursive: true });
|
|
61
66
|
await fs.writeFile(filePath, content);
|
|
67
|
+
await updateIndexTs(repoDir);
|
|
62
68
|
console.log(`✅ Repo created at ${filePath}`);
|
|
63
|
-
}
|
|
69
|
+
}
|
|
@@ -15,6 +15,12 @@ async function getAvailableRepos(module) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
async function updateIndexTs(dir) {
|
|
19
|
+
const files = (await fs.readdir(dir)).filter(f => f.endsWith('.ts') && f !== 'index.ts');
|
|
20
|
+
const content = files.map(f => `export * from './${f.replace('.ts', '')}';`).join('\n') + '\n';
|
|
21
|
+
await fs.writeFile(path.join(dir, 'index.ts'), content, 'utf-8');
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
export default async function generateService() {
|
|
19
25
|
const config = await loadUserConfig();
|
|
20
26
|
|
|
@@ -66,5 +72,6 @@ export class ${capital}Service {
|
|
|
66
72
|
|
|
67
73
|
await fs.mkdir(serviceDir, { recursive: true });
|
|
68
74
|
await fs.writeFile(filePath, content);
|
|
75
|
+
await updateIndexTs(serviceDir);
|
|
69
76
|
console.log(`✅ Service created at ${filePath}`);
|
|
70
77
|
}
|