Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: PabloSzx/bob-esbuild
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bob-tsm@0.4.4
Choose a base ref
...
head repository: PabloSzx/bob-esbuild
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bob-tsm@0.4.5
Choose a head ref
  • 19 commits
  • 13 files changed
  • 4 contributors

Commits on Jan 3, 2022

  1. update

    PabloSzx committed Jan 3, 2022
    Copy the full SHA
    8b69768 View commit details

Commits on Jan 7, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    a91cfaf View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d5431ca View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    Josh-Walker-GM Josh GM Walker
    Copy the full SHA
    272c40a View commit details
  4. update lock

    PabloSzx committed Jan 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8526201 View commit details

Commits on Jan 8, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    7b7f8f4 View commit details

Commits on Jan 14, 2022

  1. Copy the full SHA
    fe4d77c View commit details
  2. Copy the full SHA
    a87fa88 View commit details
  3. Update dependency next to ^12.0.8

    renovate-bot authored and PabloSzx committed Jan 14, 2022
    Copy the full SHA
    0d65eed View commit details
  4. Copy the full SHA
    679d9aa View commit details
  5. Update dependency rollup to ^2.64.0

    renovate-bot authored and PabloSzx committed Jan 14, 2022
    Copy the full SHA
    e9d72d6 View commit details
  6. update lock

    PabloSzx committed Jan 14, 2022
    Copy the full SHA
    8b464ec View commit details
  7. Copy the full SHA
    ab336b9 View commit details
  8. Copy the full SHA
    6f0f1dc View commit details
  9. allow to rewrite package.json before writeFile with config "rewritePa…

    …ckage" & improve PackageJSON type
    PabloSzx committed Jan 14, 2022
    Copy the full SHA
    0696aae View commit details
  10. Version Packages (#247)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Jan 14, 2022
    Copy the full SHA
    c7c34d5 View commit details

Commits on Jan 15, 2022

  1. Update dependency globby to ^12.1.0

    renovate-bot authored and PabloSzx committed Jan 15, 2022
    Copy the full SHA
    6c30622 View commit details
  2. Copy the full SHA
    c09357a View commit details
  3. Version Packages (#249)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Jan 15, 2022
    Copy the full SHA
    c17e601 View commit details
4 changes: 2 additions & 2 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
@@ -35,10 +35,10 @@
"test": "bob-tsm --cjs --paths src/index.ts && bob-tsm --paths src/index.ts"
},
"dependencies": {
"bob-esbuild": "workspace:^3.2.2",
"bob-esbuild": "workspace:^3.2.3",
"bob-esbuild-cli": "workspace:^3.0.1",
"bob-ts": "workspace:^3.0.1",
"bob-tsm": "workspace:^0.4.4",
"bob-tsm": "workspace:^0.4.5",
"shared": "workspace:^1.0.0"
},
"publishConfig": {
6 changes: 3 additions & 3 deletions examples/nextjs-custom-server/package.json
Original file line number Diff line number Diff line change
@@ -9,13 +9,13 @@
"start": "cross-env NODE_ENV=production bob-tsm src/server.ts"
},
"dependencies": {
"bob-tsm": "workspace:^0.4.4",
"next": "^12.0.7",
"bob-tsm": "workspace:^0.4.5",
"next": "^12.0.8",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@types/node": "^17.0.4",
"@types/node": "^17.0.7",
"@types/react": "^17.0.38",
"cross-env": "^7.0.3",
"typescript": "^4.5.4"
2 changes: 1 addition & 1 deletion examples/shared/package.json
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
"prepare": "bob-esbuild build"
},
"dependencies": {
"bob-esbuild": "workspace:^3.2.2",
"bob-esbuild": "workspace:^3.2.3",
"bob-esbuild-cli": "workspace:^3.0.1"
},
"dependenciesMeta": {
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -27,9 +27,9 @@
"@changesets/config": "^1.6.3",
"@changesets/read": "^0.5.2",
"@manypkg/get-packages": "^1.1.3",
"@types/node": "^17.0.4",
"@types/node": "^17.0.7",
"changesets-github-release": "^0.0.4",
"esbuild": "^0.14.10",
"esbuild": "^0.14.11",
"husky": "^7.0.4",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3",
@@ -40,10 +40,5 @@
},
"engines": {
"pnpm": ">=6.7.1"
},
"pnpm": {
"overrides": {
"esbuild": "^0.14.10"
}
}
}
12 changes: 6 additions & 6 deletions packages/bob-ts/package.json
Original file line number Diff line number Diff line change
@@ -37,26 +37,26 @@
},
"dependencies": {
"bob-esbuild-plugin": "workspace:^3.1.3",
"rollup": "^2.62.0"
"rollup": "^2.64.0"
},
"devDependencies": {
"@rollup/plugin-json": "^4.1.0",
"@types/node": "^17.0.4",
"@types/node": "^17.0.7",
"bob-esbuild-cli": "workspace:^3.0.1",
"changesets-github-release": "^0.0.4",
"commander": "^8.3.0",
"esbuild": "^0.14.10",
"esbuild": "^0.14.11",
"execa": "^6.0.0",
"globby": "^12.0.2",
"globby": "^12.1.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-node-externals": "^3.1.2",
"rollup-plugin-tsconfig-paths": "^1.1.5",
"rollup-plugin-tsconfig-paths": "^1.1.6",
"tree-kill": "^1.2.2",
"typescript": "^4.5.4"
},
"peerDependencies": {
"@types/node": "*",
"esbuild": ">=0.14.9",
"esbuild": ">=0.14.11",
"typescript": "*"
},
"engines": {
6 changes: 6 additions & 0 deletions packages/bob-tsm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# bob-tsm

## 0.4.5

### Patch Changes

- c09357a: Set "typescript" as optional peer dependency

## 0.4.4

### Patch Changes
13 changes: 9 additions & 4 deletions packages/bob-tsm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bob-tsm",
"version": "0.4.4",
"version": "0.4.5",
"homepage": "https://github.com/PabloSzx/bob-esbuild",
"bugs": "https://github.com/PabloSzx/bob-esbuild/issues",
"repository": {
@@ -45,17 +45,22 @@
"c8": "^7.11.0",
"chokidar": "^3.5.2",
"commander": "^8.3.0",
"esbuild": "^0.14.10",
"esbuild": "^0.14.11",
"execa": "^6.0.0",
"semver": "^7.3.5",
"tree-kill": "^1.2.2",
"typescript": "^4.5.4",
"typescript-paths": "^1.2.6"
"typescript-paths": "^1.3.1"
},
"peerDependencies": {
"esbuild": ">=0.14.9",
"esbuild": ">=0.14.11",
"typescript": ">=4.1.2"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"optionalDependencies": {
"fsevents": "~2.3.2"
},
7 changes: 7 additions & 0 deletions packages/bob/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# bob-esbuild

## 3.2.3

### Patch Changes

- 0696aae: allow to rewrite package.json before writeFile with config "rewritePackage" & improve PackageJSON type
- ab336b9: Keep "peerDependenciesMeta" on package.json rewrite

## 3.2.2

### Patch Changes
19 changes: 10 additions & 9 deletions packages/bob/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bob-esbuild",
"version": "3.2.2",
"version": "3.2.3",
"repository": {
"type": "git",
"url": "https://github.com/PabloSzx/bob-esbuild",
@@ -31,37 +31,38 @@
"postpublish": "gh-release"
},
"dependencies": {
"@pnpm/types": "^7.9.0",
"bob-esbuild-plugin": "workspace:3.1.3",
"rollup": "^2.62.0"
"rollup": "^2.64.0"
},
"devDependencies": {
"@pnpm/exportable-manifest": "^2.2.3",
"@pnpm/exportable-manifest": "^2.2.4",
"@rollup/plugin-json": "^4.1.0",
"@types/folder-hash": "^4.0.1",
"@types/fs-extra": "^9.0.13",
"@types/lodash.get": "^4.4.6",
"@types/node": "^17.0.4",
"@types/node": "^17.0.7",
"builtin-modules": "^3.2.0",
"chalk": "^5.0.0",
"changesets-github-release": "^0.0.4",
"cosmiconfig": "^7.0.1",
"date-fns": "^2.28.0",
"esbuild": "^0.14.10",
"esbuild": "^0.14.11",
"execa": "^6.0.0",
"fast-glob": "^3.2.7",
"fast-glob": "^3.2.11",
"folder-hash": "^4.0.1",
"fs-extra": "^10.0.0",
"globby": "^12.0.2",
"globby": "^12.1.0",
"lodash.get": "^4.4.2",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-node-externals": "^3.1.2",
"rollup-plugin-tsconfig-paths": "^1.1.5",
"rollup-plugin-tsconfig-paths": "^1.1.6",
"tree-kill": "^1.2.2",
"tsconfck": "^1.1.1",
"typescript": "^4.5.4"
},
"peerDependencies": {
"esbuild": ">=0.14.9",
"esbuild": ">=0.14.11",
"typescript": "*"
},
"publishConfig": {
47 changes: 26 additions & 21 deletions packages/bob/src/config/packageJson.ts
Original file line number Diff line number Diff line change
@@ -3,24 +3,23 @@ import type { Plugin } from 'rollup';
import { ensureDir, get, writeJSON, makePublishManifest } from '../deps.js';
import { warn } from '../log/warn';
import type { ResolvedBobConfig } from './cosmiconfig';
import type { PackageBuildConfig } from './packageBuildConfig';
import { rewriteExports } from './rewrite-exports';
import type { ProjectManifest } from '@pnpm/types';
import type { PackageBuildConfig } from './packageBuildConfig';

export interface PackageJSON extends Record<string, unknown> {
name: string;
type?: string;
main?: string;
module?: string;
types?: string;
bin?: Record<string, string>;
publishConfig?: {
directory?: string;
};
export interface PackageJSON extends ProjectManifest, Record<string, unknown> {
files?: string[];
buildConfig?: PackageBuildConfig;
type?: string;
exports?: Record<string, string | { require?: string; import?: string }>;
buildConfig?: PackageBuildConfig;
}

export const getPackageJsonName = (pkg: PackageJSON): string => {
if ('name' in pkg && pkg.name) return pkg.name;

throw Error('Invalid package.json without name: ' + JSON.stringify(pkg));
};

export function rewritePackageJson(pkg: PackageJSON, distDir: string, cwd: string = process.cwd()) {
const newPkg: PackageJSON = {
name: pkg.name,
@@ -36,6 +35,7 @@ export function rewritePackageJson(pkg: PackageJSON, distDir: string, cwd: strin
'description',
'sideEffects',
'peerDependencies',
'peerDependenciesMeta',
'dependencies',
'optionalDependencies',
'repository',
@@ -126,27 +126,32 @@ export function validatePackageJson(pkg: PackageJSON, distDir: string) {
}
}

export async function writePackageJson({ packageJson, distDir, cwd = process.cwd() }: GeneratePackageJsonOptions) {
export async function writePackageJson({
packageJson,
distDir,
cwd = process.cwd(),
rewritePackage,
}: GeneratePackageJsonOptions) {
const distDirPath = resolve(cwd, distDir);
await ensureDir(distDirPath);
await writeJSON(
resolve(distDirPath, 'package.json'),
await makePublishManifest(cwd, rewritePackageJson(packageJson, distDir, cwd)),
{
spaces: 2,
}
);

const pkg = (await makePublishManifest(cwd, rewritePackageJson(packageJson, distDir, cwd))) as PackageJSON;

await writeJSON(resolve(distDirPath, 'package.json'), rewritePackage ? await rewritePackage(pkg) : pkg, {
spaces: 2,
});
}

export interface GeneratePackageJsonOptions {
packageJson: PackageJSON;
distDir: string;
cwd?: string;
skipValidate?: boolean;
rewritePackage?: (pkg: PackageJSON) => Promise<PackageJSON> | PackageJSON;
}

export const generatePackageJson = (options: GeneratePackageJsonOptions, config: ResolvedBobConfig): Plugin | null => {
const manualRewrite = config.manualRewritePackageJson?.[options.packageJson.name];
const manualRewrite = config.manualRewritePackageJson?.[getPackageJsonName(options.packageJson)];

if (!options.packageJson.publishConfig?.directory) {
if (manualRewrite) {
4 changes: 2 additions & 2 deletions packages/bob/src/config/rollup.ts
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import { retry } from '../utils/retry';
import { copyToDist } from './copyToDist';
import { globalConfig } from './cosmiconfig';
import { GetPackageBuildConfig } from './packageBuildConfig';
import { generatePackageJson } from './packageJson';
import { generatePackageJson, getPackageJsonName } from './packageJson';
import { rollupBin } from './rollupBin';

export interface ConfigOptions {
@@ -202,7 +202,7 @@ export async function getRollupConfig(optionsArg: ConfigOptions = {}) {

const [buildConfig, { config: globalOptions }] = await Promise.all([GetPackageBuildConfig(cwd), globalConfig]);

const options = { ...globalOptions.packageConfigs?.[buildConfig.pkg.name], ...cleanObject(optionsArg) };
const options = { ...globalOptions.packageConfigs?.[getPackageJsonName(buildConfig.pkg)], ...cleanObject(optionsArg) };

const clean = options.clean ?? globalOptions.clean;

8 changes: 4 additions & 4 deletions packages/esbuild-plugin/package.json
Original file line number Diff line number Diff line change
@@ -33,13 +33,13 @@
},
"devDependencies": {
"changesets-github-release": "^0.0.4",
"esbuild": "^0.14.10",
"rollup": "^2.62.0",
"esbuild": "^0.14.11",
"rollup": "^2.64.0",
"tsconfck": "^1.1.1",
"tsup": "^5.11.10"
"tsup": "^5.11.11"
},
"peerDependencies": {
"esbuild": ">=0.14.9",
"esbuild": ">=0.14.11",
"rollup": "*"
},
"publishConfig": {
Loading