mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Updated webcomponent build script
parent
d7b81739e7
commit
1ec723edd4
|
@ -163,13 +163,13 @@
|
||||||
"build": {
|
"build": {
|
||||||
"builder": "@angular-devkit/build-angular:browser",
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/openvidu-webcomponent",
|
"outputPath": "dist/openvidu-webcomponent-rc",
|
||||||
"index": "src/index.html",
|
"index": "src/index.html",
|
||||||
"main": "src/app/openvidu-webcomponent/openvidu-webcomponent.main.ts",
|
"main": "src/app/openvidu-webcomponent/openvidu-webcomponent.main.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": "src/polyfills.ts",
|
||||||
"tsConfig": "src/app/openvidu-webcomponent/tsconfig.openvidu-webcomponent.json",
|
"tsConfig": "src/app/openvidu-webcomponent/tsconfig.openvidu-webcomponent.json",
|
||||||
"aot": true,
|
"aot": true,
|
||||||
"assets": ["src/favicon.ico", "src/assets"],
|
"assets": ["src/favicon.ico"],
|
||||||
"styles": [
|
"styles": [
|
||||||
"src/app/openvidu-webcomponent/openvidu-webcomponent.component.scss"
|
"src/app/openvidu-webcomponent/openvidu-webcomponent.component.scss"
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
const fs = require("fs-extra");
|
const fs = require('fs-extra');
|
||||||
const concat = require("concat");
|
const concat = require('concat');
|
||||||
const VERSION = require("./package.json").version;
|
const VERSION = require('./package.json').version;
|
||||||
|
const ovWebcomponentRCPath = './dist/openvidu-webcomponent-rc';
|
||||||
|
const ovWebcomponentProdPath = './dist/openvidu-webcomponent';
|
||||||
|
|
||||||
module.exports.buildWebcomponent = async () => {
|
module.exports.buildWebcomponent = async () => {
|
||||||
console.log("Building OpenVidu Web Component (" + VERSION + ")");
|
console.log('Building OpenVidu Web Component (' + VERSION + ')');
|
||||||
const tutorialWcPath = "../../openvidu-tutorials/openvidu-webcomponent/web";
|
const tutorialWcPath = '../../openvidu-tutorials/openvidu-webcomponent/web';
|
||||||
const e2eWcPath = "./e2e/webcomponent-app";
|
const e2eWcPath = './e2e/webcomponent-app';
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await buildElement();
|
await buildElement();
|
||||||
|
@ -13,35 +16,25 @@ module.exports.buildWebcomponent = async () => {
|
||||||
await copyFiles(e2eWcPath);
|
await copyFiles(e2eWcPath);
|
||||||
await renameWebComponentTestName(e2eWcPath);
|
await renameWebComponentTestName(e2eWcPath);
|
||||||
|
|
||||||
console.log("OpenVidu Web Component (" + VERSION + ") built");
|
console.log(`OpenVidu Web Component (${VERSION}) built`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function buildElement() {
|
async function buildElement() {
|
||||||
const files = [
|
const files = [`${ovWebcomponentRCPath}/runtime.js`, `${ovWebcomponentRCPath}/main.js`, `${ovWebcomponentRCPath}/polyfills.js`];
|
||||||
"./dist/openvidu-webcomponent/runtime.js",
|
|
||||||
"./dist/openvidu-webcomponent/main.js",
|
|
||||||
"./dist/openvidu-webcomponent/polyfills.js"
|
|
||||||
];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fs.ensureDir("openvidu-webcomponent");
|
await fs.ensureDir('./dist/openvidu-webcomponent');
|
||||||
await concat(
|
await concat(files, `${ovWebcomponentProdPath}/openvidu-webcomponent-${VERSION}.js`);
|
||||||
files,
|
await fs.copy(`${ovWebcomponentRCPath}/styles.css`, `${ovWebcomponentProdPath}/openvidu-webcomponent-${VERSION}.css`);
|
||||||
"./openvidu-webcomponent/openvidu-webcomponent-" + VERSION + ".js"
|
// await fs.copy(
|
||||||
);
|
// "./dist/openvidu-webcomponent/assets",
|
||||||
await fs.copy(
|
// "./openvidu-webcomponent/assets"
|
||||||
"./dist/openvidu-webcomponent/styles.css",
|
// );
|
||||||
"./openvidu-webcomponent/openvidu-webcomponent-" + VERSION + ".css"
|
|
||||||
);
|
|
||||||
await fs.copy(
|
|
||||||
"./dist/openvidu-webcomponent/assets",
|
|
||||||
"./openvidu-webcomponent/assets"
|
|
||||||
);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error executing build function in webcomponent-builds.js");
|
console.error('Error executing build function in webcomponent-builds.js');
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,14 +47,11 @@ function renameWebComponentTestName(dir) {
|
||||||
async function copyFiles(destination) {
|
async function copyFiles(destination) {
|
||||||
if (fs.existsSync(destination)) {
|
if (fs.existsSync(destination)) {
|
||||||
try {
|
try {
|
||||||
console.log(
|
console.log(`Copying openvidu-webcomponent files from: ${ovWebcomponentProdPath} to: ${destination}`);
|
||||||
"Copying openvidu-webcomponent files from: ./openvidu-webcomponent to: " +
|
await fs.ensureDir(ovWebcomponentProdPath);
|
||||||
destination
|
await fs.copy(ovWebcomponentProdPath, destination);
|
||||||
);
|
|
||||||
await fs.ensureDir("openvidu-webcomponent");
|
|
||||||
await fs.copy("./openvidu-webcomponent/", destination);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error executing copy function in webcomponent-builds.js");
|
console.error('Error executing copy function in webcomponent-builds.js');
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue