Skip to content

Commit eb53da4

Browse files
committed
Refactor packaging
1 parent c9f71d3 commit eb53da4

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

build.mjs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
#!/usr/bin/env zx
22
/* global $, fs, argv, echo, chalk */
33

4+
$.verbose = true
5+
46
await $`npm run lint && npx svelte-package`
57
const packed = await $`npx vite build -c vite.dist.config.js`
6-
7-
// Prepare `/dist`
8-
const pkg = await fs.readJson('package.json')
9-
pkg.scripts = undefined
10-
await fs.writeJson('dist/package.json', pkg, { spaces: 2 })
11-
await fs.copy('README.md', 'dist/README.md')
12-
await fs.copy('LICENSE', 'dist/LICENSE')
138
await fs.copy('dist/dist/index.umd.js', 'dist/dist/index.umd.cjs')
14-
await $`cd dist && npx publint`
9+
await $`npx --yes publint`
1510

1611
if (argv.packageOnly) process.exit()
17-
1812
await $`npx vite build`
1913

2014
// Calculate stats
@@ -44,5 +38,5 @@ To deploy the demo, run:
4438
$ npx gh-pages -d build -t -f
4539
4640
To publish into npm, run:
47-
$ cd dist && npm publish --access public
41+
$ npm publish --access public
4842
`

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"format": "prettier --write .",
1212
"lint": "prettier --check . && eslint && npm run check",
1313
"test": "playwright test",
14-
"prepublishOnly": "echo 'Did you mean to publish `./package/`, instead of `./`?' && exit 1",
1514
"build": "zx build.mjs",
1615
"package": "zx build.mjs --packageOnly"
1716
},
@@ -51,18 +50,19 @@
5150
"type": "module",
5251
"exports": {
5352
".": {
54-
"types": "./index.d.ts",
55-
"svelte": "./index.js"
53+
"types": "./dist/index.d.ts",
54+
"svelte": "./dist/index.js"
5655
},
5756
"./dist": {
58-
"import": "./dist/index.es.js",
59-
"require": "./dist/index.umd.cjs"
57+
"import": "./dist/dist/index.es.js",
58+
"require": "./dist/dist/index.umd.cjs"
6059
}
6160
},
62-
"svelte": "./index.js",
63-
"jsdelivr": "./dist/index.umd.js",
61+
"svelte": "./dist/index.js",
62+
"types": "./dist/index.d.ts",
63+
"jsdelivr": "./dist/dist/index.umd.js",
6464
"files": [
65-
"**/*"
65+
"dist"
6666
],
6767
"license": "ISC",
6868
"repository": "github:zerodevx/svelte-toast",

0 commit comments

Comments
 (0)