-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
#!/usr/bin/env zx | ||
|
||
await $`npm run lint` | ||
await $`npm run check` | ||
await $`npm run build` | ||
await $`npx svelte-package` | ||
const out = await $`npx vite build -c vite.dist.config.js` | ||
|
||
// Calculate stats | ||
const sizes = out.stdout | ||
.split('\n') | ||
.find((i) => i.includes('index.umd.cjs')) | ||
.split(' ') | ||
.filter((i) => !isNaN(parseFloat(i))) | ||
const cloc = JSON.parse(await $`npx cloc src/lib --json`).SUM.code.toString() | ||
|
||
// Write stats into `/build` | ||
const shields = { schemaVersion: 1, color: 'blue' } | ||
await fs.writeJson('build/_min.json', { ...shields, label: 'minified', message: `${sizes[0]} kB` }) | ||
await fs.writeJson('build/_gzip.json', { ...shields, label: 'gzipped', message: `${sizes[1]} kB` }) | ||
await fs.writeJson('build/_loc.json', { ...shields, label: 'lines of code', message: cloc }) | ||
|
||
// Prepare `/dist` | ||
const pkg = await fs.readJson('package.json') | ||
pkg.scripts = undefined | ||
await fs.writeJson('dist/package.json', pkg, { spaces: 2 }) | ||
await fs.copy('README.md', 'dist/README.md') | ||
await fs.copy('LICENSE', 'dist/LICENSE') | ||
await $`cd dist && npx publint` | ||
|
||
echo` | ||
To deploy the demo, run: | ||
$ npx gh-pages -d build -t -f | ||
To publish into npm, run: | ||
$ cd dist && npm publish --access public | ||
` |
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