@atproto/dev-env 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build.js CHANGED
@@ -1,27 +1,37 @@
1
+ const pkgJson = require('@npmcli/package-json')
1
2
  const { copy } = require('esbuild-plugin-copy')
3
+ const { nodeExternalsPlugin } = require('esbuild-node-externals')
2
4
 
3
- require('esbuild')
4
- .build({
5
- logLevel: 'info',
6
- entryPoints: ['src/index.ts', 'src/bin.ts'],
7
- bundle: true,
8
- sourcemap: true,
9
- outdir: 'dist',
10
- platform: 'node',
11
- external: [
12
- 'better-sqlite3',
13
- // Referenced in pg driver, but optional and we don't use it
14
- 'pg-native',
15
- 'sharp',
16
- ],
17
- plugins: [
18
- copy({
19
- assets: {
20
- from: ['../pds/src/mailer/templates/**/*'],
21
- to: ['./templates'],
22
- keepStructure: true,
23
- },
24
- }),
25
- ],
26
- })
27
- .catch(() => process.exit(1))
5
+ const buildShallow =
6
+ process.argv.includes('--shallow') || process.env.ATP_BUILD_SHALLOW === 'true'
7
+
8
+ if (process.argv.includes('--update-main-to-dist')) {
9
+ return pkgJson
10
+ .load(__dirname)
11
+ .then((pkg) => pkg.update({ main: 'dist/index.js' }))
12
+ .then((pkg) => pkg.save())
13
+ }
14
+
15
+ require('esbuild').build({
16
+ logLevel: 'info',
17
+ entryPoints: ['src/index.ts', 'src/bin.ts'],
18
+ bundle: true,
19
+ sourcemap: true,
20
+ outdir: 'dist',
21
+ platform: 'node',
22
+ external: [
23
+ 'better-sqlite3',
24
+ // Referenced in pg driver, but optional and we don't use it
25
+ 'pg-native',
26
+ 'sharp',
27
+ ],
28
+ plugins: [].concat(buildShallow ? [nodeExternalsPlugin()] : []).concat([
29
+ copy({
30
+ assets: {
31
+ from: ['../pds/src/mailer/templates/**/*'],
32
+ to: ['./templates'],
33
+ keepStructure: true,
34
+ },
35
+ }),
36
+ ]),
37
+ })
package/dist/bin.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atproto/dev-env",
3
- "version": "0.2.0",
4
- "main": "src/index.ts",
3
+ "version": "0.2.1",
4
+ "main": "dist/index.js",
5
5
  "bin": "dist/bin.js",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -18,7 +18,11 @@
18
18
  "lint": "eslint . --ext .ts,.tsx",
19
19
  "lint:fix": "yarn lint --fix",
20
20
  "verify": "run-p prettier lint",
21
- "verify:fix": "yarn prettier:fix && yarn lint:fix"
21
+ "verify:fix": "yarn prettier:fix && yarn lint:fix",
22
+ "update-main-to-dist": "node ./update-pkg.js --update-main-to-dist",
23
+ "update-main-to-src": "node ./update-pkg.js --update-main-to-src",
24
+ "prepublish": "npm run update-main-to-dist",
25
+ "postpublish": "npm run update-main-to-src"
22
26
  },
23
27
  "dependencies": {
24
28
  "@atproto/api": "*",