@autorest/powershell
Version:
AutoRest PowerShell Cmdlet Generator
28 lines (26 loc) • 1.44 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.generatePsm1Internal = void 0;
const psscript_file_1 = require("../file-formats/psscript-file");
const path_1 = require("path");
const psm1_1 = require("./psm1");
async function generatePsm1Internal(project) {
const psm1 = new psscript_file_1.PSScriptFile(await project.state.readFile(project.psm1Internal) || '');
const dllPath = (0, path_1.relative)(project.internalFolder, project.dll);
psm1.prepend('Generated', `
# Load the private module dll
$null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '${dllPath}')
# Get the private module's instance
$instance = [${project.serviceNamespace.moduleClass.declaration}]::Instance
# Export nothing to clear implicit exports
Export-ModuleMember
${(0, psm1_1.getProfileExportScript)('$PSScriptRoot', false)}`);
psm1.trim();
project.state.writeFile(project.psm1Internal, `${psm1}`, undefined, 'source-file-powershell');
}
exports.generatePsm1Internal = generatePsm1Internal;
//# sourceMappingURL=psm1.internal.js.map
;