publish:dev script to help client development
This commit is contained in:
parent
dda4517cb0
commit
4cd2de5df3
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Publish Dev",
|
||||
"program": "${workspaceFolder}/scripts/publishDev.js"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -6,7 +6,8 @@
|
|||
"module": "dist/budibase-client.js",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"test": "jest"
|
||||
"test": "jest",
|
||||
"publish:dev": "yarn build && node ./scripts/publishDev.js"
|
||||
},
|
||||
"jest": {
|
||||
"globals": {
|
||||
|
@ -46,6 +47,7 @@
|
|||
"@babel/preset-env": "^7.5.5",
|
||||
"@babel/runtime": "^7.5.5",
|
||||
"babel-jest": "^24.8.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"jest": "^24.8.0",
|
||||
"rollup": "^1.12.0",
|
||||
"rollup-plugin-commonjs": "^10.0.0",
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
const { readdir, stat, copyFile } = require("fs-extra");
|
||||
const { constants } = require("fs");
|
||||
const { join } = require("path");
|
||||
|
||||
const packagesFolder = "..";
|
||||
|
||||
const jsFile = dir => join(dir, "budibase-client.js");
|
||||
const jsMapFile = dir => join(dir, "budibase-client.js.map");
|
||||
const sourceJs = jsFile("dist");
|
||||
const sourceJsMap = jsMapFile("dist");
|
||||
|
||||
const appPackages = join(packagesFolder, "server", "appPackages");
|
||||
|
||||
const publicMain = appName => join(appPackages, appName, "public", "main");
|
||||
const publicUnauth = appName => join(appPackages, appName, "public", "unauthenticated");
|
||||
const nodeModules = appName => join(appPackages, appName, "node_modules", "@budibase", "client", "dist");
|
||||
|
||||
(async () => {
|
||||
|
||||
const apps = await readdir(appPackages);
|
||||
|
||||
const copySource = file => async toDir => {
|
||||
const dest = jsFile(toDir);
|
||||
try {
|
||||
await copyFile(file, dest, constants.COPYFILE_FICLONE);
|
||||
console.log(`COPIED ${file} to ${dest}`);
|
||||
} catch(e) {
|
||||
console.log(`COPY FAILED ${file} to ${dest}: ${e}`);
|
||||
}
|
||||
}
|
||||
|
||||
const copySourceJs = copySource(sourceJs);
|
||||
const copySourceJsMap = copySource(sourceJsMap);
|
||||
|
||||
|
||||
for(let app of apps) {
|
||||
if(!(await stat(join(appPackages, app))).isDirectory()) continue;
|
||||
|
||||
await copySourceJs(nodeModules(app));
|
||||
await copySourceJsMap(nodeModules(app));
|
||||
|
||||
await copySourceJs(publicMain(app));
|
||||
await copySourceJsMap(publicMain(app));
|
||||
|
||||
await copySourceJs(publicUnauth(app));
|
||||
await copySourceJsMap(publicUnauth(app));
|
||||
}
|
||||
|
||||
})();
|
Loading…
Reference in New Issue