Skip to content

Commit 0cd648d

Browse files
committed
nice
1 parent 8212213 commit 0cd648d

File tree

123 files changed

+142
-526
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+142
-526
lines changed

Diff for: internal-tooling/src/sync-logos.ts

+32-11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import path from 'path';
44
import fs from 'fs';
55
import debug from 'debug';
66
import chalk from 'chalk';
7+
import type { BunFile } from 'bun';
78

89
const log = debug('wd:sync-logos');
910

@@ -27,8 +28,7 @@ async function getMonorepoRoot() {
2728
function isDirectorySymlink(dirPath: string) {
2829
try {
2930
const stats = fs.lstatSync(dirPath);
30-
console.log({ isSymlink: stats.isSymbolicLink(), isDirectory: stats.isDirectory() });
31-
return stats.isSymbolicLink() && stats.isDirectory();
31+
return stats.isSymbolicLink();
3232
} catch (error) {
3333
return false;
3434
}
@@ -49,7 +49,7 @@ async function copyFiles({
4949
}) {
5050
// if we are in copy mode, remove any existing symlink and copy the files
5151
if (isLinked) {
52-
fs.rmdirSync(packageLogosDir, { recursive: true });
52+
fs.unlinkSync(packageLogosDir);
5353
log(`\t\t\t🗑️ Deleted existing symlink for ${packageDir}/logos`);
5454
} else if (isCopied) {
5555
fs.rmSync(packageLogosDir, { recursive: true, force: true });
@@ -92,23 +92,37 @@ async function symlinkFiles({
9292

9393
const source = packageLogosDir;
9494
const target = path.relative(source, logosDir);
95-
fs.symlinkSync(target, source, 'dir');
95+
fs.symlinkSync(target, source, 'junction');
9696
log(`\t\t\t🔗 Symlinked ${logosDir} to ${packageDir}/logos`);
9797
}
9898

99-
async function updatePackageJson({ packageDir, packagesDir }: { packageDir: string; packagesDir: string }) {
100-
// ensure "files" field in package.json includes "logos"
99+
async function getPackageJson({ packageDir, packagesDir }: { packageDir: string; packagesDir: string }) {
101100
const packageJsonPath = path.join(packagesDir, packageDir, 'package.json');
102101
const packageJsonFile = Bun.file(packageJsonPath);
103102
const pkg = await packageJsonFile.json();
103+
return { file: packageJsonFile, pkg, path: packageJsonPath, nicePath: path.join(packageDir, 'package.json') };
104+
}
105+
106+
async function updatePackageJson({
107+
pkg,
108+
file,
109+
path,
110+
nicePath,
111+
}: {
112+
pkg: any;
113+
file: BunFile;
114+
path: string;
115+
nicePath: string;
116+
}) {
117+
// ensure "files" field in package.json includes "logos"
104118
if (!pkg.files) {
105119
pkg.files = ['logos'];
106-
await packageJsonFile.write(JSON.stringify(pkg, null, 2));
107-
log(`\t\t📝 Added "logos" to "files" in ${packageDir}/package.json`);
120+
await file.write(JSON.stringify(pkg, null, 2));
121+
log(`\t\t📝 Added "logos" to "files" in ${nicePath}`);
108122
} else if (!pkg.files.includes('logos')) {
109123
pkg.files.push('logos');
110-
await packageJsonFile.write(JSON.stringify(pkg, null, 2));
111-
log(`\t\t📝 Added "logos" to "files" in ${packageDir}/package.json`);
124+
await file.write(JSON.stringify(pkg, null, 2));
125+
log(`\t\t📝 Added "logos" to "files" in ${nicePath}`);
112126
}
113127
}
114128

@@ -130,6 +144,13 @@ async function main() {
130144
const packageLogosDir = path.join(packagesDir, packageDir, 'logos');
131145
const isLinked = isDirectorySymlink(packageLogosDir);
132146
const isCopied = !isLinked && fs.existsSync(packageLogosDir);
147+
const details = await getPackageJson({ packageDir, packagesDir });
148+
149+
if (details.pkg.private) {
150+
log(`\t\t🔒 Skipping private package ${details.nicePath}`);
151+
continue;
152+
}
153+
133154
log(`\t\t🔁 Syncing logos to ${packageDir}`);
134155

135156
if (!copyLogos) {
@@ -150,7 +171,7 @@ async function main() {
150171
});
151172
}
152173

153-
await updatePackageJson({ packageDir, packagesDir });
174+
await updatePackageJson(details);
154175
}
155176
}
156177

Diff for: packages/-ember-data/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<p align="center">
22
<img
33
class="project-logo"
4-
src="./ember-data-logo-light.svg#gh-light-mode-only"
4+
src="./logos/ember-data-logo-light.svg#gh-light-mode-only"
55
alt="EmberData"
66
width="240px"
77
title="EmberData"
88
/>
99
<img
1010
class="project-logo"
11-
src="./ember-data-logo-dark.svg#gh-dark-mode-only"
11+
src="./logos/ember-data-logo-dark.svg#gh-dark-mode-only"
1212
alt="EmberData"
1313
width="240px"
1414
title="EmberData"

Diff for: packages/-ember-data/ember-data-logo-dark.svg

-12
This file was deleted.

0 commit comments

Comments
 (0)