-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: store writer framework IDE into project directory instead of ui…
….json * feat: read file from .wf directory * feat: create a command to migrate an application * feat: migrate all the applications * feat: implement migration process when ui.json is present
- Loading branch information
1 parent
1b4e80d
commit a4cc175
Showing
57 changed files
with
644 additions
and
2,247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import os | ||
|
||
import alfred | ||
|
||
|
||
@alfred.command('apps.update', help='update the apps in the repo to the latest version') | ||
@alfred.option('--app', help='the path of the app to update') | ||
def apps_update(app: str = None): | ||
import writer | ||
from writer.core import ( | ||
wf_project_migrate_obsolete_ui_json, | ||
wf_project_read_files, | ||
wf_project_write_files, | ||
) | ||
|
||
if app is not None: | ||
apps = [app] | ||
else: | ||
apps = [ | ||
'apps/ai-starter', | ||
'apps/default', | ||
'apps/hello', | ||
'apps/pdg-tutorial', | ||
'apps/quickstart', | ||
'apps/text-demo', | ||
'tests/backend/testapp', | ||
'tests/backend/testbasicauth', | ||
'tests/backend/testmultiapp/app1', | ||
'tests/backend/testmultiapp/app2', | ||
] | ||
|
||
for app in apps: | ||
abs_path = os.path.realpath(app) | ||
if not os.path.isdir(abs_path): | ||
continue | ||
|
||
if os.path.isfile(os.path.join(abs_path, "ui.json")): | ||
print(f'{app} : migrate ui.json') | ||
wf_project_migrate_obsolete_ui_json(abs_path) | ||
|
||
metadata, components = wf_project_read_files(abs_path) | ||
if metadata.get('writer_version') == writer.VERSION: | ||
print("The app is already up to date") | ||
else: | ||
metadata['writer_version'] = writer.VERSION | ||
wf_project_write_files(abs_path, metadata, components) | ||
print(f"{app} : app is up to date") |
3 changes: 3 additions & 0 deletions
3
apps/ai-starter/.wf/components-page-0-c0f99a9e-5004-4e75-a6c6-36f17490b134.jsonl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"id": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "type": "page", "content": {"pageMode": "compact"}, "isCodeManaged": false, "position": 0, "parentId": "root", "handlers": {}, "visible": true} | ||
{"id": "bebc5fe9-63a7-46a7-b0fa-62303555cfaf", "type": "header", "content": {"text": "@{my_app.title}"}, "isCodeManaged": false, "position": 0, "parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "handlers": {}, "visible": true} | ||
{"id": "ejpasds0o8qyjs1n", "type": "section", "content": {"title": "Section Title"}, "isCodeManaged": false, "position": 1, "parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "handlers": {}, "visible": true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"id": "root", "type": "root", "content": {"appName": "AI Starter"}, "isCodeManaged": false, "position": 0, "handlers": {}, "visible": true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"writer_version": "0.7.0rc2" | ||
} |
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
apps/default/.wf/components-page-0-c0f99a9e-5004-4e75-a6c6-36f17490b134.jsonl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{"id": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "type": "page", "content": {"pageMode": "compact"}, "isCodeManaged": false, "position": 0, "parentId": "root", "handlers": {}, "visible": true} | ||
{"id": "bebc5fe9-63a7-46a7-b0fa-62303555cfaf", "type": "header", "content": {"text": "@{my_app.title}"}, "isCodeManaged": false, "position": 0, "parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "handlers": {}, "visible": true} | ||
{"id": "28d3885b-0fb8-4d41-97c6-978540015431", "type": "section", "content": {"title": "", "containerShadow": "0px 4px 11px -12px #000000"}, "isCodeManaged": false, "position": 1, "parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "handlers": {}, "visible": true} | ||
{"id": "9556c0e3-8584-4ac9-903f-908a775a33ec", "type": "button", "content": {"text": " Increment", "icon": "arrow_upward"}, "isCodeManaged": false, "position": 1, "parentId": "0d05bc9f-1655-4d0b-bc9b-c2f4c71a5117", "handlers": {"click": "increment"}, "visible": true} | ||
{"id": "51d1554e-1b88-461c-9353-1419cba0053a", "type": "button", "content": {"text": "Decrement", "icon": "arrow_downward"}, "isCodeManaged": false, "position": 0, "parentId": "0d05bc9f-1655-4d0b-bc9b-c2f4c71a5117", "handlers": {"click": "decrement"}, "visible": true} | ||
{"id": "0d05bc9f-1655-4d0b-bc9b-c2f4c71a5117", "type": "horizontalstack", "content": {"contentHAlign": "center"}, "isCodeManaged": false, "position": 0, "parentId": "f3777e75-3659-4d44-8ef7-aeec0d06855b", "handlers": {}, "visible": true} | ||
{"id": "172a14df-f73a-44fa-8fb1-e8648e7d32d2", "type": "metric", "content": {"metricValue": "@{counter}", "note": "@{message}", "name": "Counter"}, "isCodeManaged": false, "position": 0, "parentId": "c2519671-9ce7-44e7-ba4e-b0efda9cb20e", "handlers": {}, "visible": true} | ||
{"id": "d4a5e62c-c6fe-49c4-80d4-33862af8727d", "type": "columns", "content": {}, "isCodeManaged": false, "position": 0, "parentId": "28d3885b-0fb8-4d41-97c6-978540015431", "handlers": {}, "visible": true} | ||
{"id": "f3777e75-3659-4d44-8ef7-aeec0d06855b", "type": "column", "content": {"title": "", "width": "1", "contentHAlign": "center", "contentVAlign": "center"}, "isCodeManaged": false, "position": 2, "parentId": "d4a5e62c-c6fe-49c4-80d4-33862af8727d", "handlers": {}, "visible": true} | ||
{"id": "c2519671-9ce7-44e7-ba4e-b0efda9cb20e", "type": "column", "content": {"width": "1"}, "isCodeManaged": false, "position": 0, "parentId": "d4a5e62c-c6fe-49c4-80d4-33862af8727d", "handlers": {}, "visible": true} | ||
{"id": "d4a71819-7444-4083-a1c7-7995452a7abf", "type": "separator", "content": {}, "isCodeManaged": false, "position": 1, "parentId": "d4a5e62c-c6fe-49c4-80d4-33862af8727d", "handlers": {}, "visible": true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"id": "root", "type": "root", "content": {"appName": "My App"}, "isCodeManaged": false, "position": 0, "handlers": {}, "visible": true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"writer_version": "0.7.0rc2" | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.