Skip to content

Commit dcfabd5

Browse files
authored
fix(close #5): missing dist files in npm package (#6)
1 parent 6d71ff7 commit dcfabd5

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

.github/workflows/publish-npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
with:
1515
node-version: 12
1616
registry-url: https://registry.npmjs.org
17-
- run: npm publish --access public
17+
- run: yarn publish dist --access public
1818
env:
1919
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.npmignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
"license": "MIT",
88
"author": "BoringCodes <hi@boringcodes.com> (https://boringcodes.com)",
99
"repository": "https://github.com/boringcodes/utils.git",
10-
"main": "dist/index.js",
11-
"typings": "dist/index.d.ts",
12-
"files": [
13-
"dist"
14-
],
10+
"main": "index.js",
11+
"typings": "index.d.ts",
1512
"scripts": {
1613
"clean": "rm -rf dist",
1714
"purge": "rm -rf node_modules",

rollup.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import fs from 'fs';
12
import resolve from 'rollup-plugin-node-resolve';
23
import commonjs from 'rollup-plugin-commonjs';
34
import typescript from 'rollup-plugin-typescript2';
@@ -20,6 +21,18 @@ const common = {
2021
],
2122
};
2223

24+
(() => {
25+
const dir = 'dist';
26+
const files = ['CHANGELOG.md', 'LICENSE', 'package.json', 'README.md'];
27+
28+
fs.mkdirSync(dir);
29+
files.map((file) => {
30+
fs.writeFileSync(`${dir}/${file}`, fs.readFileSync(file, 'utf-8'), 'utf-8');
31+
32+
console.info(`${file}${dir}/${file}`);
33+
});
34+
})();
35+
2336
export default [
2437
{
2538
...common,

0 commit comments

Comments
 (0)