@genesislcap/build-kit 14.142.0 → 14.142.1-alpha-d86f783.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 (42) hide show
  1. package/dist/utils/archive.d.ts +2 -0
  2. package/dist/utils/archive.d.ts.map +1 -0
  3. package/dist/utils/archive.js +20 -0
  4. package/dist/utils/index.d.ts +5 -1
  5. package/dist/utils/index.d.ts.map +1 -1
  6. package/dist/utils/index.js +5 -1
  7. package/dist/utils/npm.d.ts +1 -1
  8. package/dist/utils/npm.d.ts.map +1 -1
  9. package/dist/utils/npm.js +4 -2
  10. package/dist/utils/prompts.d.ts.map +1 -1
  11. package/dist/utils/prompts.js +7 -5
  12. package/dist/utils/seed.fetching.d.ts +36 -0
  13. package/dist/utils/seed.fetching.d.ts.map +1 -0
  14. package/dist/utils/seed.fetching.js +157 -0
  15. package/dist/utils/seed.meta.d.ts +10 -0
  16. package/dist/utils/seed.meta.d.ts.map +1 -0
  17. package/dist/utils/seed.meta.js +38 -0
  18. package/dist/utils/seed.processing.d.ts +4 -0
  19. package/dist/utils/seed.processing.d.ts.map +1 -0
  20. package/dist/utils/seed.processing.js +87 -0
  21. package/dist/utils/seed.setup.d.ts +3 -0
  22. package/dist/utils/seed.setup.d.ts.map +1 -0
  23. package/dist/utils/seed.setup.js +73 -0
  24. package/package.json +6 -3
  25. package/src/utils/archive.ts +18 -0
  26. package/src/utils/index.ts +5 -1
  27. package/src/utils/npm.ts +4 -2
  28. package/src/utils/prompts.ts +8 -5
  29. package/src/utils/seed.fetching.ts +256 -0
  30. package/src/utils/seed.meta.ts +34 -0
  31. package/src/utils/seed.processing.ts +100 -0
  32. package/src/utils/seed.setup.ts +98 -0
  33. package/test/fixtures/mock-seed/.genx/.genxrc.js +7 -0
  34. package/test/fixtures/mock-seed/.genx/configure.js +3 -0
  35. package/test/fixtures/mock-seed/.genx/package.json +17 -0
  36. package/test/fixtures/mock-seed/test.md +44 -0
  37. package/test/utils/seed.fetching.test.ts +145 -0
  38. package/test/utils/seed.meta.test.ts +33 -0
  39. package/dist/utils/seed.d.ts +0 -31
  40. package/dist/utils/seed.d.ts.map +0 -1
  41. package/dist/utils/seed.js +0 -264
  42. package/src/utils/seed.ts +0 -351
@@ -0,0 +1,145 @@
1
+ import { relative } from 'node:path';
2
+ import { assert, createLogicSuite } from '@genesislcap/foundation-testing';
3
+ import { getSeedDirs, resolveGitSeed, resolveNPMSeed } from '../../src/utils';
4
+
5
+ const suite = createLogicSuite('resolveGitSeed');
6
+
7
+ const scenarios = [
8
+ {
9
+ description: 'defaulting',
10
+ args: [],
11
+ expected: {
12
+ repo: 'genesiscommunitysuccess/blank-app-seed',
13
+ ref: 'main',
14
+ id: `gh:genesiscommunitysuccess/blank-app-seed#main`,
15
+ },
16
+ },
17
+ {
18
+ description: 'git user defaulting',
19
+ args: ['positions-app-seed'],
20
+ expected: {
21
+ repo: 'genesiscommunitysuccess/positions-app-seed',
22
+ ref: 'main',
23
+ id: `gh:genesiscommunitysuccess/positions-app-seed#main`,
24
+ },
25
+ },
26
+ {
27
+ description: 'custom ref',
28
+ args: ['positions-app-seed', 'mytag'],
29
+ expected: {
30
+ repo: 'genesiscommunitysuccess/positions-app-seed',
31
+ ref: 'mytag',
32
+ id: `gh:genesiscommunitysuccess/positions-app-seed#mytag`,
33
+ },
34
+ },
35
+ {
36
+ description: 'custom ref',
37
+ args: ['positions-app-seed', 'mytag', 'subfolder'],
38
+ expected: {
39
+ repo: 'genesiscommunitysuccess/positions-app-seed',
40
+ ref: 'mytag',
41
+ id: `gh:genesiscommunitysuccess/positions-app-seed/subfolder#mytag`,
42
+ },
43
+ },
44
+ {
45
+ description: 'custom provider',
46
+ args: ['positions-app-seed', 'mytag', 'subfolder', 'bitbucket'],
47
+ expected: {
48
+ repo: 'genesiscommunitysuccess/positions-app-seed',
49
+ ref: 'mytag',
50
+ id: `bitbucket:genesiscommunitysuccess/positions-app-seed/subfolder#mytag`,
51
+ },
52
+ },
53
+ ];
54
+
55
+ scenarios.forEach((scenario) => {
56
+ suite(scenario.description, () => {
57
+ assert.equal(resolveGitSeed(...scenario.args), scenario.expected);
58
+ });
59
+ });
60
+
61
+ suite.run();
62
+
63
+ const suite2 = createLogicSuite('resolveNPMSeed');
64
+
65
+ const scenarios2 = [
66
+ {
67
+ description: 'defaulting',
68
+ args: [],
69
+ expected: {
70
+ artifact: 'genesislcap/blank-app-seed',
71
+ ref: 'latest',
72
+ },
73
+ },
74
+ {
75
+ description: 'custom seed',
76
+ args: ['positions-app-seed'],
77
+ expected: {
78
+ artifact: 'genesislcap/positions-app-seed',
79
+ ref: 'latest',
80
+ },
81
+ },
82
+ {
83
+ description: 'custom ref',
84
+ args: ['positions-app-seed', 'prerelease'],
85
+ expected: {
86
+ artifact: 'genesislcap/positions-app-seed',
87
+ ref: 'prerelease',
88
+ },
89
+ },
90
+ {
91
+ description: 'no scope',
92
+ args: ['my-seed', 'prerelease', 'false'],
93
+ expected: {
94
+ artifact: 'my-seed',
95
+ ref: 'prerelease',
96
+ },
97
+ },
98
+ ];
99
+
100
+ scenarios2.forEach((scenario) => {
101
+ suite(scenario.description, () => {
102
+ assert.equal(resolveNPMSeed(...scenario.args), scenario.expected);
103
+ });
104
+ });
105
+
106
+ suite2.run();
107
+
108
+ const suite3 = createLogicSuite('getSeedDirs');
109
+
110
+ suite3('loading remote seed - init', async () => {
111
+ const dir = 'myapp';
112
+ const isInit = true;
113
+ const remote = true;
114
+ const result = getSeedDirs('blank-app-seed', dir, '', isInit, remote);
115
+ const genxDir = relative(process.cwd(), `${dir}/.genx`);
116
+ assert.equal(result, {
117
+ localPath: 'blank-app-seed',
118
+ dir,
119
+ subdir: '',
120
+ isLocalSeed: false,
121
+ genxDir,
122
+ extractedSeedDir: dir,
123
+ extractedSeedGenxDir: genxDir,
124
+ });
125
+ });
126
+
127
+ suite3('loading remote seed - add', async () => {
128
+ const dir = 'myapp';
129
+ const isInit = false;
130
+ const remote = true;
131
+ const result = getSeedDirs('blank-app-seed', dir, '', isInit, remote);
132
+ const genxDir = relative(process.cwd(), `${dir}/.genx`);
133
+ const extractedSeedGenxDir = relative(process.cwd(), `${dir}/.genx/tmp/.genx`);
134
+ assert.equal(result, {
135
+ localPath: 'blank-app-seed',
136
+ dir,
137
+ subdir: '',
138
+ isLocalSeed: false,
139
+ genxDir,
140
+ extractedSeedDir: `${dir}/.genx/tmp`,
141
+ extractedSeedGenxDir,
142
+ });
143
+ });
144
+
145
+ suite3.run();
@@ -0,0 +1,33 @@
1
+ import { assert, createLogicSuite } from '@genesislcap/foundation-testing';
2
+ import { loadGenxModule, loadSeed } from '../../src/utils';
3
+
4
+ const suite = createLogicSuite('loadSeed');
5
+
6
+ suite('loading local seed', async () => {
7
+ const result = await loadSeed('./test/fixtures/mock-seed/.genx');
8
+ assert.type(result.configure, 'function');
9
+ });
10
+
11
+ suite.run();
12
+
13
+ const suite2 = createLogicSuite('loadGenxModule');
14
+
15
+ suite2('loading local seed', async () => {
16
+ const result = await loadGenxModule('./test/fixtures/mock-seed/.genx');
17
+ assert.equal(result, {
18
+ name: 'mock-seed',
19
+ description: 'Mock Seed',
20
+ version: '1.0.0',
21
+ license: 'Apache-2.0',
22
+ genxSeedConfig: {
23
+ processFiles: {
24
+ interpolateVariables: {
25
+ enabled: true,
26
+ include: ['.kt', '.md'],
27
+ },
28
+ },
29
+ },
30
+ });
31
+ });
32
+
33
+ suite2.run();
@@ -1,31 +0,0 @@
1
- import type { PackageJson } from 'pkg-types';
2
- export type LocalFetchResult = {
3
- local: boolean;
4
- genxDir: string;
5
- seed: string;
6
- subdir: string;
7
- pkg: PackageJson;
8
- dir: string;
9
- extractedSeedDir: string;
10
- extractedSeedGenxDir: string;
11
- };
12
- export type RemoteFetchResult = LocalFetchResult & {
13
- repo: string;
14
- user: string;
15
- ref: string;
16
- provider: string;
17
- id: string;
18
- };
19
- export type FetchResult = LocalFetchResult | RemoteFetchResult;
20
- export declare const installSeedDeps: (dir: any, isLogLevelVerbose: any) => Promise<void>;
21
- export declare const loadSeed: (dir: any) => Promise<{
22
- prompts: any;
23
- configure: any;
24
- details: any;
25
- defaults: import("inquirer").Question<import("inquirer").Answers>;
26
- validators: import("inquirer").Question<import("inquirer").Answers>;
27
- validate: (data: any) => any[];
28
- }>;
29
- export declare const fetchSeed: (seed: string, dir: string, remote: boolean, ref: string, insecure: boolean, subdir: string, isInit: boolean) => Promise<FetchResult>;
30
- export declare const configureSeedApp: (seedInfo: any, fetchSeedResult: any, params: any, dir: any, skipOptionalPrompts: any, isInit: boolean) => Promise<void>;
31
- //# sourceMappingURL=seed.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../src/utils/seed.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAY7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,WAAW,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,GAAG;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAiB/D,eAAO,MAAM,eAAe,qDAmC3B,CAAC;AAGF,eAAO,MAAM,QAAQ;;;;;;;EAgBpB,CAAC;AAeF,eAAO,MAAM,SAAS,SACd,MAAM,OACP,MAAM,UACH,OAAO,OACV,MAAM,YACD,OAAO,UACT,MAAM,UACN,OAAO,KACd,QAAQ,WAAW,CAiFrB,CAAC;AA6FF,eAAO,MAAM,gBAAgB,iGAMnB,OAAO,kBAyChB,CAAC"}
@@ -1,264 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configureSeedApp = exports.fetchSeed = exports.loadSeed = exports.installSeedDeps = void 0;
4
- const tslib_1 = require("tslib");
5
- const node_fs_1 = require("node:fs");
6
- const node_path_1 = require("node:path");
7
- const consola_1 = require("consola");
8
- const giget_1 = require("giget");
9
- const child_process_1 = require("./child-process");
10
- const console_1 = require("./console");
11
- const fs_1 = require("./fs");
12
- const handlebars_1 = require("./handlebars");
13
- const json_1 = require("./json");
14
- const object_1 = require("./object");
15
- const prompts_1 = require("./prompts");
16
- const PROMPT_DATA_FILE = 'answers.json';
17
- // map repo to Giget-compatible template ID
18
- const resolveSeed = (seed = '', ref = 'main', subdir = '', provider = 'gh') => {
19
- const parts = seed.split('/');
20
- const repo = parts.pop() || 'blank-app-seed';
21
- const user = parts.pop() || 'genesiscommunitysuccess';
22
- const dir = subdir ? `/${subdir}` : '';
23
- return {
24
- repo,
25
- user,
26
- ref,
27
- provider,
28
- id: `${provider}:${user}/${repo}${dir}#${ref}`,
29
- };
30
- };
31
- const installSeedDeps = (dir, isLogLevelVerbose) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
32
- let dependencies = {};
33
- try {
34
- const packageJSONPath = (0, node_path_1.resolve)(dir, 'package.json');
35
- const packageJSON = require(packageJSONPath);
36
- dependencies = packageJSON.dependencies || {};
37
- }
38
- catch (e) { }
39
- consola_1.consola.debug('Seed NPM dependencies', {
40
- targetInstallDir: dir,
41
- dependencyCount: Object.keys(dependencies).length,
42
- });
43
- if (Object.keys(dependencies).length !== 0) {
44
- const start2 = Date.now();
45
- consola_1.consola.info('Installing seed NPM dependencies...');
46
- yield (0, child_process_1.runAsync)(dir, 'npm install', {
47
- prefixCommandWithNode: false,
48
- exitOnError: false,
49
- verbose: isLogLevelVerbose,
50
- env: Object.assign(Object.assign({}, process.env), { NODE_ENV: 'production' }),
51
- }).catch((err) => {
52
- consola_1.consola.error('Unexpected error installing seed dependencies. Try re-runing with --log-level verbose');
53
- if (err) {
54
- consola_1.consola.error(err);
55
- }
56
- process.exit(1);
57
- });
58
- consola_1.consola.success(`Installed in ${Date.now() - start2}ms`);
59
- }
60
- });
61
- exports.installSeedDeps = installSeedDeps;
62
- // load seed details including prompt question defaults and validators
63
- const loadSeed = (dir) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
64
- const GENX_RC = '.genxrc.js';
65
- const genxConfigPath = (0, node_path_1.resolve)(dir, GENX_RC);
66
- const { prompts, configure, details } = require(genxConfigPath);
67
- const defaults = yield (0, prompts_1.getPromptDefaults)(prompts());
68
- const validators = yield (0, prompts_1.getPromptValidators)(prompts());
69
- const validate = (data) => (0, prompts_1.validateSeedData)(data, validators);
70
- return {
71
- prompts: prompts(),
72
- configure: configure(),
73
- details: details(),
74
- defaults,
75
- validators,
76
- validate,
77
- };
78
- });
79
- exports.loadSeed = loadSeed;
80
- const loadGenxModule = (genxDir, module = 'package.json', warnIfMissing = true) => {
81
- const path = (0, node_path_1.resolve)(genxDir, module);
82
- try {
83
- return require(path);
84
- }
85
- catch (e) {
86
- if (warnIfMissing) {
87
- consola_1.consola.warn(`Could not load ${module} from ${genxDir}`);
88
- }
89
- return {};
90
- }
91
- };
92
- // download remote or copy local seed
93
- const fetchSeed = (seed, dir, remote, ref, insecure, subdir, isInit) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
94
- var _a;
95
- // disable SSL cert verification
96
- if (insecure) {
97
- process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
98
- }
99
- const GENX_DIR = '/.genx';
100
- const TMP_DIR = '/tmp';
101
- const start = Date.now();
102
- const localPath = subdir ? `${seed}/${subdir}` : seed;
103
- const isLocalSeed = !remote && (0, node_fs_1.existsSync)(localPath);
104
- const genxDir = (0, node_path_1.relative)(process.cwd(), `${dir}${GENX_DIR}`);
105
- const extractedSeedDir = isInit ? dir : (0, node_path_1.relative)(process.cwd(), `${dir}${GENX_DIR}${TMP_DIR}`);
106
- const extractedSeedGenxDir = isInit
107
- ? genxDir
108
- : (0, node_path_1.relative)(process.cwd(), `${extractedSeedDir}${GENX_DIR}`);
109
- if (!isInit) {
110
- yield (0, fs_1.rm)(extractedSeedDir);
111
- (0, node_fs_1.mkdirSync)(extractedSeedDir);
112
- }
113
- let result;
114
- if (isLocalSeed) {
115
- consola_1.consola.info(`Copying local seed ${(0, console_1.bold)(localPath)}`);
116
- try {
117
- if (ref) {
118
- consola_1.consola.warn(`${(0, console_1.bold)('ref')} has no effect when used with a local seed`);
119
- }
120
- (0, node_fs_1.cpSync)(localPath, extractedSeedDir, { recursive: true });
121
- consola_1.consola.success(`Seed copied in ${Date.now() - start}ms`);
122
- result = {
123
- local: true,
124
- genxDir,
125
- seed: localPath,
126
- subdir,
127
- pkg: loadGenxModule(extractedSeedGenxDir),
128
- dir,
129
- extractedSeedDir,
130
- extractedSeedGenxDir,
131
- };
132
- }
133
- catch (e) {
134
- consola_1.consola.error(`Error copying ${localPath} to ${(0, console_1.bold)(dir)}`, e);
135
- process.exit(1);
136
- }
137
- }
138
- else {
139
- const data = resolveSeed(seed, ref, subdir);
140
- const subDirMessage = subdir ? `, subdir ${(0, console_1.bold)(subdir)}` : '';
141
- consola_1.consola.info(`Downloading ${(0, console_1.bold)(data.user)} seed ${(0, console_1.bold)(data.repo)} (Git ref ${(0, console_1.bold)(data.ref)}${subDirMessage}) to ${(0, console_1.bold)(dir)} directory...`);
142
- try {
143
- yield (0, giget_1.downloadTemplate)(data.id, {
144
- dir: extractedSeedDir,
145
- // auth?: string; // custom Authorization token to use for downloading template
146
- registry: false, // disable built-in Giget registry
147
- });
148
- consola_1.consola.success(`Seed downloaded in ${Date.now() - start}ms`);
149
- result = Object.assign({ local: false, genxDir,
150
- seed,
151
- subdir, pkg: loadGenxModule(extractedSeedGenxDir), dir,
152
- extractedSeedDir,
153
- extractedSeedGenxDir }, data);
154
- }
155
- catch (err) {
156
- const error = process.env.DEBUG ? err : err.message;
157
- consola_1.consola.error(error);
158
- process.exit(1);
159
- }
160
- }
161
- yield removeExclusions(extractedSeedDir, (_a = result.pkg.genxSeedConfig) === null || _a === void 0 ? void 0 : _a.exclude);
162
- return result;
163
- });
164
- exports.fetchSeed = fetchSeed;
165
- const removeExclusions = (dir, exclusions) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
166
- try {
167
- const exclude = (exclusions !== null && exclusions !== void 0 ? exclusions : []).map((x) => (0, node_path_1.resolve)(dir, x));
168
- yield Promise.all(exclude.map((exclusion) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
169
- if ((0, node_fs_1.existsSync)(exclusion)) {
170
- yield (0, fs_1.rm)(exclusion);
171
- consola_1.consola.debug(`Excluded: ${exclusion}`);
172
- }
173
- else {
174
- consola_1.consola.debug(`Ignored invalid exclusion: ${exclusion}`);
175
- }
176
- })));
177
- }
178
- catch (err) {
179
- const error = process.env.DEBUG ? err : err.message;
180
- consola_1.consola.error(error);
181
- process.exit(1);
182
- }
183
- });
184
- const processItem = ({ base, dir: itemDir, path, isDir, ext, stats }, data, renamingEnabled, interpolationEnabled, interpolationWhitelist) => {
185
- const baseNew = (0, handlebars_1.render)(base, data);
186
- const needsRenaming = renamingEnabled && baseNew !== base;
187
- const pathNew = needsRenaming ? (0, node_path_1.resolve)(itemDir, baseNew) : path;
188
- if (needsRenaming) {
189
- try {
190
- (0, node_fs_1.renameSync)((0, node_path_1.resolve)(itemDir, base), (0, node_path_1.resolve)(itemDir, baseNew));
191
- consola_1.consola.debug(`Renamed ${(0, console_1.bold)(base)} to ${(0, console_1.bold)(baseNew)}`);
192
- }
193
- catch (e) {
194
- consola_1.consola.error(`Error renaming ${(0, console_1.bold)(base)} to ${(0, console_1.bold)(baseNew)}`);
195
- }
196
- }
197
- // Handlebars rendering
198
- if (interpolationEnabled && !isDir && interpolationWhitelist.some((i) => baseNew.includes(i))) {
199
- try {
200
- (0, handlebars_1.renderFile)(pathNew, data, pathNew);
201
- consola_1.consola.debug(`Interpolated variables in ${pathNew}`);
202
- }
203
- catch (e) {
204
- consola_1.consola.error(`Error interpolating variables in ${pathNew}`);
205
- }
206
- }
207
- return { isDir, ext, dir: itemDir, base: baseNew, path: pathNew, stats };
208
- };
209
- const processOptions = (fetchSeedResult, dir, data, isInit, persistedAnswers) => {
210
- var _a, _b;
211
- const options = ((_a = fetchSeedResult.pkg) === null || _a === void 0 ? void 0 : _a.genxSeedConfig) || {};
212
- consola_1.consola.debug('Seed options', JSON.stringify(options));
213
- if (options.processFiles) {
214
- const ignoreDirs = ((_b = options.processFiles) === null || _b === void 0 ? void 0 : _b.exclude) || [
215
- '.git',
216
- '.genx',
217
- '.github',
218
- 'node_modules',
219
- '.gradle',
220
- 'gradle',
221
- ];
222
- const filter = (entry) => !ignoreDirs.includes(entry.base);
223
- const mapper = (entry) => {
224
- var _a, _b, _c, _d, _e;
225
- return processItem(entry, data, !!((_a = options.processFiles) === null || _a === void 0 ? void 0 : _a.rename), !!((_c = (_b = options.processFiles) === null || _b === void 0 ? void 0 : _b.interpolateVariables) === null || _c === void 0 ? void 0 : _c.enabled), (_e = (_d = options.processFiles) === null || _d === void 0 ? void 0 : _d.interpolateVariables) === null || _e === void 0 ? void 0 : _e.include);
226
- };
227
- (0, fs_1.listAllFiles)(dir, filter, mapper);
228
- }
229
- if (options.persistAnswers) {
230
- const jsonPath = (0, node_path_1.resolve)(fetchSeedResult.genxDir, PROMPT_DATA_FILE);
231
- const additions = persistedAnswers.additions || [];
232
- const json = isInit
233
- ? data
234
- : Object.assign(Object.assign({}, data), { appSeed: persistedAnswers.appSeed, additions: [...additions, data.appSeed] });
235
- (0, json_1.writeJSON)(jsonPath, json);
236
- }
237
- };
238
- // run seed configure script
239
- const configureSeedApp = (seedInfo, fetchSeedResult, params, dir, skipOptionalPrompts, isInit) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
240
- const { configure, prompts, details, defaults, validate } = seedInfo;
241
- // load persisted answers if available
242
- const persistedAnswers = loadGenxModule(fetchSeedResult.genxDir, PROMPT_DATA_FILE, false);
243
- // get prompt answers
244
- const data = yield (0, prompts_1.getData)(persistedAnswers, prompts, details, defaults, validate, params, dir, skipOptionalPrompts, fetchSeedResult);
245
- consola_1.consola.debug('Loaded seed data', data);
246
- const utils = {
247
- writeFileWithData: handlebars_1.renderFile,
248
- editJSONFile: json_1.editJSONFile,
249
- replaceObjectKeys: object_1.replaceObjectKeys,
250
- listAllFiles: fs_1.listAllFiles,
251
- rename: fs_1.rename,
252
- };
253
- // run seed configure script
254
- yield configure(data, utils).catch((e) => consola_1.consola.error(e));
255
- // process seed exclusions, render templates, rename files/folders
256
- processOptions(fetchSeedResult, fetchSeedResult.extractedSeedDir, data, isInit, persistedAnswers);
257
- // when adding seed, copy result from temp folder to the app root (omitting .genx folder of the seed)
258
- if (!isInit) {
259
- yield (0, fs_1.rm)(fetchSeedResult.extractedSeedGenxDir);
260
- (0, node_fs_1.cpSync)(fetchSeedResult.extractedSeedDir, dir, { recursive: true });
261
- yield (0, fs_1.rm)(fetchSeedResult.extractedSeedDir);
262
- }
263
- });
264
- exports.configureSeedApp = configureSeedApp;