@metaverse-systems/the-seed 1.0.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 (93) hide show
  1. package/.eslintrc.json +36 -0
  2. package/README.md +1 -0
  3. package/dist/Build.d.ts +11 -0
  4. package/dist/Build.js +72 -0
  5. package/dist/Build.js.map +1 -0
  6. package/dist/Config.d.ts +18 -0
  7. package/dist/Config.js +42 -0
  8. package/dist/Config.js.map +1 -0
  9. package/dist/Scopes.d.ts +34 -0
  10. package/dist/Scopes.js +88 -0
  11. package/dist/Scopes.js.map +1 -0
  12. package/dist/Template.d.ts +25 -0
  13. package/dist/Template.js +97 -0
  14. package/dist/Template.js.map +1 -0
  15. package/dist/index.d.ts +3 -0
  16. package/dist/index.js +9 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/scripts/BuildCLI.d.ts +3 -0
  19. package/dist/scripts/BuildCLI.js +30 -0
  20. package/dist/scripts/BuildCLI.js.map +1 -0
  21. package/dist/scripts/ConfigCLI.d.ts +3 -0
  22. package/dist/scripts/ConfigCLI.js +43 -0
  23. package/dist/scripts/ConfigCLI.js.map +1 -0
  24. package/dist/scripts/ScopesCLI.d.ts +3 -0
  25. package/dist/scripts/ScopesCLI.js +64 -0
  26. package/dist/scripts/ScopesCLI.js.map +1 -0
  27. package/dist/scripts/TemplateCLI.d.ts +3 -0
  28. package/dist/scripts/TemplateCLI.js +30 -0
  29. package/dist/scripts/TemplateCLI.js.map +1 -0
  30. package/dist/scripts/config.d.ts +2 -0
  31. package/dist/scripts/config.js +43 -0
  32. package/dist/scripts/config.js.map +1 -0
  33. package/dist/scripts/the-seed.d.ts +2 -0
  34. package/dist/scripts/the-seed.js +37 -0
  35. package/dist/scripts/the-seed.js.map +1 -0
  36. package/dist/types.d.ts +21 -0
  37. package/dist/types.js +3 -0
  38. package/dist/types.js.map +1 -0
  39. package/jest.config.js +5 -0
  40. package/package.json +42 -0
  41. package/src/Build.ts +84 -0
  42. package/src/Config.ts +44 -0
  43. package/src/Scopes.ts +102 -0
  44. package/src/Template.ts +118 -0
  45. package/src/index.ts +7 -0
  46. package/src/scripts/BuildCLI.ts +35 -0
  47. package/src/scripts/ConfigCLI.ts +47 -0
  48. package/src/scripts/ScopesCLI.ts +67 -0
  49. package/src/scripts/TemplateCLI.ts +34 -0
  50. package/src/scripts/the-seed.ts +39 -0
  51. package/src/types.ts +25 -0
  52. package/structure.md +25 -0
  53. package/templates/component/AUTHORS +1 -0
  54. package/templates/component/COPYING +21 -0
  55. package/templates/component/ChangeLog +0 -0
  56. package/templates/component/INSTALL +368 -0
  57. package/templates/component/Makefile.am +3 -0
  58. package/templates/component/NEWS +0 -0
  59. package/templates/component/README +0 -0
  60. package/templates/component/SKELETON.pc.in +11 -0
  61. package/templates/component/autogen.sh +7 -0
  62. package/templates/component/configure.ac +17 -0
  63. package/templates/component/src/Makefile.am +7 -0
  64. package/templates/component/src/SKELETON.cpp +31 -0
  65. package/templates/component/src/SKELETON.hpp +11 -0
  66. package/templates/program/AUTHORS +1 -0
  67. package/templates/program/COPYING +21 -0
  68. package/templates/program/ChangeLog +0 -0
  69. package/templates/program/INSTALL +368 -0
  70. package/templates/program/Makefile.am +2 -0
  71. package/templates/program/NEWS +0 -0
  72. package/templates/program/README +0 -0
  73. package/templates/program/autogen.sh +7 -0
  74. package/templates/program/configure.ac +19 -0
  75. package/templates/program/src/Makefile.am +6 -0
  76. package/templates/program/src/SKELETON.cpp +28 -0
  77. package/templates/program/src/SKELETON.hpp +6 -0
  78. package/templates/system/AUTHORS +1 -0
  79. package/templates/system/COPYING +21 -0
  80. package/templates/system/ChangeLog +0 -0
  81. package/templates/system/INSTALL +368 -0
  82. package/templates/system/Makefile.am +3 -0
  83. package/templates/system/NEWS +0 -0
  84. package/templates/system/README +0 -0
  85. package/templates/system/SKELETON.pc.in +11 -0
  86. package/templates/system/autogen.sh +7 -0
  87. package/templates/system/configure.ac +18 -0
  88. package/templates/system/src/Makefile.am +6 -0
  89. package/templates/system/src/SKELETON.cpp +43 -0
  90. package/templates/system/src/SKELETON.hpp +14 -0
  91. package/test/Config.test.ts +34 -0
  92. package/test/Scopes.test.ts +53 -0
  93. package/tsconfig.json +26 -0
package/.eslintrc.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "env": {
3
+ "es2021": true,
4
+ "node": true
5
+ },
6
+ "extends": [
7
+ "eslint:recommended",
8
+ "plugin:@typescript-eslint/recommended"
9
+ ],
10
+ "parser": "@typescript-eslint/parser",
11
+ "parserOptions": {
12
+ "ecmaVersion": "latest",
13
+ "sourceType": "module"
14
+ },
15
+ "plugins": [
16
+ "@typescript-eslint"
17
+ ],
18
+ "rules": {
19
+ "indent": [
20
+ "error",
21
+ 2
22
+ ],
23
+ "linebreak-style": [
24
+ "error",
25
+ "unix"
26
+ ],
27
+ "quotes": [
28
+ "error",
29
+ "double"
30
+ ],
31
+ "semi": [
32
+ "error",
33
+ "always"
34
+ ]
35
+ }
36
+ }
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @metaverse-systems/the-seed
@@ -0,0 +1,11 @@
1
+ import Config from "./Config";
2
+ declare class Build {
3
+ config: Config;
4
+ target: string;
5
+ constructor(config: Config);
6
+ autogen: () => void;
7
+ configure: () => void;
8
+ reconfigure: (target: string) => void;
9
+ compile: () => void;
10
+ }
11
+ export default Build;
package/dist/Build.js ADDED
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { execSync } = require('child_process');
4
+ const targets = {
5
+ "native": "x86_64-linux-gnu",
6
+ "windows": "x86_64-w64-mingw32",
7
+ "wasm": "wasm32-unknown-emscripten",
8
+ };
9
+ const execOptions = { stdio: 'pipe' };
10
+ class Build {
11
+ constructor(config) {
12
+ this.target = "linux";
13
+ this.autogen = () => {
14
+ const autogen_command = "./autogen.sh";
15
+ try {
16
+ const result = execSync(autogen_command, execOptions).toString();
17
+ }
18
+ catch (e) {
19
+ console.error(e);
20
+ throw e;
21
+ }
22
+ console.log("Completed " + autogen_command);
23
+ };
24
+ this.configure = () => {
25
+ console.log("Target: " + this.target);
26
+ const newTarget = targets[this.target];
27
+ const distclean_command = "make distclean";
28
+ try {
29
+ const result = execSync(distclean_command, execOptions).toString();
30
+ }
31
+ catch (e) {
32
+ }
33
+ const prefix = this.config.config.prefix;
34
+ console.log("Prefix: " + prefix);
35
+ const exec_prefix = prefix + "/" + newTarget;
36
+ console.log("Exec prefix: " + exec_prefix);
37
+ const configure_command = "PKG_CONFIG_PATH=" + exec_prefix + "/lib/pkgconfig/ " +
38
+ (this.target === "wasm" ? "emconfigure " : "") +
39
+ "./configure --prefix=" + prefix +
40
+ " --exec-prefix=" + exec_prefix +
41
+ (this.target === "windows" ? " --host=" + targets["windows"] : "");
42
+ try {
43
+ const result = execSync(configure_command, execOptions).toString();
44
+ }
45
+ catch (e) {
46
+ console.error(e);
47
+ throw e;
48
+ }
49
+ console.log("Configure complete");
50
+ };
51
+ this.reconfigure = (target) => {
52
+ this.target = target;
53
+ this.autogen();
54
+ this.configure();
55
+ };
56
+ this.compile = () => {
57
+ const make_command = this.target === "wasm" ?
58
+ "emmake make" :
59
+ "make";
60
+ try {
61
+ const result = execSync(make_command).toString();
62
+ }
63
+ catch (e) {
64
+ console.error(e);
65
+ throw e;
66
+ }
67
+ };
68
+ this.config = config;
69
+ }
70
+ }
71
+ exports.default = Build;
72
+ //# sourceMappingURL=Build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Build.js","sourceRoot":"","sources":["../src/Build.ts"],"names":[],"mappings":";;AACA,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAE9C,MAAM,OAAO,GAET;IACF,QAAQ,EAAE,kBAAkB;IAC5B,SAAS,EAAE,oBAAoB;IAC/B,MAAM,EAAE,2BAA2B;CACpC,CAAC;AAEF,MAAM,WAAW,GAAG,EAAC,KAAK,EAAG,MAAM,EAAE,CAAC;AAEtC,MA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/B,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAEvE,IAAI;gBACF,MAAM,MAAM,GAAG,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC;aACpE;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACjB,MAAM,CAAC,CAAC;aACT;YAED,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC,CAAA;QAED,gBAAW,GAAG,CAAC,MAAc,EAAE,EAAE;YAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC,CAAA;QAED,YAAO,GAAG,GAAG,EAAE;YACb,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;gBACzC,aAAa,CAAC,CAAC;gBACf,MAAM,CAAC;YAEX,IAAI;gBACF,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;aAClD;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACjB,MAAM,CAAC,CAAC;aACT;QACH,CAAC,CAAA;QA9DC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CA8DF;AAED,kBAAe,KAAK,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { ConfigType } from "./types";
2
+ declare class Config {
3
+ configDir: string;
4
+ configFile: string;
5
+ config: ConfigType;
6
+ constructor(configDir: string);
7
+ loadConfig: () => void;
8
+ saveConfig: () => void;
9
+ getQuestions: () => {
10
+ name: string;
11
+ message: string;
12
+ default: string;
13
+ }[];
14
+ parseAnswers: (answers: {
15
+ [index: string]: any;
16
+ }) => void;
17
+ }
18
+ export default Config;
package/dist/Config.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const fs_1 = tslib_1.__importDefault(require("fs"));
5
+ const os_1 = tslib_1.__importDefault(require("os"));
6
+ class Config {
7
+ constructor(configDir) {
8
+ this.config = {
9
+ prefix: os_1.default.homedir() + "/the-seed",
10
+ scopes: {}
11
+ };
12
+ this.loadConfig = () => {
13
+ try {
14
+ this.config = JSON.parse(fs_1.default.readFileSync(this.configDir + this.configFile).toString());
15
+ }
16
+ catch (err) {
17
+ }
18
+ };
19
+ this.saveConfig = () => {
20
+ fs_1.default.writeFileSync(this.configDir + this.configFile, JSON.stringify(this.config, null, 2));
21
+ };
22
+ this.getQuestions = () => {
23
+ return [
24
+ {
25
+ name: "prefix",
26
+ message: "Installation prefix?",
27
+ default: this.config["prefix"]
28
+ }
29
+ ];
30
+ };
31
+ this.parseAnswers = (answers) => {
32
+ Object.keys(answers).forEach((k) => {
33
+ this.config[k] = answers[k];
34
+ });
35
+ };
36
+ this.configDir = configDir;
37
+ this.configFile = "/config.json";
38
+ this.loadConfig();
39
+ }
40
+ }
41
+ exports.default = Config;
42
+ //# sourceMappingURL=Config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.js","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":";;;AAAA,oDAAoB;AACpB,oDAAoB;AAGpB,MAAM,MAAM;IAQV,YAAY,SAAiB;QAL7B,WAAM,GAAe;YACnB,MAAM,EAAE,YAAE,CAAC,OAAO,EAAE,GAAG,WAAW;YAClC,MAAM,EAAE,EAAE;SACX,CAAC;QAQF,eAAU,GAAG,GAAG,EAAE;YAChB,IAAI;gBACF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;aACxF;YAAC,OAAO,GAAG,EAAE;aACb;QACH,CAAC,CAAC;QAEF,eAAU,GAAG,GAAG,EAAE;YAChB,YAAE,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3F,CAAC,CAAC;QAEF,iBAAY,GAAG,GAAG,EAAE;YAClB,OAAO;gBACL;oBACE,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,sBAAsB;oBAC/B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;iBAC/B;aACF,CAAC;QACJ,CAAC,CAAC;QAEF,iBAAY,GAAG,CAAC,OAAgC,EAAE,EAAE;YAClD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;gBACjC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QA9BA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,cAAc,CAAC;QACjC,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;CA4BF;AAED,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,34 @@
1
+ import Config from "./Config";
2
+ declare class Scopes {
3
+ config: Config;
4
+ constructor(config: Config);
5
+ askWhichScope: () => {
6
+ type: string;
7
+ name: string;
8
+ message: string;
9
+ choices: string[];
10
+ }[];
11
+ askNewScope: () => ({
12
+ name: string;
13
+ message: string;
14
+ default: any;
15
+ } | {
16
+ name: string;
17
+ message: string;
18
+ })[];
19
+ askEditScope: (defaults?: any) => {
20
+ name: string;
21
+ message: string;
22
+ default: any;
23
+ }[];
24
+ createOrEditScope: (answers: any) => void;
25
+ deleteScope: (scope: string) => void;
26
+ getScopes: () => string[];
27
+ getScope: (scope: string) => import("./types").ScopeType;
28
+ getQuestions: (defaults: any) => {
29
+ name: string;
30
+ message: string;
31
+ default: any;
32
+ }[];
33
+ }
34
+ export default Scopes;
package/dist/Scopes.js ADDED
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Scopes {
4
+ constructor(config) {
5
+ this.askWhichScope = () => {
6
+ return [
7
+ {
8
+ "type": "list",
9
+ "name": "scopeName",
10
+ "message": "Which scope?",
11
+ "choices": this.getScopes()
12
+ }
13
+ ];
14
+ };
15
+ this.askNewScope = () => {
16
+ return [
17
+ {
18
+ "name": "scopeName",
19
+ "message": "Name for scope?",
20
+ },
21
+ ...this.askEditScope()
22
+ ];
23
+ };
24
+ this.askEditScope = (defaults) => {
25
+ return [
26
+ {
27
+ "name": "authorName",
28
+ "message": "Your name?",
29
+ "default": (defaults === null || defaults === void 0 ? void 0 : defaults.name) ? defaults.name : ""
30
+ },
31
+ {
32
+ "name": "authorEmail",
33
+ "message": "Your email?",
34
+ "default": (defaults === null || defaults === void 0 ? void 0 : defaults.email) ? defaults.email : ""
35
+ },
36
+ {
37
+ "name": "authorURL",
38
+ "message": "Your URL?",
39
+ "default": (defaults === null || defaults === void 0 ? void 0 : defaults.url) ? defaults.url : ""
40
+ }
41
+ ];
42
+ };
43
+ this.createOrEditScope = (answers) => {
44
+ let name = "";
45
+ if (answers.scopeName[0] != "@")
46
+ name = "@";
47
+ name += answers.scopeName;
48
+ this.config.config.scopes[name] = {
49
+ author: {
50
+ name: answers.authorName,
51
+ email: answers.authorEmail,
52
+ url: answers.authorURL
53
+ }
54
+ };
55
+ };
56
+ this.deleteScope = (scope) => {
57
+ let name = "";
58
+ if (scope[0] != "@")
59
+ name = "@";
60
+ name += scope;
61
+ console.log("Deleting scope " + name);
62
+ if (!Object.keys(this.config.config.scopes).includes(name)) {
63
+ console.error("Scope does not exist.");
64
+ return;
65
+ }
66
+ delete this.config.config.scopes[name];
67
+ };
68
+ this.getScopes = () => {
69
+ const scopes = Object.keys(this.config.config.scopes);
70
+ return scopes;
71
+ };
72
+ this.getScope = (scope) => {
73
+ return this.config.config.scopes[scope];
74
+ };
75
+ this.getQuestions = (defaults) => {
76
+ return [
77
+ {
78
+ name: "scopeName",
79
+ message: "Scope name?",
80
+ default: defaults.scopeName || null
81
+ }
82
+ ];
83
+ };
84
+ this.config = config;
85
+ }
86
+ }
87
+ exports.default = Scopes;
88
+ //# sourceMappingURL=Scopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Scopes.js","sourceRoot":"","sources":["../src/Scopes.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM;IAGV,YAAY,MAAc;QAI1B,kBAAa,GAAG,GAAG,EAAE;YACnB,OAAO;gBACL;oBACE,MAAM,EAAE,MAAM;oBACd,MAAM,EAAE,WAAW;oBACnB,SAAS,EAAE,cAAc;oBACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE;iBAC5B;aACF,CAAC;QACJ,CAAC,CAAC;QAEF,gBAAW,GAAG,GAAG,EAAE;YACjB,OAAO;gBACL;oBACE,MAAM,EAAE,WAAW;oBACnB,SAAS,EAAE,iBAAiB;iBAC7B;gBACD,GAAG,IAAI,CAAC,YAAY,EAAE;aACvB,CAAC;QACJ,CAAC,CAAC;QAEF,iBAAY,GAAG,CAAC,QAAc,EAAE,EAAE;YAChC,OAAO;gBACL;oBACE,MAAM,EAAE,YAAY;oBACpB,SAAS,EAAE,YAAY;oBACvB,SAAS,EAAE,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;iBAC/C;gBACD;oBACE,MAAM,EAAE,aAAa;oBACrB,SAAS,EAAE,aAAa;oBACxB,SAAS,EA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CAAC;gBACvC,OAAO;aACR;YAED,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC,CAAC;QAEF,cAAS,GAAG,GAAG,EAAE;YACf,MAAM,MAAM,GAAa,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAEhE,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,KAAa,EAAE,EAAE;YAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC,CAAA;QAED,iBAAY,GAAG,CAAC,QAAa,EAAE,EAAE;YAC/B,OAAO;gBACL;oBACE,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE,aAAa;oBACtB,OAAO,EAAE,QAAQ,CAAC,SAAS,IAAI,IAAI;iBACpC;aACF,CAAC;QACJ,CAAC,CAAC;QA1FA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CA0FF;AAED,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,25 @@
1
+ import Config from "./Config";
2
+ import Scopes from "./Scopes";
3
+ declare class Template {
4
+ type: string;
5
+ packageDir: string;
6
+ config: Config;
7
+ scopes: Scopes;
8
+ package: any;
9
+ constructor(config: Config);
10
+ askName: () => ({
11
+ type: string;
12
+ name: string;
13
+ message: string;
14
+ choices: string[];
15
+ } | {
16
+ name: string;
17
+ message: string;
18
+ type?: undefined;
19
+ choices?: undefined;
20
+ })[];
21
+ copyTemplate: (scope: string, name: string) => void;
22
+ createPackage: (scope: string, name: string) => void;
23
+ save: () => void;
24
+ }
25
+ export default Template;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const fs = require("fs-extra");
5
+ const { execSync } = require('child_process');
6
+ const path_1 = tslib_1.__importDefault(require("path"));
7
+ const Scopes_1 = tslib_1.__importDefault(require("./Scopes"));
8
+ const build_command = "build_command src/Template.ts";
9
+ const build_win64_command = "";
10
+ class Template {
11
+ constructor(config) {
12
+ this.type = "";
13
+ this.packageDir = "";
14
+ this.askName = () => {
15
+ return [
16
+ {
17
+ "type": "list",
18
+ "name": "scopeName",
19
+ "message": "Choose scope for " + this.type,
20
+ "choices": this.scopes.getScopes()
21
+ },
22
+ {
23
+ "name": "templateName",
24
+ "message": "Choose name for " + this.type
25
+ }
26
+ ];
27
+ };
28
+ this.copyTemplate = (scope, name) => {
29
+ const templateDir = path_1.default.join(path_1.default.dirname(require.main.filename), "../../templates/" + this.type);
30
+ const scopeDir = this.config.config.prefix + "/projects/" + scope;
31
+ const underscoreRegex = new RegExp("-", "g");
32
+ const underscoreName = name.replace(underscoreRegex, "_");
33
+ if (!fs.existsSync(scopeDir)) {
34
+ fs.mkdirSync(scopeDir);
35
+ }
36
+ // Create package from template
37
+ fs.copySync(templateDir, this.packageDir);
38
+ // Replace template variables with real values
39
+ const author = this.scopes.getScope(scope).author;
40
+ const variables = {
41
+ "AUTHOR_EMAIL": author.email,
42
+ "AUTHOR_URL": author.url,
43
+ "SKELETON_": underscoreName,
44
+ "SKELETON": name
45
+ };
46
+ const files = [
47
+ 'AUTHORS',
48
+ 'configure.ac',
49
+ 'Makefile.am',
50
+ 'src/Makefile.am',
51
+ 'src/SKELETON.hpp',
52
+ 'src/SKELETON.cpp'
53
+ ];
54
+ if (this.type != "program") {
55
+ files.push('SKELETON.pc.in');
56
+ }
57
+ files.forEach((file) => {
58
+ let temp = fs.readFileSync(this.packageDir + "/" + file).toString();
59
+ Object.keys(variables).forEach((variable) => {
60
+ const regex = new RegExp(variable, "g");
61
+ temp = temp.replace(regex, variables[variable]);
62
+ });
63
+ fs.writeFileSync(this.packageDir + "/" + file, temp);
64
+ });
65
+ fs.renameSync(this.packageDir + "/src/SKELETON.hpp", this.packageDir + "/src/" + name + ".hpp");
66
+ fs.renameSync(this.packageDir + "/src/SKELETON.cpp", this.packageDir + "/src/" + name + ".cpp");
67
+ if (this.type != "program")
68
+ fs.renameSync(this.packageDir + "/SKELETON.pc.in", this.packageDir + "/" + name + ".pc.in");
69
+ };
70
+ this.createPackage = (scope, name) => {
71
+ const scopeDir = this.config.config.prefix + "/projects/" + scope;
72
+ this.packageDir = scopeDir + "/" + name;
73
+ this.copyTemplate(scope, name);
74
+ // Create default package.json
75
+ execSync('npm init --yes', { cwd: this.packageDir });
76
+ this.package = JSON.parse(fs.readFileSync(this.packageDir + "/package.json"));
77
+ this.package.author = this.scopes.getScope(scope).author;
78
+ this.package.license = "UNLICENSED";
79
+ this.package.name = scope + "/" + name;
80
+ this.package.version = "0.0.1";
81
+ this.package.scripts = {
82
+ "test": "echo \"Error: no test specified\" && exit 1",
83
+ "build": build_command,
84
+ "build-win64": build_win64_command
85
+ };
86
+ delete this.package.main;
87
+ this.save();
88
+ };
89
+ this.save = () => {
90
+ fs.writeFileSync(this.packageDir + "/package.json", JSON.stringify(this.package, null, 2));
91
+ };
92
+ this.config = config;
93
+ this.scopes = new Scopes_1.default(config);
94
+ }
95
+ }
96
+ exports.default = Template;
97
+ //# sourceMappingURL=Template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Template.js","sourceRoot":"","sources":["../src/Template.ts"],"names":[],"mappings":";;;AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC/B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC9C,wDAAwB;AAGxB,8DAA8B;AAE9B,MAAM,aAAa,GAAG,+BAA+B,CAAC;AACtD,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B,MAAM,QAAQ;IAOZ,YAAY,MAAc;QAN1B,SAAI,GAAW,EAAE,CAAC;QAClB,eAAU,GAAW,EAAE,CAAC;QAUxB,YAAO,GAAG,GAAG,EAAE;YACb,OAAO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AAE,CAAC,CAAC,CAAC,CAAC;QAC7F,CAAC,CAAA;QAhGC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,gBAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CA+FF;AAED,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import Config from "./Config";
2
+ import Scopes from "./Scopes";
3
+ export { Config, Scopes, };
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Scopes = exports.Config = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const Config_1 = tslib_1.__importDefault(require("./Config"));
6
+ exports.Config = Config_1.default;
7
+ const Scopes_1 = tslib_1.__importDefault(require("./Scopes"));
8
+ exports.Scopes = Scopes_1.default;
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,8DAA8B;AAI5B,iBAJK,gBAAM,CAIL;AAHR,8DAA8B;AAI5B,iBAJK,gBAAM,CAIL"}
@@ -0,0 +1,3 @@
1
+ import { ScriptArgsType } from "../types";
2
+ declare const BuildCLI: (scriptConfig: ScriptArgsType) => void;
3
+ export default BuildCLI;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const Config_1 = tslib_1.__importDefault(require("../Config"));
5
+ const Build_1 = tslib_1.__importDefault(require("../Build"));
6
+ const BuildCLI = (scriptConfig) => {
7
+ const config = new Config_1.default(scriptConfig.configDir);
8
+ const command = scriptConfig.args[3];
9
+ const build = new Build_1.default(config);
10
+ switch (command) {
11
+ case "help":
12
+ console.log("Available build targets:");
13
+ console.log(" native");
14
+ console.log(" windows");
15
+ console.log(" wasm");
16
+ break;
17
+ case "native":
18
+ case "windows":
19
+ case "wasm":
20
+ build.reconfigure(command);
21
+ build.compile();
22
+ break;
23
+ default:
24
+ console.log("default");
25
+ build.compile();
26
+ break;
27
+ }
28
+ };
29
+ exports.default = BuildCLI;
30
+ //# sourceMappingURL=BuildCLI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildCLI.js","sourceRoot":"","sources":["../../src/scripts/BuildCLI.ts"],"names":[],"mappings":";;;AAEA,+DAA+B;AAC/B,6DAA6B;AAG7B,MAAM,QAAQ,GAAG,CAAC,YAA4B,EAAE,EAAE;IAChD,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAElD,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAErC,MAAM,KAAK,GAAG,IAAI,eAAK,CAAC,MAAM,CAAC,CAAC;IAEhC,QAAO,OAAO,EACd;QACE,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;YACxC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACtB,MAAM;QACR,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS,CAAC;QACf,KAAK,MAAM;YACT,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC3B,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,MAAM;QACR;YACJ,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACjB,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,MAAM;KACT;AACH,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ScriptArgsType } from "../types";
2
+ declare const ConfigCLI: (scriptConfig: ScriptArgsType) => void;
3
+ export default ConfigCLI;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const fs_1 = tslib_1.__importDefault(require("fs"));
5
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
6
+ const Config_1 = tslib_1.__importDefault(require("../Config"));
7
+ const ConfigCLI = (scriptConfig) => {
8
+ const config = new Config_1.default(scriptConfig.configDir);
9
+ const updateConfig = () => {
10
+ inquirer_1.default.prompt(config.getQuestions())
11
+ .then((answers) => config.parseAnswers(answers))
12
+ .then(() => config.saveConfig());
13
+ };
14
+ const command = scriptConfig.args[3] || "list";
15
+ switch (command) {
16
+ case "list":
17
+ if (!fs_1.default.existsSync(scriptConfig.configDir + config.configFile)) {
18
+ console.log(scriptConfig.configDir + config.configFile + " not found. Run '" + scriptConfig.binName + " config edit' to create it.");
19
+ break;
20
+ }
21
+ console.log(scriptConfig.configDir + config.configFile);
22
+ console.log(config.config);
23
+ break;
24
+ case "edit":
25
+ updateConfig();
26
+ break;
27
+ case "scopes":
28
+ const subcommand = scriptConfig.args[4] || "help";
29
+ console.log(scriptConfig.binName + " " + command + " " + subcommand);
30
+ switch (subcommand) {
31
+ case "help":
32
+ console.log("Scopes commands:");
33
+ console.log(" " + scriptConfig.binName + " " + command + " list");
34
+ break;
35
+ case "list":
36
+ console.log(Object.keys(config.config.scopes));
37
+ break;
38
+ }
39
+ break;
40
+ }
41
+ };
42
+ exports.default = ConfigCLI;
43
+ //# sourceMappingURL=ConfigCLI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigCLI.js","sourceRoot":"","sources":["../../src/scripts/ConfigCLI.ts"],"names":[],"mappings":";;;AAAA,oDAAoB;AACpB,gEAAgC;AAChC,+DAA+B;AAG/B,MAAM,SAAS,GAAG,CAAC,YAA4B,EAAE,EAAE;IACjD,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,kBAAQ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ACR,KAAK,MAAM;oBACT,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC/C,MAAM;aACT;YACD,MAAM;KACT;AACH,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ScriptArgsType } from "../types";
2
+ declare const ScopesCLI: (scriptConfig: ScriptArgsType) => void;
3
+ export default ScopesCLI;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const inquirer_1 = tslib_1.__importDefault(require("inquirer"));
5
+ const Config_1 = tslib_1.__importDefault(require("../Config"));
6
+ const Scopes_1 = tslib_1.__importDefault(require("../Scopes"));
7
+ const ScopesCLI = (scriptConfig) => {
8
+ const config = new Config_1.default(scriptConfig.configDir);
9
+ const scopes = new Scopes_1.default(config);
10
+ const command = scriptConfig.args[3] || "help";
11
+ switch (command) {
12
+ case "help":
13
+ console.log("Scopes commands:");
14
+ console.log(" " + scriptConfig.binName + " scopes help");
15
+ console.log(" -- This screen");
16
+ console.log(" " + scriptConfig.binName + " scopes list");
17
+ console.log(" -- List existing scopes");
18
+ console.log(" " + scriptConfig.binName + " scopes edit");
19
+ console.log(" -- Edit an existing scope");
20
+ console.log(" " + scriptConfig.binName + " scopes add");
21
+ console.log(" -- Create a new scope");
22
+ console.log(" " + scriptConfig.binName + " scopes delete");
23
+ console.log(" -- Delete a scope");
24
+ break;
25
+ case "list":
26
+ console.log(Object.keys(config.config.scopes));
27
+ break;
28
+ case "edit":
29
+ if (Object.keys(config.config.scopes).length === 0) {
30
+ console.log("There are no scopes to edit.");
31
+ break;
32
+ }
33
+ inquirer_1.default.prompt(scopes.askWhichScope())
34
+ .then((answers) => {
35
+ const { scopeName } = answers;
36
+ inquirer_1.default.prompt(scopes.askEditScope(config.config.scopes[scopeName].author))
37
+ .then((editAnswers) => {
38
+ editAnswers.scopeName = scopeName;
39
+ scopes.createOrEditScope(editAnswers);
40
+ })
41
+ .then(() => config.saveConfig());
42
+ });
43
+ break;
44
+ case "add":
45
+ inquirer_1.default.prompt(scopes.askNewScope())
46
+ .then((answers) => scopes.createOrEditScope(answers))
47
+ .then(() => config.saveConfig());
48
+ break;
49
+ case "delete":
50
+ if (Object.keys(config.config.scopes).length === 0) {
51
+ console.log("There are no scopes to edit.");
52
+ break;
53
+ }
54
+ inquirer_1.default.prompt(scopes.askWhichScope())
55
+ .then((answers) => {
56
+ const { scopeName } = answers;
57
+ scopes.deleteScope(scopeName);
58
+ })
59
+ .then(() => config.saveConfig());
60
+ break;
61
+ }
62
+ };
63
+ exports.default = ScopesCLI;
64
+ //# sourceMappingURL=ScopesCLI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopesCLI.js","sourceRoot":"","sources":["../../src/scripts/ScopesCLI.ts"],"names":[],"mappings":";;;AACA,gEAAgC;AAChC,+DAA+B;AAC/B,+DAA+B;AAG/B,MAAM,SAAS,GAAG,CAAC,YAA4B,EAAE,EAAE;IACjD,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,MAAM,CAAC,CAAC;IAElC,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;IAE/C,QAAO,OAAO,EACd;QACE,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,YAAY,CAAC,OAAO,GAAG,cAAc,CAAC,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,YAAY,CAAC,OAAO,GAAG,cAAc,CAAC,CAAC;YAC1D,OAAO,CAAC,GA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