Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit b012a64

Browse files
committed
Ready to publish
1 parent 4ae12a1 commit b012a64

33 files changed

+94
-16934
lines changed

assets/gx.png

17.7 KB
Loading
Loading

gxdesignops.sketchplugin/Contents/Sketch/__deploy-to-cloud-2.js

-5,219
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__deploy-to-cloud-2.js.map

-1
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__deploy-to-cloud-status_ts

+1-1
Large diffs are not rendered by default.

gxdesignops.sketchplugin/Contents/Sketch/__deploy-to-cloud.js

-5,219
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__deploy-to-cloud.js.map

-1
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__deploy-to-cloud_ts

+1-1
Large diffs are not rendered by default.

gxdesignops.sketchplugin/Contents/Sketch/__my-command.js

-1,079
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__my-command.js.map

-1
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__see-result.js

-5,327
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__see-result.js.map

-1
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__see-result_ts

+1-1
Large diffs are not rendered by default.

gxdesignops.sketchplugin/Contents/Sketch/__send-to-queue-file.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gxdesignops.sketchplugin/Contents/Sketch/__send-to-queue-file.js.map

-1
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__send-to-queue-gx-sketch.js.map

-1
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__send-to-queue.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gxdesignops.sketchplugin/Contents/Sketch/__send-to-queue.js.map

-1
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/__set-queue-path.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gxdesignops.sketchplugin/Contents/Sketch/__set-queue-path.js.map

-1
This file was deleted.

gxdesignops.sketchplugin/Contents/Sketch/manifest.json

+4-10
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,18 @@
22
"compatibleVersion": 3,
33
"bundleVersion": 1,
44
"name": "GeneXusDesignOps",
5-
"title": "GxDesignOps",
5+
"title": "GeneXus Design Ops",
66
"commands": [
77
{
8-
"name": "Build and Deploy Prototype",
8+
"name": "Build & Deploy Prototype",
99
"identifier": "gxdesignops.deploy-to-cloud-identifier",
1010
"script": "__deploy-to-cloud_ts"
1111
},
1212
{
13-
"name": "Status",
13+
"name": "Check Last Status",
1414
"identifier": "gxdesignops.deploy-to-cloud-status-identifier",
1515
"script": "__deploy-to-cloud-status_ts"
1616
},
17-
{
18-
"name": "Send Sketch and Images ",
19-
"identifier": "gxdesignops.send-to-queue-identifier",
20-
"script": "__send-to-queue.js"
21-
},
2217
{
2318
"name": "Send GeneXus Format",
2419
"identifier": "gxdesignops.send-to-queue-identifier-gx",
@@ -46,15 +41,14 @@
4641
"gxdesignops.deploy-to-cloud-identifier",
4742
"gxdesignops.deploy-to-cloud-status-identifier",
4843
"-",
49-
"gxdesignops.send-to-queue-identifier",
5044
"gxdesignops.send-to-queue-identifier-gx",
5145
"gxdesignops.file-send-to-queue-identifier",
5246
"gxdesignops.see-result",
5347
"-",
5448
"gxdesignops.set-queue-path"
5549
]
5650
},
57-
"version": "2.4.1",
51+
"version": "2.4.2",
5852
"description": "Sketch Plugin For GeneXus Design Ops Cycles",
5953
"identifier": "GeneXus DesignOps",
6054
"disableCocoaScriptPreprocessor": true,

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gxdesignops",
33
"description": "Sketch Plugin For GeneXus Design Ops Cycles",
44
"repository": "https://github.com/genexuslabs/sketchdesignops.git",
5-
"version": "2.4.1",
5+
"version": "2.4.2",
66
"engines": {
77
"sketch": ">=49.0"
88
},
@@ -16,7 +16,7 @@
1616
"sketch-assets-file": "sketch-assets/icons.sketch"
1717
},
1818
"scripts": {
19-
"dev:sketch": "SET NODE_ENV=development && skpm-build",
19+
"dev:sketch": "NODE_ENV=development skpm-build",
2020
"build": "skpm-build",
2121
"watch": "skpm-build --watch",
2222
"start": "skpm-build --watch --run",

src/deploy-to-cloud-status.ts

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import sketch from 'sketch';
2-
import { openUrl, output, showOperationMessage, syncFetch, attachToConsole, startOperationContext, step, info } from './utils';
2+
import { openUrl, output, showOperationMessage, syncFetch, attachToConsole, startOperationContext, step, info, getFileAndQueueName, getQueuePath } from './utils';
33
import { execSync } from '@skpm/child_process';
4-
import Settings from 'sketch/settings';
5-
import { SettingKeys } from './constants';
64
import { runOnBackgroundAsync } from './utils-new';
5+
import { getSettingsData, setCurrentProject } from './settings-helper';
76

87

98
async function runCommand() {
@@ -27,21 +26,20 @@ export default async function () {
2726
export async function status() {
2827
startOperationContext("Checking status", 10);
2928

29+
let fileName;
30+
({ fileName } = getFileAndQueueName(sketch.getSelectedDocument(), getQueuePath()));
31+
3032
step("Reading Settings");
31-
32-
const projectId = Settings.settingForKey(SettingKeys.PROJECT_ID);
33-
34-
const serverUrl = Settings.settingForKey(SettingKeys.SERVER_URL);
35-
36-
const statusUrl = serverUrl + 'status?id=' + projectId;
37-
38-
33+
34+
setCurrentProject(fileName);
35+
const settings = getSettingsData();
36+
const statusUrl = settings.serverUrl + 'status?id=' + settings.projectId;
3937
step("Checking Job Status");
4038

4139
let isReady = false;
4240
let deployUrl;
4341
let pendingRetryCount = 3;
44-
let message = '';
42+
let message = 'Unknown error';
4543
let failed = false;
4644
let waitingRetries = 0;
4745
let buildingRetries = 0;

src/deploy-to-cloud.ts

+12-20
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { spawnSync, execSync } from '@skpm/child_process';
44
import Settings from 'sketch/settings';
55
import { SettingKeys } from './constants';
66
import { runOnBackgroundAsync } from './utils-new';
7+
import { getSettingsData, setCurrentProject } from './settings-helper';
78

89

910
async function runCommand() {
@@ -34,15 +35,7 @@ export default async function () {
3435
export async function publish(queuePath, doc, images) {
3536
startOperationContext("Build And Deploy Prototype", 10);
3637

37-
step("Reading Settings");
38-
39-
const projectId = Settings.settingForKey(SettingKeys.PROJECT_ID) || uuidv4();
40-
const projectName = Settings.settingForKey(SettingKeys.PROJECT_NAME) || '';
41-
const projectUserName = Settings.settingForKey(SettingKeys.PROJECT_USER_NAME) || '';
42-
const serverUrl = Settings.settingForKey(SettingKeys.SERVER_URL);
43-
44-
const enqueueUrl = serverUrl + 'enqueue';
45-
38+
4639
let enableFonts = Settings.settingForKey(SettingKeys.ENABLE_FONTS) == 1
4740

4841
var fileName;
@@ -58,6 +51,12 @@ export async function publish(queuePath, doc, images) {
5851
}
5952
}
6053

54+
step("Reading Settings");
55+
setCurrentProject(fileName);
56+
const settings = getSettingsData();
57+
const enqueueUrl = settings.serverUrl + 'enqueue';
58+
59+
6160
step("Copy Images");
6261

6362
if (images) {
@@ -112,9 +111,9 @@ export async function publish(queuePath, doc, images) {
112111

113112
const enqueueRequest = {
114113
source: 'sketch',
115-
projectId: projectId,
116-
projectName: projectName,
117-
userName: projectUserName,
114+
projectId: settings.projectId,
115+
projectName: settings.projectName,
116+
userName: settings.userName,
118117
overwrite: true
119118
}
120119

@@ -169,7 +168,7 @@ export async function publish(queuePath, doc, images) {
169168
}
170169

171170
step('Job uploaded successfully');
172-
sketch.UI.alert("GeneXus", "Your prototype has been uploaded. 💚 Please check status page for work status.");
171+
sketch.UI.alert("GeneXus", "Your prototype has been uploaded. 💚 Please check status option for work status. (Plugins -> GeneXus -> Check Status)");
173172

174173
return true;
175174
}
@@ -185,10 +184,3 @@ function upload(url, filePath) {
185184
}
186185
return false;
187186
}
188-
189-
function uuidv4() {
190-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
191-
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
192-
return v.toString(16);
193-
});
194-
}

src/manifest.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@ const { identifier, name } = require('./identifier');
22

33
const commandList = [
44
{
5-
name: 'Build and Deploy Prototype',
5+
name: 'Build & Deploy Prototype',
66
identifier: `${identifier}.deploy-to-cloud-identifier`,
77
script: './deploy-to-cloud.ts'
88
},
99
{
10-
name: 'Status',
10+
name: 'Check Last Status',
1111
identifier: `${identifier}.deploy-to-cloud-status-identifier`,
1212
script: './deploy-to-cloud-status.ts'
1313
},
14-
{
15-
name: "Send Sketch and Images ",
16-
identifier: `${identifier}.send-to-queue-identifier`,
17-
script: "./send-to-queue.js"
18-
},
14+
1915
{
2016
name: "Send GeneXus Format",
2117
identifier: `${identifier}.send-to-queue-identifier-gx`,
@@ -43,15 +39,15 @@ module.exports = {
4339
compatibleVersion: 3,
4440
bundleVersion: 1,
4541
name,
46-
title: "GxDesignOps",
42+
title: "GeneXus Design Ops",
4743
commands: commandList,
4844
menu: {
4945
title: name,
5046
items: [
5147
`${identifier}.deploy-to-cloud-identifier`,
5248
`${identifier}.deploy-to-cloud-status-identifier`,
5349
'-',
54-
`${identifier}.send-to-queue-identifier`,
50+
//`${identifier}.send-to-queue-identifier`,
5551
`${identifier}.send-to-queue-identifier-gx`,
5652
`${identifier}.file-send-to-queue-identifier`,
5753
`${identifier}.see-result`,

src/project-helper.ts

Whitespace-only changes.

src/see-result.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export default function () {
66
var queuePath = getQueuePath();
77
var fileName;
88

9-
let doc = window["doc"] || global["doc"];
10-
9+
const doc = sketch.getSelectedDocument();
10+
1111
({ fileName, queuePath } = getFileAndQueueName(doc, queuePath));
1212

1313
const urlPath = queuePath + fileName.replace(".sketch", ".url");

src/send-to-queue.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ import { SettingKeys} from './constants';
88

99
export default function() {
1010
sketch.UI.alert("Copied to Design Ops Queue ! 💚");
11-
const doc = sketch.getSelectedDocument()
11+
const doc = sketch.getSelectedDocument();
1212
var queuePath = getQueuePath();
13-
if (queuePath)
13+
if (queuePath) {
1414
if (!copySketch(queuePath, doc, true))
1515
showOperationMessage("😔 Some error occurs, see console for further details", output);
16+
}
1617
}
1718

1819

1920
export function copySketch(queuePath, doc, images) {
2021
var fileName;
2122
var path = queuePath;
23+
console.log("Starting copySketch " + queuePath);
2224
({ fileName, queuePath } = getFileAndQueueName(doc, path));
2325
console.log("copy to queue:" + queuePath);
2426
if (queuePath.localeCompare(path) != 0) {

src/set-queue-path.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function (context) {
88

99
// Read settings
1010
const projectId = Settings.settingForKey(SettingKeys.PROJECT_ID) || uuidv4();
11-
const projectName = Settings.settingForKey(SettingKeys.PROJECT_NAME) || '';
11+
//const projectName = Settings.settingForKey(SettingKeys.PROJECT_NAME) || '';
1212
const projectUserName = Settings.settingForKey(SettingKeys.PROJECT_USER_NAME) || '';
1313
let serverUrl = Settings.settingForKey(SettingKeys.SERVER_URL) || 'https://maed962my9.execute-api.us-east-1.amazonaws.com/prod/';
1414

@@ -51,8 +51,8 @@ export default function (context) {
5151
dialog.addDivider();
5252
dialog.addLeftLabel("", "Project Id");
5353
const textProjectId = dialog.addTextInput("projectId", "", projectId);
54-
dialog.addLeftLabel("", "Project Name");
55-
const textProjectName = dialog.addTextInput("projectName", "", projectName, "Project Name");
54+
//dialog.addLeftLabel("", "Project Name");
55+
//const textProjectName = dialog.addTextInput("projectName", "", projectName, "Project Name");
5656
dialog.addLeftLabel("", "User Name");
5757
const textProjectUserName = dialog.addTextInput("projectUserName", "", projectUserName, "GeneXus User Account Name");
5858
dialog.addLeftLabel("", "Server Url");
@@ -63,8 +63,8 @@ export default function (context) {
6363
textServerUrl.setEnabled(true);
6464
textProjectId.setEnabled(true);
6565
textProjectId.setEditable(false);
66-
textProjectName.setEnabled(true);
67-
textProjectName.setEnabled(true);
66+
//textProjectName.setEnabled(true);
67+
//textProjectName.setEnabled(true);
6868
textProjectUserName.setEditable(true);
6969
textProjectUserName.setEnabled(true);
7070

@@ -117,7 +117,7 @@ export default function (context) {
117117

118118
Settings.setSettingForKey(SettingKeys.SERVER_URL, serverUrl);
119119
Settings.setSettingForKey(SettingKeys.PROJECT_ID, projectId);
120-
Settings.setSettingForKey(SettingKeys.PROJECT_NAME, projectNameUserValue);
120+
//Settings.setSettingForKey(SettingKeys.PROJECT_NAME, projectNameUserValue);
121121
Settings.setSettingForKey(SettingKeys.PROJECT_USER_NAME, projectUserNameUserValue);
122122

123123
Settings.setSettingForKey("DesignOpsQueue", queueDesign);

src/settings-helper.ts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Settings } from "sketch";
2+
import { SettingKeys } from "./constants";
3+
import { normalize, uuidv4 } from "./utils-new";
4+
5+
let currentActiveProjectName: string;
6+
7+
export function setCurrentProject(name: string) {
8+
currentActiveProjectName = name.replace('.', '-');
9+
}
10+
11+
export interface SettingsData {
12+
13+
projectId: string;
14+
projectName: string;
15+
userName: string;
16+
serverUrl: string;
17+
}
18+
19+
export function getSettingsData(): SettingsData{
20+
return {
21+
projectId: normalize(Settings.settingForKey(SettingKeys.PROJECT_ID) || uuidv4() + '-' + currentActiveProjectName),
22+
userName: Settings.settingForKey(SettingKeys.PROJECT_USER_NAME) || '',
23+
serverUrl: Settings.settingForKey(SettingKeys.SERVER_URL),
24+
projectName: currentActiveProjectName
25+
}
26+
}
27+

src/utils-new.ts

+16-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { attachToConsole, Delegate, setDialogFeedback} from './utils';
66
export async function runOnBackgroundAsync(runCommand, title, description, actionName) {
77
UIDialog.setUp(context);
88

9-
const dialog = new UIDialog(title, NSMakeRect(0, 0, 400, 180), actionName, description, "Close")
9+
const dialog = new UIDialog(title, NSMakeRect(0, 0, 400, 220), actionName, description, "Close")
1010
var step = 0;
1111
var progress = dialog.addProgress(true, 0, 10);
1212
// @ts-ignore: Types sketch error
@@ -17,8 +17,6 @@ export async function runOnBackgroundAsync(runCommand, title, description, actio
1717
{
1818
'next:': async function next() {
1919
if (!(step in steps)) {
20-
// @ts-ignore: Types sketch error
21-
//lbl.setString(userOutput);
2220
return;
2321
}
2422
step++;
@@ -34,25 +32,17 @@ export async function runOnBackgroundAsync(runCommand, title, description, actio
3432
progress.setHidden(false);
3533
// @ts-ignore: Types sketch error
3634
progress.startAnimation(true);
37-
// @ts-ignore: Types sketch error
38-
//lbl.setString(userOutput);
3935
},
4036
2: async function () {
41-
// @ts-ignore: Types sketch error
42-
// lbl.setString(userOutput);
4337
},
4438
3: async function () {
4539
console.log('running command..');
4640
await runCommand();
47-
// @ts-ignore: Types sketch error
48-
//lbl.setString(userOutput);
4941
},
5042
4: async function () {
5143
timer.invalidate();
52-
// @ts-ignore: Types sketch error
53-
progress.stopAnimation(true);
5444
// @ts-ignore: Unreachable code error
55-
//lbl.setString(userOutput);
45+
progress.stopAnimation(true);
5646
}
5747
};
5848
var onExport = function onExport() {
@@ -74,4 +64,17 @@ export async function runOnBackgroundAsync(runCommand, title, description, actio
7464
return false
7565
}
7666
}
77-
}
67+
}
68+
69+
export function normalize(name: string){
70+
return name.replace(' ', '').replace('.', '-');
71+
72+
}
73+
74+
75+
export function uuidv4() {
76+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
77+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
78+
return v.toString(16);
79+
});
80+
}

test/TravelAgency.gxsketch

0 Bytes
Binary file not shown.

testTravelAgency.sketch

10.7 MB
Binary file not shown.

0 commit comments

Comments
 (0)