@positron-js/cli 1.0.3

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 (89) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/build-android.config.js +30 -0
  4. package/build-android.jsx +86 -0
  5. package/build-ios.config.js +27 -0
  6. package/build-ios.jsx +108 -0
  7. package/content/app/PositronApp/App.xaml +14 -0
  8. package/content/app/PositronApp/App.xaml.cs +42 -0
  9. package/content/app/PositronApp/MauiProgram.cs +35 -0
  10. package/content/app/PositronApp/Platforms/Android/AndroidManifest.xml +17 -0
  11. package/content/app/PositronApp/Platforms/Android/MainActivity.cs +59 -0
  12. package/content/app/PositronApp/Platforms/Android/MainApplication.cs +15 -0
  13. package/content/app/PositronApp/Platforms/Android/Resources/values/colors.xml +6 -0
  14. package/content/app/PositronApp/Platforms/Android/Resources/values/string.xml +4 -0
  15. package/content/app/PositronApp/Platforms/MacCatalyst/AppDelegate.cs +9 -0
  16. package/content/app/PositronApp/Platforms/MacCatalyst/Info.plist +30 -0
  17. package/content/app/PositronApp/Platforms/MacCatalyst/Program.cs +15 -0
  18. package/content/app/PositronApp/Platforms/Tizen/Main.cs +16 -0
  19. package/content/app/PositronApp/Platforms/Tizen/tizen-manifest.xml +15 -0
  20. package/content/app/PositronApp/Platforms/Windows/App.xaml +8 -0
  21. package/content/app/PositronApp/Platforms/Windows/App.xaml.cs +24 -0
  22. package/content/app/PositronApp/Platforms/Windows/Package.appxmanifest +46 -0
  23. package/content/app/PositronApp/Platforms/Windows/app.manifest +15 -0
  24. package/content/app/PositronApp/Platforms/iOS/AppDelegate.cs +20 -0
  25. package/content/app/PositronApp/Platforms/iOS/Info.plist +34 -0
  26. package/content/app/PositronApp/Platforms/iOS/Program.cs +15 -0
  27. package/content/app/PositronApp/PositronApp.csproj +99 -0
  28. package/content/app/PositronApp/Properties/launchSettings.json +8 -0
  29. package/content/app/PositronApp/Resources/AppIcon/appicon.svg +42 -0
  30. package/content/app/PositronApp/Resources/AppIcon/appiconfg.svg +41 -0
  31. package/content/app/PositronApp/Resources/Fonts/OpenSans-Regular.ttf +0 -0
  32. package/content/app/PositronApp/Resources/Fonts/OpenSans-Semibold.ttf +0 -0
  33. package/content/app/PositronApp/Resources/Images/dotnet_bot.svg +8 -0
  34. package/content/app/PositronApp/Resources/Raw/AboutAssets.txt +15 -0
  35. package/content/app/PositronApp/Resources/Splash/splash.svg +41 -0
  36. package/content/app/PositronApp/Resources/Styles/Colors.xaml +44 -0
  37. package/content/app/PositronApp/Resources/Styles/Styles.xaml +384 -0
  38. package/content/app/PositronApp/appsettings.json +5 -0
  39. package/content/app/PositronApp/config/google-services.json +3 -0
  40. package/content/app/PositronApp.sln +39 -0
  41. package/dist/App.d.ts +3 -0
  42. package/dist/App.d.ts.map +1 -0
  43. package/dist/App.js +5 -0
  44. package/dist/App.js.map +1 -0
  45. package/dist/AppCommand.d.ts +3 -0
  46. package/dist/AppCommand.d.ts.map +1 -0
  47. package/dist/AppCommand.js +8 -0
  48. package/dist/AppCommand.js.map +1 -0
  49. package/dist/AppInfo.d.ts +5 -0
  50. package/dist/AppInfo.d.ts.map +1 -0
  51. package/dist/AppInfo.js +10 -0
  52. package/dist/AppInfo.js.map +1 -0
  53. package/dist/cli.d.ts +39 -0
  54. package/dist/cli.d.ts.map +1 -0
  55. package/dist/cli.js +155 -0
  56. package/dist/cli.js.map +1 -0
  57. package/dist/commands/init/init.d.ts +2 -0
  58. package/dist/commands/init/init.d.ts.map +1 -0
  59. package/dist/commands/init/init.js +29 -0
  60. package/dist/commands/init/init.js.map +1 -0
  61. package/dist/commands/sync/sync.d.ts +2 -0
  62. package/dist/commands/sync/sync.d.ts.map +1 -0
  63. package/dist/commands/sync/sync.js +61 -0
  64. package/dist/commands/sync/sync.js.map +1 -0
  65. package/dist/core/LocalFile.d.ts +17 -0
  66. package/dist/core/LocalFile.d.ts.map +1 -0
  67. package/dist/core/LocalFile.js +42 -0
  68. package/dist/core/LocalFile.js.map +1 -0
  69. package/dist/cwd/cwd.d.ts +13 -0
  70. package/dist/cwd/cwd.d.ts.map +1 -0
  71. package/dist/cwd/cwd.js +84 -0
  72. package/dist/cwd/cwd.js.map +1 -0
  73. package/dist/schema/appConfig.d.ts +6 -0
  74. package/dist/schema/appConfig.d.ts.map +1 -0
  75. package/dist/schema/appConfig.js +6 -0
  76. package/dist/schema/appConfig.js.map +1 -0
  77. package/dist/tsconfig.tsbuildinfo +1 -0
  78. package/index.js +1 -0
  79. package/package.json +23 -0
  80. package/src/App.ts +4 -0
  81. package/src/AppCommand.ts +9 -0
  82. package/src/AppInfo.ts +12 -0
  83. package/src/cli.ts +202 -0
  84. package/src/commands/init/init.ts +40 -0
  85. package/src/commands/sync/sync.ts +83 -0
  86. package/src/core/LocalFile.ts +59 -0
  87. package/src/cwd/cwd.ts +102 -0
  88. package/src/schema/appConfig.ts +5 -0
  89. package/tsconfig.json +31 -0
package/src/cwd/cwd.ts ADDED
@@ -0,0 +1,102 @@
1
+ import { existsSync, mkdirSync, readdirSync, writeFileSync } from "fs";
2
+ import { copyFile, mkdir, readdir, readFile, writeFile } from "fs/promises";
3
+ import { join } from "path";
4
+ import LocalFile from "../core/LocalFile.js";
5
+
6
+ function *dirList(src): Generator<string> {
7
+ for (const d of readdirSync(src, { withFileTypes: true })) {
8
+ const c = join(src,d.name);
9
+ if (d.isDirectory()) {
10
+ yield *dirList(c);
11
+ continue;
12
+ }
13
+ yield c;
14
+ }
15
+ }
16
+
17
+ const copyDir = async (src: string, dest: string, replace) => {
18
+ if (!existsSync(dest)) {
19
+ mkdirSync(dest, { recursive: true });
20
+ }
21
+ for(const item of await readdir(src, { withFileTypes: true })) {
22
+ const srcPath = join(src, item.name);
23
+ const destPath = join(dest, item.name);
24
+ if (item.isDirectory()) {
25
+ await copyDir(srcPath, destPath, replace);
26
+ continue;
27
+ }
28
+ await copyFile(srcPath, destPath);
29
+
30
+ if (/\.(cs|xaml|json|xml|csproj)$/i.test(destPath)) {
31
+
32
+ // update config...
33
+ const buffer = await readFile(destPath);
34
+
35
+ const text = buffer.toString("utf8");
36
+
37
+ let replaced = text;
38
+ for (const [k,v] of replace) {
39
+ replaced = replaced.replaceAll(k, v);
40
+ }
41
+
42
+ if (replaced !== text) {
43
+ await writeFile(destPath, replaced);
44
+ }
45
+ }
46
+
47
+ console.log(`copy ${destPath}`)
48
+ }
49
+ };
50
+
51
+ export const cwd = {
52
+
53
+ get path() {
54
+ return process.cwd();
55
+ },
56
+
57
+ createTextFileIfNotExists(file, data: string | Buffer) {
58
+ const path = join(this.path, file);
59
+ if (existsSync(path)) {
60
+ return;
61
+ }
62
+ writeFileSync(file, data);
63
+ },
64
+
65
+ exists(path) {
66
+ return existsSync(join(this.path, path));
67
+ },
68
+
69
+ file(path) {
70
+ return new LocalFile(join(this.path, path))
71
+ },
72
+
73
+ async copyFolder(src, dest, config) {
74
+ const path = join(this.path, dest);
75
+ const replace = [];
76
+ for (const key in config) {
77
+ if (Object.prototype.hasOwnProperty.call(config, key)) {
78
+ const element = config[key];
79
+ replace.push([`$$config.${key}$$`, element]);
80
+ }
81
+ }
82
+ await copyDir(src, path, replace);
83
+ },
84
+
85
+ async readFile(path) {
86
+ path = join(this.path, path);
87
+ return await readFile(path, "utf8");
88
+ },
89
+
90
+ async readJson(path) {
91
+ return JSON.parse(await readFile(path, "utf8"));
92
+ },
93
+
94
+ writeFile(path, content, encoding = "utf8" as BufferEncoding) {
95
+ return writeFile(path, content, encoding);
96
+ },
97
+
98
+ readDir(path) {
99
+ return dirList(join(this.path, path));
100
+ }
101
+
102
+ };
@@ -0,0 +1,5 @@
1
+ export const appConfig = {
2
+ "name": "App Name",
3
+ "id": "com.neurospeech.app",
4
+ "url": "https://socialmail.me"
5
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "jsx": "react",
4
+ "target": "ES2021",
5
+ "module":"NodeNext",
6
+ "incremental": true,
7
+ "sourceMap": true,
8
+ "declaration": true,
9
+ "declarationMap": true,
10
+ "outDir": "dist",
11
+ "skipDefaultLibCheck": true,
12
+ "skipLibCheck": true,
13
+ "experimentalDecorators": true,
14
+ "emitDecoratorMetadata": true,
15
+ "jsxFactory": "XNode.create",
16
+ "lib": [
17
+ "ES2018",
18
+ "ES2021.WeakRef",
19
+ "esnext.disposable",
20
+ "ES2021.String",
21
+ "ES2022.Object"
22
+ ]
23
+ },
24
+ "include": [
25
+ "src/**/*"
26
+ ],
27
+ "exclude": [
28
+ "node_modules",
29
+ "tests"
30
+ ]
31
+ }