Skip to content

Commit e68f5c1

Browse files
Develop (#186)
* Angular upgrade to v19 and critical vuln fixes (#183) * #SS-I12: fix - ng 19 upgrade * #SS-I12: fix - ng 19 upgrade * #SS-I12: fix - ng 19 upgrade * #SS-I12: fix - ng 19 upgrade * #SS-I21: fix - angular upgrade to 19 * #SS-I21: fix - removed unused workflow * #SS-I21: fix - linting fix * Changes in asset allocation druid build (#184) * refactor: Consolidate web component assets and scripts into a new `assets/video-player` folder. * refactor: relocate web component build output and assets into dedicated `assets/video-player` subdirectories. * refactor: Updated package version * refactor: Relocate video player web component files and assets to a dedicated directory. * End event (#185) * fix: trigger end event * package name * Version change * reverted changes * feedbacks --------- Co-authored-by: yashash <126703764+yashashkumar@users.noreply.github.com>
1 parent 1bb5099 commit e68f5c1

28 files changed

Lines changed: 12522 additions & 16744 deletions

.circleci/config.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.eslintrc.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,40 @@
4646
"plugin:@angular-eslint/template/recommended"
4747
],
4848
"rules": {}
49+
},
50+
{
51+
"files": [
52+
"projects/sunbird-video-player/**/*.ts"
53+
],
54+
"parserOptions": {
55+
"project": [
56+
"projects/sunbird-video-player/tsconfig.lib.json",
57+
"projects/sunbird-video-player/tsconfig.spec.json"
58+
],
59+
"createDefaultProgram": true
60+
},
61+
"extends": [
62+
"plugin:@angular-eslint/recommended",
63+
"plugin:@angular-eslint/template/process-inline-templates",
64+
"plugin:@typescript-eslint/recommended"
65+
],
66+
"rules": {}
67+
},
68+
{
69+
"files": [
70+
"projects/video-player-wc/**/*.ts"
71+
],
72+
"parserOptions": {
73+
"project": [
74+
"projects/video-player-wc/tsconfig.app.json",
75+
"projects/video-player-wc/tsconfig.spec.json"
76+
],
77+
"createDefaultProgram": true
78+
},
79+
"extends": [
80+
"plugin:@angular-eslint/recommended"
81+
],
82+
"rules": {}
4983
}
5084
]
5185
}

.github/workflows/jira-description-action.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/publish_module.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
- name: Set up Node.js
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: '22.15.0'
18+
node-version: '22.21.1'
1919

2020
- name: Install dependencies
21-
run: npm ci --legacy-peer-deps
21+
run: npm i --legacy-peer-deps
2222

2323
- name: Build and publish package
2424
env:
@@ -27,5 +27,5 @@ jobs:
2727
npm run build-lib
2828
npm pack ./dist/sunbird-video-player
2929
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
30-
npm publish project-sunbird-sunbird-video-player-v9-*
30+
npm publish project-sunbird-sunbird-video-player-v9-* --access public
3131

.github/workflows/publish_web_component.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
- name: Set up Node.js
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: '22.15.0'
18+
node-version: '22.21.1'
1919

2020
- name: Install dependencies
21-
run: npm ci --legacy-peer-deps
21+
run: npm i --legacy-peer-deps
2222

2323
- name: Build and publish package
2424
env:

assets-copy.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
const fs = require('fs-extra');
22
(async () => {
33
try {
4-
var source = "projects/sunbird-video-player/node_modules/@project-sunbird/sunbird-player-sdk-v9/lib/assets";
5-
const dest = "dist/sunbird-video-player/lib/assets/";
6-
const isAssetsExists = await fs.pathExists(dest)
7-
var libsource = "projects/sunbird-video-player/src/lib/assets";
8-
if (isAssetsExists) {
9-
await fs.remove(dest);
10-
}
11-
await fs.ensureDir(dest);
12-
await fs.copy(source, dest)
13-
await fs.copy(libsource, dest)
4+
var source = "projects/sunbird-video-player/node_modules/@project-sunbird/sunbird-player-sdk-v9/lib/assets";
5+
const dest = "dist/sunbird-video-player/lib/assets/";
6+
const isAssetsExists = await fs.pathExists(dest)
7+
var libsource = "projects/sunbird-video-player/src/lib/assets";
8+
if (isAssetsExists) {
9+
await fs.remove(dest);
10+
}
11+
await fs.ensureDir(dest);
12+
const isSdkAssetsExists = await fs.pathExists(source);
13+
if (isSdkAssetsExists) {
14+
await fs.copy(source, dest);
15+
}
16+
await fs.copy(libsource, dest)
1417
console.log('Assets copied successfully')
1518
} catch (err) {
1619
console.error("Error while copying assets", err)

build-wc.js

Lines changed: 77 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const fs = require("fs-extra");
22
const concat = require("concat");
3+
const path = require("path");
34

45
const build = async () => {
56
const files = [
@@ -11,24 +12,85 @@ const build = async () => {
1112
"projects/sunbird-video-player/src/lib/assets/videojs-markers.js",
1213
"projects/sunbird-video-player/src/lib/assets/videojs-transcript-click.min.js"
1314
];
15+
1416
const cssFiles = [
1517
"./dist/video-player-wc/styles.css",
1618
"projects/sunbird-video-player/src/lib/assets/videojs.markers.min.css",
1719
];
18-
await fs.ensureDir("dist/video-player-wc");
19-
// make signle js file for web component
20-
await concat(files, "web-component/sunbird-video-player.js");
21-
await fs.copy("./dist/video-player-wc/assets", "web-component/assets");
22-
const assetFilesToBeDeleted = ["videojs-markers.js", "videojs-transcript-click.min.js", "videojs.markers.min.css"]
23-
24-
assetFilesToBeDeleted.forEach(async (file) => {
25-
await fs.remove(`web-component/assets/${file}`)
26-
await fs.remove(`web-component-demo/assets/${file}`)
27-
})
28-
await fs.copy("README.md", "web-component/README.md")
29-
30-
// make signle css file for web component
31-
await concat(cssFiles, "web-component/styles.css");
32-
console.log("Files concatenated successfully!!!");
20+
21+
const outputDir = "web-component/assets/video-player";
22+
const packageJsonSource = "web-component/package.json";
23+
24+
// Backup package.json if it exists
25+
let packageJsonContent = null;
26+
if (await fs.pathExists(packageJsonSource)) {
27+
packageJsonContent = await fs.readJson(packageJsonSource);
28+
}
29+
30+
// Clean and create directory
31+
await fs.remove("web-component");
32+
await fs.ensureDir(outputDir);
33+
34+
// Copy all web component files to assets/video-player/
35+
await concat(files, `${outputDir}/sunbird-video-player.js`);
36+
await concat(cssFiles, `${outputDir}/styles.css`);
37+
38+
// Ensure dist assets directory exists and copy from source
39+
await fs.ensureDir("./dist/video-player-wc/assets");
40+
await fs.copy("projects/sunbird-video-player/src/lib/assets", "./dist/video-player-wc/assets");
41+
42+
// Copy assets contents to assets/video-player/
43+
if (await fs.pathExists("./dist/video-player-wc/assets")) {
44+
await fs.copy("./dist/video-player-wc/assets", outputDir);
45+
}
46+
47+
// Remove the bundled asset files that were already concatenated
48+
const assetFilesToBeDeleted = [
49+
"videojs-markers.js",
50+
"videojs-transcript-click.min.js",
51+
"videojs.markers.min.css"
52+
];
53+
54+
for (const file of assetFilesToBeDeleted) {
55+
await fs.remove(`${outputDir}/${file}`);
56+
}
57+
58+
// Copy README to web-component root
59+
await fs.copy("README.md", "web-component/README.md");
60+
61+
// Restore package.json to both locations
62+
if (packageJsonContent) {
63+
// Keep package.json at web-component root
64+
await fs.writeJson(packageJsonSource, packageJsonContent, { spaces: 2 });
65+
console.log("✅ package.json restored to web-component/");
66+
67+
// Also copy to assets/video-player directory
68+
await fs.writeJson(`${outputDir}/package.json`, packageJsonContent, { spaces: 2 });
69+
console.log("✅ package.json copied to web-component/assets/video-player/");
70+
}
71+
72+
// Also copy to demo folder with same structure
73+
const demoDir = "web-component-demo/assets/video-player";
74+
await fs.remove("web-component-demo/assets");
75+
await fs.ensureDir(demoDir);
76+
await concat(files, `${demoDir}/sunbird-video-player.js`);
77+
await concat(cssFiles, `${demoDir}/styles.css`);
78+
79+
// Copy assets to demo directory
80+
if (await fs.pathExists("./dist/video-player-wc/assets")) {
81+
await fs.copy("./dist/video-player-wc/assets", demoDir);
82+
}
83+
84+
// Remove the bundled asset files from demo as well
85+
for (const file of assetFilesToBeDeleted) {
86+
await fs.remove(`${demoDir}/${file}`);
87+
}
88+
89+
// Clean up old files from previous build structure (if they exist)
90+
await fs.remove("web-component-demo/sunbird-video-player.js");
91+
await fs.remove("web-component-demo/styles.css");
92+
93+
console.log("✅ Files organized successfully!");
94+
console.log(`📁 Output: ${outputDir}/`);
3395
};
3496
build();

0 commit comments

Comments
 (0)