writr 1.7.0 → 1.8.5

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 (86) hide show
  1. package/README.md +18 -4
  2. package/bin/writr +1 -5
  3. package/dist/cache.js +0 -2
  4. package/dist/cache.js.map +1 -1
  5. package/dist/config.d.ts +4 -1
  6. package/dist/config.js +6 -2
  7. package/dist/config.js.map +1 -1
  8. package/dist/data/dataService.js +7 -9
  9. package/dist/data/dataService.js.map +1 -1
  10. package/dist/data/fileDataProvider.js +14 -12
  11. package/dist/data/fileDataProvider.js.map +1 -1
  12. package/dist/generator.d.ts +8 -0
  13. package/dist/generator.js +58 -0
  14. package/dist/generator.js.map +1 -0
  15. package/dist/index.d.ts +1 -4
  16. package/dist/index.js +72 -57
  17. package/dist/index.js.map +1 -1
  18. package/dist/log.d.ts +6 -0
  19. package/dist/log.js +17 -0
  20. package/dist/log.js.map +1 -0
  21. package/dist/migrate/ghostMigrationProvider.d.ts +9 -0
  22. package/dist/migrate/ghostMigrationProvider.js +67 -0
  23. package/dist/migrate/ghostMigrationProvider.js.map +1 -0
  24. package/dist/migrate/jekyllMigrationProvider.d.ts +4 -0
  25. package/dist/migrate/jekyllMigrationProvider.js +15 -0
  26. package/dist/migrate/jekyllMigrationProvider.js.map +1 -0
  27. package/dist/migrate/mediumMigrationProvider.d.ts +7 -0
  28. package/dist/migrate/mediumMigrationProvider.js +30 -0
  29. package/dist/migrate/mediumMigrationProvider.js.map +1 -0
  30. package/dist/migrate/migrationProviderInterface.d.ts +3 -0
  31. package/dist/migrate/migrationProviderInterface.js +3 -0
  32. package/dist/migrate/migrationProviderInterface.js.map +1 -0
  33. package/dist/migrate/wordpressMigrationProvider.d.ts +12 -0
  34. package/dist/migrate/wordpressMigrationProvider.js +105 -0
  35. package/dist/migrate/wordpressMigrationProvider.js.map +1 -0
  36. package/dist/migrate.d.ts +6 -0
  37. package/dist/migrate.js +38 -0
  38. package/dist/migrate.js.map +1 -0
  39. package/dist/post.js +2 -4
  40. package/dist/post.js.map +1 -1
  41. package/dist/render/atomRenderProvider.js +3 -3
  42. package/dist/render/atomRenderProvider.js.map +1 -1
  43. package/dist/render/htmRenderlProvider.js +12 -12
  44. package/dist/render/htmRenderlProvider.js.map +1 -1
  45. package/dist/render/imageRenderProvider.js +3 -3
  46. package/dist/render/imageRenderProvider.js.map +1 -1
  47. package/dist/render/jsonRenderProvider.js +4 -6
  48. package/dist/render/jsonRenderProvider.js.map +1 -1
  49. package/dist/serve.d.ts +16 -0
  50. package/dist/serve.js +33 -0
  51. package/dist/serve.js.map +1 -0
  52. package/dist/storage/fileStorageProvider.d.ts +2 -3
  53. package/dist/storage/fileStorageProvider.js +12 -22
  54. package/dist/storage/fileStorageProvider.js.map +1 -1
  55. package/dist/storage/storageProviderInterface.d.ts +1 -0
  56. package/dist/storage/storageService.d.ts +3 -4
  57. package/dist/storage/storageService.js +5 -3
  58. package/dist/storage/storageService.js.map +1 -1
  59. package/dist/tag.js +3 -4
  60. package/dist/tag.js.map +1 -1
  61. package/dist/utils/parser.d.ts +5 -0
  62. package/dist/utils/parser.js +41 -0
  63. package/dist/utils/parser.js.map +1 -0
  64. package/dist/utils/setup.d.ts +8 -0
  65. package/dist/utils/setup.js +79 -0
  66. package/dist/utils/setup.js.map +1 -0
  67. package/init/article-complex.md +40 -0
  68. package/init/article-ejs.md +40 -0
  69. package/init/article-unpublished.md +11 -0
  70. package/init/article1-simple.md +13 -0
  71. package/init/article1.md +11 -0
  72. package/init/article2.md +14 -0
  73. package/init/big-content.md +11 -0
  74. package/init/config.json +9 -0
  75. package/init/images/Introducing Docula 1.png +0 -0
  76. package/init/images/Introducing Docula 2.jpeg +0 -0
  77. package/init/images/Introducing Docula 3.png +0 -0
  78. package/init/images/Introducing Docula 4.png +0 -0
  79. package/init/permalink-test.md +13 -0
  80. package/init/templates/index.hjs +13 -0
  81. package/init/templates/partials/header.hjs +2 -0
  82. package/init/templates/post.hjs +19 -0
  83. package/init/templates/post2.hjs +17 -0
  84. package/init/templates/post3.ejs +7 -0
  85. package/init/templates/tag.hjs +9 -0
  86. package/package.json +24 -18
package/dist/serve.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Serve = void 0;
4
+ const browserSync = require("browser-sync");
5
+ const generator_1 = require("./generator");
6
+ class Serve {
7
+ constructor(options) {
8
+ this.bs = browserSync.create();
9
+ this.params = options.opts();
10
+ this.generator = new generator_1.SiteGenerator(options);
11
+ }
12
+ async buildAndReload() {
13
+ await this.generator.run();
14
+ this.bs.reload();
15
+ }
16
+ run() {
17
+ const { output, port, watch, path } = this.params;
18
+ const baseDir = `${process.cwd()}/${output}`;
19
+ if (watch) {
20
+ this.bs.watch(`${process.cwd()}/${path}/*.md`, async () => await this.buildAndReload());
21
+ }
22
+ this.bs.init({
23
+ server: {
24
+ baseDir,
25
+ },
26
+ ui: false,
27
+ logPrefix: "Writr",
28
+ port: parseInt(port),
29
+ });
30
+ }
31
+ }
32
+ exports.Serve = Serve;
33
+ //# sourceMappingURL=serve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,2CAA0C;AAS1C,MAAa,KAAK;IAMjB,YAAY,OAAY;QACvB,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,yBAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,cAAc;QACnB,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAED,GAAG;QACF,MAAM,EAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAChD,MAAM,OAAO,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,MAAM,EAAE,CAAC;QAE7C,IAAG,KAAK,EAAE;YACT,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,IAAI,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;SACxF;QAED,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE;gBACP,OAAO;aACP;YACD,EAAE,EAAE,KAAK;YACT,SAAS,EAAE,OAAO;YAClB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;SACpB,CAAC,CAAC;IACJ,CAAC;CAED;AAnCD,sBAmCC"}
@@ -1,11 +1,10 @@
1
- import { StorageProviderInterface } from "../storage/storageProviderInterface";
1
+ import { StorageProviderInterface } from "./storageProviderInterface";
2
2
  export declare class FileStorageProvider implements StorageProviderInterface {
3
- log: any;
4
- constructor();
5
3
  get(path: string): Promise<string | undefined>;
6
4
  set(path?: string, data?: string): Promise<boolean>;
7
5
  delete(path: string): Promise<boolean>;
8
6
  copy(src: string, dest: string): Promise<boolean>;
9
7
  exists(path: string): Promise<boolean>;
10
8
  ensureFilePath(path: string): Promise<void>;
9
+ readDir(path: string): string[];
11
10
  }
@@ -2,11 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FileStorageProvider = void 0;
4
4
  const fs = require("fs-extra");
5
- const winston_1 = require("winston");
5
+ const log_1 = require("../log");
6
6
  class FileStorageProvider {
7
- constructor() {
8
- this.log = (0, winston_1.createLogger)({ transports: [new winston_1.transports.Console()] });
9
- }
10
7
  async get(path) {
11
8
  let result;
12
9
  try {
@@ -14,24 +11,16 @@ class FileStorageProvider {
14
11
  result = buffer.toString();
15
12
  }
16
13
  catch (error) {
17
- this.log.error(error);
14
+ new log_1.ConsoleMessage().error(error.message);
18
15
  }
19
16
  return result;
20
17
  }
21
18
  async set(path, data) {
22
- let result = false;
23
- if (path !== undefined && data !== undefined && path !== "" && data !== "") {
24
- try {
25
- await this.ensureFilePath(path);
26
- await fs.writeFile(path, data);
27
- result = true;
28
- }
29
- catch (error) {
30
- /* istanbul ignore next */
31
- this.log.error(error);
32
- }
33
- }
34
- return result;
19
+ if (!path || !data)
20
+ return false;
21
+ await this.ensureFilePath(path);
22
+ await fs.writeFile(path, data);
23
+ return true;
35
24
  }
36
25
  async delete(path) {
37
26
  let result = false;
@@ -40,8 +29,7 @@ class FileStorageProvider {
40
29
  result = true;
41
30
  }
42
31
  catch (error) {
43
- /* istanbul ignore next */
44
- this.log.error(error);
32
+ new log_1.ConsoleMessage().error(error.message);
45
33
  }
46
34
  return result;
47
35
  }
@@ -53,8 +41,7 @@ class FileStorageProvider {
53
41
  result = true;
54
42
  }
55
43
  catch (error) {
56
- /* istanbul ignore next */
57
- this.log.error(error);
44
+ new log_1.ConsoleMessage().error(error.message);
58
45
  }
59
46
  return result;
60
47
  }
@@ -71,6 +58,9 @@ class FileStorageProvider {
71
58
  let dir = pathList.join("/");
72
59
  await fs.ensureDir(dir);
73
60
  }
61
+ readDir(path) {
62
+ return fs.readdirSync(path);
63
+ }
74
64
  }
75
65
  exports.FileStorageProvider = FileStorageProvider;
76
66
  //# sourceMappingURL=fileStorageProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileStorageProvider.js","sourceRoot":"","sources":["../../src/storage/fileStorageProvider.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAG/B,qCAAmD;AAEnD,MAAa,mBAAmB;IAI5B;QACI,IAAI,CAAC,GAAG,GAAG,IAAA,sBAAY,EAAC,EAAE,UAAU,EAAE,CAAC,IAAI,oBAAU,CAAC,OAAO,EAAE,CAAC,EAAC,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,I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,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,IAAW;QAC5B,IAAI,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,QAAQ,CAAC,GAAG,EAAE,CAAC;QAEf,IAAI,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE7B,MAAM,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,CAAC,IAAY;QAChB,OAAO,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;CACJ;AArED,kDAqEC"}
@@ -4,4 +4,5 @@ export interface StorageProviderInterface {
4
4
  delete(path: string): Promise<boolean>;
5
5
  copy(src: string, dest: string): Promise<boolean>;
6
6
  exists(path: string): Promise<boolean>;
7
+ readDir(path: string): string[];
7
8
  }
@@ -1,13 +1,12 @@
1
- import { StorageProviderInterface } from "../storage/storageProviderInterface";
2
- import { Config } from "../config";
1
+ import { StorageProviderInterface } from "./storageProviderInterface";
3
2
  export declare class StorageService implements StorageProviderInterface {
4
- config: Config;
5
3
  provider: StorageProviderInterface;
6
- constructor(config: Config);
4
+ constructor();
7
5
  get(path: string): Promise<string | undefined>;
8
6
  set(path: string, data: string): Promise<boolean>;
9
7
  delete(path: string): Promise<boolean>;
10
8
  exists(path: string): Promise<boolean>;
11
9
  copy(src: string, dest: string): Promise<boolean>;
12
10
  getProvider(): StorageProviderInterface;
11
+ readDir(path: string): string[];
13
12
  }
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StorageService = void 0;
4
- const fileStorageProvider_1 = require("../storage/fileStorageProvider");
4
+ const fileStorageProvider_1 = require("./fileStorageProvider");
5
5
  class StorageService {
6
- constructor(config) {
7
- this.config = config;
6
+ constructor() {
8
7
  this.provider = new fileStorageProvider_1.FileStorageProvider();
9
8
  }
10
9
  async get(path) {
@@ -25,6 +24,9 @@ class StorageService {
25
24
  getProvider() {
26
25
  return this.provider;
27
26
  }
27
+ readDir(path) {
28
+ return this.getProvider().readDir(path);
29
+ }
28
30
  }
29
31
  exports.StorageService = StorageService;
30
32
  //# sourceMappingURL=storageService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storageService.js","sourceRoot":"","sources":["../../src/storage/storageService.ts"],"names":[],"mappings":";;;AACA,wEAAqE;AAIrE,MAAa,cAAc;IAKvB,YAAY,MAAa;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,yCAAmB,EAAE,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAW;QACjB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAW,EAAE,IAAW;QAC9B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAW;QACpB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAW;QACpB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAU,EAAE,IAAW;QAC9B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,WAAW;QAEP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;CACJ;AAlCD,wCAkCC"}
1
+ {"version":3,"file":"storageService.js","sourceRoot":"","sources":["../../src/storage/storageService.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAa,cAAc;IAIvB;QACI,IAAI,CAAC,QAAQ,GAAG,IAAI,yCAAmB,EAAE,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAW;QACjB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,IAAW,EAAE,IAAW;QAC9B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAW;QACpB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAW;QACpB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAU,EAAE,IAAW;QAC9B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,WAAW;QAEP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,IAAY;QAChB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;CACJ;AApCD,wCAoCC"}
package/dist/tag.js CHANGED
@@ -9,8 +9,7 @@ class Tag {
9
9
  this.name = name.trim();
10
10
  }
11
11
  get id() {
12
- let result = "";
13
- result = this.name.toLowerCase().replace(/[^a-z0-9+]+/gi, " ").trim();
12
+ let result = this.name.toLowerCase().replace(/[^a-z0-9+]+/gi, " ").trim();
14
13
  result = result.split(" ").join("-");
15
14
  return result;
16
15
  }
@@ -19,9 +18,9 @@ class Tag {
19
18
  result.name = this.name;
20
19
  result.id = this.id;
21
20
  result.posts = [];
22
- this.posts.forEach(async (post) => {
21
+ for (const post of this.posts) {
23
22
  result.posts.push(await post.toObject());
24
- });
23
+ }
25
24
  return result;
26
25
  }
27
26
  static create(obj) {
package/dist/tag.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tag.js","sourceRoot":"","sources":["../src/tag.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAE9B,MAAa,GAAG;IAId,YAAY,IAAY;QAHxB,SAAI,GAAW,EAAE,CAAC;QAClB,UAAK,GAAgB,IAAI,KAAK,EAAQ,CAAC;QAGrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED,IAAI,EAAE;QACJ,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACtE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,IAAI,MAAM,GAAQ,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACxB,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;QAElB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAChC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,GA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AI,CAAC,KAAK,EAAE;YAC7B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SAC1C;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,GAAQ;QACpB,IAAI,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE/B,IAAI,GAAG,CAAC,KAAK,EAAE;YACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACzC,IAAI,CAAC,GAAG,WAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBAElC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACtB;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA1CD,kBA0CC"}
@@ -0,0 +1,5 @@
1
+ export declare class Parser {
2
+ htmlToMd(html: string): string;
3
+ generateMdHeaders({ title, slug, date, categories, tags }: Record<string, any>): string;
4
+ slugify(text: string): string;
5
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Parser = void 0;
4
+ const node_html_markdown_1 = require("node-html-markdown");
5
+ class Parser {
6
+ htmlToMd(html) {
7
+ if (!html)
8
+ return '';
9
+ return new node_html_markdown_1.NodeHtmlMarkdown().translate(html);
10
+ }
11
+ generateMdHeaders({ title, slug, date, categories, tags }) {
12
+ let header = '---\n';
13
+ if (title)
14
+ header += `title: ${title}\n`;
15
+ if (slug)
16
+ header += `url: ${slug}\n`;
17
+ if (date)
18
+ header += `date: ${(new Date(date)).toISOString().slice(0, 10)}\n`;
19
+ if (categories)
20
+ header += `categories: ${typeof categories === 'string' ? categories : categories.join(', ')}\n`;
21
+ if (tags)
22
+ header += `tags: ${typeof tags === 'string' ? tags : tags.join(', ')}\n`;
23
+ header += '---\n\n';
24
+ return header;
25
+ }
26
+ slugify(text) {
27
+ const from = "ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;";
28
+ const to = "aaaaaeeeeeiiiiooooouuuunc------";
29
+ const newText = text.split('').map((letter, i) => letter.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)));
30
+ return newText
31
+ .toString() // Cast to string
32
+ .toLowerCase() // Convert the string to lowercase letters
33
+ .trim() // Remove whitespace from both sides of a string
34
+ .replace(/\s+/g, '-') // Replace spaces with -
35
+ .replace(/&/g, '-y-') // Replace & with 'and'
36
+ .replace(/[^\w\-]+/g, '') // Remove all non-word chars
37
+ .replace(/\-\-+/g, '-'); // Replace multiple - with single -
38
+ }
39
+ }
40
+ exports.Parser = Parser;
41
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/utils/parser.ts"],"names":[],"mappings":";;;AAAA,2DAAoD;AAEpD,MAAa,MAAM;IAEjB,QAAQ,CAAC,IAAY;QACnB,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QACrB,OAAO,IAAI,qCAAgB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,iBAAiB,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAsB;QAE1E,IAAI,MAAM,GAAG,OAAO,CAAC;QACrB,IAAI,KAAK;YAAE,MAAM,IAAI,UAAU,KAAK,IAAI,CAAC;QACzC,IAAI,IAAI;YAAE,MAAM,IAAI,QAAQ,IAAI,IAAI,CAAC;QACrC,IAAI,IAAI;YAAE,MAAM,IAAI,SAAS,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC;QAC7E,I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onContent;
5
+ constructor(name?: string);
6
+ init(): Promise<void>;
7
+ new(): Promise<void>;
8
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Setup = void 0;
4
+ const fs = require("fs-extra");
5
+ const inquirer = require("inquirer");
6
+ const parser_1 = require("./parser");
7
+ class Setup {
8
+ constructor(name = 'default') {
9
+ this.name = name;
10
+ this.gitignoreContent = "### Node ###\n" +
11
+ "# Logs\n" +
12
+ "logs\n" +
13
+ "*.log\n" +
14
+ "npm-debug.log*\n" +
15
+ "yarn-debug.log*\n" +
16
+ "yarn-error.log*\n" +
17
+ "lerna-debug.log*\n" +
18
+ "# Dependency directories\n" +
19
+ "node_modules/\n" +
20
+ "jspm_packages/\n" +
21
+ "# Optional npm cache directory\n" +
22
+ ".npm\n";
23
+ this.packageJsonContent = {
24
+ name: this.name,
25
+ version: "0.0.1",
26
+ description: "",
27
+ keywords: [],
28
+ license: "ISC",
29
+ author: "",
30
+ scripts: {
31
+ test: "echo \"Error: no test specified\" && exit 1"
32
+ },
33
+ };
34
+ }
35
+ ;
36
+ async init() {
37
+ try {
38
+ fs.mkdirSync(this.name);
39
+ fs.outputFileSync(`./${this.name}/.gitignore`, this.gitignoreContent);
40
+ fs.outputFileSync(`./${this.name}/package.json`, JSON.stringify(this.packageJsonContent, null, 2));
41
+ fs.copySync(`${__dirname}/../../init`, `./${this.name}/blog`);
42
+ }
43
+ catch (error) {
44
+ throw new Error('Directory already exists');
45
+ }
46
+ }
47
+ async new() {
48
+ try {
49
+ const questions = [
50
+ {
51
+ name: 'title',
52
+ message: 'What is the title of the post?',
53
+ },
54
+ {
55
+ name: 'categories',
56
+ message: 'Please enter the categories of the post separated by commas',
57
+ },
58
+ {
59
+ name: 'tags',
60
+ message: 'Please enter the tags of the post separated by commas',
61
+ },
62
+ {
63
+ name: 'date',
64
+ message: 'Please enter the date of the post in the format YYYY-MM-DD',
65
+ default: new Date().toLocaleDateString('en-CA'),
66
+ },
67
+ ];
68
+ const response = await inquirer.prompt(questions);
69
+ response.slug = new parser_1.Parser().slugify(response.title);
70
+ const headerContent = new parser_1.Parser().generateMdHeaders(response);
71
+ await fs.outputFileSync(`${response.slug}.md`, headerContent);
72
+ }
73
+ catch (error) {
74
+ throw new Error('Error creating new file');
75
+ }
76
+ }
77
+ }
78
+ exports.Setup = Setup;
79
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/utils/setup.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,qCAAqC;AACrC,qCAAgC;AAEhC,MAAa,KAAK;IAMhB,YAAY,OAAe,SAAS;QAElC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB;YACtC,UAAU;YACV,QAAQ;YACR,SAAS;YACT,kBAAkB;YAClB,mBAAmB;YACnB,mBAAmB;YACnB,oBAAoB;YACpB,4BAA4B;YAC5B,iBAAiB;YACjB,kBAAkB;YAClB,kCAAkC;YAClC,QAAQ,CAAC;QACX,IAAI,CAAC,kBAAkB,GAAG;YACxB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,6CAA6C;aACpD;SACF,CAAA;IAEH,CAAC;IAAA,CAAC;IAEF,KAAK,CAAC,IAAI;QACR,IAAG;YACD,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,EAAE,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC,IAAI,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACtE,EAAE,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC,IAAI,eAAe,EAAE,IAAI,CA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
6
+ - Docula
7
+ date: 2017-03-07
8
+ layout: post2
9
+ featured_image: Docula_%20Persistent%20Links%20and%20Styles%201.jpeg
10
+ ---
11
+
12
+ ![](images/Docula_%20Persistent%20Links%20and%20Styles%201.jpeg)
13
+
14
+ ## Docula: Persistent Links and Styles!
15
+
16
+ In our last update, we simplified the modules down to two ([docula-ui](https://www.npmjs.com/package/docula-ui), and [docula-core](https://www.npmjs.com/package/docula-core)) and also added In-Memory data stores as the default. Now with this latest update, we made it so that you can do [persistent linking](https://docu.la/docs/article/configuration/deeplinks) and [customize the interface](https://docu.la/docs/article/configuration/customization) it very easily.
17
+
18
+ ### Persistent Linking
19
+
20
+ There are many times a document can move around in a GitHub repository, but you want to keep to an URL that works. [Check out how to do it here!](https://docu.la/docs/article/configuration/deeplinks)
21
+
22
+ ### Styling! Let’s Get Started
23
+
24
+ The first step is to see how we did this. Since we use [GitHub](https://github.com/) for our knowledge base repository, it made sense to extend the configuration for skinning there. Here is what the [Fons repository](https://github.com/fonsio/public-kb) looks like with the `style.css` and `navigation.html` file in the root.
25
+
26
+ ![](images/Docula_%20Persistent%20Links%20and%20Styles%202.png)
27
+
28
+ The configuration for your [docula-ui](https://www.npmjs.com/package/docula-ui) is easy to do the config. You will want to add in the style.css path and navigation.html path. Also, if you have a customized logo, you can do that. Here is an example that we use for Fons.
29
+
30
+ ```
31
+ Docula.install(app, '/help', {git: 'https://github.com/fonsio/public-kb.git',pageTitle: 'Fons',logo: 'https://fons.io/n/img/fons-logo-300x85.png',redis: redisConfig(),elasticsearch: elasticConfig(),topNavigation: 'navigation.html',cssTheme: 'theme.scss'});
32
+ ```
33
+
34
+ Yep, its as simple as that and you can see the style.css and navigation.html examples here: [https://github.com/fonsio/public-kb](https://github.com/fonsio/public-kb)
35
+
36
+ <div>
37
+ <p>foo</p>
38
+ </div>
39
+ ***Happy Styling!***
40
+
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: 'Docula: EJS Style'
3
+ tags:
4
+ - Github
5
+ - Open Source
6
+ - Docula
7
+ date: 2017-03-07
8
+ layout: post3
9
+ featured_image: Docula_%20Persistent%20Links%20and%20Styles%201.jpeg
10
+ ---
11
+
12
+ ![](images/Docula_%20Persistent%20Links%20and%20Styles%201.jpeg)
13
+
14
+ ## Docula: Persistent Links and Styles!
15
+
16
+ In our last update, we simplified the modules down to two ([docula-ui](https://www.npmjs.com/package/docula-ui), and [docula-core](https://www.npmjs.com/package/docula-core)) and also added In-Memory data stores as the default. Now with this latest update, we made it so that you can do [persistent linking](https://docu.la/docs/article/configuration/deeplinks) and [customize the interface](https://docu.la/docs/article/configuration/customization) it very easily.
17
+
18
+ ### Persistent Linking
19
+
20
+ There are many times a document can move around in a GitHub repository, but you want to keep to an URL that works. [Check out how to do it here!](https://docu.la/docs/article/configuration/deeplinks)
21
+
22
+ ### Styling! Let’s Get Started
23
+
24
+ The first step is to see how we did this. Since we use [GitHub](https://github.com/) for our knowledge base repository, it made sense to extend the configuration for skinning there. Here is what the [Fons repository](https://github.com/fonsio/public-kb) looks like with the `style.css` and `navigation.html` file in the root.
25
+
26
+ ![](images/Docula_%20Persistent%20Links%20and%20Styles%202.png)
27
+
28
+ The configuration for your [docula-ui](https://www.npmjs.com/package/docula-ui) is easy to do the config. You will want to add in the style.css path and navigation.html path. Also, if you have a customized logo, you can do that. Here is an example that we use for Fons.
29
+
30
+ ```
31
+ Docula.install(app, '/help', {git: 'https://github.com/fonsio/public-kb.git',pageTitle: 'Fons',logo: 'https://fons.io/n/img/fons-logo-300x85.png',redis: redisConfig(),elasticsearch: elasticConfig(),topNavigation: 'navigation.html',cssTheme: 'theme.scss'});
32
+ ```
33
+
34
+ Yep, its as simple as that and you can see the style.css and navigation.html examples here: [https://github.com/fonsio/public-kb](https://github.com/fonsio/public-kb)
35
+
36
+ <div>
37
+ <p>foo</p>
38
+ </div>
39
+ ***Happy Styling!***
40
+
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Tesla Unpublished
3
+ author: Elon Musk
4
+ date: 2016-08-12
5
+ keywords: tesla, model 3, elon, musk
6
+ categories: muskified, nice3
7
+ tags: tesla, model 3,Whale,cool, unpublished
8
+ published: false
9
+ ---
10
+
11
+ How now brown cow.
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: 'Article Simple'
3
+ date: 2018-15-01
4
+ ---
5
+
6
+ ![](Images/Docula_%20Persistent%20Links%20and%20Styles%201.jpeg)
7
+
8
+ ## Docula: Persistent Links and Styles!
9
+
10
+ In our last update, we simplified the modules down to two (<u>[docula-ui](https://www.npmjs.com/package/docula-ui)</u>, and <u>[docula-core](https://www.npmjs.com/package/docula-core))</u> and also added In-Memory data stores as the default. Now with this latest update, we made it so that you can do <u>[persistent linking](https://docu.la/docs/article/configuration/deeplinks)</u> and <u>[customize the interface](https://docu.la/docs/article/configuration/customization)</u> it very easily.
11
+
12
+
13
+
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: Article One
3
+ author: John Smith
4
+ url: the-largest-whale
5
+ date: 2019-03-12
6
+ keywords: large, Whale
7
+ categories: ["foo", "mouse"]
8
+ tags: Whale,ocean,Candle,blast
9
+ ---
10
+
11
+ My life as a blogger is really cool
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Tesla Model 3
3
+ author: Elon Musk
4
+ url: all-about-the-tesla-model-3
5
+ date: 2016-08-12
6
+ publishedAt: 6/25/2017
7
+ keywords: tesla, model 3, elon, musk
8
+ categories: muskified, nice3
9
+ tags: tesla, model 3,Whale,cool
10
+ ---
11
+
12
+ How now brown cow.
13
+
14
+ This is how we do it
@@ -0,0 +1,11 @@
1
+ ---
2
+ {
3
+ "title": "Big Content",
4
+ "author": "Mr. Big",
5
+ "url": "big-content-is-real",
6
+ "date": "2017-11-08",
7
+ "publishedAt": "",
8
+ "keywords": "big, content, house",
9
+ "tags": "aerospace, facts"
10
+ }
11
+ ---
@@ -0,0 +1,9 @@
1
+ {
2
+ "output" : "./blog_output",
3
+ "render": [ "html" , "json", "atom", "images"],
4
+ "path": "./blog",
5
+ "title": "Example Blog",
6
+ "url": "https://writr.io/blog",
7
+ "authorName": "Jared Wray",
8
+ "authorEmail": "me@jaredwray.com"
9
+ }
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: 'Article Perm'
3
+ date: 2018-12-04
4
+ permalink: '/foo/crazy/url/article-perm'
5
+ ---
6
+
7
+ ![](images/Docula_%20Persistent%20Links%20and%20Styles%201.jpeg)
8
+
9
+ ## Getting Persistent links in a blog document is critical
10
+
11
+ In our last update, we simplified the modules down to two (<u>[docula-ui](https://www.npmjs.com/package/docula-ui)</u>, and <u>[docula-core](https://www.npmjs.com/package/docula-core))</u> and also added In-Memory data stores as the default. Now with this latest update, we made it so that you can do <u>[persistent linking](https://docu.la/docs/article/configuration/deeplinks)</u> and <u>[customize the interface](https://docu.la/docs/article/configuration/customization)</u> it very easily.
12
+
13
+
@@ -0,0 +1,13 @@
1
+ {{#each posts}}
2
+ <p>{{formatDate date "MM/DD/YYYY"}}</p>
3
+ <p><a href="{{url}}">{{title}} - {{author}}</a></p>
4
+ {{/each}}
5
+
6
+ <p>Tags: <br />
7
+ <ul>
8
+ {{#each tags}}
9
+ <li><a href="{{id}}">{{name}}</a></li>{{/each}}
10
+ </ul>
11
+ </p>
12
+
13
+ {{formatDate "" "YYYY"}}
@@ -0,0 +1,2 @@
1
+
2
+ Header: {{post.title}}
@@ -0,0 +1,19 @@
1
+ <h1>Post</h1>
2
+
3
+ {{> header}}
4
+
5
+ <p>{{post.title}}</p>
6
+ <p>{{post.author}}</p>
7
+ <p>{{{post.body}}}</p>
8
+
9
+ <p>{{post.matter.featured_image}}</p>
10
+
11
+ <p>{{previousPost.id}}</p>
12
+ <p>{{nextPost.id}}</p>
13
+
14
+ <h1>Tags</h1>
15
+ <ul>
16
+ {{#each tags}}
17
+ <li>{{name}}</li>
18
+ {{/each}}
19
+ </ul>
@@ -0,0 +1,17 @@
1
+ <h1>Post 2</h1>
2
+
3
+ <p>{{post.title}}</p>
4
+ <p>{{post.author}}</p>
5
+ <p>{{{post.body}}}</p>
6
+
7
+ <p>{{post.matter.featured_image}}</p>
8
+
9
+ <p>{{previousPost.id}}</p>
10
+ <p>{{nextPost.id}}</p>
11
+
12
+ <h1>Tags</h1>
13
+ <ul>
14
+ {{#each tags}}
15
+ <li>{{name}}</li>
16
+ {{/each}}
17
+ </ul>
@@ -0,0 +1,7 @@
1
+ <h1>Post 3</h1>
2
+
3
+ <p><%= post.title %></p>
4
+ <p><%=post.author %></p>
5
+ <p><%- post.body %></p>
6
+
7
+ <p><%=post.matter.featured_image %></p>
@@ -0,0 +1,9 @@
1
+
2
+
3
+ <p>Tag:
4
+ {{tag.name}}<br /></p>
5
+
6
+ <ul>
7
+ {{#each tag.posts}}
8
+ <li>{{title}} - {{author}}</li>{{/each}}
9
+ </ul>