-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* v0.2.1 * fix dev-env publish * v0.2.2 * fix package.json
- Loading branch information
Showing
5 changed files
with
57 additions
and
28 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 |
---|---|---|
@@ -1,27 +1,37 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { copy } = require('esbuild-plugin-copy') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
|
||
require('esbuild') | ||
.build({ | ||
logLevel: 'info', | ||
entryPoints: ['src/index.ts', 'src/bin.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
external: [ | ||
'better-sqlite3', | ||
// Referenced in pg driver, but optional and we don't use it | ||
'pg-native', | ||
'sharp', | ||
], | ||
plugins: [ | ||
copy({ | ||
assets: { | ||
from: ['../pds/src/mailer/templates/**/*'], | ||
to: ['./templates'], | ||
keepStructure: true, | ||
}, | ||
}), | ||
], | ||
}) | ||
.catch(() => process.exit(1)) | ||
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', 'src/bin.ts'], | ||
bundle: true, | ||
sourcemap: true, | ||
outdir: 'dist', | ||
platform: 'node', | ||
external: [ | ||
'better-sqlite3', | ||
// Referenced in pg driver, but optional and we don't use it | ||
'pg-native', | ||
'sharp', | ||
], | ||
plugins: [].concat(buildShallow ? [nodeExternalsPlugin()] : []).concat([ | ||
copy({ | ||
assets: { | ||
from: ['../pds/src/mailer/templates/**/*'], | ||
to: ['./templates'], | ||
keepStructure: true, | ||
}, | ||
}), | ||
]), | ||
}) |
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,14 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
|
||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
if (process.argv.includes('--update-main-to-src')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'src/index.ts' })) | ||
.then((pkg) => pkg.save()) | ||
} |