docula 0.3.2 → 0.3.4

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 (94) hide show
  1. package/README.md +1 -1
  2. package/dist/config.d.ts +21 -0
  3. package/dist/config.d.ts.map +1 -0
  4. package/dist/config.js +78 -0
  5. package/dist/config.js.map +1 -0
  6. package/dist/docula-plugin.d.ts +9 -0
  7. package/dist/docula-plugin.d.ts.map +1 -0
  8. package/dist/docula-plugin.js +2 -0
  9. package/dist/docula-plugin.js.map +1 -0
  10. package/dist/docula.d.ts +22 -0
  11. package/dist/docula.d.ts.map +1 -0
  12. package/dist/docula.js +192 -0
  13. package/dist/docula.js.map +1 -0
  14. package/dist/eleventy/filters.d.ts +2 -0
  15. package/dist/eleventy/filters.d.ts.map +1 -0
  16. package/dist/eleventy/filters.js +10 -0
  17. package/dist/eleventy/filters.js.map +1 -0
  18. package/dist/eleventy/global-data.d.ts +3 -0
  19. package/dist/eleventy/global-data.d.ts.map +1 -0
  20. package/dist/eleventy/global-data.js +2 -0
  21. package/dist/eleventy/global-data.js.map +1 -0
  22. package/dist/eleventy/shortcodes.d.ts +4 -0
  23. package/dist/eleventy/shortcodes.d.ts.map +1 -0
  24. package/dist/eleventy/shortcodes.js +18 -0
  25. package/dist/eleventy/shortcodes.js.map +1 -0
  26. package/dist/eleventy.d.ts +24 -0
  27. package/dist/eleventy.d.ts.map +1 -0
  28. package/dist/eleventy.js +82 -0
  29. package/dist/eleventy.js.map +1 -0
  30. package/dist/index.d.ts +9 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +53 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/logger.d.ts +4 -0
  35. package/dist/logger.d.ts.map +1 -0
  36. package/dist/logger.js +20 -0
  37. package/dist/logger.js.map +1 -0
  38. package/dist/plugins/algolia.d.ts +21 -0
  39. package/dist/plugins/algolia.d.ts.map +1 -0
  40. package/dist/plugins/algolia.js +54 -0
  41. package/dist/plugins/algolia.js.map +1 -0
  42. package/dist/plugins/github.d.ts +16 -0
  43. package/dist/plugins/github.d.ts.map +1 -0
  44. package/dist/plugins/github.js +68 -0
  45. package/dist/plugins/github.js.map +1 -0
  46. package/dist/plugins/index.d.ts +18 -0
  47. package/dist/plugins/index.d.ts.map +1 -0
  48. package/dist/plugins/index.js +16 -0
  49. package/dist/plugins/index.js.map +1 -0
  50. package/dist/plugins/npm.d.ts +14 -0
  51. package/dist/plugins/npm.d.ts.map +1 -0
  52. package/dist/plugins/npm.js +36 -0
  53. package/dist/plugins/npm.js.map +1 -0
  54. package/dist/plugins/pagefind.d.ts +10 -0
  55. package/dist/plugins/pagefind.d.ts.map +1 -0
  56. package/dist/plugins/pagefind.js +22 -0
  57. package/dist/plugins/pagefind.js.map +1 -0
  58. package/dist/plugins/robots.d.ts +14 -0
  59. package/dist/plugins/robots.d.ts.map +1 -0
  60. package/dist/plugins/robots.js +34 -0
  61. package/dist/plugins/robots.js.map +1 -0
  62. package/dist/plugins/sitemap.d.ts +11 -0
  63. package/dist/plugins/sitemap.d.ts.map +1 -0
  64. package/dist/plugins/sitemap.js +27 -0
  65. package/dist/plugins/sitemap.js.map +1 -0
  66. package/dist/schemas.d.ts +21 -0
  67. package/dist/schemas.d.ts.map +1 -0
  68. package/dist/schemas.js +25 -0
  69. package/dist/schemas.js.map +1 -0
  70. package/dist/tools/__mocks__/inquirer-prompt.d.ts +20 -0
  71. package/dist/tools/__mocks__/inquirer-prompt.d.ts.map +1 -0
  72. package/dist/tools/__mocks__/inquirer-prompt.js +19 -0
  73. package/dist/tools/__mocks__/inquirer-prompt.js.map +1 -0
  74. package/dist/tools/__mocks__/path.d.ts +5 -0
  75. package/dist/tools/__mocks__/path.d.ts.map +1 -0
  76. package/dist/tools/__mocks__/path.js +7 -0
  77. package/dist/tools/__mocks__/path.js.map +1 -0
  78. package/dist/tools/inquirer-prompt.d.ts +11 -0
  79. package/dist/tools/inquirer-prompt.d.ts.map +1 -0
  80. package/dist/tools/inquirer-prompt.js +139 -0
  81. package/dist/tools/inquirer-prompt.js.map +1 -0
  82. package/dist/tools/path.d.ts +4 -0
  83. package/dist/tools/path.d.ts.map +1 -0
  84. package/dist/tools/path.js +6 -0
  85. package/dist/tools/path.js.map +1 -0
  86. package/dist/tools/tools.d.ts +3 -0
  87. package/dist/tools/tools.d.ts.map +1 -0
  88. package/dist/tools/tools.js +10 -0
  89. package/dist/tools/tools.js.map +1 -0
  90. package/dist/types/config.d.ts +8 -0
  91. package/dist/types/config.d.ts.map +1 -0
  92. package/dist/types/config.js +2 -0
  93. package/dist/types/config.js.map +1 -0
  94. package/package.json +13 -15
@@ -0,0 +1,20 @@
1
+ /// <reference types="jest" />
2
+ export declare const getGithubInfo: jest.Mock<{
3
+ author: string;
4
+ repo: string;
5
+ }, [], any>;
6
+ export declare const validateUrl: jest.Mock<boolean, [], any>;
7
+ export declare const getSiteUrl: jest.Mock<string, [], any>;
8
+ export declare const getUserPlugins: jest.Mock<{
9
+ plugins: string[];
10
+ }, [], any>;
11
+ export declare const setPlugins: jest.Mock<{
12
+ siteUrl: string;
13
+ searchEngine: string;
14
+ plugins: string[];
15
+ github: {
16
+ author: string;
17
+ repo: string;
18
+ };
19
+ }, [], any>;
20
+ //# sourceMappingURL=inquirer-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inquirer-prompt.d.ts","sourceRoot":"","sources":["../../../src/tools/__mocks__/inquirer-prompt.ts"],"names":[],"mappings":";AAAA,eAAO,MAAM,aAAa;;;WAGvB,CAAC;AAEJ,eAAO,MAAM,WAAW,6BAAsB,CAAC;AAE/C,eAAO,MAAM,UAAU,4BAA2C,CAAC;AAEnE,eAAO,MAAM,cAAc;;WAExB,CAAC;AAEJ,eAAO,MAAM,UAAU;;;;;;;;WAQpB,CAAC"}
@@ -0,0 +1,19 @@
1
+ export const getGithubInfo = jest.fn(() => ({
2
+ author: 'jaredwray',
3
+ repo: 'docula',
4
+ }));
5
+ export const validateUrl = jest.fn(() => true);
6
+ export const getSiteUrl = jest.fn(() => 'https://www.example.com');
7
+ export const getUserPlugins = jest.fn(() => ({
8
+ plugins: ['robots.txt', 'npm'],
9
+ }));
10
+ export const setPlugins = jest.fn(() => ({
11
+ siteUrl: 'https://www.example.com',
12
+ searchEngine: 'pagefind',
13
+ plugins: ['github'],
14
+ github: {
15
+ author: 'jaredwray',
16
+ repo: 'docula',
17
+ },
18
+ }));
19
+ //# sourceMappingURL=inquirer-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inquirer-prompt.js","sourceRoot":"","sources":["../../../src/tools/__mocks__/inquirer-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3C,MAAM,EAAE,WAAW;IACnB,IAAI,EAAE,QAAQ;CACd,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,yBAAyB,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5C,OAAO,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC;CAC9B,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACxC,OAAO,EAAE,yBAAyB;IAClC,YAAY,EAAE,UAAU;IACxB,OAAO,EAAE,CAAC,QAAQ,CAAC;IACnB,MAAM,EAAE;QACP,MAAM,EAAE,WAAW;QACnB,IAAI,EAAE,QAAQ;KACd;CACD,CAAC,CAAC,CAAC","sourcesContent":["export const getGithubInfo = jest.fn(() => ({\n\tauthor: 'jaredwray',\n\trepo: 'docula',\n}));\n\nexport const validateUrl = jest.fn(() => true);\n\nexport const getSiteUrl = jest.fn(() => 'https://www.example.com');\n\nexport const getUserPlugins = jest.fn(() => ({\n\tplugins: ['robots.txt', 'npm'],\n}));\n\nexport const setPlugins = jest.fn(() => ({\n\tsiteUrl: 'https://www.example.com',\n\tsearchEngine: 'pagefind',\n\tplugins: ['github'],\n\tgithub: {\n\t\tauthor: 'jaredwray',\n\t\trepo: 'docula',\n\t},\n}));\n"]}
@@ -0,0 +1,5 @@
1
+ /// <reference types="jest" />
2
+ export declare const getFileName: jest.Mock<string, [], any>;
3
+ export declare const getConfigPath: jest.Mock<string, [], any>;
4
+ export declare const getSitePath: jest.Mock<string, [], any>;
5
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/tools/__mocks__/path.ts"],"names":[],"mappings":";AACA,eAAO,MAAM,WAAW,4BAA2B,CAAC;AAEpD,eAAO,MAAM,aAAa,4BAA+D,CAAC;AAE1F,eAAO,MAAM,WAAW,4BAAmD,CAAC"}
@@ -0,0 +1,7 @@
1
+ // eslint-disable-next-line unicorn/prefer-module
2
+ export const getFileName = jest.fn(() => __dirname);
3
+ // eslint-disable-next-line n/prefer-global/process
4
+ export const getConfigPath = jest.fn(() => `${process.cwd()}/test/data/site/config.json`);
5
+ // eslint-disable-next-line n/prefer-global/process
6
+ export const getSitePath = jest.fn(() => `${process.cwd()}/test/data/site`);
7
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/tools/__mocks__/path.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AACpD,mDAAmD;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,6BAA6B,CAAC,CAAC;AAC1F,mDAAmD;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// eslint-disable-next-line unicorn/prefer-module\nexport const getFileName = jest.fn(() => __dirname);\n// eslint-disable-next-line n/prefer-global/process\nexport const getConfigPath = jest.fn(() => `${process.cwd()}/test/data/site/config.json`);\n// eslint-disable-next-line n/prefer-global/process\nexport const getSitePath = jest.fn(() => `${process.cwd()}/test/data/site`);\n"]}
@@ -0,0 +1,11 @@
1
+ export declare const getGithubInfo: () => Promise<Record<string, string>>;
2
+ export declare const validateUrl: (value: string) => boolean | string;
3
+ export declare const getSiteUrl: () => Promise<string>;
4
+ export declare const getUserPlugins: () => Promise<string[]>;
5
+ export declare const getSearchEngine: () => Promise<'algolia' | 'pagefind'>;
6
+ export declare const getAlgoliaInfo: () => Promise<Record<string, string>>;
7
+ export declare const getSiteType: () => Promise<'landing' | 'multipage'>;
8
+ export declare const buildLandingPage: () => Promise<Record<string, unknown>>;
9
+ export declare const buildMultipageSite: () => Promise<Record<string, unknown>>;
10
+ export declare const setPlugins: () => Promise<Record<string, unknown>>;
11
+ //# sourceMappingURL=inquirer-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inquirer-prompt.d.ts","sourceRoot":"","sources":["../../src/tools/inquirer-prompt.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,QAAa,QAAQ,OAAO,MAAM,EAAE,MAAM,CAAC,CAUnE,CAAC;AAEH,eAAO,MAAM,WAAW,UAAW,MAAM,KAAG,OAAO,GAAG,MAOrD,CAAC;AAEF,eAAO,MAAM,UAAU,QAAa,QAAQ,MAAM,CAUjD,CAAC;AAEF,eAAO,MAAM,cAAc,QAAa,QAAQ,MAAM,EAAE,CAqBvD,CAAC;AAEF,eAAO,MAAM,eAAe,QAAa,QAAQ,SAAS,GAAG,UAAU,CActE,CAAC;AAEF,eAAO,MAAM,cAAc,QAAa,QAAQ,OAAO,MAAM,EAAE,MAAM,CAAC,CAgBpE,CAAC;AAEH,eAAO,MAAM,WAAW,QAAa,QAAQ,SAAS,GAAG,WAAW,CAcnE,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAa,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,CAcxE,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAa,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,CAsB1E,CAAC;AAEF,eAAO,MAAM,UAAU,QAAa,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,CAKlE,CAAC"}
@@ -0,0 +1,139 @@
1
+ import inquirer from 'inquirer';
2
+ import { urlRegex } from './tools.js';
3
+ export const getGithubInfo = async () => inquirer.prompt([
4
+ {
5
+ type: 'input',
6
+ name: 'author',
7
+ message: 'What is your GitHub username?',
8
+ }, {
9
+ type: 'input',
10
+ name: 'repo',
11
+ message: 'What is your GitHub repository\'s name?',
12
+ },
13
+ ]);
14
+ export const validateUrl = (value) => {
15
+ const trimmed = value.trim();
16
+ if (trimmed.length > 0 && urlRegex.test(trimmed)) {
17
+ return true;
18
+ }
19
+ return 'Please enter a complete URL.';
20
+ };
21
+ export const getSiteUrl = async () => {
22
+ const siteAnswer = await inquirer.prompt([
23
+ {
24
+ type: 'input',
25
+ name: 'url',
26
+ message: 'What is the URL of your site?',
27
+ validate: validateUrl,
28
+ },
29
+ ]);
30
+ return siteAnswer.url;
31
+ };
32
+ export const getUserPlugins = async () => {
33
+ const userPlugins = await inquirer.prompt([
34
+ {
35
+ type: 'checkbox',
36
+ name: 'plugins',
37
+ message: 'Select the plugins you want to use',
38
+ choices: [
39
+ {
40
+ name: 'github',
41
+ value: 'github',
42
+ }, {
43
+ name: 'robots.txt',
44
+ value: 'robots',
45
+ }, {
46
+ name: 'sitemap.xml',
47
+ value: 'sitemap',
48
+ },
49
+ ],
50
+ },
51
+ ]);
52
+ return userPlugins.plugins;
53
+ };
54
+ export const getSearchEngine = async () => {
55
+ const searchEngine = await inquirer.prompt([
56
+ {
57
+ type: 'list',
58
+ name: 'engine',
59
+ message: 'Which search engine do you want to use?',
60
+ choices: ['Algolia', 'Pagefind'],
61
+ default: 'Pagefind',
62
+ filter(value) {
63
+ return value.toLowerCase();
64
+ },
65
+ },
66
+ ]);
67
+ return searchEngine.engine;
68
+ };
69
+ export const getAlgoliaInfo = async () => inquirer.prompt([
70
+ {
71
+ type: 'input',
72
+ name: 'appId',
73
+ message: 'What is your Algolia application ID?',
74
+ },
75
+ {
76
+ type: 'input',
77
+ name: 'apiKey',
78
+ message: 'What is your Algolia API key?',
79
+ },
80
+ {
81
+ type: 'input',
82
+ name: 'indexName',
83
+ message: 'What is your Algolia index name?',
84
+ },
85
+ ]);
86
+ export const getSiteType = async () => {
87
+ const siteType = await inquirer.prompt([
88
+ {
89
+ type: 'list',
90
+ name: 'type',
91
+ message: 'What type of site do you want to build?',
92
+ choices: ['Landing', 'Multi page'],
93
+ default: 'Multi page',
94
+ filter(value) {
95
+ return value.toLowerCase();
96
+ },
97
+ },
98
+ ]);
99
+ return siteType.type;
100
+ };
101
+ export const buildLandingPage = async () => {
102
+ let githubInfo;
103
+ const siteUrl = await getSiteUrl();
104
+ const plugins = await getUserPlugins();
105
+ if (plugins.includes('github')) {
106
+ githubInfo = await getGithubInfo();
107
+ }
108
+ return {
109
+ siteUrl,
110
+ plugins,
111
+ ...(githubInfo && { github: githubInfo }),
112
+ };
113
+ };
114
+ export const buildMultipageSite = async () => {
115
+ let githubInfo;
116
+ let algoliaInfo;
117
+ const siteUrl = await getSiteUrl();
118
+ const searchEngine = await getSearchEngine();
119
+ const plugins = await getUserPlugins();
120
+ if (searchEngine === 'algolia') {
121
+ algoliaInfo = await getAlgoliaInfo();
122
+ }
123
+ if (plugins.includes('github')) {
124
+ githubInfo = await getGithubInfo();
125
+ }
126
+ return {
127
+ siteUrl,
128
+ searchEngine,
129
+ plugins: [...plugins, searchEngine],
130
+ ...(githubInfo && { github: githubInfo }),
131
+ ...(algoliaInfo && { algolia: algoliaInfo }),
132
+ };
133
+ };
134
+ export const setPlugins = async () => {
135
+ const siteType = await getSiteType();
136
+ const config = await (siteType.includes('landing') ? buildLandingPage() : buildMultipageSite());
137
+ return { siteType, ...config };
138
+ };
139
+ //# sourceMappingURL=inquirer-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inquirer-prompt.js","sourceRoot":"","sources":["../../src/tools/inquirer-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,IAAqC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;IACzF;QACC,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,+BAA+B;KACxC,EAAE;QACF,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,yCAAyC;KAClD;CACD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAa,EAAoB,EAAE;IAC9D,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;QACjD,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,8BAA8B,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,IAAqB,EAAE;IACrD,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACxC;YACC,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,KAAK;YACX,OAAO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vC,IAAI,YAAY,KAAK,SAAS,EAAE;QAC/B,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;KACrC;IAED,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAC/B,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC;KACnC;IAED,OAAO;QACN,OAAO;QACP,YAAY;QACZ,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,YAAY,CAAC;QACnC,GAAG,CAAC,UAAU,IAAI,EAAC,MAAM,EAAE,UAAU,EAAC,CAAC;QACvC,GAAG,CAAC,WAAW,IAAI,EAAC,OAAO,EAAE,WAAW,EAAC,CAAC;KAC1C,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,IAAsC,EAAE;IACtE,MAAM,QAAQ,GAAG,MAAM,WAAW,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAEhG,OAAO,EAAC,QAAQ,EAAE,GAAG,MAAM,EAAC,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import inquirer from 'inquirer';\nimport {urlRegex} from './tools.js';\n\nexport const getGithubInfo = async (): Promise<Record<string, string>> => inquirer.prompt([\n\t{\n\t\ttype: 'input',\n\t\tname: 'author',\n\t\tmessage: 'What is your GitHub username?',\n\t}, {\n\t\ttype: 'input',\n\t\tname: 'repo',\n\t\tmessage: 'What is your GitHub repository\\'s name?',\n\t},\n]);\n\nexport const validateUrl = (value: string): boolean | string => {\n\tconst trimmed = value.trim();\n\tif (trimmed.length > 0 && urlRegex.test(trimmed)) {\n\t\treturn true;\n\t}\n\n\treturn 'Please enter a complete URL.';\n};\n\nexport const getSiteUrl = async (): Promise<string> => {\n\tconst siteAnswer = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'input',\n\t\t\tname: 'url',\n\t\t\tmessage: 'What is the URL of your site?',\n\t\t\tvalidate: validateUrl,\n\t\t},\n\t]);\n\treturn siteAnswer.url;\n};\n\nexport const getUserPlugins = async (): Promise<string[]> => {\n\tconst userPlugins = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'checkbox',\n\t\t\tname: 'plugins',\n\t\t\tmessage: 'Select the plugins you want to use',\n\t\t\tchoices: [\n\t\t\t\t{\n\t\t\t\t\tname: 'github',\n\t\t\t\t\tvalue: 'github',\n\t\t\t\t}, {\n\t\t\t\t\tname: 'robots.txt',\n\t\t\t\t\tvalue: 'robots',\n\t\t\t\t}, {\n\t\t\t\t\tname: 'sitemap.xml',\n\t\t\t\t\tvalue: 'sitemap',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t]);\n\treturn userPlugins.plugins;\n};\n\nexport const getSearchEngine = async (): Promise<'algolia' | 'pagefind'> => {\n\tconst searchEngine = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'list',\n\t\t\tname: 'engine',\n\t\t\tmessage: 'Which search engine do you want to use?',\n\t\t\tchoices: ['Algolia', 'Pagefind'],\n\t\t\tdefault: 'Pagefind',\n\t\t\tfilter(value: string): string {\n\t\t\t\treturn value.toLowerCase();\n\t\t\t},\n\t\t},\n\t]);\n\treturn searchEngine.engine;\n};\n\nexport const getAlgoliaInfo = async (): Promise<Record<string, string>> => inquirer.prompt([\n\t{\n\t\ttype: 'input',\n\t\tname: 'appId',\n\t\tmessage: 'What is your Algolia application ID?',\n\t},\n\t{\n\t\ttype: 'input',\n\t\tname: 'apiKey',\n\t\tmessage: 'What is your Algolia API key?',\n\t},\n\t{\n\t\ttype: 'input',\n\t\tname: 'indexName',\n\t\tmessage: 'What is your Algolia index name?',\n\t},\n]);\n\nexport const getSiteType = async (): Promise<'landing' | 'multipage'> => {\n\tconst siteType = await inquirer.prompt([\n\t\t{\n\t\t\ttype: 'list',\n\t\t\tname: 'type',\n\t\t\tmessage: 'What type of site do you want to build?',\n\t\t\tchoices: ['Landing', 'Multi page'],\n\t\t\tdefault: 'Multi page',\n\t\t\tfilter(value: string): string {\n\t\t\t\treturn value.toLowerCase();\n\t\t\t},\n\t\t},\n\t]);\n\treturn siteType.type;\n};\n\nexport const buildLandingPage = async (): Promise<Record<string, unknown>> => {\n\tlet githubInfo: Record<string, string> | undefined;\n\tconst siteUrl = await getSiteUrl();\n\tconst plugins = await getUserPlugins();\n\n\tif (plugins.includes('github')) {\n\t\tgithubInfo = await getGithubInfo();\n\t}\n\n\treturn {\n\t\tsiteUrl,\n\t\tplugins,\n\t\t...(githubInfo && {github: githubInfo}),\n\t};\n};\n\nexport const buildMultipageSite = async (): Promise<Record<string, unknown>> => {\n\tlet githubInfo: Record<string, string> | undefined;\n\tlet algoliaInfo: Record<string, string> | undefined;\n\tconst siteUrl = await getSiteUrl();\n\tconst searchEngine = await getSearchEngine();\n\tconst plugins = await getUserPlugins();\n\n\tif (searchEngine === 'algolia') {\n\t\talgoliaInfo = await getAlgoliaInfo();\n\t}\n\n\tif (plugins.includes('github')) {\n\t\tgithubInfo = await getGithubInfo();\n\t}\n\n\treturn {\n\t\tsiteUrl,\n\t\tsearchEngine,\n\t\tplugins: [...plugins, searchEngine],\n\t\t...(githubInfo && {github: githubInfo}),\n\t\t...(algoliaInfo && {algolia: algoliaInfo}),\n\t};\n};\n\nexport const setPlugins = async (): Promise<Record<string, unknown>> => {\n\tconst siteType = await getSiteType();\n\tconst config = await (siteType.includes('landing') ? buildLandingPage() : buildMultipageSite());\n\n\treturn {siteType, ...config};\n};\n"]}
@@ -0,0 +1,4 @@
1
+ export declare const getFileName: () => string;
2
+ export declare const getSitePath: () => string;
3
+ export declare const getConfigPath: () => string;
4
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/tools/path.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,cAAuC,CAAC;AAEhE,eAAO,MAAM,WAAW,cAAgC,CAAC;AACzD,eAAO,MAAM,aAAa,cAAuC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ export const getFileName = () => fileURLToPath(import.meta.url);
3
+ // eslint-disable-next-line n/prefer-global/process
4
+ export const getSitePath = () => `${process.cwd()}/site`;
5
+ export const getConfigPath = () => `${getSitePath()}/config.json`;
6
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/tools/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChE,mDAAmD;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC;AACzD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,GAAG,WAAW,EAAE,cAAc,CAAC","sourcesContent":["import {fileURLToPath} from 'node:url';\n\nexport const getFileName = () => fileURLToPath(import.meta.url);\n// eslint-disable-next-line n/prefer-global/process\nexport const getSitePath = () => `${process.cwd()}/site`;\nexport const getConfigPath = () => `${getSitePath()}/config.json`;\n\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const reportError: (error: unknown) => void;
2
+ export declare const urlRegex: RegExp;
3
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/tools/tools.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,UAAW,OAAO,KAAG,IAO5C,CAAC;AAEF,eAAO,MAAM,QAAQ,QAA6E,CAAC"}
@@ -0,0 +1,10 @@
1
+ import logger from '../logger.js';
2
+ export const reportError = (error) => {
3
+ let message = String(error);
4
+ if (error instanceof Error) {
5
+ message = error.message;
6
+ }
7
+ logger.error(message);
8
+ };
9
+ export const urlRegex = /^(http(s)?:\/\/.)[-\w@:%.+~#=]{2,256}\.[a-z]{2,6}\b([-\w@:%+.~#?&/=]*)$/g;
10
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/tools/tools.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAQ,EAAE;IACnD,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,KAAK,YAAY,KAAK,EAAE;QAC3B,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;KACxB;IAED,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,0EAA0E,CAAC","sourcesContent":["import logger from '../logger.js';\n\nexport const reportError = (error: unknown): void => {\n\tlet message = String(error);\n\tif (error instanceof Error) {\n\t\tmessage = error.message;\n\t}\n\n\tlogger.error(message);\n};\n\nexport const urlRegex = /^(http(s)?:\\/\\/.)[-\\w@:%.+~#=]{2,256}\\.[a-z]{2,6}\\b([-\\w@:%+.~#?&/=]*)$/g;\n\n"]}
@@ -0,0 +1,8 @@
1
+ import type DoculaPlugins from '../plugins/index.js';
2
+ import { type PluginConfig, type PluginInstance } from '../plugins/index.js';
3
+ export { type PluginConfig, type PluginInstance } from '../plugins/index.js';
4
+ export type PluginName = keyof typeof DoculaPlugins;
5
+ export type PluginInstances = Record<string, PluginInstance>;
6
+ export type Plugins = PluginName[];
7
+ export type PluginConfigs = Record<PluginName, PluginConfig>;
8
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAC,KAAK,YAAY,EAAE,KAAK,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAE3E,OAAO,EAAC,KAAK,YAAY,EAAE,KAAK,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,aAAa,CAAC;AAEpD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE7D,MAAM,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAEnC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"","sourcesContent":["import type DoculaPlugins from '../plugins/index.js';\nimport {type PluginConfig, type PluginInstance} from '../plugins/index.js';\n\nexport {type PluginConfig, type PluginInstance} from '../plugins/index.js';\n\nexport type PluginName = keyof typeof DoculaPlugins;\n\nexport type PluginInstances = Record<string, PluginInstance>;\n\nexport type Plugins = PluginName[];\n\nexport type PluginConfigs = Record<PluginName, PluginConfig>;\n\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docula",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Open Source Static Site Generator",
5
5
  "exports": "./dist/docula.js",
6
6
  "types": "./dist/docula.d.ts",
@@ -28,11 +28,7 @@
28
28
  "source",
29
29
  "static",
30
30
  "site",
31
- "github",
32
- "zendesk",
33
- "intercom",
34
- "swagger",
35
- "stripe"
31
+ "github"
36
32
  ],
37
33
  "author": "Jared Wray (me@jaredwray.com)",
38
34
  "license": "MIT",
@@ -45,20 +41,22 @@
45
41
  "@types/fs-extra": "^11.0.1",
46
42
  "@types/inquirer": "^9.0.3",
47
43
  "@types/jest": "^29.5.3",
48
- "@types/luxon": "^3.3.0",
49
- "jest": "^29.6.1",
44
+ "@types/luxon": "^3.3.1",
45
+ "jest": "^29.6.2",
46
+ "jest-resolve": "^29.6.2",
50
47
  "jest-ts-webcompat-resolver": "^1.0.0",
51
48
  "ts-jest": "^29.1.1",
52
49
  "ts-jest-resolver": "^2.0.1",
53
50
  "typescript": "^5.1.6",
54
- "xo": "^0.55.0"
51
+ "webpack": "^5.88.2",
52
+ "xo": "^0.56.0"
55
53
  },
56
54
  "dependencies": {
57
55
  "@11ty/eleventy": "^1.0.2",
58
56
  "@11ty/eleventy-navigation": "^0.3.5",
59
- "@types/markdown-it": "^12.2.3",
57
+ "@types/markdown-it": "^13.0.0",
60
58
  "ajv": "^8.12.0",
61
- "algoliasearch": "^4.19.0",
59
+ "algoliasearch": "^4.19.1",
62
60
  "axios": "^1.4.0",
63
61
  "commander": "^11.0.0",
64
62
  "dayjs": "^1.11.9",
@@ -67,12 +65,12 @@
67
65
  "eleventy-plugin-toc": "^1.1.5",
68
66
  "express": "^4.18.2",
69
67
  "fs-extra": "^11.1.1",
70
- "inquirer": "^9.2.8",
71
- "instantsearch.js": "^4.56.7",
72
- "luxon": "^3.3.0",
68
+ "inquirer": "^9.2.10",
69
+ "instantsearch.js": "^4.56.9",
70
+ "luxon": "^3.4.0",
73
71
  "markdown-it": "^13.0.1",
74
72
  "markdown-it-anchor": "^8.6.7",
75
- "node-fetch": "3.3.1",
73
+ "node-fetch": "3.3.2",
76
74
  "winston": "^3.10.0"
77
75
  },
78
76
  "files": [