mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-19 19:42:19 +02:00
Move package.json inside the node/ directory
Previously all APIs were available through the top-level index.ts, but now the zkgroup APIs are in their own module. To access that in the old packaging required writing import * from '@signalapp/signal-client/node/dist/zkgroup' This commit moves the package root into the node/ directory to eliminate the 'node/' component, then adds a top-level, precompiled zkgroup.js/.d.ts so that clients can use import * from '@signalapp/signal-client/zkgroup'
This commit is contained in:
parent
c3459d0566
commit
3fd42d7a60
11
.github/workflows/build_and_test.yml
vendored
11
.github/workflows/build_and_test.yml
vendored
@ -51,13 +51,9 @@ jobs:
|
||||
node:
|
||||
- *all
|
||||
- '.nvmrc'
|
||||
- '.prettierignore'
|
||||
- '.prettierrc'
|
||||
- 'binding.gyp'
|
||||
- '.prettierrc.js'
|
||||
- 'node/**'
|
||||
- 'package.json'
|
||||
- 'rust/bridge/node/**'
|
||||
- 'yarn.lock'
|
||||
rust_ios: &rust_ios
|
||||
- *all
|
||||
- 'rust/bridge/ffi/**'
|
||||
@ -236,20 +232,25 @@ jobs:
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
|
||||
- run: yarn install --frozen-lockfile
|
||||
working-directory: node
|
||||
|
||||
- run: yarn tsc
|
||||
working-directory: node
|
||||
|
||||
- run: yarn lint
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
working-directory: node
|
||||
|
||||
- run: yarn format -c
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
working-directory: node
|
||||
|
||||
- name: Run yarn test
|
||||
uses: GabrielBB/xvfb-action@v1.4
|
||||
with:
|
||||
# The tests use an Electron-based runner, so we need to set up a dummy display for them.
|
||||
run: yarn test
|
||||
working-directory: node
|
||||
|
||||
swift_package:
|
||||
name: Swift Package
|
||||
|
11
.github/workflows/npm.yml
vendored
11
.github/workflows/npm.yml
vendored
@ -48,14 +48,16 @@ jobs:
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
|
||||
- run: yarn install --ignore-scripts --frozen-lockfile
|
||||
working-directory: node
|
||||
|
||||
- run: npx prebuildify --napi
|
||||
working-directory: node
|
||||
|
||||
- name: Upload library
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: libsignal_client (${{matrix.os}})
|
||||
path: prebuilds/*
|
||||
path: node/prebuilds/*
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
@ -85,21 +87,26 @@ jobs:
|
||||
path: artifacts
|
||||
|
||||
- name: Copy libraries
|
||||
run: mkdir prebuilds && mv ${{ steps.download.outputs.download-path }}/*/* prebuilds && find prebuilds
|
||||
run: mkdir node/prebuilds && mv ${{ steps.download.outputs.download-path }}/*/* node/prebuilds && find node/prebuilds
|
||||
|
||||
- run: yarn install --frozen-lockfile
|
||||
working-directory: node
|
||||
|
||||
- run: yarn tsc
|
||||
working-directory: node
|
||||
|
||||
- run: yarn lint
|
||||
working-directory: node
|
||||
|
||||
- run: yarn format -c
|
||||
working-directory: node
|
||||
|
||||
- name: Run yarn test
|
||||
uses: GabrielBB/xvfb-action@v1.4
|
||||
with:
|
||||
# The tests use an Electron-based runner, so we need to set up a dummy display for them.
|
||||
run: yarn test
|
||||
working-directory: node
|
||||
|
||||
- name: Publish to NPM
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -3,8 +3,8 @@
|
||||
/target
|
||||
/swift/.build
|
||||
/node/dist
|
||||
/node_modules
|
||||
/build
|
||||
/node/node_modules
|
||||
/node/build
|
||||
|
||||
/rust/bridge/node/futures/tests/node-tests/node_modules
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
node/dist/**
|
||||
node/Native.d.ts
|
@ -87,6 +87,7 @@ appropriate version automatically.
|
||||
We use [`yarn`](https://classic.yarnpkg.com/) as our package manager. The Rust library will automatically be built when you run `yarn install`.
|
||||
|
||||
```shell
|
||||
$ cd node
|
||||
$ nvm use
|
||||
$ yarn install
|
||||
$ yarn tsc
|
||||
|
@ -42,7 +42,7 @@ def main():
|
||||
if len(sys.argv) > 1:
|
||||
update_version('SignalClient.podspec', PODSPEC_PATTERN, sys.argv[1])
|
||||
update_version(os.path.join('java', 'build.gradle'), GRADLE_PATTERN, sys.argv[1])
|
||||
update_version('package.json', NODE_PATTERN, sys.argv[1])
|
||||
update_version(os.path.join('node', 'package.json'), NODE_PATTERN, sys.argv[1])
|
||||
update_version(bridge_path('ffi'), CARGO_PATTERN, sys.argv[1])
|
||||
update_version(bridge_path('jni'), CARGO_PATTERN, sys.argv[1])
|
||||
update_version(bridge_path('node'), CARGO_PATTERN, sys.argv[1])
|
||||
@ -51,7 +51,7 @@ def main():
|
||||
package_versions = {
|
||||
'swift': read_version('SignalClient.podspec', PODSPEC_PATTERN),
|
||||
'java': read_version(os.path.join('java', 'build.gradle'), GRADLE_PATTERN),
|
||||
'node': read_version('package.json', NODE_PATTERN)
|
||||
'node': read_version(os.path.join('node', 'package.json'), NODE_PATTERN)
|
||||
}
|
||||
|
||||
bridge_versions = {
|
||||
|
@ -1,2 +1,4 @@
|
||||
dist/**
|
||||
.eslintrc.js
|
||||
zkgroup.js
|
||||
zkgroup.d.ts
|
||||
|
3
node/.prettierignore
Normal file
3
node/.prettierignore
Normal file
@ -0,0 +1,3 @@
|
||||
build/**
|
||||
dist/**
|
||||
Native.d.ts
|
@ -5,4 +5,4 @@
|
||||
|
||||
import * as Native from './Native';
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|
||||
export default require('node-gyp-build')(__dirname + '/../..') as typeof Native;
|
||||
export default require('node-gyp-build')(__dirname + '/..') as typeof Native;
|
||||
|
@ -19,10 +19,10 @@
|
||||
'type': 'none',
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'node/build_node_bridge.py',
|
||||
'action_name': 'build_node_bridge.py',
|
||||
'action': [
|
||||
'python3',
|
||||
'node/build_node_bridge.py',
|
||||
'build_node_bridge.py',
|
||||
# Use separated arguments for paths, joined arguments for non-paths.
|
||||
'--out-dir', '<(PRODUCT_DIR)/',
|
||||
'--os-name=<(NODE_OS_NAME)',
|
@ -2,23 +2,25 @@
|
||||
"name": "@signalapp/signal-client",
|
||||
"version": "0.10.0",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "node/dist/index.js",
|
||||
"types": "node/dist/index.d.ts",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"node/dist/*.js",
|
||||
"node/dist/*.d.ts",
|
||||
"node/dist/zkgroup/**/*.js",
|
||||
"node/dist/zkgroup/**/*.d.ts",
|
||||
"dist/*.js",
|
||||
"dist/*.d.ts",
|
||||
"dist/zkgroup/**/*.js",
|
||||
"dist/zkgroup/**/*.d.ts",
|
||||
"zkgroup.js",
|
||||
"zkgroup.d.ts",
|
||||
"prebuilds/*/*.node"
|
||||
],
|
||||
"scripts": {
|
||||
"install": "node-gyp-build",
|
||||
"build": "node-gyp build",
|
||||
"tsc": "tsc -b node && yarn cpy node/*.d.ts node/dist/",
|
||||
"clean": "rimraf node/dist build prebuilds",
|
||||
"test": "electron-mocha --recursive node/dist/test --require source-map-support/register",
|
||||
"lint": "cd node && eslint . --ext .js,.jsx,.ts,.tsx",
|
||||
"format": "p() { prettier ${@:- --write} package.json '*.js' 'node/**/*.{css,js,json,md,scss,ts,tsx}'; }; p"
|
||||
"tsc": "tsc -b && yarn cpy Native.d.ts dist/",
|
||||
"clean": "rimraf dist build prebuilds",
|
||||
"test": "electron-mocha --recursive dist/test --require source-map-support/register",
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
||||
"format": "p() { prettier ${@:- --write} '**/*.{css,js,json,md,scss,ts,tsx}'; }; p"
|
||||
},
|
||||
"dependencies": {
|
||||
"node-gyp-build": "^4.2.3",
|
@ -6,5 +6,6 @@
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"sourceMap": true
|
||||
}
|
||||
},
|
||||
"include": ["index.ts", "zkgroup/index.ts", "test/*.ts"]
|
||||
}
|
||||
|
7
node/zkgroup.d.ts
vendored
Normal file
7
node/zkgroup.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
//
|
||||
// Copyright 2021 Signal Messenger, LLC.
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
// Make it possible to import from '@signalapp/signal-client/zkgroup'.
|
||||
export * from './dist/zkgroup';
|
10
node/zkgroup.js
Normal file
10
node/zkgroup.js
Normal file
@ -0,0 +1,10 @@
|
||||
//
|
||||
// Copyright 2021 Signal Messenger, LLC.
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
//
|
||||
|
||||
/* eslint-env commonjs */
|
||||
|
||||
// Make it possible to import from '@signalapp/signal-client/zkgroup'.
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
module.exports = require('./dist/zkgroup');
|
Loading…
Reference in New Issue
Block a user