forked from bluesky-social/atproto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support shallow builds and sourcemaps (bluesky-social#352)
* Enable all modules to be built shallowly, externalizing their deps * Setup shallow builds to modify package.json main * Hoist update-main-to-dist to separate call, fix lex-cli and plc shallow builds * Generate sourcemaps during build * Tidy * Hoist new build deps up to root
- Loading branch information
Showing
34 changed files
with
445 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
sourcemap: true, | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
const buildShallow = | ||
process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true' | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
|
||
require('esbuild').build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
plugins: buildShallow ? [nodeExternalsPlugin()] : [], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.