Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce cli/nodejs api multi-step flows #141

Open
TwitchBronBron opened this issue Feb 2, 2024 · 0 comments
Open

Introduce cli/nodejs api multi-step flows #141

TwitchBronBron opened this issue Feb 2, 2024 · 0 comments
Milestone

Comments

@TwitchBronBron
Copy link
Member

TwitchBronBron commented Feb 2, 2024

During the rename, we removed a bunch of flows. They need to be considered for re-integration, but in a better way. Maybe cli, maybe multi-actuion cli, maybe a separate RokuDeployFlows class. We don't know yet, but we want to save them.

make a zip and then delete the staging dir (we removed the "delete staging dir" part)

createPackage.

    /**
     * Create a zip folder containing all of the specified roku project files.
     * @param options
     */
    public async createPackage(options: CreatePackageOptions, beforeZipCallback?: (info: BeforeZipCallbackInfo) => Promise<void> | void) {
        options = this.getOptions(options) as any;

        await this.stage(options);

        let manifestPath = util.standardizePath(`${options.stagingDir}/manifest`);
        let parsedManifest = await this.parseManifest(manifestPath);

        if (options.incrementBuildNumber) {
            let timestamp = dateformat(new Date(), 'yymmddHHMM');
            parsedManifest.build_version = timestamp; //eslint-disable-line camelcase
            await this.fsExtra.writeFile(manifestPath, this.stringifyManifest(parsedManifest));
        }

        if (beforeZipCallback) {
            let info: BeforeZipCallbackInfo = {
                manifestData: parsedManifest,
                stagingFolderPath: options.stagingDir,
                stagingDir: options.stagingDir
            };

            await Promise.resolve(beforeZipCallback(info));
        }
        await this.zip(options);
    }

deploy

 /**
     * Create a zip of the project, and then publish to the target Roku device
     * @param options
     */
    public async deploy(options?: DeployOptions, beforeZipCallback?: (info: BeforeZipCallbackInfo) => void) {
        options = this.getOptions(options) as any;
        await this.createPackage(options, beforeZipCallback);
        if (options.deleteInstalledChannel) {
            try {
                await this.deleteInstalledChannel(options);
            } catch (e) {
                // note we don't report the error; as we don't actually care that we could not deploy - it's just useless noise to log it.
            }
        }
        let result = await this.sideload(options as any);
        return result;
    }

deployAndSignPackage

    /**
     * executes sames steps as deploy and signs the package and stores it in the out folder
     * @param options
     */
    public async deployAndSignPackage(options?: DeployAndSignPackageOptions, beforeZipCallback?: (info: BeforeZipCallbackInfo) => void): Promise<string> {
        options = this.getOptions(options) as any;
        let retainStagingDirInitialValue = options.retainStagingDir;
        options.retainStagingDir = true;
        await this.deploy(options as any, beforeZipCallback);

        if (options.convertToSquashfs) {
            await this.convertToSquashfs(options as any);
        }

        let remotePkgPath = await this.signPackage(options as any);
        let localPkgFilePath = await this.retrieveSignedPackage(remotePkgPath, options as any);
        if (retainStagingDirInitialValue !== true) {
            await this.fsExtra.remove(options.stagingDir);
        }
        return localPkgFilePath;
    }
@TwitchBronBron TwitchBronBron added this to the v4.0.0 milestone Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant