Skip to content

Commit

Permalink
git subrepo clone [email protected]:daisy/pipeline-ui ui
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "ui"
  merged:   "7e007fd55b"
upstream:
  origin:   "[email protected]:daisy/pipeline-ui"
  branch:   "main"
  commit:   "7e007fd55b"
git-subrepo:
  version:  "0.3.1"
  origin:   "???"
  commit:   "???"
  • Loading branch information
bertfrees committed Dec 1, 2022
1 parent bb1c256 commit 9720ce0
Show file tree
Hide file tree
Showing 148 changed files with 16,092 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ui/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
27 changes: 27 additions & 0 deletions ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
env: {
es2020: true,
node: true,
},
extends: ['prettier', 'plugin:prettier/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'@typescript-eslint/no-empty-interface': 0,
'prettier/prettier': [
'error',
{
semi: false,
endOfLine: 'auto',
singleQuote: true,
tabWidth: 4,
useTabs: false,
trailingComma: 'es5',
},
],
},
}
29 changes: 29 additions & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build
/dist

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.eslintcache
.swc

npm-debug.log*
yarn-debug.log*
yarn-error.log*
node_modules

daisy-pipeline
.vscode/settings.json
11 changes: 11 additions & 0 deletions ui/.gitrepo
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
remote = [email protected]:daisy/pipeline-ui
branch = main
commit = 7e007fd55bc983231eeeac9612b638caead93d38
parent = bb1c2569df532c753759b136dc222e4b78791567
cmdver = 0.3.1
1 change: 1 addition & 0 deletions ui/.husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions ui/.husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
4 changes: 4 additions & 0 deletions ui/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
21 changes: 21 additions & 0 deletions ui/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"sourceMaps": true,
"jsc": {
"parser": {
"target": "es2021",
"syntax": "typescript",
"jsx": true,
"tsx": true,
"dynamicImport": true,
"allowJs": true
},
"transform": {
"react": {
"pragma": "React.createElement",
"pragmaFrag": "React.Fragment",
"throwIfNamespace": true,
"runtime": "automatic"
}
}
}
}
21 changes: 21 additions & 0 deletions ui/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Romain Deltour

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 29 additions & 0 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# pipeline-ui
A user interface for the DAISY Pipeline 2

## Features

* Easy-to-use desktop application for the powerful [DAISY Pipeline](http://daisy.github.io/pipeline/) engine
* Run multiple jobs in a tabbed interface
* High contrast dark mode available
* Basic [keyboard shortcuts](#keyboard-shortcuts)


## Usage notes

* Download and install the latest [release](https://github.com/daisy/pipeline-ui/releases)
* Start the Pipeline App and wait for the Pipeline engine to start
* Choose a script and fill out the appropriate fields
* Run the job and observe its progress and results

## Keyboard shortcuts

Use these shortcuts with `Alt + Shift` on Windows or `Control + Opt` on Mac

* `0-9` to access the first 10 tabs quickly (1 = first tab, 0 = tenth tab)
* `R` to run a job
* `N` to add a new job

## Other

See the [developer documentation](https://github.com/daisy/pipeline-ui/wiki/Developer-documentation)
43 changes: 43 additions & 0 deletions ui/app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const {
devServer,
devTempBuildFolder,
name: NAME,
author: AUTHOR,
version: VERSION,
displayName: TITLE,
description: DESCRIPTION,
} = require('./package.json')

exports.APP_CONFIG = {
APP_ID: `org.daisy.${NAME}`.toLowerCase(),
NAME,
TITLE,
AUTHOR,
VERSION,
DESCRIPTION,

MAIN: {
WINDOW: {
WIDTH: 1500,
HEIGHT: 1000,
},
},

RENDERER: {
DEV_SERVER: {
URL: devServer,
},
},

FOLDERS: {
ENTRY_POINTS: {
MAIN: './src/main/index.ts',
BRIDGE: './src/renderer/bridge/index.ts',
RENDERER: './src/renderer/index.tsx',
},

INDEX_HTML: 'src/renderer/index.html',
RESOURCES: 'src/resources',
DEV_TEMP_BUILD: devTempBuildFolder,
},
}
13 changes: 13 additions & 0 deletions ui/bin/constants/colors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
exports.COLORS = {
RED: '\x1b[31m',
RESET: '\x1b[0m',
GRAY: '\x1b[90m',
BLUE: '\x1b[34m',
CYAN: '\x1b[36m',
GREEN: '\x1b[32m',
WHITE: '\x1b[37m',
YELLOW: '\x1b[33m',
MAGENTA: '\x1b[35m',
LIGHT_GRAY: '\x1b[37m',
SOFT_GRAY: '\x1b[38;5;244m',
}
3 changes: 3 additions & 0 deletions ui/bin/constants/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('./colors'),
}
34 changes: 34 additions & 0 deletions ui/bin/modules/postbuild/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { writeFile } = require('fs/promises')
const { resolve } = require('path')

const packageJSON = require('../../../package.json')

async function createPackageJSONDistVersion() {
const {
main,
scripts,
devDependencies,
devTempBuildFolder,
...restOfPackageJSON
} = packageJSON

const packageJSONDistVersion = {
main: main?.split('/')?.reverse()?.[0] || 'index.js',
...restOfPackageJSON,
}

try {
await writeFile(
resolve(devTempBuildFolder, 'package.json'),
JSON.stringify(packageJSONDistVersion, null, 2)
)
} catch ({ message }) {
console.log(`
🛑 Something went wrong!\n
🧐 There was a problem creating the package.json dist version...\n
👀 Error: ${message}
`)
}
}

createPackageJSONDistVersion()
75 changes: 75 additions & 0 deletions ui/bin/modules/release/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
const { writeFile } = require('fs/promises')
const { resolve } = require('path')
const open = require('open')

const { extractOwnerAndRepoFromGitRemoteURL } = require('./utils')
const { checkValidations } = require('./validations')
const packageJSON = require('../../../package.json')
const { question, exec } = require('../../utils')
const { COLORS } = require('../../constants')

async function makeRelease() {
console.clear()

const { version } = packageJSON

const newVersion = await question(
`Enter a new version: ${COLORS.SOFT_GRAY}(current is ${version})${COLORS.RESET} `
)

if (checkValidations({ version, newVersion })) {
return
}

packageJSON.version = newVersion

try {
console.log(
`${COLORS.CYAN}> Updating package.json version...${COLORS.RESET}`
)

await writeFile(
resolve('package.json'),
JSON.stringify(packageJSON, null, 2)
)

console.log(`\n${COLORS.GREEN}Done!${COLORS.RESET}\n`)
console.log(`${COLORS.CYAN}> Trying to release it...${COLORS.RESET}`)

exec(
[
`git commit -am v${newVersion}`,
`git tag v${newVersion}`,
`git push`,
`git push --tags`,
],
{
inherit: true,
}
)

const [repository] = exec([`git remote get-url --push origin`])
const ownerAndRepo = extractOwnerAndRepoFromGitRemoteURL(repository)

console.log(
`${COLORS.CYAN}> Opening the repository releases page...${COLORS.RESET}`
)

await open(`https://github.com/${ownerAndRepo}/releases`)

console.log(
`${COLORS.CYAN}> Opening the repository actions page...${COLORS.RESET}`
)

await open(`https://github.com/${ownerAndRepo}/actions`)

console.log(`\n${COLORS.GREEN}Done!${COLORS.RESET}\n`)
} catch ({ message }) {
console.log(`
🛑 Something went wrong!\n
👀 Error: ${message}
`)
}
}

makeRelease()
6 changes: 6 additions & 0 deletions ui/bin/modules/release/utils/extractors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
exports.extractOwnerAndRepoFromGitRemoteURL = (url) => {
return url
?.replace(/^git@github.com:|.git$/gims, '')
?.replace(/^https:\/\/github.com\/|.git$/gims, '')
?.trim()
}
3 changes: 3 additions & 0 deletions ui/bin/modules/release/utils/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('./extractors'),
}
35 changes: 35 additions & 0 deletions ui/bin/modules/release/validations/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const semver = require('semver')

const { COLORS } = require('../../../constants')

exports.checkValidations = ({ version, newVersion }) => {
if (!newVersion) {
console.log(`${COLORS.RED}No version entered${COLORS.RESET}`)

return true
}

if (!semver.valid(newVersion)) {
console.log(
`${COLORS.RED}Version must have a semver format (${COLORS.SOFT_GRAY}x.x.x${COLORS.RESET} example: ${COLORS.GREEN}1.0.1${COLORS.RESET}${COLORS.RED})${COLORS.RESET}`
)

return true
}

if (semver.ltr(newVersion, version)) {
console.log(
`${COLORS.RED}New version is lower than current version${COLORS.RESET}`
)

return true
}

if (semver.eq(newVersion, version)) {
console.log(
`${COLORS.RED}New version is equal to current version${COLORS.RESET}`
)

return true
}
}
Loading

0 comments on commit 9720ce0

Please sign in to comment.