Skip to content

Commit

Permalink
fix: add files to publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Ryazanov committed Jul 31, 2023
1 parent 36a40aa commit 49c0b80
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: npm run build

- name: Copy declaration files
run: npm run copy-declaration-files
run: npm run copy-release-files

- name: Release
run: npm run release
Expand Down
3 changes: 3 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"github": {
"release": true
},
"npm": {
"publishPath": "./build"
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "conventionalcommits",
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"docs": "node ./generate/docs/index.js",
"test": "jest --coverage",
"test:ci": "npm run test -- --maxWorkers=50%",
"copy-declaration-files": "node tools/copy-declaration-files.js"
"copy-release-files": "node tools/copy-release-files.js"
},
"description": "Fast, small and purely functional utility library",
"repository": "https://github.com/Tinkoff/utils.js",
Expand All @@ -24,13 +24,11 @@
"curry",
"performance"
],
"files": [
"build",
".npmignore",
"CHANGELOG.md"
],
"sideEffects": false,
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
Expand Down
14 changes: 0 additions & 14 deletions tools/copy-declaration-files.js

This file was deleted.

30 changes: 30 additions & 0 deletions tools/copy-release-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const path = require('path');
const fsExtra = require('fs-extra');
const recursiveReadSync = require('recursive-readdir-sync');

const ROOT_PATH = path.join(__dirname, '..')
const BUILD_PATH = path.join(ROOT_PATH, 'build')

const copyReleaseFiles = async () => {
await Promise.all(
recursiveReadSync(path.join(ROOT_PATH, 'ts_temp'))
.filter(fileName => fileName.endsWith('.d.ts'))
.map(fileName =>
fsExtra.copy(
fileName,
fileName.replace('ts_temp', 'build')
)
)
);

await Promise.all(
['package.json', '.npmignore', 'README.md', 'LICENSE', 'CHANGELOG.md'].map(fileName =>
fsExtra.copy(
path.join(ROOT_PATH, fileName),
path.join(BUILD_PATH, fileName)
)
)
);
}

copyReleaseFiles().then(() => {})

0 comments on commit 49c0b80

Please sign in to comment.