Skip to content

Commit 9a94005

Browse files
committed
wip
1 parent aedd6fb commit 9a94005

4 files changed

Lines changed: 43 additions & 29 deletions

File tree

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
"directories": {
1313
"test": "test"
1414
},
15+
"pkg": {
16+
"scripts": "./dist/src/config/*.js",
17+
"assets": "./dist/ascii-logo.txt"
18+
},
1519
"mocha": {
1620
"reporter": "dot",
1721
"require": [
@@ -65,8 +69,8 @@
6569
"needle": "^2.5.2",
6670
"pino": "^6.7.0",
6771
"source-map-support": "^0.5.19",
68-
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.5.0",
6972
"uuid": "^8.3.1",
73+
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.5.0",
7074
"ws": "^7.5.6"
7175
},
7276
"devDependencies": {
@@ -75,6 +79,7 @@
7579
"@types/body-parser": "^1.19.0",
7680
"@types/content-type": "^1.1.3",
7781
"@types/cucumber": "^6.0.1",
82+
"@types/glob": "^7.2.0",
7883
"@types/js-yaml": "^3.12.5",
7984
"@types/mkdirp": "^1.0.1",
8085
"@types/mocha": "^8.0.4",
@@ -94,8 +99,8 @@
9499
"istanbul": "^0.4.5",
95100
"mocha": "^8.2.1",
96101
"n0p3": "^1.0.2",
97-
"nexe": "^3.3.7",
98102
"nyc": "^15",
103+
"pkg": "^5.5.1",
99104
"proxyquire": "^2.1.3",
100105
"sinon": "^9.2.1",
101106
"sinon-chai": "^3.5.0",

scripts/package.sh

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@ DEEPSTREAM_PACKAGE=${PACKAGE_DIR}/deepstream.io
1414
GIT_BRANCH=$( git rev-parse --abbrev-ref HEAD )
1515
CREATE_DISTROS=false
1616

17-
NODE_SOURCE="nexe_node/node/$NODE_VERSION_WITHOUT_V/node-v$NODE_VERSION_WITHOUT_V"
18-
19-
EXTENSION=""
20-
if [[ ${OS} = "win32" ]]; then
21-
EXTENSION=".exe"
22-
fi
23-
EXECUTABLE_NAME="build/deepstream$EXTENSION"
17+
EXECUTABLE_NAME="build/deepstream"
2418

2519
# Needed even for void builds for travis deploy to pass
2620
mkdir -p build
@@ -31,17 +25,8 @@ if ! [[ ${NODE_VERSION_WITHOUT_V} == ${LTS_VERSION}* ]]; then
3125
fi
3226

3327
if [[ -z $1 ]]; then
34-
if ! [[ ${TRAVIS_BRANCH} = 'master' ]] && ! [[ ${APPVEYOR_REPO_BRANCH} = 'master' ]] && ! [[ ${GIT_BRANCH} = 'master' ]]; then
28+
if ! [[ ${GIT_BRANCH} = 'master' ]]; then
3529
echo "Running on branch ${GIT_BRANCH}"
36-
if [[ -z ${TRAVIS_TAG} ]] && [[ -z ${APPVEYOR_REPO_TAG} ]]; then
37-
echo "Only runs on tags or master"
38-
exit
39-
elif [[ ${APPVEYOR_REPO_TAG} = false ]]; then
40-
echo "On appveyor, not a tag or master"
41-
exit
42-
else
43-
echo "Running on tag $TRAVIS_TAG $APPVEYOR_REPO_TAG"
44-
fi
4530
else
4631
echo "Running on master"
4732
fi
@@ -72,12 +57,6 @@ function compile {
7257
echo "Generating meta.json"
7358
node scripts/details.js META
7459

75-
# Nexe Patches
76-
echo "Nexe Patches for Browserify, copying stub versions of optional installs since they aern't bundled anyway"
77-
78-
echo "Stubbing xml2js for needle"
79-
mkdir -p node_modules/xml2js && echo "throw new Error()" >> node_modules/xml2js/index.js
80-
8160
# Creating package structure
8261
rm -rf build/${PACKAGE_VERSION}
8362
mkdir -p ${DEEPSTREAM_PACKAGE}
@@ -117,7 +96,7 @@ function compile {
11796
cd -
11897

11998
echo "Creating '$EXECUTABLE_NAME', this will take a while..."
120-
NODE_VERSION_WITHOUT_V=${NODE_VERSION_WITHOUT_V} EXECUTABLE_NAME=${EXECUTABLE_NAME} node scripts/nexe.js > /dev/null &
99+
LTS=${LTS_VERSION} OS=${OS} EXECUTABLE_NAME=${EXECUTABLE_NAME} node scripts/pkg.js
121100

122101
PROC_ID=$!
123102
SECONDS=0;
@@ -129,9 +108,9 @@ function compile {
129108
echo ""
130109

131110
if wait ${pid}; then
132-
echo -e "\tNexe Build Succeeded"
111+
echo -e "\tPkg Build Succeeded"
133112
else
134-
echo -e "\tNexe Build Failed"
113+
echo -e "\tPkg Build Failed"
135114
exit 1
136115
fi
137116

scripts/pkg.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const { exec } = require('pkg')
2+
3+
const LTS = process.env.LTS
4+
let OS = process.env.OS
5+
6+
if (OS === 'win32') {
7+
OS = 'win'
8+
}
9+
if (OS === 'darwin') {
10+
OS = 'macos'
11+
}
12+
13+
const target = 'node'+ LTS + '-' + OS
14+
15+
console.log('TARGET', target);
16+
17+
exec(
18+
[
19+
'package.json',
20+
'--targets',
21+
target,
22+
'--output',
23+
process.env.EXECUTABLE_NAME,
24+
'--options',
25+
'--max-old-space-size=8192',
26+
'--compress',
27+
'GZip'
28+
]).then(() => {
29+
console.log('success')
30+
})

src/config/ds-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const getDSInfo = (libDir?: string) => {
2929
const fetchLibs = (libDir: string, meta: any) => {
3030
const directory = libDir || 'lib'
3131
const files = glob.sync(path.join(directory, '*', 'package.json'))
32-
meta.libs = files.map((filePath) => {
32+
meta.libs = files.map((filePath: any) => {
3333
const pkg = fs.readFileSync(filePath, 'utf8')
3434
const object = JSON.parse(pkg)
3535
return `${object.name}:${object.version}`

0 commit comments

Comments
 (0)