rename prod server file

master
Brad Cornes 2021-05-18 10:51:22 +01:00
parent 9b0026ca1d
commit 1d0af70caa
2 changed files with 11 additions and 4 deletions

View File

@ -185,12 +185,12 @@
} }
}, },
"scripts": { "scripts": {
"dev": "glob-exec --foreach --parallel \"src/*.ts\" -- \"ncc build {{file}} --watch -o dist/{{file.toString().replace(/^src\\//, '').replace(/\\.ts$/, '')}}\"", "dev": "npm run clean && glob-exec --foreach --parallel \"src/*.ts\" -- \"ncc build {{file}} --watch -o dist/{{file.toString().replace(/^src\\//, '').replace(/\\.ts$/, '')}}\"",
"build": "glob-exec --foreach --parallel \"src/*.ts\" -- \"ncc build {{file}} -o dist/{{file.toString().replace(/^src\\//, '').replace(/\\.ts$/, '')}}\"", "build": "npm run clean && glob-exec --foreach --parallel \"src/*.ts\" -- \"ncc build {{file}} -o dist/{{file.toString().replace(/^src\\//, '').replace(/\\.ts$/, '')}}\" && mv dist/server/index.js dist/server/tailwindServer.js && npm run minify",
"minify": "glob-exec --foreach --parallel \"dist/**/*.js\" -- \"terser {{file}} --compress --mangle --output {{file.toString()}}\"", "minify": "glob-exec --foreach --parallel \"dist/**/*.js\" -- \"terser {{file}} --compress --mangle --output {{file.toString()}}\"",
"package": "vsce package", "package": "vsce package",
"publish": "vsce publish", "publish": "vsce publish",
"vscode:prepublish": "npm run clean && npm run build && npm run minify", "vscode:prepublish": "npm run build",
"clean": "rimraf dist", "clean": "rimraf dist",
"test": "jest" "test": "jest"
}, },

View File

@ -82,8 +82,15 @@ function getUserLanguages(folder?: WorkspaceFolder): Record<string, string> {
return isObject(langs) ? langs : {} return isObject(langs) ? langs : {}
} }
export function activate(context: ExtensionContext) { export async function activate(context: ExtensionContext) {
let module = context.asAbsolutePath(path.join('dist', 'server', 'index.js')) let module = context.asAbsolutePath(path.join('dist', 'server', 'index.js'))
let prod = path.join('dist', 'server', 'tailwindServer.js')
try {
await Workspace.fs.stat(Uri.joinPath(context.extensionUri, prod))
module = context.asAbsolutePath(prod)
} catch (_) {}
let outputChannel: OutputChannel let outputChannel: OutputChannel
context.subscriptions.push( context.subscriptions.push(