@geekmidas/cli 0.10.0 → 0.13.0
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/README.md +525 -0
- package/dist/bundler-B1qy9b-j.cjs +112 -0
- package/dist/bundler-B1qy9b-j.cjs.map +1 -0
- package/dist/bundler-DskIqW2t.mjs +111 -0
- package/dist/bundler-DskIqW2t.mjs.map +1 -0
- package/dist/{config-C9aXOHBe.cjs → config-AmInkU7k.cjs} +8 -8
- package/dist/config-AmInkU7k.cjs.map +1 -0
- package/dist/{config-BrkUalUh.mjs → config-DYULeEv8.mjs} +3 -3
- package/dist/config-DYULeEv8.mjs.map +1 -0
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/encryption-C8H-38Yy.mjs +42 -0
- package/dist/encryption-C8H-38Yy.mjs.map +1 -0
- package/dist/encryption-Dyf_r1h-.cjs +44 -0
- package/dist/encryption-Dyf_r1h-.cjs.map +1 -0
- package/dist/index.cjs +2123 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2141 -192
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-CZLI4QTr.mjs → openapi-BfFlOBCG.mjs} +801 -38
- package/dist/openapi-BfFlOBCG.mjs.map +1 -0
- package/dist/{openapi-BeHLKcwP.cjs → openapi-Bt_1FDpT.cjs} +794 -31
- package/dist/openapi-Bt_1FDpT.cjs.map +1 -0
- package/dist/{openapi-react-query-o5iMi8tz.cjs → openapi-react-query-B-sNWHFU.cjs} +5 -5
- package/dist/openapi-react-query-B-sNWHFU.cjs.map +1 -0
- package/dist/{openapi-react-query-CcciaVu5.mjs → openapi-react-query-B6XTeGqS.mjs} +5 -5
- package/dist/openapi-react-query-B6XTeGqS.mjs.map +1 -0
- package/dist/openapi-react-query.cjs +1 -1
- package/dist/openapi-react-query.d.cts.map +1 -1
- package/dist/openapi-react-query.d.mts.map +1 -1
- package/dist/openapi-react-query.mjs +1 -1
- package/dist/openapi.cjs +2 -2
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +2 -2
- package/dist/storage-BOOpAF8N.cjs +5 -0
- package/dist/storage-Bj1E26lU.cjs +187 -0
- package/dist/storage-Bj1E26lU.cjs.map +1 -0
- package/dist/storage-kSxTjkNb.mjs +133 -0
- package/dist/storage-kSxTjkNb.mjs.map +1 -0
- package/dist/storage-tgZSUnKl.mjs +3 -0
- package/dist/{types-b-vwGpqc.d.cts → types-BR0M2v_c.d.mts} +100 -1
- package/dist/types-BR0M2v_c.d.mts.map +1 -0
- package/dist/{types-DXgiA1sF.d.mts → types-BhkZc-vm.d.cts} +100 -1
- package/dist/types-BhkZc-vm.d.cts.map +1 -0
- package/examples/cron-example.ts +27 -27
- package/examples/env.ts +27 -27
- package/examples/function-example.ts +31 -31
- package/examples/gkm.config.json +20 -20
- package/examples/gkm.config.ts +8 -8
- package/examples/gkm.minimal.config.json +5 -5
- package/examples/gkm.production.config.json +25 -25
- package/examples/logger.ts +2 -2
- package/package.json +6 -6
- package/src/__tests__/EndpointGenerator.hooks.spec.ts +191 -191
- package/src/__tests__/config.spec.ts +55 -55
- package/src/__tests__/loadEnvFiles.spec.ts +93 -93
- package/src/__tests__/normalizeHooksConfig.spec.ts +58 -58
- package/src/__tests__/openapi-react-query.spec.ts +497 -497
- package/src/__tests__/openapi.spec.ts +428 -428
- package/src/__tests__/test-helpers.ts +76 -76
- package/src/auth/__tests__/credentials.spec.ts +204 -0
- package/src/auth/__tests__/index.spec.ts +168 -0
- package/src/auth/credentials.ts +187 -0
- package/src/auth/index.ts +226 -0
- package/src/build/__tests__/bundler.spec.ts +444 -0
- package/src/build/__tests__/index-new.spec.ts +474 -474
- package/src/build/__tests__/manifests.spec.ts +333 -333
- package/src/build/bundler.ts +210 -0
- package/src/build/endpoint-analyzer.ts +236 -0
- package/src/build/handler-templates.ts +1253 -0
- package/src/build/index.ts +260 -179
- package/src/build/manifests.ts +52 -52
- package/src/build/providerResolver.ts +145 -145
- package/src/build/types.ts +64 -43
- package/src/config.ts +39 -39
- package/src/deploy/__tests__/docker.spec.ts +111 -0
- package/src/deploy/__tests__/dokploy.spec.ts +245 -0
- package/src/deploy/__tests__/init.spec.ts +662 -0
- package/src/deploy/docker.ts +128 -0
- package/src/deploy/dokploy.ts +204 -0
- package/src/deploy/index.ts +136 -0
- package/src/deploy/init.ts +484 -0
- package/src/deploy/types.ts +48 -0
- package/src/dev/__tests__/index.spec.ts +266 -266
- package/src/dev/index.ts +647 -601
- package/src/docker/__tests__/compose.spec.ts +531 -0
- package/src/docker/__tests__/templates.spec.ts +280 -0
- package/src/docker/compose.ts +273 -0
- package/src/docker/index.ts +230 -0
- package/src/docker/templates.ts +446 -0
- package/src/generators/CronGenerator.ts +72 -72
- package/src/generators/EndpointGenerator.ts +699 -398
- package/src/generators/FunctionGenerator.ts +84 -84
- package/src/generators/Generator.ts +72 -72
- package/src/generators/OpenApiTsGenerator.ts +577 -577
- package/src/generators/SubscriberGenerator.ts +124 -124
- package/src/generators/__tests__/CronGenerator.spec.ts +433 -433
- package/src/generators/__tests__/EndpointGenerator.spec.ts +532 -382
- package/src/generators/__tests__/FunctionGenerator.spec.ts +244 -244
- package/src/generators/__tests__/SubscriberGenerator.spec.ts +397 -382
- package/src/generators/index.ts +4 -4
- package/src/index.ts +623 -201
- package/src/init/__tests__/generators.spec.ts +334 -334
- package/src/init/__tests__/init.spec.ts +332 -332
- package/src/init/__tests__/utils.spec.ts +89 -89
- package/src/init/generators/config.ts +175 -175
- package/src/init/generators/docker.ts +41 -41
- package/src/init/generators/env.ts +72 -72
- package/src/init/generators/index.ts +1 -1
- package/src/init/generators/models.ts +64 -64
- package/src/init/generators/monorepo.ts +161 -161
- package/src/init/generators/package.ts +71 -71
- package/src/init/generators/source.ts +6 -6
- package/src/init/index.ts +203 -208
- package/src/init/templates/api.ts +115 -115
- package/src/init/templates/index.ts +75 -75
- package/src/init/templates/minimal.ts +98 -98
- package/src/init/templates/serverless.ts +89 -89
- package/src/init/templates/worker.ts +98 -98
- package/src/init/utils.ts +54 -56
- package/src/openapi-react-query.ts +194 -194
- package/src/openapi.ts +63 -63
- package/src/secrets/__tests__/encryption.spec.ts +226 -0
- package/src/secrets/__tests__/generator.spec.ts +319 -0
- package/src/secrets/__tests__/index.spec.ts +91 -0
- package/src/secrets/__tests__/storage.spec.ts +611 -0
- package/src/secrets/encryption.ts +91 -0
- package/src/secrets/generator.ts +164 -0
- package/src/secrets/index.ts +383 -0
- package/src/secrets/storage.ts +192 -0
- package/src/secrets/types.ts +53 -0
- package/src/types.ts +295 -176
- package/tsdown.config.ts +11 -8
- package/dist/config-BrkUalUh.mjs.map +0 -1
- package/dist/config-C9aXOHBe.cjs.map +0 -1
- package/dist/openapi-BeHLKcwP.cjs.map +0 -1
- package/dist/openapi-CZLI4QTr.mjs.map +0 -1
- package/dist/openapi-react-query-CcciaVu5.mjs.map +0 -1
- package/dist/openapi-react-query-o5iMi8tz.cjs.map +0 -1
- package/dist/types-DXgiA1sF.d.mts.map +0 -1
- package/dist/types-b-vwGpqc.d.cts.map +0 -1
|
@@ -3,102 +3,102 @@ import { tmpdir } from 'node:os';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
checkDirectoryExists,
|
|
7
|
+
detectPackageManager,
|
|
8
|
+
validateProjectName,
|
|
9
9
|
} from '../utils.js';
|
|
10
10
|
|
|
11
11
|
describe('validateProjectName', () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
12
|
+
it('should accept valid project names', () => {
|
|
13
|
+
expect(validateProjectName('my-project')).toBe(true);
|
|
14
|
+
expect(validateProjectName('my_project')).toBe(true);
|
|
15
|
+
expect(validateProjectName('myProject')).toBe(true);
|
|
16
|
+
expect(validateProjectName('my-project-123')).toBe(true);
|
|
17
|
+
expect(validateProjectName('project')).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should reject empty names', () => {
|
|
21
|
+
expect(validateProjectName('')).toBe('Project name is required');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should reject names with invalid characters', () => {
|
|
25
|
+
const result = validateProjectName('my project');
|
|
26
|
+
expect(result).toContain('can only contain');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should accept scoped package names', () => {
|
|
30
|
+
// @ / . are valid for scoped npm packages
|
|
31
|
+
expect(validateProjectName('@my/project')).toBe(true);
|
|
32
|
+
expect(validateProjectName('my.project')).toBe(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should reject names with other special characters', () => {
|
|
36
|
+
expect(validateProjectName('my$project')).toContain('can only contain');
|
|
37
|
+
expect(validateProjectName('my#project')).toContain('can only contain');
|
|
38
|
+
expect(validateProjectName('my!project')).toContain('can only contain');
|
|
39
|
+
});
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
describe('checkDirectoryExists', () => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
43
|
+
let tempDir: string;
|
|
44
|
+
|
|
45
|
+
beforeEach(async () => {
|
|
46
|
+
tempDir = join(tmpdir(), `cli-test-${Date.now()}`);
|
|
47
|
+
await mkdir(tempDir, { recursive: true });
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
afterEach(async () => {
|
|
51
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should return true for non-existent directory', () => {
|
|
55
|
+
expect(checkDirectoryExists('non-existent-dir', tempDir)).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should return error for existing directory', async () => {
|
|
59
|
+
const existingDir = 'existing-dir';
|
|
60
|
+
await mkdir(join(tempDir, existingDir));
|
|
61
|
+
const result = checkDirectoryExists(existingDir, tempDir);
|
|
62
|
+
expect(result).toContain('already exists');
|
|
63
|
+
});
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
describe('detectPackageManager', () => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
67
|
+
let tempDir: string;
|
|
68
|
+
let originalEnv: string | undefined;
|
|
69
|
+
|
|
70
|
+
beforeEach(async () => {
|
|
71
|
+
tempDir = join(tmpdir(), `cli-test-${Date.now()}`);
|
|
72
|
+
await mkdir(tempDir, { recursive: true });
|
|
73
|
+
originalEnv = process.env.npm_config_user_agent;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
afterEach(async () => {
|
|
77
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
78
|
+
if (originalEnv !== undefined) {
|
|
79
|
+
process.env.npm_config_user_agent = originalEnv;
|
|
80
|
+
} else {
|
|
81
|
+
delete process.env.npm_config_user_agent;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should detect pnpm from user agent', () => {
|
|
86
|
+
process.env.npm_config_user_agent = 'pnpm/8.0.0';
|
|
87
|
+
expect(detectPackageManager(tempDir)).toBe('pnpm');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should detect yarn from user agent', () => {
|
|
91
|
+
process.env.npm_config_user_agent = 'yarn/4.0.0';
|
|
92
|
+
expect(detectPackageManager(tempDir)).toBe('yarn');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('should detect bun from user agent', () => {
|
|
96
|
+
process.env.npm_config_user_agent = 'bun/1.0.0';
|
|
97
|
+
expect(detectPackageManager(tempDir)).toBe('bun');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('should default to npm when no lockfile or user agent', () => {
|
|
101
|
+
delete process.env.npm_config_user_agent;
|
|
102
|
+
expect(detectPackageManager(tempDir)).toBe('npm');
|
|
103
|
+
});
|
|
104
104
|
});
|
|
@@ -1,215 +1,215 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
GeneratedFile,
|
|
3
|
+
TemplateConfig,
|
|
4
|
+
TemplateOptions,
|
|
5
5
|
} from '../templates/index.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Generate configuration files (gkm.config.ts, tsconfig.json, biome.json, turbo.json)
|
|
9
9
|
*/
|
|
10
10
|
export function generateConfigFiles(
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
options: TemplateOptions,
|
|
12
|
+
template: TemplateConfig,
|
|
13
13
|
): GeneratedFile[] {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const { telescope, studio, routesStructure } = options;
|
|
15
|
+
const isServerless = template.name === 'serverless';
|
|
16
|
+
const hasWorker = template.name === 'worker';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
// Get routes glob pattern based on structure
|
|
19
|
+
const getRoutesGlob = () => {
|
|
20
|
+
switch (routesStructure) {
|
|
21
|
+
case 'centralized-endpoints':
|
|
22
|
+
return './src/endpoints/**/*.ts';
|
|
23
|
+
case 'centralized-routes':
|
|
24
|
+
return './src/routes/**/*.ts';
|
|
25
|
+
case 'domain-based':
|
|
26
|
+
return './src/**/routes/*.ts';
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
// Build gkm.config.ts
|
|
31
|
+
let gkmConfig = `import { defineConfig } from '@geekmidas/cli/config';
|
|
32
32
|
|
|
33
33
|
export default defineConfig({
|
|
34
34
|
routes: '${getRoutesGlob()}',
|
|
35
35
|
envParser: './src/config/env#envParser',
|
|
36
36
|
logger: './src/config/logger#logger',`;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
if (isServerless || hasWorker) {
|
|
39
|
+
gkmConfig += `
|
|
40
40
|
functions: './src/functions/**/*.ts',`;
|
|
41
|
-
|
|
41
|
+
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
if (hasWorker) {
|
|
44
|
+
gkmConfig += `
|
|
45
45
|
crons: './src/crons/**/*.ts',
|
|
46
46
|
subscribers: './src/subscribers/**/*.ts',`;
|
|
47
|
-
|
|
47
|
+
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
if (telescope) {
|
|
50
|
+
gkmConfig += `
|
|
51
51
|
telescope: {
|
|
52
52
|
enabled: true,
|
|
53
53
|
path: '/__telescope',
|
|
54
54
|
},`;
|
|
55
|
-
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
if (studio) {
|
|
58
|
+
gkmConfig += `
|
|
59
59
|
studio: './src/config/studio#studio',`;
|
|
60
|
-
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
// Always add openapi config (output path is fixed to .gkm/openapi.ts)
|
|
63
|
+
gkmConfig += `
|
|
64
64
|
openapi: {
|
|
65
65
|
enabled: true,
|
|
66
66
|
},`;
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
gkmConfig += `
|
|
69
69
|
});
|
|
70
70
|
`;
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
72
|
+
// Build tsconfig.json - extends root for monorepo, standalone for non-monorepo
|
|
73
|
+
const tsConfig = options.monorepo
|
|
74
|
+
? {
|
|
75
|
+
extends: '../../tsconfig.json',
|
|
76
|
+
compilerOptions: {
|
|
77
|
+
outDir: './dist',
|
|
78
|
+
rootDir: './src',
|
|
79
|
+
baseUrl: '.',
|
|
80
|
+
paths: {
|
|
81
|
+
[`@${options.name}/*`]: ['../../packages/*/src'],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
include: ['src/**/*.ts'],
|
|
85
|
+
exclude: ['node_modules', 'dist'],
|
|
86
|
+
}
|
|
87
|
+
: {
|
|
88
|
+
compilerOptions: {
|
|
89
|
+
target: 'ES2022',
|
|
90
|
+
module: 'NodeNext',
|
|
91
|
+
moduleResolution: 'NodeNext',
|
|
92
|
+
lib: ['ES2022'],
|
|
93
|
+
strict: true,
|
|
94
|
+
esModuleInterop: true,
|
|
95
|
+
skipLibCheck: true,
|
|
96
|
+
forceConsistentCasingInFileNames: true,
|
|
97
|
+
resolveJsonModule: true,
|
|
98
|
+
declaration: true,
|
|
99
|
+
declarationMap: true,
|
|
100
|
+
outDir: './dist',
|
|
101
|
+
rootDir: './src',
|
|
102
|
+
},
|
|
103
|
+
include: ['src/**/*.ts'],
|
|
104
|
+
exclude: ['node_modules', 'dist'],
|
|
105
|
+
};
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
107
|
+
// Skip biome.json and turbo.json for monorepo (they're at root)
|
|
108
|
+
if (options.monorepo) {
|
|
109
|
+
return [
|
|
110
|
+
{
|
|
111
|
+
path: 'gkm.config.ts',
|
|
112
|
+
content: gkmConfig,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
path: 'tsconfig.json',
|
|
116
|
+
content: `${JSON.stringify(tsConfig, null, 2)}\n`,
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
121
|
+
// Build biome.json
|
|
122
|
+
const biomeConfig = {
|
|
123
|
+
$schema: 'https://biomejs.dev/schemas/1.9.4/schema.json',
|
|
124
|
+
vcs: {
|
|
125
|
+
enabled: true,
|
|
126
|
+
clientKind: 'git',
|
|
127
|
+
useIgnoreFile: true,
|
|
128
|
+
},
|
|
129
|
+
organizeImports: {
|
|
130
|
+
enabled: true,
|
|
131
|
+
},
|
|
132
|
+
formatter: {
|
|
133
|
+
enabled: true,
|
|
134
|
+
indentStyle: 'space',
|
|
135
|
+
indentWidth: 2,
|
|
136
|
+
lineWidth: 80,
|
|
137
|
+
},
|
|
138
|
+
javascript: {
|
|
139
|
+
formatter: {
|
|
140
|
+
quoteStyle: 'single',
|
|
141
|
+
trailingCommas: 'all',
|
|
142
|
+
semicolons: 'always',
|
|
143
|
+
arrowParentheses: 'always',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
linter: {
|
|
147
|
+
enabled: true,
|
|
148
|
+
rules: {
|
|
149
|
+
recommended: true,
|
|
150
|
+
correctness: {
|
|
151
|
+
noUnusedImports: 'error',
|
|
152
|
+
noUnusedVariables: 'error',
|
|
153
|
+
},
|
|
154
|
+
style: {
|
|
155
|
+
noNonNullAssertion: 'off',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
files: {
|
|
160
|
+
ignore: ['node_modules', 'dist', '.gkm', 'coverage'],
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
164
|
+
// Build turbo.json
|
|
165
|
+
const turboConfig = {
|
|
166
|
+
$schema: 'https://turbo.build/schema.json',
|
|
167
|
+
tasks: {
|
|
168
|
+
build: {
|
|
169
|
+
dependsOn: ['^build'],
|
|
170
|
+
outputs: ['dist/**'],
|
|
171
|
+
},
|
|
172
|
+
dev: {
|
|
173
|
+
cache: false,
|
|
174
|
+
persistent: true,
|
|
175
|
+
},
|
|
176
|
+
test: {
|
|
177
|
+
dependsOn: ['^build'],
|
|
178
|
+
cache: false,
|
|
179
|
+
},
|
|
180
|
+
'test:once': {
|
|
181
|
+
dependsOn: ['^build'],
|
|
182
|
+
outputs: ['coverage/**'],
|
|
183
|
+
},
|
|
184
|
+
typecheck: {
|
|
185
|
+
dependsOn: ['^build'],
|
|
186
|
+
outputs: [],
|
|
187
|
+
},
|
|
188
|
+
lint: {
|
|
189
|
+
outputs: [],
|
|
190
|
+
},
|
|
191
|
+
fmt: {
|
|
192
|
+
outputs: [],
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
196
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
197
|
+
return [
|
|
198
|
+
{
|
|
199
|
+
path: 'gkm.config.ts',
|
|
200
|
+
content: gkmConfig,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
path: 'tsconfig.json',
|
|
204
|
+
content: `${JSON.stringify(tsConfig, null, 2)}\n`,
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
path: 'biome.json',
|
|
208
|
+
content: `${JSON.stringify(biomeConfig, null, 2)}\n`,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
path: 'turbo.json',
|
|
212
|
+
content: `${JSON.stringify(turboConfig, null, 2)}\n`,
|
|
213
|
+
},
|
|
214
|
+
];
|
|
215
215
|
}
|