scripts/release/createNativeModules.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, nativeWidgetFolders, githubUrl) {
    const jsActionsPath = join(repoRootPath, "packages/jsActions/mobile-resources-native/dist");
    const jsActions = await getFiles(jsActionsPath);
    const tmpFolderWidgets = join(tmpFolder, "widgets");
    const tmpFolderActions = join(tmpFolder, "javascriptsource/nativemobileresources/actions");
    console.log("Updating NativeComponentsTestProject..");
    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 js actions..");
    await Promise.all([
        ...nativeWidgetFolders.map(async folder => {
            const src = (await getFiles(folder, [`.mpk`]))[0];
            const dest = join(tmpFolderWidgets, basename(src));
            await rm(dest);
            await copyFile(src, dest);
        }),
        ...jsActions.map(async file => {
            const dest = join(tmpFolderActions, file.replace(jsActionsPath, ""));
            await rm(dest);
            await copyFile(file, dest);
        })
    ]);
    await execShellCommand(
        `echo ${process.env.TAG.split("-v")[1]} > themesource/nativemobileresources/.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 native widgets and js actions" && git push`,
            tmpFolder
        );
    } else {
        console.warn(`Nothing to commit from repo ${tmpFolder}s`);
    }
}
async function updateTestProject ( tmpFolder , nativeWidgetFolders , githubUrl ) { const jsActionsPath = join ( repoRootPath , "packages/jsActions/mobile-resources-native/dist" ) ; const jsActions = await getFiles ( jsActionsPath ) ; const tmpFolderWidgets = join ( tmpFolder , "widgets" ) ; const tmpFolderActions = join ( tmpFolder , "javascriptsource/nativemobileresources/actions" ) ; console . log ( "Updating NativeComponentsTestProject.." ) ; 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 js actions.." ) ; await Promise . all ( [ ... nativeWidgetFolders . map ( async folder => { const src = ( await getFiles ( folder , [ ` ` ] ) ) [ 0 ] ; const dest = join ( tmpFolderWidgets , basename ( src ) ) ; await rm ( dest ) ; await copyFile ( src , dest ) ; } ) , ... jsActions . map ( async file => { const dest = join ( tmpFolderActions , file . replace ( jsActionsPath , "" ) ) ; 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