2024-10-11 11:11:40 +02:00
|
|
|
import { fileURLToPath } from 'url'
|
|
|
|
import path from 'path'
|
2024-10-17 23:51:03 +02:00
|
|
|
import fs from 'fs'
|
2024-10-11 11:11:40 +02:00
|
|
|
import { cp } from './utils.js'
|
|
|
|
|
|
|
|
// Get the directory of the current file
|
|
|
|
const __filename = fileURLToPath(import.meta.url)
|
|
|
|
const __dirname = path.dirname(__filename)
|
|
|
|
|
|
|
|
// Path relative to the script file's directory
|
|
|
|
const DEFAULT_PROJECT_PATH = path.join(__dirname, 'empty')
|
|
|
|
|
|
|
|
export function newProject() {
|
|
|
|
console.log("Initialize a new project")
|
|
|
|
console.log(DEFAULT_PROJECT_PATH)
|
|
|
|
cp(DEFAULT_PROJECT_PATH, ".")
|
|
|
|
}
|
|
|
|
|
2024-10-17 23:51:03 +02:00
|
|
|
import { readConfig } from './site.js'
|
|
|
|
import { build } from './site.js'
|
|
|
|
|
2024-10-11 11:11:40 +02:00
|
|
|
export function buildProject() {
|
2024-10-17 23:51:03 +02:00
|
|
|
console.log("building")
|
|
|
|
|
|
|
|
let config = {
|
|
|
|
... readConfig(),
|
|
|
|
buildDir: './.build',
|
|
|
|
ignore: [".build", ".sajt"]
|
|
|
|
}
|
|
|
|
|
|
|
|
config.remote.port = 22
|
2025-02-24 18:46:31 +01:00
|
|
|
config.remote.privateKey = fs.readFileSync(path.resolve(process.env.HOME ?? "", '.ssh/id_rsa'))
|
2024-10-17 23:51:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
build(config)
|
|
|
|
|
|
|
|
//loadTemplate()
|
|
|
|
//parseMD()
|
|
|
|
//buildProject(config)
|
|
|
|
}
|
|
|
|
|
|
|
|
//import { run } from './src/desktop/main.js'
|
|
|
|
import * as proc from 'child_process'
|
|
|
|
|
|
|
|
//import { app, BrowserWindow } from 'electron'
|
|
|
|
|
|
|
|
import * as electron from 'electron'
|
|
|
|
|
|
|
|
export function appProject() {
|
|
|
|
//run()
|
|
|
|
|
|
|
|
//const child = proc.spawn(electron, ["."])
|
2025-02-24 18:46:31 +01:00
|
|
|
// console.log(electron)
|
|
|
|
// console.log(electron.default)
|
2024-10-17 23:51:03 +02:00
|
|
|
|
2025-02-24 18:46:31 +01:00
|
|
|
// const child = proc.spawn(electron.default, [".build"])
|
2024-10-17 23:51:03 +02:00
|
|
|
|
|
|
|
// https://www.matthewslipper.com/2019/09/22/everything-you-wanted-electron-child-process.html
|
|
|
|
// exec('node start', (error, stdout, stderr) => {
|
|
|
|
// if (error) {
|
|
|
|
// console.error(`error: ${error.message}`)
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (stderr) {
|
|
|
|
// console.error(`stderr: ${stderr}`);
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
|
|
|
|
// console.log(`stdout:\n${stdout}`)
|
|
|
|
// })
|
2024-10-11 11:11:40 +02:00
|
|
|
}
|