scripts/release/createDataWidgetsModule.js
// Update test project with latest changes and update version in themesource
Update test project with latest changes and update version in themesource
Update test project with latest changes and update version in themesource
async function updateTestProject(tmpFolder, widgetsFolders, githubUrl) {
    const stylesPath = join(repoRootPath, "packages/modules/data-widgets/src/themesource");
    const styles = await getFiles(stylesPath);
    const tmpFolderWidgets = join(tmpFolder, "widgets");
    const tmpFolderActions = join(tmpFolder, "themesource");
    console.log("Updating DataWidgets project..");
    const githubUrlDomain = githubUrl.replace("https://", "");
    const githubUrlAuthenticated = `https://${process.env.GH_USERNAME}:${process.env.GH_PAT}@${githubUrlDomain}`;
    await rm(tmpFolder, { recursive: true, force: true });
    mkdir("-p", tmpFolder);
    await execShellCommand(`git clone ${githubUrlAuthenticated} ${tmpFolder}`);
    await setLocalGitCredentials(tmpFolder);
    console.log("Copying widgets and styles..");
    await Promise.all([
        ...widgetsFolders.map(async folder => {
            const src = (await getFiles(folder, [`.mpk`]))[0];
            const dest = join(tmpFolderWidgets, basename(src));
            await rm(dest);
            await copyFile(src, dest);
        }),
        ...styles.map(async file => {
            const dest = join(tmpFolderActions, file.replace(stylesPath, ""));
            await rm(dest);
            await copyFile(file, dest);
        })
    ]);
    await execShellCommand(`echo ${process.env.TAG.split("-v")[1]} > themesource/datawidgets/.version`, tmpFolder);
    const gitOutput = await execShellCommand(`cd ${tmpFolder} && git status`);
    if (!/nothing to commit/i.test(gitOutput)) {
        await execShellCommand(`git add . && git commit -m "Updated widgets and styles" && git push`, tmpFolder);
    } else {
        console.warn(`Nothing to commit from repo ${tmpFolder}s`);
    }
}
async function updateTestProject ( tmpFolder , widgetsFolders , githubUrl ) { const stylesPath = join ( repoRootPath , "packages/modules/data-widgets/src/themesource" ) ; const styles = await getFiles ( stylesPath ) ; const tmpFolderWidgets = join ( tmpFolder , "widgets" ) ; const tmpFolderActions = join ( tmpFolder , "themesource" ) ; console . log ( "Updating DataWidgets project.." ) ; const githubUrlDomain = githubUrl . replace ( "https://" , "" ) ; const githubUrlAuthenticated = ` ${ process . env . GH_USERNAME } ${ process . env . GH_PAT } ${ githubUrlDomain } ` ; await rm ( tmpFolder , { recursive : true , force : true } ) ; mkdir ( "-p" , tmpFolder ) ; await execShellCommand ( ` ${ githubUrlAuthenticated } ${ tmpFolder } ` ) ; await setLocalGitCredentials ( tmpFolder ) ; console . log ( "Copying widgets and styles.." ) ; await Promise . all ( [ ... widgetsFolders . map ( async folder => { const src = ( await getFiles ( folder , [ ` ` ] ) ) [ 0 ] ; const dest = join ( tmpFolderWidgets , basename ( src ) ) ; await rm ( dest ) ; await copyFile ( src , dest ) ; } ) , ... styles . map ( async file => { const dest = join ( tmpFolderActions , file . replace ( stylesPath , "" ) ) ; await rm ( dest ) ; await copyFile ( file , dest ) ; } ) ] ) ; await execShellCommand ( ` ${ process . env . TAG . split ( "-v" ) [ 1 ] } ` , tmpFolder ) ; const gitOutput = await execShellCommand ( ` ${ tmpFolder } ` ) ; if ( ! / nothing to commit / i . test ( gitOutput ) ) { await execShellCommand ( ` ` , tmpFolder ) ; } else { console . warn ( ` ${ tmpFolder } ` ) ; } }
Update test project with latest changes and update version in themesource
Update test project with latest changes and update version in themesource