Skip to content

Commit a6a518f

Browse files
authored
Add package.json file for releasing clp-ffi-js as a package. (y-scope#5)
1 parent 2fd345c commit a6a518f

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.task
33
build
44
cmake-build-*
5+
dist
56

67
# IDEs
78
.idea

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
clp-ffi-js a JavaScript FFI library for [CLP]. It currently supports decoding log events from CLP IR
2-
streams. Other CLP features are being added incrementally.
1+
clp-ffi-js is a JavaScript FFI library for [CLP]. It currently supports decoding log events from CLP
2+
IR streams. Other CLP features are being added incrementally.
33

44
You can use GitHub issues to [request features][feature-req] or [report bugs][bug-report].
55

Taskfile.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ includes:
66
vars:
77
G_BUILD_DIR: "{{.ROOT_DIR}}/build"
88
G_CLP_FFI_JS_BUILD_DIR: "{{.G_BUILD_DIR}}/clp-ffi-js"
9+
G_CLP_FFI_JS_CHECKSUM: "{{.G_BUILD_DIR}}/clp-ffi-js.md5"
10+
G_CLP_FFI_JS_TARGET_NAME: "ClpFfiJs"
11+
G_DIST_DIR: "{{.ROOT_DIR}}/dist"
912
G_EMSDK_DIR: "{{.G_BUILD_DIR}}/emsdk"
1013
G_EMSDK_CHECKSUM: "{{.G_BUILD_DIR}}/emsdk.md5"
1114

@@ -29,7 +32,7 @@ tasks:
2932

3033
clp-ffi-js:
3134
vars:
32-
CHECKSUM_FILE: "{{.G_BUILD_DIR}}/{{.TASK}}.md5"
35+
CHECKSUM_FILE: "{{.G_CLP_FFI_JS_CHECKSUM}}"
3336
OUTPUT_DIR: "{{.G_CLP_FFI_JS_BUILD_DIR}}"
3437
sources:
3538
- "{{.G_EMSDK_CHECKSUM}}"
@@ -47,7 +50,7 @@ tasks:
4750
- "mkdir -p '{{.OUTPUT_DIR}}'"
4851
- |-
4952
cmake -S "{{.ROOT_DIR}}" -B "{{.OUTPUT_DIR}}" -G "Unix Makefiles"
50-
cmake --build "{{.OUTPUT_DIR}}" --parallel --target ClpFfiJs
53+
cmake --build "{{.OUTPUT_DIR}}" --parallel --target "{{.G_CLP_FFI_JS_TARGET_NAME}}"
5154
# This command must be last
5255
- task: "utils:compute-checksum"
5356
vars:
@@ -93,6 +96,33 @@ tasks:
9396
OUTPUT_FILE: "{{.CHECKSUM_FILE}}"
9497
EXCLUDE_PATHS: *emsdk_checksum_exclude_paths
9598

99+
package:
100+
vars:
101+
CHECKSUM_FILE: "{{.G_BUILD_DIR}}/{{.TASK}}.md5"
102+
OUTPUT_DIR: "{{.G_DIST_DIR}}"
103+
sources:
104+
- "{{.G_CLP_FFI_JS_CHECKSUM}}"
105+
- "{{.TASKFILE}}"
106+
generates: ["{{.CHECKSUM_FILE}}"]
107+
deps:
108+
- "clp-ffi-js"
109+
- task: "utils:validate-checksum"
110+
vars:
111+
CHECKSUM_FILE: "{{.CHECKSUM_FILE}}"
112+
DATA_DIR: "{{.OUTPUT_DIR}}"
113+
cmds:
114+
- "rm -rf {{.OUTPUT_DIR}}"
115+
- >-
116+
rsync -a
117+
"{{.G_CLP_FFI_JS_BUILD_DIR}}/{{.G_CLP_FFI_JS_TARGET_NAME}}."{d.ts,js,wasm}
118+
"{{.OUTPUT_DIR}}/"
119+
- "npm pack"
120+
# This command must be last
121+
- task: "utils:compute-checksum"
122+
vars:
123+
DATA_DIR: "{{.OUTPUT_DIR}}"
124+
OUTPUT_FILE: "{{.CHECKSUM_FILE}}"
125+
96126
init:
97127
internal: true
98128
silent: true

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "clp-ffi-js",
3+
"version": "0.1.0",
4+
"description": "clp-ffi-js is a JavaScript FFI library for CLP.",
5+
"author": "YScope Inc. <dev@yscope.com>",
6+
"license": "Apache-2.0",
7+
"homepage": "https://github.com/y-scope/clp-ffi-js#readme",
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/y-scope/clp-ffi-js.git"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/y-scope/clp-ffi-js/issues"
14+
},
15+
"scripts": {
16+
"release": "git diff --exit-code && npm publish"
17+
},
18+
"files": [
19+
"./dist"
20+
],
21+
"exports": {
22+
".": {
23+
"import": "./dist/ClpFfiJs.js",
24+
"types": "./dist/ClpFfiJs.d.ts"
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)