Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove example project #339

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,7 @@ def build_assets():
for name in os.listdir(source):
shutil.copy(f"{source}/{name}", target)

print(f"[example] Copied '{source}' to '{target}'")


def build_example():
source = "example"
target = "build/example"

shutil.rmtree(target, ignore_errors=True)
shutil.copytree(source, target)

print(f"[example] Copied '{source}' to '{target}'")
print(f"[assets] Copied '{source}' to '{target}'")


def build_runner():
Expand Down Expand Up @@ -69,6 +59,5 @@ def build_server():

if __name__ == "__main__":
build_assets()
build_example()
build_runner()
build_server()
1 change: 0 additions & 1 deletion desktop/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ app.whenReady().then(async () => {

if (!is.dev) {
log.info('## Start server')
await resources.ensureExample()
await resources.ensureRunner()
await python.ensurePython()
await python.ensureLibraries()
Expand Down
16 changes: 0 additions & 16 deletions desktop/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,6 @@ import fsp from 'fs/promises'
import * as settings from './settings'
import log from 'electron-log'

export async function ensureExample() {
log.info('[ensureExample]', { path: settings.APP_RUNNER })

let message = 'existed'
if (!fs.existsSync(settings.APP_EXAMPLE)) {
await fsp.mkdir(settings.APP_EXAMPLE, { recursive: true })
await fsp.cp(settings.DIST_EXAMPLE, settings.APP_EXAMPLE, {
recursive: true,
verbatimSymlinks: true,
})
message = 'created'
}

log.info('[ensureExample]', { message })
}

export async function ensureRunner() {
log.info('[ensureRunner]', { path: settings.APP_RUNNER })

Expand Down
2 changes: 1 addition & 1 deletion desktop/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function runServer({ serverPort }: { serverPort: number }) {
// Start server
const proc = spawnFile(
settings.PYTHON_TARGET,
['-m', 'server', settings.APP_EXAMPLE, '--port', serverPort.toString()],
['-m', 'server', settings.APP_TMP, '--port', serverPort.toString()],
process.resourcesPath
)

Expand Down
4 changes: 2 additions & 2 deletions desktop/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const PORT_DEV = 4040
export const PORT_PROD = 4444

export const DIST = process.resourcesPath
export const DIST_EXAMPLE = join(DIST, 'example')
export const DIST_RUNNER = join(DIST, 'runner')
export const DIST_SERVER = join(DIST, 'server')

Expand All @@ -17,7 +16,8 @@ export const APP_USER_MODEL_ID = 'org.opendataeditor'
export const APP_HOME = join(HOME, `.${APP_NAME}`)
export const APP_RUNNER = join(APP_HOME, 'runner')
export const APP_PYTHON = join(APP_HOME, 'python')
export const APP_EXAMPLE = join(APP_HOME, 'example')
// APP_TMP will be the folder to upload files the first time the user opens the Application
export const APP_TMP = join(APP_HOME, 'tmp')

export const PYTHON_SOURCE = join(APP_RUNNER, WIN ? 'python.exe' : 'bin/python3')
export const PYTHON_TARGET = join(APP_PYTHON, WIN ? 'Scripts\\python.exe' : 'bin/python3')
2 changes: 0 additions & 2 deletions electron-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ extraResources:
to: 'pyproject.toml'
- from: 'build/runner'
to: 'runner'
- from: 'build/example'
to: 'example'
- from: 'build/server'
to: 'server'
filter:
Expand Down
2 changes: 0 additions & 2 deletions example/.opendataeditor/.gitignore

This file was deleted.

157 changes: 0 additions & 157 deletions example/.opendataeditor/metadata.json

This file was deleted.

43 changes: 0 additions & 43 deletions example/article.md

This file was deleted.

33 changes: 0 additions & 33 deletions example/chart.json

This file was deleted.

Loading
Loading