diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fcadb2c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=lf diff --git a/assets/electron/template/app/config.cjs b/assets/electron/template/app/config.cjs index 9278ff2..8157308 100644 --- a/assets/electron/template/app/config.cjs +++ b/assets/electron/template/app/config.cjs @@ -22,6 +22,7 @@ * @property {string} appCategoryType * @property {string} icon * @property {boolean} disableAsarPackaging + * @property {boolean} enableExtraLogging * @property {boolean} enableSteamSupport * @property {number} steamGameId */ @@ -38,6 +39,7 @@ const config = { description: 'A simple Electron application', electronVersion: '', disableAsarPackaging: false, + enableExtraLogging: false, enableDisableRendererBackgrounding: false, enableInProcessGPU: false, frame: true, diff --git a/assets/electron/template/app/pipelab-plugin.cjs b/assets/electron/template/app/pipelab-plugin.cjs index 519984c..a31fd32 100644 --- a/assets/electron/template/app/pipelab-plugin.cjs +++ b/assets/electron/template/app/pipelab-plugin.cjs @@ -17,33 +17,33 @@ module.exports = class PipelabPlugin extends PluginBase { } prePackage() { - console.log('running prePackage hook') + // console.log('running prePackage hook') } generateAssets() { - console.log('running generateAssets hook') + // console.log('running generateAssets hook') } postStart() { - console.log('running postStart hook') + // console.log('running postStart hook') } packageAfterCopy() { - console.log('running packageAfterCopy hook') + // console.log('running packageAfterCopy hook') } packageAfterPrune() { - console.log('running packageAfterPrune hook') + // console.log('running packageAfterPrune hook') } packageAfterExtract() { - console.log('running packageAfterExtract hook') + // console.log('running packageAfterExtract hook') } postPackage() { - console.log('running postPackage hook') + // console.log('running postPackage hook') } preMake() { - console.log('running preMake hook') + // console.log('running preMake hook') } postMake() { - console.log('running postMake hook') + // console.log('running postMake hook') } readPackageJson() { - console.log('running readPackageJson hook') + // console.log('running readPackageJson hook') } } diff --git a/components.d.ts b/components.d.ts index 9ca32c9..5ec358d 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,12 +7,6 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { - Accordion: typeof import('primevue/accordion')['default'] - AccordionContent: typeof import('primevue/accordioncontent')['default'] - AccordionHeader: typeof import('primevue/accordionheader')['default'] - AccordionPanel: typeof import('primevue/accordionpanel')['default'] - Avatar: typeof import('primevue/avatar')['default'] - Badge: typeof import('primevue/badge')['default'] Button: typeof import('primevue/button')['default'] Checkbox: typeof import('primevue/checkbox')['default'] Chip: typeof import('primevue/chip')['default'] @@ -35,11 +29,6 @@ declare module 'vue' { Select: typeof import('primevue/select')['default'] SelectButton: typeof import('primevue/selectbutton')['default'] Skeleton: typeof import('primevue/skeleton')['default'] - Tab: typeof import('primevue/tab')['default'] - TabList: typeof import('primevue/tablist')['default'] - TabPanel: typeof import('primevue/tabpanel')['default'] - TabPanels: typeof import('primevue/tabpanels')['default'] - Tabs: typeof import('primevue/tabs')['default'] Toast: typeof import('primevue/toast')['default'] } } diff --git a/index.html b/index.html index abfb193..620183c 100644 --- a/index.html +++ b/index.html @@ -26,6 +26,7 @@ href="https://fonts.gstatic.com" crossorigin > + diff --git a/src/renderer/store/editor.ts b/src/renderer/store/editor.ts index 1064d79..43469a4 100644 --- a/src/renderer/store/editor.ts +++ b/src/renderer/store/editor.ts @@ -84,6 +84,8 @@ export type BlockToNode = T['type'] extends 'action' ? Loop : never +export type Status = 'idle' | 'running' | 'error' | 'canceled' | 'done' + export const useEditor = defineStore('editor', () => { const appStore = useAppStore() const { presets, pluginDefinitions } = storeToRefs(appStore) @@ -117,12 +119,14 @@ export const useEditor = defineStore('editor', () => { const environnements = ref>([]) /** All log lines relative to their plugin instance */ - const logLines = ref>({}) + const logLines = ref>({}) + + const nodeStatuses = ref>({}) /** The API helper */ // const api = useAPI() - const pushLine = (nodeUid: string, data: unknown[]) => { + const pushLine = (nodeUid: string, data: string) => { if (!logLines.value[nodeUid]) { logLines.value[nodeUid] = [] } @@ -638,6 +642,8 @@ export const useEditor = defineStore('editor', () => { clearLogs, logLines, + nodeStatuses, + setActiveNode, setBlockValue, setTriggerValue, diff --git a/src/renderer/style/main.scss b/src/renderer/style/main.scss index 518d6bf..bff840f 100644 --- a/src/renderer/style/main.scss +++ b/src/renderer/style/main.scss @@ -88,3 +88,16 @@ $sizes: 12, 14, 16, 18, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, font-size: #{nth($sizes, $i)}px; } } + +.rotate { + animation: rotate 2s linear infinite; +} + +@keyframes rotate { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} diff --git a/src/shared/libs/plugin-construct/export-shared.ts b/src/shared/libs/plugin-construct/export-shared.ts index bcf91d2..d00d9ca 100644 --- a/src/shared/libs/plugin-construct/export-shared.ts +++ b/src/shared/libs/plugin-construct/export-shared.ts @@ -182,7 +182,7 @@ export const exportc3p = async ( log('error, no result, crashed', e) throw new Error('ConstructExport failed: ' + e.message) } finally { - await context.browser().close() + // await context.browser().close() await context.close() } } diff --git a/src/shared/libs/plugin-electron/configure.ts b/src/shared/libs/plugin-electron/configure.ts index 101e5f4..0a68609 100644 --- a/src/shared/libs/plugin-electron/configure.ts +++ b/src/shared/libs/plugin-electron/configure.ts @@ -219,7 +219,16 @@ export const props = createAction({ control: { type: 'boolean' }, - description: 'Whether to to disable packaging project files in a single binary or not', + description: 'Whether to disable packaging project files in a single binary or not', + }, + enableExtraLogging: { + required: true, + label: 'Enable extra logging', + value: false, + control: { + type: 'boolean' + }, + description: 'Whether to enable extra logging of internal tools while bundling', }, // Flags diff --git a/src/shared/libs/plugin-electron/forge.ts b/src/shared/libs/plugin-electron/forge.ts index 5f8b369..e333aea 100644 --- a/src/shared/libs/plugin-electron/forge.ts +++ b/src/shared/libs/plugin-electron/forge.ts @@ -273,6 +273,7 @@ export const forge = async ( description: 'A simple Electron application', electronVersion: '', disableAsarPackaging: false, + enableExtraLogging: false, enableDisableRendererBackgrounding: false, enableInProcessGPU: false, frame: true, @@ -397,10 +398,11 @@ export const forge = async ( { cwd: destinationFolder, env: { - // DEBUG: '*', + DEBUG: completeConfiguration.enableExtraLogging ? '*' : '', ELECTRON_NO_ASAR: '1', ELECTRON_RUN_AS_NODE: '1', - PATH: `${shimsPaths}${delimiter}${process.env.PATH}` + PATH: `${shimsPaths}${delimiter}${process.env.PATH}`, + // DEBUG: "electron-packager" } }, log, diff --git a/src/shared/libs/plugin-electron/model.ts b/src/shared/libs/plugin-electron/model.ts index 8011eae..42fa741 100644 --- a/src/shared/libs/plugin-electron/model.ts +++ b/src/shared/libs/plugin-electron/model.ts @@ -5,6 +5,7 @@ export type ElectronConfiguration = { appVersion: string electronVersion: string disableAsarPackaging: boolean + enableExtraLogging: boolean customMainCode: string author: string description: string diff --git a/src/shared/libs/plugin-poki/assets/poki-icon.webp b/src/shared/libs/plugin-poki/assets/poki-icon.webp new file mode 100644 index 0000000..9b57d90 Binary files /dev/null and b/src/shared/libs/plugin-poki/assets/poki-icon.webp differ diff --git a/src/shared/libs/plugin-poki/export.ts b/src/shared/libs/plugin-poki/export.ts new file mode 100644 index 0000000..b693e3d --- /dev/null +++ b/src/shared/libs/plugin-poki/export.ts @@ -0,0 +1,116 @@ +import { createAction, createActionRunner, runWithLiveLogs } from '@pipelab/plugin-core' + +export const ID = 'poki-upload' + +export const uploadToPoki = createAction({ + id: ID, + name: 'Upload to Poki.io', + description: '', + icon: '', + displayString: + "`Upload ${fmt.param(params['input-folder'], 'primary', 'No path selected')} to ${fmt.param(params['user'], 'primary', 'No project')}/${fmt.param(params['project'], 'primary', 'No project')}:${fmt.param(params['channel'], 'primary', 'No channel')}`", + meta: {}, + params: { + 'input-folder': { + label: 'Folder to Upload', + value: '', + control: { + type: 'path', + options: { + properties: ['openDirectory'] + } + } + }, + project: { + label: 'Project', + description: 'This is you Poki game id', + value: '', + control: { + type: 'input', + options: { + kind: 'text' + } + } + }, + name: { + label: 'Version name', + description: 'This is the name of the version', + value: '', + control: { + type: 'input', + options: { + kind: 'text' + } + } + }, + notes: { + label: 'Version notes', + description: 'These are notes you want to specify with your version', + value: '', + control: { + type: 'input', + options: { + kind: 'text' + } + } + } + }, + outputs: {} +}) + +export const uploadToPokiRunner = createActionRunner( + async ({ log, inputs, cwd, paths }) => { + const { app } = await import('electron') + const { join, dirname } = await import('node:path') + const { mkdir, access, chmod, writeFile } = await import('node:fs/promises') + + const { unpack } = paths + const modulesPath = join(unpack, 'node_modules') + const poki = join(modulesPath, '@poki', 'cli', 'bin', 'index.js') + + const pokiJsonPath = join(inputs['input-folder'], 'poki.json') + + // create file at the same place the folder to upload + await writeFile( + pokiJsonPath, + JSON.stringify( + { + game_id: inputs.project, + build_dir: '.' + }, + undefined, + 2 + ), + 'utf-8' + ) + + // TODO: needs auth + + await runWithLiveLogs( + poki, + ['upload', '--name', inputs.name, '--notes', inputs.notes], + { + cwd: inputs['input-folder'] + }, + log, + { + onStderr(data, subprocess) { + log(data) + }, + onStdout(data, subprocess) { + log(data) + } + } + ) + + /* + { + "game_id": "c7bfd2ba-e23b-486f-9504-a6f196cb44df", + "build_dir": "dist" + } + npx @poki/cli upload --name "$(git rev-parse --short HEAD)" --notes "$(git log -1 --pretty=%B)" + */ + + log('Uploaded to poki') + } +) diff --git a/src/shared/libs/plugin-poki/index.ts b/src/shared/libs/plugin-poki/index.ts new file mode 100644 index 0000000..4883fdd --- /dev/null +++ b/src/shared/libs/plugin-poki/index.ts @@ -0,0 +1,21 @@ +import { uploadToPoki, uploadToPokiRunner } from './export' + +import { createNodeDefinition } from '@pipelab/plugin-core' +import icon from './assets/poki-icon.webp' + +export default createNodeDefinition({ + description: 'Poki', + name: 'Poki', + id: 'poki', + icon: { + type: 'image', + image: icon + }, + nodes: [ + // make and package + { + node: uploadToPoki, + runner: uploadToPokiRunner + } + ] +})