Skip to content

Introduce cli/nodejs api multi-step flows #141

@TwitchBronBron

Description

@TwitchBronBron

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;
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions