Skip to content

Commit 08fc54f

Browse files
committed
fix(general): show install output, rename .npmignore & minify build
release-npm
1 parent a753282 commit 08fc54f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
import { join, dirname } from 'path'
3-
import { existsSync, unlinkSync, rmdirSync, lstatSync, mkdirSync, cpSync } from 'fs'
3+
import { existsSync, unlinkSync, rmdirSync, lstatSync, mkdirSync, cpSync, renameSync } from 'fs'
44
import { execSync } from 'child_process'
55
import names from './names.js'
66
import customize from './customize.js'
@@ -42,9 +42,17 @@ console.log('Installing dependencies...')
4242

4343
execSync('npm install --legacy-peer-deps', {
4444
cwd: destinationDirectory,
45-
stdio: 'pipe',
45+
stdio: 'inherit',
4646
})
4747

48+
const npmIgnorePath = join(process.cwd(), '.npmignore')
49+
50+
if (existsSync(npmIgnorePath)) {
51+
// npm will apparently rename .gitignore outside a repo to prevent accidentially publishing.
52+
// Since this template specifies "files" in package.json that doesn't happen.
53+
renameSync(npmIgnorePath, join(process.cwd(), '.gitignore'))
54+
}
55+
4856
console.log('')
4957
console.log(`😃 Created new plugin called ${name.regular} in ${destinationDirectory}.`)
5058
console.log(`🛠️ Start coding in the file ./index.tsx.`)

template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"scripts": {
1212
"app": "node create-app.js",
13-
"build": "esbuild index.tsx --outdir=dist --bundle --format=esm --sourcemap --external:react-native --external:react",
13+
"build": "esbuild index.tsx --outdir=dist --bundle --minify --format=esm --sourcemap --external:react-native --external:react",
1414
"watch": "concurrently --kill-others \"npm run build:watch\" \"npm run copy\"",
1515
"copy": "cpx 'dist/**/*' app/node_modules/<%= name %>/dist --watch",
1616
"build:watch": "esbuild index.tsx --watch --outdir=dist --bundle --format=esm --sourcemap --external:react-native --external:react",

0 commit comments

Comments
 (0)