@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.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/build-android.config.js +30 -0
- package/build-android.jsx +86 -0
- package/build-ios.config.js +27 -0
- package/build-ios.jsx +108 -0
- package/content/app/PositronApp/App.xaml +14 -0
- package/content/app/PositronApp/App.xaml.cs +42 -0
- package/content/app/PositronApp/MauiProgram.cs +35 -0
- package/content/app/PositronApp/Platforms/Android/AndroidManifest.xml +17 -0
- package/content/app/PositronApp/Platforms/Android/MainActivity.cs +59 -0
- package/content/app/PositronApp/Platforms/Android/MainApplication.cs +15 -0
- package/content/app/PositronApp/Platforms/Android/Resources/values/colors.xml +6 -0
- package/content/app/PositronApp/Platforms/Android/Resources/values/string.xml +4 -0
- package/content/app/PositronApp/Platforms/MacCatalyst/AppDelegate.cs +9 -0
- package/content/app/PositronApp/Platforms/MacCatalyst/Info.plist +30 -0
- package/content/app/PositronApp/Platforms/MacCatalyst/Program.cs +15 -0
- package/content/app/PositronApp/Platforms/Tizen/Main.cs +16 -0
- package/content/app/PositronApp/Platforms/Tizen/tizen-manifest.xml +15 -0
- package/content/app/PositronApp/Platforms/Windows/App.xaml +8 -0
- package/content/app/PositronApp/Platforms/Windows/App.xaml.cs +24 -0
- package/content/app/PositronApp/Platforms/Windows/Package.appxmanifest +46 -0
- package/content/app/PositronApp/Platforms/Windows/app.manifest +15 -0
- package/content/app/PositronApp/Platforms/iOS/AppDelegate.cs +20 -0
- package/content/app/PositronApp/Platforms/iOS/Info.plist +34 -0
- package/content/app/PositronApp/Platforms/iOS/Program.cs +15 -0
- package/content/app/PositronApp/PositronApp.csproj +99 -0
- package/content/app/PositronApp/Properties/launchSettings.json +8 -0
- package/content/app/PositronApp/Resources/AppIcon/appicon.svg +42 -0
- package/content/app/PositronApp/Resources/AppIcon/appiconfg.svg +41 -0
- package/content/app/PositronApp/Resources/Fonts/OpenSans-Regular.ttf +0 -0
- package/content/app/PositronApp/Resources/Fonts/OpenSans-Semibold.ttf +0 -0
- package/content/app/PositronApp/Resources/Images/dotnet_bot.svg +8 -0
- package/content/app/PositronApp/Resources/Raw/AboutAssets.txt +15 -0
- package/content/app/PositronApp/Resources/Splash/splash.svg +41 -0
- package/content/app/PositronApp/Resources/Styles/Colors.xaml +44 -0
- package/content/app/PositronApp/Resources/Styles/Styles.xaml +384 -0
- package/content/app/PositronApp/appsettings.json +5 -0
- package/content/app/PositronApp/config/google-services.json +3 -0
- package/content/app/PositronApp.sln +39 -0
- package/dist/App.d.ts +3 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +5 -0
- package/dist/App.js.map +1 -0
- package/dist/AppCommand.d.ts +3 -0
- package/dist/AppCommand.d.ts.map +1 -0
- package/dist/AppCommand.js +8 -0
- package/dist/AppCommand.js.map +1 -0
- package/dist/AppInfo.d.ts +5 -0
- package/dist/AppInfo.d.ts.map +1 -0
- package/dist/AppInfo.js +10 -0
- package/dist/AppInfo.js.map +1 -0
- package/dist/cli.d.ts +39 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +155 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/init/init.d.ts +2 -0
- package/dist/commands/init/init.d.ts.map +1 -0
- package/dist/commands/init/init.js +29 -0
- package/dist/commands/init/init.js.map +1 -0
- package/dist/commands/sync/sync.d.ts +2 -0
- package/dist/commands/sync/sync.d.ts.map +1 -0
- package/dist/commands/sync/sync.js +61 -0
- package/dist/commands/sync/sync.js.map +1 -0
- package/dist/core/LocalFile.d.ts +17 -0
- package/dist/core/LocalFile.d.ts.map +1 -0
- package/dist/core/LocalFile.js +42 -0
- package/dist/core/LocalFile.js.map +1 -0
- package/dist/cwd/cwd.d.ts +13 -0
- package/dist/cwd/cwd.d.ts.map +1 -0
- package/dist/cwd/cwd.js +84 -0
- package/dist/cwd/cwd.js.map +1 -0
- package/dist/schema/appConfig.d.ts +6 -0
- package/dist/schema/appConfig.d.ts.map +1 -0
- package/dist/schema/appConfig.js +6 -0
- package/dist/schema/appConfig.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.js +1 -0
- package/package.json +23 -0
- package/src/App.ts +4 -0
- package/src/AppCommand.ts +9 -0
- package/src/AppInfo.ts +12 -0
- package/src/cli.ts +202 -0
- package/src/commands/init/init.ts +40 -0
- package/src/commands/sync/sync.ts +83 -0
- package/src/core/LocalFile.ts +59 -0
- package/src/cwd/cwd.ts +102 -0
- package/src/schema/appConfig.ts +5 -0
- 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
|
+
};
|
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
|
+
}
|