update compatibility to AntOS next

This commit is contained in:
mrsang
2021-04-21 11:37:58 +02:00
parent bc33f7ff10
commit 190c2fd346
1014 changed files with 96281 additions and 2092 deletions

View File

@ -1,15 +1,9 @@
# Antedit
This is an example project, generated by AntOS Development Kit
Simple yet powerful text/code editor based on the Monaco editor,
the editor that powers VS Code.
## Howto
Use the CodePad command palette to access to the SDK functionalities:
The editor functionality can be extended by its extension mechanism.
Extension can be developed/released/isntalled by the editor itself.
1. Create new project
2. Init the project from the current folder located in side bar
3. Build and run the project
4. Release the project in zip package
## Set up build target
Open the `project.json` file from the current project tree and add/remove
build target entries. Save the file
### Change logs
- 0.1.7-a: Add keyboard shortcut support to extension actions

View File

@ -1,173 +0,0 @@
(function() {
// import the CodePad application module
const App = this.OS.application.Antedit;
// define the extension
App.extensions.AntOSDKExtension = class AntOSDKExtension extends App.EditorBaseExtension {
constructor(app) {
super("AntOSDKExtension",app);
this.sdk = undefined;
this.last_target = undefined;
}
init(){
if(! OS.API.AntOSDKBuilder)
{
throw new Error(__("{0} is not installed, please install it", "libantosdk").__());
return;
}
if(!this.sdk)
{
this.sdk = new OS.API.AntOSDKBuilder(this.logger(),"");
}
this.logger().clear();
}
create() {
this.init();
this.app
.openDialog("FileDialog", {
title: "__(New AntOS package at)",
file: { basename: "PackageName" },
mimes: ["dir"],
})
.then((d) => {
return this.mktpl(d.file.path, d.name);
});
}
build() {
this.init();
this.metadata("build.json")
.then(async (options) => {
try{
const targets = Object.keys(options.targets).map(e =>{
return {text: e};
} );
console.log(targets);
const target = await this.app.openDialog("SelectionDialog",{
title: __("Select a build target"),
data: targets
});
this.last_target = target.text;
await this.app.load(this.sdk.batch([target.text], options));
}
catch(error)
{
this.logger().error(__("Unable to read build options:{0}", error.stack));
}
})
.catch((e) => this.logger().error(__("Unable to read meta-data:{0}", e.stack)));
}
load_lib(){
this.init();
OS.API.VFS.read_files([
"sdk://core/ts/jquery.d.ts",
"sdk://core/ts/antos.d.ts"
]).then((results) => {
for(const content of results)
{
monaco.languages.typescript.typescriptDefaults.addExtraLib(content, "");
}
this.logger().info(__("Dev packages loaded"));
})
.catch((e) => this.logger().error(__("Unable to load AntOS dev packages:{0}", e.stack)));
}
build_last()
{
this.init();
if(!this.last_target)
{
return this.build();
}
this.metadata("build.json")
.then(async (options) => {
try{
await this.app.load(this.sdk.batch([this.last_target], options));
}
catch(error)
{
this.logger().error(__("Unable to read build options:{0}", error.stack));
}
})
.catch((e) => this.logger().error(__("Unable to read meta-data:{0}", e.stack)));
}
run(){
this.metadata("/build/debug/package.json")
.then((v) => {
v.text = v.name;
v.path = `${v.root}/build/debug/`;
v.filename = v.pkgname;
v.type = "app";
v.mime = "antos/app";
if (v.icon) {
v.icon = `${v.path}/${v.icon}`;
}
if (!v.iconclass && !v.icon) {
v.iconclass = "fa fa-adn";
}
this.logger().info(__("Installing..."));
OS.setting.system.packages[v.pkgname] = v;
if(v.app)
{
this.logger().info(__("Running {0}...", v.app));
return OS.GUI.forceLaunch(v.app, []);
}
this.logger().error(__("{0} is not an application", v.pkgname));
})
.catch((e) => this.logger().error(__("Unable to read package meta-data:{0}", e.stack)));
}
cleanup() {
if(this.sdk)
{
this.sdk = undefined;
}
}
/*basedir() {
return "home://workspace/antos-codepad-extensions/AntOSDKExtension"
}*/
mktpl(path,name){
const rpath = `${path}/${name}`;
const dirs = [
rpath,
`${rpath}/build`,
`${rpath}/build/release`,
`${rpath}/build/debug`,
];
const files = [
[`tpl/main.tpl`, `${rpath}/main.ts`],
[`tpl/build.tpl`, `${rpath}/build.json`],
[`tpl/package.tpl`, `${rpath}/package.json`],
[`tpl/README.tpl`, `${rpath}/README.md`],
[`tpl/scheme.tpl`, `${rpath}/scheme.html`],
];
OS.API.VFS.mkdirAll(dirs, true)
.then(async () => {
try {
await OS.API.VFS.mktpl(files, this.basedir(), (data)=>{
return data.format(name, `${path}/${name}`);
});
this.app.currdir = rpath.asFileHandle();
this.app.toggleSideBar();
return this.app.eum.active.openFile(
`${rpath}/main.ts`.asFileHandle()
);
} catch (e) {
return this.logger().error(
__("Unable to create package from template: {0}",
e.stack)
);
}
})
.catch((e) =>
this.logger().error(__("Unable to create extension directories: {0}", e.stack))
);
}
};
App.extensions.AntOSDKExtension.dependencies = [
"pkg://libantosdk/main.js"
];
}).call(this);

View File

@ -1,15 +0,0 @@
# {0}
This is an example project, generated by AntOS Development Kit
## Howto
Use the Antedit command palette to access to the SDK functionalities:
1. Create new project
2. Init the project from the current folder located in side bar
3. Build and run the project
4. Release the project in zip package
## Set up build target
Open the `build.json` file from the current project tree and add/remove
build target entries and jobs. Save the file

View File

@ -1,70 +0,0 @@
{
"name": "{0}",
"targets":{
"clean": {
"jobs": [
{
"name": "vfs-rm",
"data": ["build/debug","build/release"]
}
]
},
"build": {
"require": ["ts"],
"jobs":[
{
"name": "vfs-mkdir",
"data": ["build","build/debug","build/release"]
},
{
"name": "ts-import",
"data": ["sdk://core/ts/core.d.ts", "sdk://core/ts/jquery.d.ts","sdk://core/ts/antos.d.ts"]
},
{
"name": "ts-compile",
"data": {
"src": ["main.ts"],
"dest": "build/debug/main.js"
}
}
]
},
"uglify": {
"require": ["terser"],
"jobs": [
{
"name":"terser-uglify",
"data": ["build/debug/main.js"]
}
]
},
"copy": {
"jobs": [
{
"name": "vfs-cp",
"data": {
"src": [
"scheme.html",
"package.json",
"README.md"
],
"dest":"build/debug"
}
}
]
},
"release": {
"depend": ["clean","build","uglify", "copy"],
"require": ["zip"],
"jobs": [
{
"name": "zip-mk",
"data": {
"src":"build/debug",
"dest":"build/release/{0}.zip"
}
}
]
}
}
}

View File

@ -1,18 +0,0 @@
namespace OS {
export namespace application {
/**
*
* @class {0}
* @extends {BaseApplication}
*/
export class {0} extends BaseApplication {
constructor(args: AppArgumentsType[]) {
super("{0}", args);
}
main(): void {
// YOUR CODE HERE
}
}
}
}

View File

@ -1,16 +0,0 @@
{
"pkgname": "{0}",
"app":"{0}",
"name":"{0}",
"description":"{0}",
"info":{
"author": "",
"email": ""
},
"version":"0.0.1-a",
"category":"Other",
"iconclass":"fa fa-adn",
"mimes":["none"],
"dependencies":[],
"locale": {}
}

View File

@ -1,3 +0,0 @@
<afx-app-window apptitle="{0}" width="500" height="400" data-id="{0}">
<afx-hbox ></afx-hbox>
</afx-app-window>

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"author": "Xuan Sang LE",
"email": "mrsang@iohub.dev"
},
"version":"0.1.5-a",
"version":"0.1.7-a",
"category":"Development",
"iconclass":"bi bi-journal-code",
"mimes":[