Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion .scripts/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ export class Logger {
}

log(text?: string): void {
text = text || "";
console.log(text);
this._capture(text || "");
this._capture(text);
}

clearCapturedText(): void {
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ steps:
verbose: false

- task: Npm@1
displayName: 'npm run build'
displayName: 'npm run build -- --logging-level=trace'
inputs:
command: custom
verbose: false
customCommand: run build
customCommand: 'run build -- --logging-level=trace'

- task: PublishBuildArtifacts@1
inputs:
Expand Down
58 changes: 40 additions & 18 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ gulp.task('codegen', async () => {

type CreatePackageType = "pack" | "publish"

const createPackages = (type: CreatePackageType = "pack") => {
function createPackages(type: CreatePackageType): void {
let errorPackages = 0;
let upToDatePackages = 0;
let publishedPackages = 0;
Expand All @@ -113,28 +113,42 @@ const createPackages = (type: CreatePackageType = "pack") => {
fs.mkdirSync(dropPath);
}

const getAllPackageFolders = function *(p: string): IterableIterator<string> {
for (const dir of fs.readdirSync(p, { withFileTypes: true })) {
if (dir.isDirectory()) {
const dirPath = path.join(p, dir.name)
const packageJsonPath = path.join(dirPath, "package.json")
if (fs.existsSync(packageJsonPath)) {
yield dirPath
} else {
yield *getAllPackageFolders(dirPath)
}
const folderNamesToIgnore: string[] = [ "node_modules" ];

function getAllPackageFolders(folderPath: string, result?: string[]): string[] {
if (result == undefined) {
result = [];
}

const folderName: string = path.basename(folderPath);
if (folderNamesToIgnore.indexOf(folderName) === -1 && fs.existsSync(folderPath) && fs.lstatSync(folderPath).isDirectory()) {
const packageJsonFilePath: string = path.join(folderPath, "package.json");
if (fs.existsSync(packageJsonFilePath) && fs.lstatSync(packageJsonFilePath).isFile()) {
result.push(folderPath);
}

for (const folderEntryName of fs.readdirSync(folderPath)) {
const folderEntryPath: string = path.join(folderPath, folderEntryName);
getAllPackageFolders(folderEntryPath, result);
}
}

return result;
}

for (const packageFolderPath of getAllPackageFolders(path.resolve("packages"))) {
const packagesToSkip: string[] = ["@azure/keyvault"];

for (const packageFolderPath of getAllPackageFolders(path.resolve(__dirname, "packages"))) {
_logger.logTrace(`INFO: Processing ${packageFolderPath}`);

const packageJsonFilePath: string = path.join(packageFolderPath, "package.json");
const packageJson: { [propertyName: string]: any } = require(packageJsonFilePath);
const packageName: string = packageJson.name;

if (!args.package || args.package === packageName || endsWith(packageName, `-${args.package}`)) {
if (packagesToSkip.indexOf(packageName) !== -1) {
_logger.log(`INFO: Skipping package ${packageName}`);
++publishedPackagesSkipped;
} else if (!args.package || args.package === packageName || endsWith(packageName, `-${args.package}`)) {
const localPackageVersion: string = packageJson.version;
if (!localPackageVersion) {
_logger.log(`ERROR: "${packageJsonFilePath}" doesn't have a version specified.`);
Expand Down Expand Up @@ -180,14 +194,22 @@ const createPackages = (type: CreatePackageType = "pack") => {
}
}

function padLeft(value: number, minimumWidth: number, padCharacter: string = " "): string {
let result: string = value.toString();
while (result.length < minimumWidth) {
result = padCharacter + result;
}
return result;
}
const minimumWidth: number = Math.max(errorPackages, upToDatePackages, publishedPackages, publishedPackagesSkipped).toString().length;
_logger.log();
_logger.log(`Error packages: ${errorPackages}`);
_logger.log(`Up to date packages: ${upToDatePackages}`);
_logger.log(`Packed packages: ${publishedPackages}`);
_logger.log(`Skipped packages: ${publishedPackagesSkipped}`);
_logger.log(`Error packages: ${padLeft(errorPackages, minimumWidth)}`);
_logger.log(`Up to date packages: ${padLeft(upToDatePackages, minimumWidth)}`);
_logger.log(`Packed packages: ${padLeft(publishedPackages, minimumWidth)}`);
_logger.log(`Skipped packages: ${padLeft(publishedPackagesSkipped, minimumWidth)}`);
}

gulp.task('pack', () => createPackages());
gulp.task('pack', () => createPackages("pack"));

gulp.task('publish', () => createPackages("publish"));

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,25 @@
"publish-all": "gulp publish"
},
"devDependencies": {
"@octokit/rest": "^15.13.0",
"@octokit/rest": "15.17.0",
"@types/glob": "^7.1.1",
"@types/gulp": "^4.0.5",
"@types/js-yaml": "^3.11.2",
"@types/minimist": "^1.2.0",
"@types/node": "^10.11.4",
"@types/nodegit": "^0.22.3",
"@types/node": "^10.12.10",
"@types/nodegit": "^0.22.5",
"@types/yargs": "^12.0.1",
"colors": "^1.3.2",
"fs": "0.0.1-security",
"fs": "^0.0.1-security",
"gulp": "^3.9.1",
"js-yaml": "^3.12.0",
"minimist": "^1.2.0",
"nodegit": "^0.23.0-alpha.1",
"nodegit": "^0.23.0",
"path": "^0.12.7",
"ts-node": "^7.0.1",
"typescript": "^3.0.3",
"webpack": "^4.19.0",
"yargs": "^12.0.2"
"typescript": "^3.1.6",
"webpack": "^4.26.1",
"yargs": "^12.0.5"
},
"engineStrict": true,
"engines": {
Expand Down
21 changes: 0 additions & 21 deletions packages/@azure/arm-datamigration/LICENSE.txt

This file was deleted.

96 changes: 0 additions & 96 deletions packages/@azure/arm-datamigration/README.md

This file was deleted.

This file was deleted.

This file was deleted.

Loading