Skip to content

Commit fb7c2ea

Browse files
consolidates version.ts files
1 parent 309939b commit fb7c2ea

File tree

8 files changed

+24
-29
lines changed

8 files changed

+24
-29
lines changed

.github/workflows/publish-to.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ v="${1%%+*}"
77
t="${2}"
88

99
cd lib
10-
for f in {,tdf3/}src/version.ts; do
11-
if ! sed "s/export const version = \'[^']\{1,\}\';\$/export const version = \'${v}\';/" "${f}" >"${f}.tmp"; then
12-
echo "Failed to insert version [${v}] into file [$f]"
13-
exit 1
14-
fi
15-
mv "${f}.tmp" "${f}"
16-
done
10+
f=src/version.ts
11+
if ! sed "s/export const version = \'[^']\{1,\}\';\$/export const version = \'${v}\';/" "${f}" >"${f}.tmp"; then
12+
echo "Failed to insert version [${v}] into file [$f]"
13+
exit 1
14+
fi
15+
mv "${f}.tmp" "${f}"
16+
1717
npm version --no-git-tag-version --allow-same-version "$v"
1818
npm publish --access public --tag "$t"
1919

lib/src/version.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ export const version = '0.2.0';
88
*/
99
export const clientType = 'web-sdk';
1010

11+
/**
12+
* Version of the opentdf/spec this library is targeting
13+
*/
1114
export const tdfSpecVersion = '4.3.0';

lib/tdf3/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export * as Client from './client/index.js';
22
export { Client as TDF3Client } from './client/index.js';
33
export * as Errors from '../../src/errors.js';
4-
export { version, clientType } from './version.js';
4+
export { clientType, tdfSpecVersion, version } from '../../src/version.js';

lib/tdf3/src/tdf.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { DecoratedReadableStream } from './client/DecoratedReadableStream.js';
44
import { fetchKasPubKey as fetchKasPubKeyV2, fetchWrappedKey } from '../../src/access.js';
55
import { DecryptParams } from './client/builders.js';
66
import { AssertionConfig, AssertionKey, AssertionVerificationKeys } from './assertions.js';
7-
import { version } from './version.js';
7+
import { tdfSpecVersion } from '../../src/version.js';
88
import { hex } from '../../src/encodings/index.js';
99
import * as assertions from './assertions.js';
1010

@@ -271,7 +271,7 @@ async function _generateManifest(
271271
// generate the manifest first, then insert integrity information into it
272272
encryptionInformation: encryptionInformationStr,
273273
assertions: assertions,
274-
tdf_spec_version: version,
274+
tdf_spec_version: tdfSpecVersion,
275275
};
276276
}
277277

lib/tdf3/src/version.ts

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

scripts/bump-version.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ if ! sed_i "s/version=${old_version}/version=${new_version}/" "Makefile"; then
4646
exit 1
4747
fi
4848

49-
if ! sed_i "s/export const version = '[^']\{1,\}';\$/export const version = \'${new_version}\';/" lib{,/tdf3}/src/version.ts; then
50-
echo "Unable to change version in version files"
51-
exit 1
52-
fi
53-
54-
if ! sed_i "s/export const version = '[^']\{1,\}';\$/export const version = \'${new_version}\';/" lib{,/tdf3}/src/version.ts; then
49+
if ! sed_i "s/export const version = '[^']\{1,\}';\$/export const version = \'${new_version}\';/" lib/src/version.ts; then
5550
echo "Unable to change version in version files"
5651
exit 1
5752
fi

scripts/check-version-is.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ if ! grep --fixed-strings --line-regexp --quiet "version=${expected_version}" "M
1616
exit 1
1717
fi
1818

19-
for f in lib{,/tdf3}/src/version.ts; do
20-
if ! grep --fixed-strings --line-regexp --quiet "export const version = '${expected_version}';" "$f"; then
21-
if grep --quiet "^export const version" "$f"; then
22-
echo "::error file=$f,line=$(sed -n '/export const version/=' $f)::Incorrect version line, should be setting it to [${expected_version}]"
23-
else
24-
echo "::error file=$f::Missing version line [version=${expected_version}]"
25-
fi
26-
exit 1
19+
f=lib/src/version.ts
20+
if ! grep --fixed-strings --line-regexp --quiet "export const version = '${expected_version}';" "$f"; then
21+
if grep --quiet "^export const version" "$f"; then
22+
echo "::error file=$f,line=$(sed -n '/export const version/=' $f)::Incorrect version line, should be setting it to [${expected_version}]"
23+
else
24+
echo "::error file=$f::Missing version line [version=${expected_version}]"
2725
fi
28-
done
26+
exit 1
27+
fi
2928

3029
for x in lib cli web-app; do
3130
sub_version="$(cd $x && node -p "require('./package.json').version")"
@@ -36,7 +35,7 @@ for x in lib cli web-app; do
3635
done
3736

3837
if [[ "${GITHUB_ACTION:-}" ]]; then
39-
echo "TARGET_VERSION=$expected_version" >>$GITHUB_OUTPUT
38+
echo "TARGET_VERSION=$expected_version" >>"$GITHUB_OUTPUT"
4039
else
4140
echo "SUCCESS: TARGET_VERSION=$expected_version"
4241
fi

scripts/platform.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ if [ $? -ne 0 ]; then
1212
npm install @bufbuild/protoc-gen-es @bufbuild/buf @connectrpc/protoc-gen-connect-es
1313
fi
1414
npx buf generate platform/service
15-
echo "Generated Typescript code from Protobuf files (src: platform/service, dst: lib/src/platform)"
15+
echo "Generated Typescript code from Protobuf files (src: platform/service, dst: lib/src/platform)"

0 commit comments

Comments
 (0)