Skip to content

Commit

Permalink
Reimplement base file as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
hoontee committed Dec 3, 2023
1 parent 0333792 commit eee597c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
20 changes: 19 additions & 1 deletion Lync/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ function runJobs(event, localPath) {
}

// Build
if (MODE == 'open' || MODE == 'build') {
if (MODE == 'open' && !('base' in projectJson) || MODE == 'build') {
const buildScriptPath = projectJson.build + '.luau'
const lunePath = PLATFORM == 'windows' && CONFIG.Path_Lune.replace('%LOCALAPPDATA%', process.env.LOCALAPPDATA)
|| PLATFORM == 'macos' && CONFIG.Path_Lune.replace('$HOME', process.env.HOME)
Expand Down Expand Up @@ -1070,6 +1070,24 @@ function runJobs(event, localPath) {
})
}

// Copy base file
if (MODE == 'open' && ('base' in projectJson)) {
if (DEBUG) console.log('Copying', cyan(projectJson.base), '->', cyan(projectJson.build))
fs.copyFileSync(projectJson.base, projectJson.build)

// Open Studio
for (const key in securityKeys) delete securityKeys[key]
if (PLATFORM == 'windows' || PLATFORM == 'macos') {
if (DEBUG) console.log('Opening', cyan(projectJson.build))
spawn((PLATFORM == 'macos' && 'open -n ' || '') + `"${projectJson.build}"`, [], {
stdio: 'ignore',
detached: true,
shell: true,
windowsHide: true
})
}
}

// Sync
if (MODE == 'serve' || MODE == 'open') {

Expand Down
5 changes: 3 additions & 2 deletions Lync/validator/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ module.exports.validate = function(type, json, localPath) {
failed = true
}

if ('base' in json) {
console.error(fileError(localPath), yellow('Deprecated key'), green('base'))
if (('base' in json) && typeof json.base != 'string') {
console.error(jsonError(localPath, json, json, 'base'), yellow('Must be a string'))
failed = true
}

if (!('build' in json)) {
Expand Down

0 comments on commit eee597c

Please sign in to comment.