Skip to content

Commit a91da22

Browse files
authored
feat: Release scripts
1 parent 144a6f7 commit a91da22

File tree

8 files changed

+76
-7
lines changed

8 files changed

+76
-7
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"npm-run-all": "^4.1.2",
3535
"prettier": "^1.12.1",
3636
"prettier-check": "^2.0.0",
37+
"replace-in-file": "^3.4.0",
3738
"rimraf": "^2.6.2",
3839
"sinon": "^5.0.3",
3940
"ts-jest": "^22.4.4",

packages/browser/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"rimraf": "^2.6.2",
3939
"rollup": "^0.58.2",
4040
"rollup-plugin-commonjs": "^9.1.3",
41+
"rollup-plugin-license": "^0.6.0",
4142
"rollup-plugin-node-resolve": "^3.3.0",
4243
"rollup-plugin-npm": "^2.0.0",
4344
"rollup-plugin-typescript2": "^0.13.0",
@@ -57,6 +58,7 @@
5758
"fix:tslint": "tslint --fix -t stylish -p .",
5859
"test": "karma start karma.config.js",
5960
"test:watch": "karma start karma.config.js --auto-watch --no-single-run",
60-
"size:check": "cat build/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print $1,\"kB\";}'"
61+
"size:check": "cat build/bundle.min.js | gzip -9 | wc -c | awk '{$1=$1/1024; print $1,\"kB\";}'",
62+
"version": "node ../../scripts/versionbump.js src/client.ts"
6163
}
6264
}

packages/browser/rollup.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import commonjs from 'rollup-plugin-commonjs';
22
import uglify from 'rollup-plugin-uglify';
33
import resolve from 'rollup-plugin-node-resolve';
44
import typescript from 'rollup-plugin-typescript2';
5+
import license from 'rollup-plugin-license';
6+
7+
const commitHash = require('child_process')
8+
.execSync('git rev-parse --short HEAD', { encoding: 'utf-8' })
9+
.trim();
510

611
export default [
712
{
@@ -46,6 +51,10 @@ export default [
4651
}),
4752
commonjs(),
4853
uglify(),
54+
license({
55+
sourcemap: true,
56+
banner: `/*! @sentry/browser <%= pkg.version %> (${commitHash}) | https://github.com/getsentry/raven-js */`,
57+
}),
4958
],
5059
},
5160
];

packages/browser/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
2525
public getSdkInfo(): SdkInfo {
2626
return {
2727
name: 'sentry-browser',
28-
version: Raven.VERSION,
28+
version: '0.5.4',
2929
};
3030
}
3131

packages/node/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"fix:prettier": "prettier --write '{src,test}/**/*.ts'",
4242
"fix:tslint": "tslint --fix -t stylish -p .",
4343
"test": "jest",
44-
"test:watch": "jest --watch --notify"
44+
"test:watch": "jest --watch --notify",
45+
"version": "node ../../scripts/versionbump.js src/client.ts"
4546
},
4647
"jest": {
4748
"collectCoverage": true,

packages/node/src/client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { BaseClient } from '@sentry/core';
22
import { SdkInfo } from '@sentry/types';
33
import { NodeBackend, NodeOptions } from './backend';
4-
import { Raven } from './raven';
54

65
/**
76
* The Sentry Node SDK Client.
@@ -24,7 +23,7 @@ export class NodeClient extends BaseClient<NodeBackend, NodeOptions> {
2423
public getSdkInfo(): SdkInfo {
2524
return {
2625
name: 'sentry-node',
27-
version: Raven.version,
26+
version: '0.5.4',
2827
};
2928
}
3029
}

scripts/versionbump.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const replace = require('replace-in-file');
2+
const pjson = require(`${process.cwd()}/package.json`);
3+
4+
const files = process.argv.slice(2);
5+
if (files.length ==== 0) {
6+
console.error('Please provide files to bump');
7+
process.exit(1);
8+
}
9+
10+
replace({
11+
files: files,
12+
from: /\d+\.\d+.\d+(?:-\w+(?:\.\w+)?)?/g,
13+
to: pjson.version,
14+
})
15+
.then(changedFiles => {
16+
console.log('Modified files:', changedFiles.join(', '));
17+
})
18+
.catch(error => {
19+
console.error('Error occurred:', error);
20+
process.exit(1);
21+
});

yarn.lock

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@ chalk@^1.1.1, chalk@^1.1.3:
17491749
strip-ansi "^3.0.0"
17501750
supports-color "^2.0.0"
17511751

1752-
chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1:
1752+
chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.3.2:
17531753
version "2.4.1"
17541754
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
17551755
dependencies:
@@ -1941,6 +1941,10 @@ commander@~2.13.0:
19411941
version "2.13.0"
19421942
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
19431943

1944+
1945+
version "1.0.5"
1946+
resolved "https://registry.yarnpkg.com/commenting/-/commenting-1.0.5.tgz#3104d542cac8a4f27b3d51438f4b80431fe4526b"
1947+
19441948
compare-func@^1.3.1:
19451949
version "1.3.2"
19461950
resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-1.3.2.tgz#99dd0ba457e1f9bc722b12c08ec33eeab31fa648"
@@ -4636,6 +4640,10 @@ lodash.templatesettings@^4.0.0:
46364640
dependencies:
46374641
lodash._reinterpolate "~3.0.0"
46384642

4643+
4644+
version "4.17.5"
4645+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
4646+
46394647
lodash@^4.0.0, lodash@^4.13.1, lodash@^4.15.0, lodash@^4.17.0, lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0:
46404648
version "4.17.10"
46414649
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
@@ -4717,6 +4725,12 @@ lru-cache@^4.0.1, lru-cache@^4.1.2:
47174725
pseudomap "^1.0.2"
47184726
yallist "^2.1.2"
47194727

4728+
4729+
version "0.22.4"
4730+
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.4.tgz#31039b4e40366395618c1d6cf8193c53917475ff"
4731+
dependencies:
4732+
vlq "^0.2.1"
4733+
47204734
magic-string@^0.22.4:
47214735
version "0.22.5"
47224736
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e"
@@ -5004,6 +5018,10 @@ modify-values@^1.0.0:
50045018
version "1.0.1"
50055019
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
50065020

5021+
5022+
version "2.21.0"
5023+
resolved "https://registry.yarnpkg.com/moment/-/moment-2.21.0.tgz#2a114b51d2a6ec9e6d83cf803f838a878d8a023a"
5024+
50075025
moment@^2.6.0:
50085026
version "2.22.2"
50095027
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
@@ -6106,6 +6124,14 @@ repeating@^2.0.0:
61066124
dependencies:
61076125
is-finite "^1.0.0"
61086126

6127+
replace-in-file@^3.4.0:
6128+
version "3.4.0"
6129+
resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-3.4.0.tgz#b48c94567bbf4f44a2bc6fabdf21ab443e806851"
6130+
dependencies:
6131+
chalk "^2.3.2"
6132+
glob "^7.1.2"
6133+
yargs "^11.0.0"
6134+
61096135
61106136
version "1.1.1"
61116137
resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.1.tgz#3eee00b2c5aa83239cfb04c5700da36f81cd08b6"
@@ -6286,6 +6312,16 @@ rollup-plugin-commonjs@^9.1.3:
62866312
resolve "^1.5.0"
62876313
rollup-pluginutils "^2.0.1"
62886314

6315+
rollup-plugin-license@^0.6.0:
6316+
version "0.6.0"
6317+
resolved "https://registry.yarnpkg.com/rollup-plugin-license/-/rollup-plugin-license-0.6.0.tgz#d8e5e75ac0fcb5a7af7c5d89a644ef42f05f48a4"
6318+
dependencies:
6319+
commenting "1.0.5"
6320+
lodash "4.17.5"
6321+
magic-string "0.22.4"
6322+
mkdirp "0.5.1"
6323+
moment "2.21.0"
6324+
62896325
rollup-plugin-node-resolve@^3.3.0:
62906326
version "3.3.0"
62916327
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.3.0.tgz#c26d110a36812cbefa7ce117cadcd3439aa1c713"
@@ -7338,7 +7374,7 @@ [email protected]:
73387374
core-util-is "1.0.2"
73397375
extsprintf "^1.2.0"
73407376

7341-
vlq@^0.2.2:
7377+
vlq@^0.2.1, vlq@^0.2.2:
73427378
version "0.2.3"
73437379
resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26"
73447380

0 commit comments

Comments
 (0)