@konomi-app/k2 1.11.0 → 1.12.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.
Files changed (158) hide show
  1. package/dist/commands/build-base.d.ts +6 -0
  2. package/dist/commands/build-base.d.ts.map +1 -0
  3. package/dist/commands/build-base.js +7 -0
  4. package/dist/commands/build-base.js.map +1 -0
  5. package/dist/commands/build-esbuild.d.ts +7 -0
  6. package/dist/commands/build-esbuild.d.ts.map +1 -0
  7. package/dist/commands/build-esbuild.js +63 -0
  8. package/dist/commands/build-esbuild.js.map +1 -0
  9. package/dist/commands/build-tailwind.d.ts +2 -0
  10. package/dist/commands/build-tailwind.d.ts.map +1 -0
  11. package/dist/commands/build-tailwind.js +19 -0
  12. package/dist/commands/build-tailwind.js.map +1 -0
  13. package/dist/commands/build.d.ts +7 -0
  14. package/dist/commands/build.d.ts.map +1 -0
  15. package/dist/commands/build.js +52 -0
  16. package/dist/commands/build.js.map +1 -0
  17. package/dist/commands/dev/index.d.ts +9 -0
  18. package/dist/commands/dev/index.d.ts.map +1 -0
  19. package/dist/commands/dev/index.js +60 -0
  20. package/dist/commands/dev/index.js.map +1 -0
  21. package/dist/commands/dev/tailwind.d.ts +5 -0
  22. package/dist/commands/dev/tailwind.d.ts.map +1 -0
  23. package/dist/commands/dev/tailwind.js +30 -0
  24. package/dist/commands/dev/tailwind.js.map +1 -0
  25. package/dist/commands/dev-base-esbuild.d.ts +8 -0
  26. package/dist/commands/dev-base-esbuild.d.ts.map +1 -0
  27. package/dist/commands/dev-base-esbuild.js +18 -0
  28. package/dist/commands/dev-base-esbuild.js.map +1 -0
  29. package/dist/commands/genkey-base.d.ts +4 -0
  30. package/dist/commands/genkey-base.d.ts.map +1 -0
  31. package/dist/commands/genkey-base.js +19 -0
  32. package/dist/commands/genkey-base.js.map +1 -0
  33. package/dist/commands/genkey.d.ts +5 -0
  34. package/dist/commands/genkey.d.ts.map +1 -0
  35. package/dist/commands/genkey.js +14 -0
  36. package/dist/commands/genkey.js.map +1 -0
  37. package/dist/commands/lint.d.ts +8 -0
  38. package/dist/commands/lint.d.ts.map +1 -0
  39. package/dist/commands/lint.js +20 -0
  40. package/dist/commands/lint.js.map +1 -0
  41. package/dist/commands/manifest/index.d.ts +2 -0
  42. package/dist/commands/manifest/index.d.ts.map +1 -0
  43. package/dist/commands/manifest/index.js +29 -0
  44. package/dist/commands/manifest/index.js.map +1 -0
  45. package/dist/commands/plugin-build.d.ts +3 -0
  46. package/dist/commands/plugin-build.d.ts.map +1 -0
  47. package/dist/commands/plugin-build.js +60 -0
  48. package/dist/commands/plugin-build.js.map +1 -0
  49. package/dist/commands/plugin-dev/create-manifest.d.ts +5 -0
  50. package/dist/commands/plugin-dev/create-manifest.d.ts.map +1 -0
  51. package/dist/commands/plugin-dev/create-manifest.js +30 -0
  52. package/dist/commands/plugin-dev/create-manifest.js.map +1 -0
  53. package/dist/commands/plugin-dev/index.d.ts +6 -0
  54. package/dist/commands/plugin-dev/index.d.ts.map +1 -0
  55. package/dist/commands/plugin-dev/index.js +50 -0
  56. package/dist/commands/plugin-dev/index.js.map +1 -0
  57. package/dist/commands/plugin-dev/tailwind.d.ts +2 -0
  58. package/dist/commands/plugin-dev/tailwind.d.ts.map +1 -0
  59. package/dist/commands/plugin-dev/tailwind.js +42 -0
  60. package/dist/commands/plugin-dev/tailwind.js.map +1 -0
  61. package/dist/commands/plugin-dev/upload.d.ts +5 -0
  62. package/dist/commands/plugin-dev/upload.d.ts.map +1 -0
  63. package/dist/commands/plugin-dev/upload.js +58 -0
  64. package/dist/commands/plugin-dev/upload.js.map +1 -0
  65. package/dist/commands/plugin-esbuild.d.ts +3 -0
  66. package/dist/commands/plugin-esbuild.d.ts.map +1 -0
  67. package/dist/commands/plugin-esbuild.js +66 -0
  68. package/dist/commands/plugin-esbuild.js.map +1 -0
  69. package/dist/commands/plugin-genkey.d.ts +3 -0
  70. package/dist/commands/plugin-genkey.d.ts.map +1 -0
  71. package/dist/commands/plugin-genkey.js +13 -0
  72. package/dist/commands/plugin-genkey.js.map +1 -0
  73. package/dist/commands/plugin-init.d.ts +3 -0
  74. package/dist/commands/plugin-init.d.ts.map +1 -0
  75. package/dist/commands/plugin-init.js +45 -0
  76. package/dist/commands/plugin-init.js.map +1 -0
  77. package/dist/commands/plugin-tsup.d.ts +3 -0
  78. package/dist/commands/plugin-tsup.d.ts.map +1 -0
  79. package/dist/commands/plugin-tsup.js +65 -0
  80. package/dist/commands/plugin-tsup.js.map +1 -0
  81. package/dist/commands/plugin-zip.d.ts +2 -0
  82. package/dist/commands/plugin-zip.d.ts.map +1 -0
  83. package/dist/commands/plugin-zip.js +46 -0
  84. package/dist/commands/plugin-zip.js.map +1 -0
  85. package/dist/commands/test/index.d.ts +3 -0
  86. package/dist/commands/test/index.d.ts.map +1 -0
  87. package/dist/commands/test/index.js +17 -0
  88. package/dist/commands/test/index.js.map +1 -0
  89. package/dist/index.d.ts +3 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +15 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/lib/cert.d.ts +4 -0
  94. package/dist/lib/cert.d.ts.map +1 -0
  95. package/dist/lib/cert.js +16 -0
  96. package/dist/lib/cert.js.map +1 -0
  97. package/dist/lib/constants.d.ts +13 -0
  98. package/dist/lib/constants.d.ts.map +1 -0
  99. package/dist/lib/constants.js +14 -0
  100. package/dist/lib/constants.js.map +1 -0
  101. package/dist/lib/esbuild.d.ts +6 -0
  102. package/dist/lib/esbuild.d.ts.map +1 -0
  103. package/dist/lib/esbuild.js +39 -0
  104. package/dist/lib/esbuild.js.map +1 -0
  105. package/dist/lib/exec.d.ts +3 -0
  106. package/dist/lib/exec.d.ts.map +1 -0
  107. package/dist/lib/exec.js +4 -0
  108. package/dist/lib/exec.js.map +1 -0
  109. package/dist/lib/import.d.ts +4 -0
  110. package/dist/lib/import.d.ts.map +1 -0
  111. package/dist/lib/import.js +18 -0
  112. package/dist/lib/import.js.map +1 -0
  113. package/dist/lib/k2.d.ts +2 -0
  114. package/dist/lib/k2.d.ts.map +1 -0
  115. package/dist/lib/k2.js +9 -0
  116. package/dist/lib/k2.js.map +1 -0
  117. package/dist/lib/kintone-api-client.d.ts +57 -0
  118. package/dist/lib/kintone-api-client.d.ts.map +1 -0
  119. package/dist/lib/kintone-api-client.js +95 -0
  120. package/dist/lib/kintone-api-client.js.map +1 -0
  121. package/dist/lib/lint.d.ts +2 -0
  122. package/dist/lib/lint.d.ts.map +1 -0
  123. package/dist/lib/lint.js +28 -0
  124. package/dist/lib/lint.js.map +1 -0
  125. package/dist/lib/plugin-contents.d.ts +5 -0
  126. package/dist/lib/plugin-contents.d.ts.map +1 -0
  127. package/dist/lib/plugin-contents.js +28 -0
  128. package/dist/lib/plugin-contents.js.map +1 -0
  129. package/dist/lib/plugin-manifest.d.ts +4 -0
  130. package/dist/lib/plugin-manifest.d.ts.map +1 -0
  131. package/dist/lib/plugin-manifest.js +13 -0
  132. package/dist/lib/plugin-manifest.js.map +1 -0
  133. package/dist/lib/tailwind.d.ts +33 -0
  134. package/dist/lib/tailwind.d.ts.map +1 -0
  135. package/dist/lib/tailwind.js +91 -0
  136. package/dist/lib/tailwind.js.map +1 -0
  137. package/dist/lib/tsup.d.ts +3 -0
  138. package/dist/lib/tsup.d.ts.map +1 -0
  139. package/dist/lib/tsup.js +26 -0
  140. package/dist/lib/tsup.js.map +1 -0
  141. package/dist/lib/utils.d.ts +16 -0
  142. package/dist/lib/utils.d.ts.map +1 -0
  143. package/dist/lib/utils.js +66 -0
  144. package/dist/lib/utils.js.map +1 -0
  145. package/dist/lib/webpack.d.ts +6 -0
  146. package/dist/lib/webpack.d.ts.map +1 -0
  147. package/dist/lib/webpack.js +72 -0
  148. package/dist/lib/webpack.js.map +1 -0
  149. package/dist/lib/zip.d.ts +4 -0
  150. package/dist/lib/zip.d.ts.map +1 -0
  151. package/dist/lib/zip.js +65 -0
  152. package/dist/lib/zip.js.map +1 -0
  153. package/dist/plugin.d.ts +3 -0
  154. package/dist/plugin.d.ts.map +1 -0
  155. package/dist/plugin.js +25 -0
  156. package/dist/plugin.js.map +1 -0
  157. package/package.json +43 -43
  158. package/types/k2.d.ts +2 -0
@@ -0,0 +1,6 @@
1
+ import { type Configuration } from 'webpack';
2
+ export default function action(params: {
3
+ entries: Configuration['entry'];
4
+ outDir: string;
5
+ }): Promise<void>;
6
+ //# sourceMappingURL=build-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-base.d.ts","sourceRoot":"","sources":["../../src/commands/build-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,wBAA8B,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,iBAG/F"}
@@ -0,0 +1,7 @@
1
+ import {} from 'webpack';
2
+ import { buildWithWebpack } from '../lib/webpack.js';
3
+ export default async function action(params) {
4
+ const { entries, outDir } = params;
5
+ return buildWithWebpack({ entries, outDir });
6
+ }
7
+ //# sourceMappingURL=build-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-base.js","sourceRoot":"","sources":["../../src/commands/build-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,MAAM,CAAC,MAA2D;IAC9F,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACnC,OAAO,gBAAgB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,7 @@
1
+ export default function command(): void;
2
+ export declare function action(options: {
3
+ outdir: string;
4
+ input: string;
5
+ config?: string;
6
+ }): Promise<void>;
7
+ //# sourceMappingURL=build-esbuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-esbuild.d.ts","sourceRoot":"","sources":["../../src/commands/build-esbuild.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,OAAO,SAQ9B;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,iBAkDvF"}
@@ -0,0 +1,63 @@
1
+ import { program } from 'commander';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import { WORKSPACE_DIRECTORY } from '../lib/constants.js';
5
+ import {} from 'esbuild';
6
+ import { buildWithEsbuild } from '../lib/esbuild.js';
7
+ import { importK2Config } from '../lib/import.js';
8
+ import { getDefaultK2Config } from '../lib/k2.js';
9
+ import { buildTailwind } from './build-tailwind.js';
10
+ export default function command() {
11
+ program
12
+ .command('esbuild-build')
13
+ .option('-o, --outdir <outdir>', 'Output directory.', path.join(WORKSPACE_DIRECTORY, 'prod'))
14
+ .option('-i, --input <input>', 'Input directory.', path.join('src', 'apps'))
15
+ .option('--config <config>', 'k2 config file path')
16
+ .description("Build the project for production. (It's a wrapper of webpack build command.)")
17
+ .action(action);
18
+ }
19
+ export async function action(options) {
20
+ console.group('🍳 Build the project for production');
21
+ try {
22
+ const { outdir, input, config } = options;
23
+ const outDir = path.resolve(outdir);
24
+ if (!fs.existsSync(outDir)) {
25
+ fs.mkdirSync(outDir, { recursive: true });
26
+ }
27
+ const allProjects = fs.readdirSync(path.resolve(input));
28
+ const entryPoints = allProjects.reduce((acc, dir) => {
29
+ for (const filename of ['index.ts', 'index.js', 'index.mjs']) {
30
+ if (fs.existsSync(path.join(input, dir, filename))) {
31
+ return { ...acc, [dir]: path.join(input, dir, filename) };
32
+ }
33
+ }
34
+ return acc;
35
+ }, {});
36
+ console.log(`📁 ${Object.keys(entryPoints).length} entry points`);
37
+ const k2Config = config ? await importK2Config(config) : getDefaultK2Config();
38
+ const fullConfig = { ...k2Config, outDir };
39
+ const results = await Promise.allSettled([
40
+ buildWithEsbuild({
41
+ entryPoints,
42
+ outdir,
43
+ sourcemap: false,
44
+ minify: true,
45
+ legalComments: 'none',
46
+ }),
47
+ buildTailwind(fullConfig),
48
+ ]);
49
+ for (const result of results) {
50
+ if (result.status === 'rejected') {
51
+ throw result.reason;
52
+ }
53
+ }
54
+ console.log('✨ Build success.');
55
+ }
56
+ catch (error) {
57
+ throw error;
58
+ }
59
+ finally {
60
+ console.groupEnd();
61
+ }
62
+ }
63
+ //# sourceMappingURL=build-esbuild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-esbuild.js","sourceRoot":"","sources":["../../src/commands/build-esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAqB,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,OAAO;SACJ,OAAO,CAAC,eAAe,CAAC;SACxB,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;SAC5F,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;SAC3E,MAAM,CAAC,mBAA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QAElE,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAC9E,MAAM,UAAU,GAAkB,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,CAAC;QAE1D,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;YACvC,gBAAgB,CAAC;gBACf,WAAW;gBACX,MAAM;gBACN,SAAS,EAAE,KAAK;gBAChB,MAAM,EAAE,IAAI;gBACZ,aAAa,EAAE,MAAM;aACtB,CAAC;YACF,aAAa,CAAC,UAAU,CAAC;SAC1B,CAAC,CAAC;QAEH,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBACjC,MAAM,MAAM,CAAC,MAAM,CAAC;YACtB,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,QAAQ,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const buildTailwind: (config: K2.FullConfig) => Promise<void>;
2
+ //# sourceMappingURL=build-tailwind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-tailwind.d.ts","sourceRoot":"","sources":["../../src/commands/build-tailwind.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,GAAU,QAAQ,EAAE,CAAC,UAAU,kBAiBxD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import path from 'path';
2
+ import { esmImport } from '../lib/import.js';
3
+ import { outputCss } from '../lib/tailwind.js';
4
+ export const buildTailwind = async (config) => {
5
+ if (!config.tailwind?.css || !config.tailwind?.config) {
6
+ return;
7
+ }
8
+ const tailwindConfig = (await esmImport(path.resolve(config.tailwind.config))).default;
9
+ const inputPath = path.resolve(config.tailwind.css);
10
+ const fileName = config.tailwind.fileName ?? 'tailwind.css';
11
+ await outputCss({
12
+ inputPath,
13
+ outputPath: path.join(config.outDir, fileName),
14
+ config: tailwindConfig,
15
+ minify: true,
16
+ });
17
+ console.log(`✨ Built ${fileName}`);
18
+ };
19
+ //# sourceMappingURL=build-tailwind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-tailwind.js","sourceRoot":"","sources":["../../src/commands/build-tailwind.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,MAAqB,EAAE,EAAE;IAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QACtD,OAAO;IACT,CAAC;IACD,MAAM,cAAc,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAEvF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAEpD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,cAAc,CAAC;IAE5D,MAAM,SAAS,CAAC;QACd,SAAS;QACT,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC;QAC9C,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,WAAW,QAAQ,EAAE,CAAC,CAAC;AACrC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export default function command(): void;
2
+ export declare function action(options: {
3
+ outdir: string;
4
+ input: string;
5
+ config?: string;
6
+ }): Promise<void>;
7
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,OAAO,SAQ9B;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,iBAoCvF"}
@@ -0,0 +1,52 @@
1
+ import { program } from 'commander';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import { WORKSPACE_DIRECTORY } from '../lib/constants.js';
5
+ import base from './build-base.js';
6
+ import { buildTailwind } from './build-tailwind.js';
7
+ import { importK2Config } from '../lib/import.js';
8
+ import { getDefaultK2Config } from '../lib/k2.js';
9
+ export default function command() {
10
+ program
11
+ .command('build')
12
+ .option('-o, --outdir <outdir>', 'Output directory.', path.join(WORKSPACE_DIRECTORY, 'prod'))
13
+ .option('-i, --input <input>', 'Input directory.', path.join('src', 'apps'))
14
+ .option('--config <config>', 'k2 config file path')
15
+ .description("Build the project for production. (It's a wrapper of webpack build command.)")
16
+ .action(action);
17
+ }
18
+ export async function action(options) {
19
+ console.group('🍳 Build the project for production');
20
+ try {
21
+ const { outdir, input, config } = options;
22
+ const outDir = path.resolve(outdir);
23
+ const allProjects = fs.readdirSync(path.resolve(input));
24
+ const entries = allProjects.reduce((acc, dir) => {
25
+ for (const filename of ['index.ts', 'index.js', 'index.mjs']) {
26
+ if (fs.existsSync(path.join(input, dir, filename))) {
27
+ return { ...acc, [dir]: path.join(input, dir, filename) };
28
+ }
29
+ }
30
+ return acc;
31
+ }, {});
32
+ const k2Config = config ? await importK2Config(config) : getDefaultK2Config();
33
+ const fullConfig = { ...k2Config, outDir };
34
+ const results = await Promise.allSettled([
35
+ base({ entries, outDir }),
36
+ buildTailwind(fullConfig),
37
+ ]);
38
+ for (const result of results) {
39
+ if (result.status === 'rejected') {
40
+ throw result.reason;
41
+ }
42
+ }
43
+ console.log('✨ Build success.');
44
+ }
45
+ catch (error) {
46
+ throw error;
47
+ }
48
+ finally {
49
+ console.groupEnd();
50
+ }
51
+ }
52
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;SAC5F,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;SAC3E,MAAM,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;SAClD,WAAW,CAAC,8EAA8E,CAAC;SAC3F,MAAM,CAAC,MAAM,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA2D;IACtF,OAAO,CAAC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AAE,CAAC;gBACjC,MAAM,MAAM,CAAC,MAAM,CAAC;YACtB,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,QAAQ,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ export default function command(): void;
2
+ export declare function action(options: {
3
+ outdir: string;
4
+ certdir: string;
5
+ port?: string;
6
+ config?: string;
7
+ input: string;
8
+ }): Promise<void>;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/index.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,OAAO,UAAU,OAAO,SAU9B;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,iBAyBA"}
@@ -0,0 +1,60 @@
1
+ import { program } from 'commander';
2
+ import {} from 'esbuild';
3
+ import fs from 'fs-extra';
4
+ import path from 'path';
5
+ import { CONFIG_FILE_NAME, DEFAULT_PORT, DEVELOPMENT_DIRECTORY, WORKSPACE_DIRECTORY, } from '../../lib/constants.js';
6
+ import base from '../dev-base-esbuild.js';
7
+ import { importK2Config } from '../../lib/import.js';
8
+ import { watchCss } from './tailwind.js';
9
+ export default function command() {
10
+ program
11
+ .command('dev')
12
+ .description('Start development server.')
13
+ .option('-i, --input <input>', 'Input directory', 'src/apps')
14
+ .option('-o, --outdir <outdir>', 'Output directory.', DEVELOPMENT_DIRECTORY)
15
+ .option('-c, --certdir <certdir>', 'Certificate directory', WORKSPACE_DIRECTORY)
16
+ .option('--config <config>', 'k2 config file path')
17
+ .option('-p, --port <port>', 'Port number')
18
+ .action(action);
19
+ }
20
+ export async function action(options) {
21
+ const { certdir, outdir, config, port: specifiedPort, input } = options;
22
+ console.group('🍳 Start development server');
23
+ try {
24
+ console.log(`📂 Output directory: ${outdir}`);
25
+ console.log(`🔑 Certificate directory: ${certdir}`);
26
+ let k2Config = null;
27
+ try {
28
+ k2Config = await importK2Config(config);
29
+ }
30
+ catch (error) {
31
+ console.log(`⚙ ${CONFIG_FILE_NAME} not found. use default settings.`);
32
+ }
33
+ const port = Number(specifiedPort ?? k2Config?.server?.port ?? DEFAULT_PORT);
34
+ await Promise.all([
35
+ build({ certdir, outdir, port, input }),
36
+ watchCss({ k2Config: k2Config ?? {}, outdir }),
37
+ ]);
38
+ }
39
+ catch (error) {
40
+ throw error;
41
+ }
42
+ finally {
43
+ console.groupEnd();
44
+ }
45
+ }
46
+ const build = async (params) => {
47
+ const { outdir, certdir, port, input } = params;
48
+ const srcDir = path.resolve(input);
49
+ const dirs = fs.readdirSync(srcDir);
50
+ const entryPoints = dirs.reduce((acc, dir) => {
51
+ for (const filename of ['index.ts', 'index.js', 'index.mjs']) {
52
+ if (fs.existsSync(path.join(srcDir, dir, filename))) {
53
+ return [...acc, { in: path.join(srcDir, dir, filename), out: dir }];
54
+ }
55
+ }
56
+ return acc;
57
+ }, []);
58
+ return base({ port, entryPoints, certDir: certdir, staticDir: outdir });
59
+ };
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dev/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAqB,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,qBAAq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;IAEF,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const watchCss: (params: {
2
+ k2Config: K2.Config;
3
+ outdir: string;
4
+ }) => Promise<import("chokidar").FSWatcher | undefined>;
5
+ //# sourceMappingURL=tailwind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwind.d.ts","sourceRoot":"","sources":["../../../src/commands/dev/tailwind.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ,GAAU,QAAQ;IAAE,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,sDA8B7E,CAAC"}
@@ -0,0 +1,30 @@
1
+ import path from 'path';
2
+ import chalk from 'chalk';
3
+ import { getTailwindConfigFromK2Config, watchTailwindCSS } from '../../lib/tailwind.js';
4
+ import fs from 'fs-extra';
5
+ export const watchCss = async (params) => {
6
+ const { k2Config, outdir } = params;
7
+ if (!k2Config.tailwind?.css || !k2Config.tailwind?.config) {
8
+ console.log('🚫 missing tailwind config. Skip watching css.');
9
+ return;
10
+ }
11
+ const tailwindConfig = await getTailwindConfigFromK2Config(k2Config.tailwind);
12
+ const input = path.resolve(k2Config.tailwind.css);
13
+ const output = path.join(outdir, 'tailwind.css');
14
+ if (!(await fs.pathExists(output))) {
15
+ await fs.outputFile(output, '');
16
+ }
17
+ return watchTailwindCSS({
18
+ input,
19
+ output: path.join(outdir, 'tailwind.css'),
20
+ config: tailwindConfig,
21
+ onChanges: ({ output, type }) => {
22
+ const outputFileName = path.basename(output);
23
+ console.log(chalk.hex('#e5e7eb')(`${new Date().toLocaleTimeString()} `) +
24
+ chalk.cyan(`[css] `) +
25
+ outputFileName +
26
+ (type === 'init' ? ' init' : ` rebuilt(${type})`));
27
+ },
28
+ });
29
+ };
30
+ //# source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,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,GAAG,CAAC;gBACzD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;gBACpB,cAAc;gBACd,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,GAAG,CAAC,CACpD,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type BuildOptions } from 'esbuild';
2
+ export default function action(params: {
3
+ entryPoints: BuildOptions['entryPoints'];
4
+ staticDir: string;
5
+ certDir: string;
6
+ port: number;
7
+ }): Promise<void>;
8
+ //# sourceMappingURL=dev-base-esbuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-base-esbuild.d.ts","sourceRoot":"","sources":["../../src/commands/dev-base-esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C,wBAA8B,MAAM,CAAC,MAAM,EAAE;IAC3C,WAAW,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,iBAgBA"}
@@ -0,0 +1,18 @@
1
+ import {} from 'esbuild';
2
+ import path from 'path';
3
+ import { getEsbuildContext } from '../lib/esbuild.js';
4
+ export default async function action(params) {
5
+ const { entryPoints, staticDir: outdir, certDir, port } = params;
6
+ const context = await getEsbuildContext({ sourcemap: 'inline', entryPoints, outdir });
7
+ const [_, serveResult] = await Promise.all([
8
+ context.watch(),
9
+ context.serve({
10
+ port,
11
+ keyfile: path.join(certDir, 'localhost-key.pem'),
12
+ certfile: path.join(certDir, 'localhost-cert.pem'),
13
+ servedir: outdir,
14
+ }),
15
+ ]);
16
+ console.log(`🚀 Start development server at https://localhost:${serveResult.port}`);
17
+ }
18
+ //# sourceMappingURL=dev-base-esbuild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-base-esbuild.js","sourceRoot":"","sources":["../../src/commands/dev-base-esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,SAAS,CAAC;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,MAAM,CAAC,MAKpC;IACC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAEjE,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtF,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACzC,OAAO,CAAC,KAAK,EAAE;QACf,OAAO,CAAC,KAAK,CAAC;YACZ,IAAI;YACJ,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,mBAAmB,CAAC;YAChD,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,oBAAoB,CAAC;YAClD,QAAQ,EAAE,MAAM;SACjB,CAAC;KACH,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,oDAAoD,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;AACtF,CAAC"}
@@ -0,0 +1,4 @@
1
+ export default function action(options: {
2
+ output: string;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=genkey-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genkey-base.d.ts","sourceRoot":"","sources":["../../src/commands/genkey-base.ts"],"names":[],"mappings":"AAEA,wBAA8B,MAAM,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,iBAe/D"}
@@ -0,0 +1,19 @@
1
+ import { generateCert } from '../lib/cert.js';
2
+ export default async function action(options) {
3
+ const { output } = options;
4
+ console.group('🍳 Generate SSL key for localhost');
5
+ try {
6
+ const { stdout } = await generateCert(output);
7
+ if (stdout) {
8
+ console.log(stdout);
9
+ }
10
+ console.log(`🔑 key generation success. Output to ./${output}`);
11
+ }
12
+ catch (error) {
13
+ throw error;
14
+ }
15
+ finally {
16
+ console.groupEnd();
17
+ }
18
+ }
19
+ //# sourceMappingURL=genkey-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genkey-base.js","sourceRoot":"","sources":["../../src/commands/genkey-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,MAAM,CAAC,OAA2B;IAC9D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE3B,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,0CAA0C,MAAM,EAAE,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,QAAQ,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export default function command(): void;
2
+ export declare function action(options: {
3
+ output: string;
4
+ }): Promise<void>;
5
+ //# sourceMappingURL=genkey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genkey.d.ts","sourceRoot":"","sources":["../../src/commands/genkey.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,OAAO,SAM9B;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,iBAEvD"}
@@ -0,0 +1,14 @@
1
+ import { program } from 'commander';
2
+ import base from './genkey-base.js';
3
+ import { WORKSPACE_DIRECTORY } from '../lib/constants.js';
4
+ export default function command() {
5
+ program
6
+ .command('genkey')
7
+ .description('Generate SSL key for localhost. (Require mkcert)')
8
+ .option('-o, --output <output>', 'Output directory.', WORKSPACE_DIRECTORY)
9
+ .action(action);
10
+ }
11
+ export async function action(options) {
12
+ await base(options);
13
+ }
14
+ //# sourceMappingURL=genkey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genkey.js","sourceRoot":"","sources":["../../src/commands/genkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,kDAAkD,CAAC;SAC/D,MAAM,CAAC,uBAAuB,EAAE,mBAAmB,EAAE,mBAAmB,CAAC;SACzE,MAAM,CAAC,MAAM,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAA2B;IACtD,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC;AACtB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export default function command(): void;
2
+ export declare function action(options: {
3
+ outdir: string;
4
+ certdir: string;
5
+ port: string;
6
+ input: string;
7
+ }): Promise<void>;
8
+ //# sourceMappingURL=lint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,OAAO,SAM9B;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,iBAOA"}
@@ -0,0 +1,20 @@
1
+ import { program } from 'commander';
2
+ import { lint } from '../lib/lint.js';
3
+ export default function command() {
4
+ program
5
+ .command('lint')
6
+ .description('Lint source files')
7
+ .option('-c, --config <config>', 'Config file path')
8
+ .action(action);
9
+ }
10
+ export async function action(options) {
11
+ try {
12
+ lint();
13
+ }
14
+ catch (error) {
15
+ throw error;
16
+ }
17
+ finally {
18
+ }
19
+ }
20
+ //# sourceMappingURL=lint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,mBAAmB,CAAC;SAChC,MAAM,CAAC,uBAAuB,EAAE,kBAAkB,CAAC;SACnD,MAAM,CAAC,MAAM,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAK5B;IACC,IAAI,CAAC;QACH,IAAI,EAAE,CAAC;IACT,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;IACX,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function command(): void;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/manifest/index.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,OAAO,IAAI,IAAI,CAKtC"}
@@ -0,0 +1,29 @@
1
+ import { program } from 'commander';
2
+ import { outputManifest } from '../../lib/plugin-manifest.js';
3
+ import { copyPluginContents } from '../../lib/plugin-contents.js';
4
+ export default function command() {
5
+ program
6
+ .command('manifest')
7
+ .option('-e, --env <env>', 'create manifest', 'prod')
8
+ .action(action);
9
+ }
10
+ async function action(options) {
11
+ console.group('🚀 Executing manifest generation');
12
+ try {
13
+ const { env } = options;
14
+ if (env !== 'prod' && env !== 'dev' && env !== 'standalone') {
15
+ throw new Error('Invalid environment');
16
+ }
17
+ await copyPluginContents();
18
+ console.log('📁 contents copied');
19
+ await outputManifest(env);
20
+ console.log(`📝 manifest.json generated (${env})`);
21
+ }
22
+ catch (error) {
23
+ throw error;
24
+ }
25
+ finally {
26
+ console.groupEnd();
27
+ }
28
+ }
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,CAAC;SACpD,MAAM,CAAC,MAAM,CAAC,CAAC;AACpB,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,OAAwB;IAC5C,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAClD,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;QACxB,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QAED,MAAM,kBAAkB,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAElC,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,+BAA+B,GAAG,GAAG,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,QAAQ,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ export default function command(): void;
2
+ export declare function action(): Promise<void>;
3
+ //# sourceMappingURL=plugin-build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-build.d.ts","sourceRoot":"","sources":["../../src/commands/plugin-build.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,OAAO,SAK9B;AAED,wBAAsB,MAAM,kBAiD3B"}
@@ -0,0 +1,60 @@
1
+ import { program } from 'commander';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import {} from 'webpack';
5
+ import { PLUGIN_CONTENTS_DIRECTORY } from '../lib/constants.js';
6
+ import { importK2PluginConfig } from '../lib/import.js';
7
+ import { getTailwindConfig, getTailwindInputCss, outputCss } from '../lib/tailwind.js';
8
+ import base from './build-base.js';
9
+ import { lint } from '../lib/lint.js';
10
+ export default function command() {
11
+ program
12
+ .command('build')
13
+ .description("Build the project for production. (It's a wrapper of webpack build command.)")
14
+ .action(action);
15
+ }
16
+ export async function action() {
17
+ console.group('🍳 Build the project for production');
18
+ try {
19
+ const config = await importK2PluginConfig();
20
+ if (config?.lint?.build) {
21
+ await lint();
22
+ console.log('✨ Lint success.');
23
+ }
24
+ if (!fs.existsSync(PLUGIN_CONTENTS_DIRECTORY)) {
25
+ await fs.mkdir(PLUGIN_CONTENTS_DIRECTORY, { recursive: true });
26
+ }
27
+ const entries = {
28
+ desktop: path.join('src', 'desktop', 'index.ts'),
29
+ config: path.join('src', 'config', 'index.ts'),
30
+ };
31
+ if (config.tailwind?.css && config.tailwind?.config) {
32
+ const tailwindConfig = await getTailwindConfig(config.tailwind);
33
+ const inputFile = getTailwindInputCss(config.tailwind);
34
+ await outputCss({
35
+ inputPath: inputFile.config,
36
+ outputPath: path.join(PLUGIN_CONTENTS_DIRECTORY, 'config.css'),
37
+ config: tailwindConfig.config,
38
+ minify: true,
39
+ });
40
+ console.log('✨ Built config.css');
41
+ await outputCss({
42
+ inputPath: inputFile.desktop,
43
+ outputPath: path.join(PLUGIN_CONTENTS_DIRECTORY, 'desktop.css'),
44
+ config: tailwindConfig.desktop,
45
+ minify: true,
46
+ });
47
+ console.log('✨ Built desktop.css');
48
+ }
49
+ await base({ entries, outDir: PLUGIN_CONTENTS_DIRECTORY });
50
+ console.log('✨ Built desktop.js and config.js');
51
+ console.log('✨ Build success.');
52
+ }
53
+ catch (error) {
54
+ throw error;
55
+ }
56
+ finally {
57
+ console.groupEnd();
58
+ }
59
+ }
60
+ //# sourceMappingURL=plugin-build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-build.js","sourceRoot":"","sources":["../../src/commands/plugin-build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAsB,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,iBAA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AS,CAAC;gBACd,SAAS,EAAE,SAAS,CAAC,MAAM;gBAC3B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,YAAY,CAAC;gBAC9D,MAAM,EAAE,cAAc,CAAC,MAAM;gBAC7B,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;YAClC,MAAM,SAAS,CAAC;gBACd,SAAS,EAAE,SAAS,CAAC,OAAO;gBAC5B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,aAAa,CAAC;gBAC/D,MAAM,EAAE,cAAc,CAAC,OAAO;gBAC9B,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACrC,CAAC;QAED,MAAM,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,QAAQ,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const getManifest: (params: {
2
+ config: Plugin.Meta.Config;
3
+ port: number;
4
+ }) => Promise<Plugin.Meta.Manifest>;
5
+ //# sourceMappingURL=create-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-manifest.d.ts","sourceRoot":"","sources":["../../../src/commands/plugin-dev/create-manifest.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAU,QAAQ;IAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,kCA2BrF,CAAC"}