Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
use posix path as it is supported in all platforms
  • Loading branch information
wanlwanl committed Dec 11, 2024
commit fcce6e0cb5337aaca1504e03756dfdf63ecb858f
2 changes: 1 addition & 1 deletion tools/js-sdk-release-tools/src/autoGenerateInPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async function automationGenerateInPipeline(

case SDKType.ModularClient: {
const typeSpecDirectory = path.posix.join(specFolder, typespecProject!);
const sdkRepoRoot = String(shell.pwd());
const sdkRepoRoot = String(shell.pwd()).replaceAll('\\', '/');
const skip = skipGeneration ?? false;
const repoUrl = repoHttpsUrl;
const options: ModularClientPackageOptions = {
Expand Down
6 changes: 3 additions & 3 deletions tools/js-sdk-release-tools/src/common/ciYamlUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NpmPackageInfo, VersionPolicyName } from './types';
import { basename, join, posix, resolve } from 'path';
import { posix } from 'path';
import { getNpmPackageName, getNpmPackageSafeName } from './npmUtils';
import { parse, stringify } from 'yaml';
import { readFile, writeFile } from 'fs/promises';
Expand Down Expand Up @@ -98,7 +98,7 @@ async function createManagementPlaneCiYaml(
npmPackageInfo: NpmPackageInfo
): Promise<void> {
const artifact = getArtifact(npmPackageInfo);
const templatePath = join(__dirname, 'ciYamlTemplates/ci.mgmt.template.yml');
const templatePath = posix.join(__dirname, 'ciYamlTemplates/ci.mgmt.template.yml');
const template = await readFile(templatePath, { encoding: 'utf-8' });
const parsed = parse(template.toString());
parsed.trigger.paths.include = [packageDirToSdkRoot, ciMgmtPath];
Expand All @@ -112,7 +112,7 @@ async function createManagementPlaneCiYaml(
async function writeCiYaml(ciMgmtPath: string, config: any) {
const content = comment + stringify(config);
await writeFile(ciMgmtPath, content, { encoding: 'utf-8', flush: true });
logger.info(`Created Management CI file '${resolve(ciMgmtPath)}' with content: \n${content}`);
logger.info(`Created Management CI file '${posix.resolve(ciMgmtPath)}' with content: \n${content}`);
}

async function createOrUpdateDataPlaneCiYaml(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ModularClientPackageOptions, NpmPackageInfo, PackageResult } from '../../common/types';
import { buildPackage, createArtifact } from '../../common/rushUtils';
import { initPackageResult, updateChangelogResult, updateNpmPackageResult } from '../../common/packageResultUtils';
import { join, normalize, posix, relative } from 'node:path';
import { posix } from 'node:path';

import { createOrUpdateCiYaml } from '../../common/ciYamlUtils';
import { generateChangelogAndBumpVersion } from '../../common/changlog/automaticGenerateChangeLogAndBumpVersion';
Expand All @@ -21,19 +21,19 @@ import unixify from 'unixify';
export async function generateAzureSDKPackage(options: ModularClientPackageOptions): Promise<PackageResult> {
logger.info(`Start to generate modular client package for azure-sdk-for-js.`);
const packageResult = initPackageResult();
const rushScript = join(options.sdkRepoRoot, 'common/scripts/install-run-rush.js');
const rushxScript = join(options.sdkRepoRoot, 'common/scripts/install-run-rushx.js');
const rushScript = posix.join(options.sdkRepoRoot, 'common/scripts/install-run-rush.js');
const rushxScript = posix.join(options.sdkRepoRoot, 'common/scripts/install-run-rushx.js');

try {
const packageDirectory = await getGeneratedPackageDirectory(options.typeSpecDirectory, options.sdkRepoRoot);
const packageJsonPath = join(packageDirectory, 'package.json');
const packageJsonPath = posix.join(packageDirectory, 'package.json');
let originalNpmPackageInfo: undefined | NpmPackageInfo;
if (await exists(packageJsonPath)) originalNpmPackageInfo = await getNpmPackageInfo(packageDirectory);

await remove(packageDirectory);

await generateTypeScriptCodeFromTypeSpec(options, originalNpmPackageInfo?.version, packageDirectory);
const relativePackageDirToSdkRoot = relative(normalize(options.sdkRepoRoot), normalize(packageDirectory));
const relativePackageDirToSdkRoot = posix.relative(posix.normalize(options.sdkRepoRoot), posix.normalize(packageDirectory));

await buildPackage(packageDirectory, options, packageResult, rushScript, rushxScript);

Expand Down
Loading