directus-template-cli 0.6.0-beta.2 → 0.7.0-beta.2

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 (36) hide show
  1. package/README.md +0 -14
  2. package/dist/commands/apply.js +1 -1
  3. package/dist/commands/extract.d.ts +0 -2
  4. package/dist/commands/extract.js +2 -29
  5. package/dist/commands/init.d.ts +37 -0
  6. package/dist/commands/init.js +178 -0
  7. package/dist/lib/constants.d.ts +16 -0
  8. package/dist/lib/constants.js +17 -1
  9. package/dist/lib/extract/extract-content.d.ts +1 -1
  10. package/dist/lib/extract/extract-content.js +5 -9
  11. package/dist/lib/extract/extract-fields.js +1 -1
  12. package/dist/lib/extract/index.d.ts +1 -6
  13. package/dist/lib/extract/index.js +5 -12
  14. package/dist/lib/init/config.d.ts +3 -0
  15. package/dist/lib/init/config.js +15 -0
  16. package/dist/lib/init/index.d.ts +14 -0
  17. package/dist/lib/init/index.js +167 -0
  18. package/dist/lib/init/types.d.ts +30 -0
  19. package/dist/lib/init/types.js +2 -0
  20. package/dist/lib/load/load-collections.d.ts +2 -0
  21. package/dist/lib/load/load-collections.js +2 -0
  22. package/dist/lib/utils/animated-bunny.d.ts +2 -0
  23. package/dist/lib/utils/animated-bunny.js +71 -0
  24. package/dist/lib/utils/ensure-dir.d.ts +2 -0
  25. package/dist/lib/utils/ensure-dir.js +16 -0
  26. package/dist/lib/utils/get-template.js +2 -1
  27. package/dist/lib/utils/parse-github-url.d.ts +14 -0
  28. package/dist/lib/utils/parse-github-url.js +54 -0
  29. package/dist/lib/utils/wait.d.ts +7 -0
  30. package/dist/lib/utils/wait.js +13 -0
  31. package/dist/services/docker.d.ts +23 -0
  32. package/dist/services/docker.js +137 -0
  33. package/dist/services/github.d.ts +18 -0
  34. package/dist/services/github.js +57 -0
  35. package/oclif.manifest.json +81 -21
  36. package/package.json +14 -3
package/README.md CHANGED
@@ -181,18 +181,6 @@ Using email/password:
181
181
  npx directus-template-cli@latest extract -p --templateName="My Template" --templateLocation="./my-template" --userEmail="admin@example.com" --userPassword="admin" --directusUrl="http://localhost:8055"
182
182
  ```
183
183
 
184
- Skipping extracting content from sensitive or large collections:
185
-
186
- ```
187
- npx directus-template-cli@latest extract -p --templateName="My Template" --templateLocation="./my-template" --directusToken="admin-token-here" --directusUrl="http://localhost:8055" --excludeCollections="posts,globals"
188
- ```
189
-
190
- Skipping extracting files and assets:
191
-
192
- ```
193
- npx directus-template-cli@latest extract -p --templateName="My Template" --templateLocation="./my-template" --directusToken="admin-token-here" --directusUrl="http://localhost:8055" --skipFiles
194
- ```
195
-
196
184
  Available flags for programmatic mode:
197
185
 
198
186
  - `--directusUrl`: URL of the Directus instance to extract the template from (required)
@@ -201,8 +189,6 @@ Available flags for programmatic mode:
201
189
  - `--userPassword`: Password for Directus authentication (required if not using token)
202
190
  - `--templateLocation`: Directory to extract the template to (required)
203
191
  - `--templateName`: Name of the template (required)
204
- - `--excludeCollections`: Comma-separated list of collection names to exclude from extraction
205
- - `--skipFiles`: Skip extracting files and assets
206
192
 
207
193
  #### Using Environment Variables
208
194
 
@@ -152,7 +152,7 @@ class ApplyCommand extends core_1.Command {
152
152
  core_1.ux.action.stop();
153
153
  core_1.ux.log(constants_1.SEPARATOR);
154
154
  core_1.ux.info('Template applied successfully.');
155
- core_1.ux.exit(0);
155
+ // ux.exit(0)
156
156
  }
157
157
  /**
158
158
  * INTERACTIVE
@@ -5,9 +5,7 @@ export default class ExtractCommand extends Command {
5
5
  static flags: {
6
6
  directusToken: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
7
  directusUrl: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
- excludeCollections: import("@oclif/core/lib/interfaces").OptionFlag<string[], import("@oclif/core/lib/interfaces").CustomOptions>;
9
8
  programmatic: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
- skipFiles: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
9
  templateLocation: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
12
10
  templateName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
13
11
  userEmail: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
@@ -30,7 +30,6 @@ class ExtractCommand extends core_1.Command {
30
30
  * @returns {Promise<void>} - Returns nothing
31
31
  */
32
32
  async extractTemplate(templateName, directory, flags) {
33
- var _a;
34
33
  try {
35
34
  if (!node_fs_1.default.existsSync(directory)) {
36
35
  node_fs_1.default.mkdirSync(directory, { recursive: true });
@@ -50,14 +49,8 @@ class ExtractCommand extends core_1.Command {
50
49
  });
51
50
  }
52
51
  core_1.ux.log(constants_1.SEPARATOR);
53
- const exclusionMessage = ((_a = flags.excludeCollections) === null || _a === void 0 ? void 0 : _a.length)
54
- ? ` (excluding ${flags.excludeCollections.join(', ')})`
55
- : '';
56
- core_1.ux.action.start(`Extracting template - ${core_1.ux.colorize(constants_1.DIRECTUS_PINK, templateName)}${exclusionMessage} from ${core_1.ux.colorize(constants_1.DIRECTUS_PINK, flags.directusUrl)} to ${core_1.ux.colorize(constants_1.DIRECTUS_PINK, directory)}`);
57
- await (0, extract_1.default)(directory, {
58
- excludeCollections: flags.excludeCollections,
59
- skipFiles: flags.skipFiles,
60
- });
52
+ core_1.ux.action.start(`Extracting template - ${core_1.ux.colorize(constants_1.DIRECTUS_PINK, templateName)} from ${core_1.ux.colorize(constants_1.DIRECTUS_PINK, flags.directusUrl)} to ${core_1.ux.colorize(constants_1.DIRECTUS_PINK, directory)}`);
53
+ await (0, extract_1.default)(directory);
61
54
  core_1.ux.action.stop();
62
55
  core_1.ux.log(constants_1.SEPARATOR);
63
56
  core_1.ux.log('Template extracted successfully.');
@@ -73,12 +66,6 @@ class ExtractCommand extends core_1.Command {
73
66
  const templateName = await core_1.ux.prompt('What is the name of the template you would like to extract?');
74
67
  const directory = await core_1.ux.prompt("What directory would you like to extract the template to? If it doesn't exist, it will be created.", { default: `templates/${(0, slugify_1.default)(templateName, { lower: true, strict: true })}` });
75
68
  core_1.ux.log(`You selected ${core_1.ux.colorize(constants_1.DIRECTUS_PINK, directory)}`);
76
- const excludeCollectionsInput = await core_1.ux.prompt('Enter collection names to exclude (comma-separated) or press enter to skip', { required: false });
77
- if (excludeCollectionsInput) {
78
- flags.excludeCollections = excludeCollectionsInput.split(',').map(name => name.trim());
79
- }
80
- const skipFiles = await core_1.ux.confirm('Skip extracting files and assets? (y/N)');
81
- flags.skipFiles = skipFiles;
82
69
  core_1.ux.log(constants_1.SEPARATOR);
83
70
  // Get Directus URL
84
71
  const directusUrl = await (0, auth_1.getDirectusUrl)();
@@ -139,25 +126,11 @@ ExtractCommand.description = 'Extract a template from a Directus instance.';
139
126
  ExtractCommand.examples = [
140
127
  '$ directus-template-cli extract',
141
128
  '$ directus-template-cli extract -p --templateName="My Template" --templateLocation="./my-template" --directusToken="admin-token-here" --directusUrl="http://localhost:8055"',
142
- '$ directus-template-cli extract -p --templateName="My Template" --templateLocation="./my-template" --directusToken="admin-token-here" --directusUrl="http://localhost:8055" --excludeCollections=collection1,collection2',
143
129
  ];
144
130
  ExtractCommand.flags = {
145
131
  directusToken: customFlags.directusToken,
146
132
  directusUrl: customFlags.directusUrl,
147
- excludeCollections: core_1.Flags.string({
148
- char: 'e',
149
- delimiter: ',', // Will split on commas and return an array
150
- description: 'Comma-separated list of collection names to exclude from extraction',
151
- multiple: true,
152
- required: false,
153
- }),
154
133
  programmatic: customFlags.programmatic,
155
- skipFiles: core_1.Flags.boolean({
156
- char: 'f',
157
- default: false,
158
- description: 'Skip extracting files and assets',
159
- required: false,
160
- }),
161
134
  templateLocation: customFlags.templateLocation,
162
135
  templateName: customFlags.templateName,
163
136
  userEmail: customFlags.userEmail,
@@ -0,0 +1,37 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class InitCommand extends Command {
3
+ static args: {
4
+ directory: import("@oclif/core/lib/interfaces").Arg<string, {
5
+ exists?: boolean;
6
+ }>;
7
+ };
8
+ static description: string;
9
+ static examples: string[];
10
+ static flags: {
11
+ frontend: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
12
+ gitInit: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
+ installDeps: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
+ overrideDir: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
+ programmatic: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
+ template: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
17
+ };
18
+ private targetDir;
19
+ /**
20
+ * Entrypoint for the command.
21
+ * @returns Promise that resolves when the command is complete.
22
+ */
23
+ run(): Promise<void>;
24
+ /**
25
+ * Interactive mode: prompts the user for each piece of info, with added template checks.
26
+ * @param flags - The flags passed to the command.
27
+ * @param args - The arguments passed to the command.
28
+ * @returns void
29
+ */
30
+ private runInteractive;
31
+ /**
32
+ * Programmatic mode: relies on flags only, with checks for template existence and valid frontend.
33
+ * @param flags - The flags passed to the command.
34
+ * @returns void
35
+ */
36
+ private runProgrammatic;
37
+ }
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const prompts_1 = require("@clack/prompts");
5
+ const core_1 = require("@oclif/core");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
8
+ const constants_1 = require("../lib/constants");
9
+ const init_1 = require("../lib/init");
10
+ const animated_bunny_1 = require("../lib/utils/animated-bunny");
11
+ const github_1 = require("../services/github");
12
+ class InitCommand extends core_1.Command {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.targetDir = '.';
16
+ }
17
+ /**
18
+ * Entrypoint for the command.
19
+ * @returns Promise that resolves when the command is complete.
20
+ */
21
+ async run() {
22
+ const { args, flags } = await this.parse(InitCommand);
23
+ const typedFlags = flags;
24
+ const typedArgs = args;
25
+ // Set the target directory and create it if it doesn't exist
26
+ this.targetDir = node_path_1.default.resolve(args.directory);
27
+ // if (!fs.existsSync(this.targetDir)) {
28
+ // fs.mkdirSync(this.targetDir, {recursive: true})
29
+ // }
30
+ await (typedFlags.programmatic ? this.runProgrammatic(typedFlags) : this.runInteractive(typedFlags, typedArgs));
31
+ }
32
+ /**
33
+ * Interactive mode: prompts the user for each piece of info, with added template checks.
34
+ * @param flags - The flags passed to the command.
35
+ * @param args - The arguments passed to the command.
36
+ * @returns void
37
+ */
38
+ async runInteractive(flags, args) {
39
+ await (0, animated_bunny_1.animatedBunny)('Let\'s create a new Directus project!');
40
+ (0, prompts_1.intro)(`${chalk_1.default.bgHex(constants_1.DIRECTUS_PURPLE).white.bold('Directus Template CLI 🐰')} - Create Project`);
41
+ // Create GitHub service
42
+ const github = (0, github_1.createGitHub)();
43
+ // If no dir is provided, ask for it
44
+ if (!args.directory || args.directory === '.') {
45
+ this.targetDir = await (0, prompts_1.text)({
46
+ message: 'Enter the directory to create the project in:',
47
+ placeholder: './my-directus-project',
48
+ }).then(ans => ans);
49
+ }
50
+ // 1. Fetch available templates
51
+ const availableTemplates = await github.getTemplates();
52
+ // 2. Prompt for template if not provided
53
+ let { template } = flags;
54
+ if (!template) {
55
+ template = await (0, prompts_1.select)({
56
+ message: 'Which Directus backend template would you like to use?',
57
+ options: availableTemplates.map(template => ({
58
+ label: template,
59
+ value: template,
60
+ })),
61
+ }).then(ans => ans);
62
+ }
63
+ // 3. Validate that the template exists, fetch subdirectories
64
+ let directories = await github.getTemplateDirectories(template);
65
+ while (directories.length === 0) {
66
+ this.log(`Template "${template}" doesn't seem to exist in directus-labs/directus-starters.`);
67
+ template = await core_1.ux.prompt('Please enter a valid template name, or Ctrl+C to cancel:');
68
+ directories = await github.getTemplateDirectories(template);
69
+ }
70
+ flags.template = template;
71
+ // Filter out the 'directus' folder; the rest are potential frontends
72
+ const potentialFrontends = directories.filter(dir => dir !== 'directus');
73
+ if (potentialFrontends.length === 0) {
74
+ this.error(`No frontends found for template "${template}". Exiting.`);
75
+ }
76
+ // 4. If user hasn't specified a valid flags.frontend, ask from the list
77
+ let chosenFrontend = flags.frontend;
78
+ if (!chosenFrontend || !potentialFrontends.includes(chosenFrontend)) {
79
+ chosenFrontend = await (0, prompts_1.select)({
80
+ message: 'Which frontend framework do you want to use?',
81
+ options: potentialFrontends.map(frontend => ({
82
+ label: frontend,
83
+ value: frontend,
84
+ })),
85
+ }).then(ans => ans);
86
+ }
87
+ flags.frontend = chosenFrontend;
88
+ const installDeps = await (0, prompts_1.confirm)({
89
+ initialValue: true,
90
+ message: 'Would you like to install project dependencies automatically?',
91
+ }).then(ans => ans);
92
+ const initGit = await (0, prompts_1.confirm)({
93
+ initialValue: true,
94
+ message: 'Initialize a new Git repository?',
95
+ }).then(ans => ans);
96
+ await (0, init_1.init)(this.targetDir, {
97
+ frontend: chosenFrontend,
98
+ gitInit: initGit,
99
+ installDeps,
100
+ template,
101
+ });
102
+ core_1.ux.exit(0);
103
+ }
104
+ /**
105
+ * Programmatic mode: relies on flags only, with checks for template existence and valid frontend.
106
+ * @param flags - The flags passed to the command.
107
+ * @returns void
108
+ */
109
+ async runProgrammatic(flags) {
110
+ const github = (0, github_1.createGitHub)();
111
+ if (!flags.template) {
112
+ core_1.ux.error('Missing --template parameter for programmatic mode.');
113
+ }
114
+ if (!flags.frontend) {
115
+ core_1.ux.error('Missing --frontend parameter for programmatic mode.');
116
+ }
117
+ const template = flags.template;
118
+ const directories = await github.getTemplateDirectories(template);
119
+ if (directories.length === 0) {
120
+ core_1.ux.error(`Template "${template}" doesn't seem to exist in directus-labs/directus-starters.`);
121
+ }
122
+ const potentialFrontends = directories.filter(dir => dir !== 'directus');
123
+ const frontend = flags.frontend;
124
+ if (!potentialFrontends.includes(frontend)) {
125
+ core_1.ux.error(`Frontend "${frontend}" doesn't exist in template "${template}". Available frontends: ${potentialFrontends.join(', ')}`);
126
+ }
127
+ await (0, init_1.init)(this.targetDir, {
128
+ frontend,
129
+ installDeps: true,
130
+ template,
131
+ });
132
+ core_1.ux.exit(0);
133
+ }
134
+ }
135
+ InitCommand.args = {
136
+ directory: core_1.Args.directory({
137
+ default: '.',
138
+ description: 'Directory to create the project in',
139
+ required: false,
140
+ }),
141
+ };
142
+ InitCommand.description = 'Initialize a new Directus + Frontend monorepo using official or community starters.';
143
+ InitCommand.examples = [
144
+ '$ directus-template-cli init',
145
+ '$ directus-template-cli init my-project',
146
+ '$ directus-template-cli init --frontend=nextjs --template=simple-cms --programmatic',
147
+ '$ directus-template-cli init my-project --frontend=nextjs --template=simple-cms --programmatic',
148
+ ];
149
+ InitCommand.flags = {
150
+ frontend: core_1.Flags.string({
151
+ description: 'Frontend framework to use (e.g., nextjs, nuxt, astro)',
152
+ }),
153
+ gitInit: core_1.Flags.boolean({
154
+ aliases: ['git-init'],
155
+ allowNo: true,
156
+ default: true,
157
+ description: 'Initialize a new Git repository',
158
+ }),
159
+ installDeps: core_1.Flags.boolean({
160
+ aliases: ['install-deps'],
161
+ allowNo: true,
162
+ default: true,
163
+ description: 'Install dependencies automatically',
164
+ }),
165
+ overrideDir: core_1.Flags.boolean({
166
+ default: false,
167
+ description: 'Override the default directory',
168
+ }),
169
+ programmatic: core_1.Flags.boolean({
170
+ char: 'p',
171
+ default: false,
172
+ description: 'Run in programmatic mode (non-interactive)',
173
+ }),
174
+ template: core_1.Flags.string({
175
+ description: 'Template name (e.g., simple-cms) or GitHub URL (e.g., https://github.com/directus-labs/starters/tree/main/simple-cms)',
176
+ }),
177
+ };
178
+ exports.default = InitCommand;
@@ -1,3 +1,19 @@
1
1
  export declare const DIRECTUS_PURPLE = "#6644ff";
2
2
  export declare const DIRECTUS_PINK = "#FF99DD";
3
3
  export declare const SEPARATOR = "------------------";
4
+ export declare const COMMUNITY_TEMPLATE_REPO: {
5
+ string: string;
6
+ url: string;
7
+ };
8
+ export declare const STARTERS_TEMPLATE_REPO: {
9
+ branch: string;
10
+ string: string;
11
+ url: string;
12
+ };
13
+ export declare const DEFAULT_REPO: {
14
+ owner: string;
15
+ path: string;
16
+ ref: string;
17
+ repo: string;
18
+ url: string;
19
+ };
@@ -1,6 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SEPARATOR = exports.DIRECTUS_PINK = exports.DIRECTUS_PURPLE = void 0;
3
+ exports.DEFAULT_REPO = exports.STARTERS_TEMPLATE_REPO = exports.COMMUNITY_TEMPLATE_REPO = exports.SEPARATOR = exports.DIRECTUS_PINK = exports.DIRECTUS_PURPLE = void 0;
4
4
  exports.DIRECTUS_PURPLE = '#6644ff';
5
5
  exports.DIRECTUS_PINK = '#FF99DD';
6
6
  exports.SEPARATOR = '------------------';
7
+ exports.COMMUNITY_TEMPLATE_REPO = {
8
+ string: 'github:directus-labs/directus-templates',
9
+ url: 'https://github.com/directus-labs/directus-templates',
10
+ };
11
+ exports.STARTERS_TEMPLATE_REPO = {
12
+ branch: 'cms-template',
13
+ string: 'github:directus-labs/starters',
14
+ url: 'https://github.com/directus-labs/starters',
15
+ };
16
+ exports.DEFAULT_REPO = {
17
+ owner: 'directus-labs',
18
+ path: '',
19
+ ref: 'cms-template',
20
+ repo: 'starters',
21
+ url: 'https://github.com/directus-labs/starters',
22
+ };
@@ -1 +1 @@
1
- export declare function extractContent(dir: string, excludeCollections?: string[]): Promise<void>;
1
+ export declare function extractContent(dir: string): Promise<void>;
@@ -8,12 +8,11 @@ const constants_1 = require("../constants");
8
8
  const sdk_2 = require("../sdk");
9
9
  const catch_error_1 = tslib_1.__importDefault(require("../utils/catch-error"));
10
10
  const write_to_file_1 = tslib_1.__importDefault(require("../utils/write-to-file"));
11
- async function getCollections(excludeCollections) {
11
+ async function getCollections() {
12
12
  const response = await sdk_2.api.client.request((0, sdk_1.readCollections)());
13
13
  return response
14
14
  .filter(item => !item.collection.startsWith('directus_', 0))
15
- .filter(item => item.schema !== null)
16
- .filter(item => !(excludeCollections === null || excludeCollections === void 0 ? void 0 : excludeCollections.includes(item.collection)))
15
+ .filter(item => item.schema != null)
17
16
  .map(i => i.collection);
18
17
  }
19
18
  async function getDataFromCollection(collection, dir) {
@@ -25,13 +24,10 @@ async function getDataFromCollection(collection, dir) {
25
24
  (0, catch_error_1.default)(error);
26
25
  }
27
26
  }
28
- async function extractContent(dir, excludeCollections) {
29
- const exclusionMessage = (excludeCollections === null || excludeCollections === void 0 ? void 0 : excludeCollections.length)
30
- ? ` (excluding ${excludeCollections.join(', ')})`
31
- : '';
32
- core_1.ux.action.start(core_1.ux.colorize(constants_1.DIRECTUS_PINK, `Extracting content${exclusionMessage}`));
27
+ async function extractContent(dir) {
28
+ core_1.ux.action.start(core_1.ux.colorize(constants_1.DIRECTUS_PINK, 'Extracting content'));
33
29
  try {
34
- const collections = await getCollections(excludeCollections);
30
+ const collections = await getCollections();
35
31
  await Promise.all(collections.map(collection => getDataFromCollection(collection, dir)));
36
32
  }
37
33
  catch (error) {
@@ -19,7 +19,7 @@ async function extractFields(dir) {
19
19
  }
20
20
  const fields = response
21
21
  .filter(
22
- // @ts-ignore
22
+ // @ts-expect-error - This is a Directus issue
23
23
  (i) => i.meta && !i.meta.system)
24
24
  .map(i => {
25
25
  if (i.meta) {
@@ -1,6 +1 @@
1
- interface ExtractOptions {
2
- excludeCollections?: string[];
3
- skipFiles?: boolean;
4
- }
5
- export default function extract(dir: string, options?: ExtractOptions): Promise<{}>;
6
- export {};
1
+ export default function extract(dir: string): Promise<{}>;
@@ -22,8 +22,7 @@ const extract_schema_1 = tslib_1.__importDefault(require("./extract-schema"));
22
22
  const extract_settings_1 = tslib_1.__importDefault(require("./extract-settings"));
23
23
  const extract_translations_1 = tslib_1.__importDefault(require("./extract-translations"));
24
24
  const extract_users_1 = tslib_1.__importDefault(require("./extract-users"));
25
- async function extract(dir, options = {}) {
26
- const { excludeCollections, skipFiles = false } = options;
25
+ async function extract(dir) {
27
26
  // Get the destination directory for the actual files
28
27
  const destination = dir + '/src';
29
28
  // Check if directory exists, if not, then create it.
@@ -35,11 +34,8 @@ async function extract(dir, options = {}) {
35
34
  await (0, extract_collections_1.default)(destination);
36
35
  await (0, extract_fields_1.default)(destination);
37
36
  await (0, extract_relations_1.default)(destination);
38
- // Only extract files and folders if skipFiles is false
39
- if (!skipFiles) {
40
- await (0, extract_folders_1.default)(destination);
41
- await (0, extract_files_1.default)(destination);
42
- }
37
+ await (0, extract_folders_1.default)(destination);
38
+ await (0, extract_files_1.default)(destination);
43
39
  await (0, extract_users_1.default)(destination);
44
40
  await (0, extract_roles_1.default)(destination);
45
41
  await (0, extract_permissions_1.default)(destination);
@@ -53,11 +49,8 @@ async function extract(dir, options = {}) {
53
49
  await (0, extract_dashboards_1.extractPanels)(destination);
54
50
  await (0, extract_settings_1.default)(destination);
55
51
  await (0, extract_extensions_1.default)(destination);
56
- await (0, extract_content_1.extractContent)(destination, excludeCollections);
57
- // Only download files if skipFiles is false
58
- if (!skipFiles) {
59
- await (0, extract_assets_1.downloadAllFiles)(destination);
60
- }
52
+ await (0, extract_content_1.extractContent)(destination);
53
+ await (0, extract_assets_1.downloadAllFiles)(destination);
61
54
  return {};
62
55
  }
63
56
  exports.default = extract;
@@ -0,0 +1,3 @@
1
+ import type { DirectusConfig, DockerConfig } from './types';
2
+ export declare const DIRECTUS_CONFIG: DirectusConfig;
3
+ export declare const DOCKER_CONFIG: DockerConfig;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DOCKER_CONFIG = exports.DIRECTUS_CONFIG = void 0;
4
+ exports.DIRECTUS_CONFIG = {
5
+ adminEmail: 'admin@example.com',
6
+ adminPassword: 'd1r3ctu5',
7
+ port: 8055,
8
+ url: 'http://localhost',
9
+ };
10
+ exports.DOCKER_CONFIG = {
11
+ composeFile: 'docker-compose.yml',
12
+ healthCheckEndpoint: '/server/health',
13
+ interval: 5000,
14
+ maxAttempts: 30,
15
+ };
@@ -0,0 +1,14 @@
1
+ import { type DownloadTemplateResult } from 'giget';
2
+ interface InitFlags {
3
+ frontend?: string;
4
+ gitInit?: boolean;
5
+ installDeps?: boolean;
6
+ overrideDir?: boolean;
7
+ template?: string;
8
+ }
9
+ export declare function init(dir: string, flags: InitFlags): Promise<{
10
+ directusDir: string;
11
+ frontendDir: string;
12
+ template: DownloadTemplateResult;
13
+ }>;
14
+ export {};