mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
added post-deploy
script
This commit is contained in:
parent
aef7680498
commit
8dcf0b2850
@ -12,7 +12,8 @@
|
||||
"dev:chat_server": "cd packages/chat_server && yarn dev",
|
||||
"dev:marketplace_server": "cd packages/marketplace_server && yarn dev",
|
||||
"dev:server": "cd packages/server && yarn dev",
|
||||
"dev:client": "cd packages/app && yarn dev"
|
||||
"dev:client": "cd packages/app && yarn dev",
|
||||
"post:deploy": "node ./scripts/post-deploy.js"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/**"
|
||||
|
45
scripts/post-deploy.js
Normal file
45
scripts/post-deploy.js
Normal file
@ -0,0 +1,45 @@
|
||||
const path = require("path")
|
||||
const fs = require("fs")
|
||||
const child_process = require("child_process")
|
||||
|
||||
const sharedRootPath = path.resolve(process.cwd(), "shared")
|
||||
|
||||
const rootPath = process.cwd()
|
||||
const packagesPath = path.resolve(rootPath, "packages")
|
||||
|
||||
const getPackages = require("./utils/getPackages")
|
||||
|
||||
async function main() {
|
||||
const packages = await getPackages({
|
||||
ignore: ["shared", "app", "wrapper"]
|
||||
})
|
||||
|
||||
for await (const packageName of packages) {
|
||||
const packagePath = path.resolve(packagesPath, packageName)
|
||||
|
||||
// copy shared
|
||||
const sharedPath = path.resolve(packagePath, "src", "_shared")
|
||||
|
||||
if (fs.existsSync(sharedPath)) {
|
||||
// remove old shared folder
|
||||
fs.rmdirSync(sharedPath, { recursive: true })
|
||||
}
|
||||
|
||||
// copy entire shared folder
|
||||
// shared/* => /_shared/*
|
||||
fs.mkdirSync(sharedPath, { recursive: true })
|
||||
|
||||
await child_process.execSync(`cp -r ${sharedRootPath}/* ${sharedPath} && echo Shared lib copied`, {
|
||||
cwd: packagePath,
|
||||
stdio: "inherit"
|
||||
})
|
||||
|
||||
// run yarn build
|
||||
await child_process.execSync("yarn build", {
|
||||
cwd: packagePath,
|
||||
stdio: "inherit"
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error)
|
Loading…
x
Reference in New Issue
Block a user