Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/napi #111

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
26252d4
interim checkin
ghinks Dec 30, 2018
4acee45
partial working code with the napi somewhat working in place of the nan.
ghinks Dec 31, 2018
5f65bb6
fixing unit tests,
ghinks Jan 1, 2019
1492871
remove logging and commented out nan code from previous api
ghinks Jan 1, 2019
b148855
indentation for binding.gyp,
ghinks Jan 1, 2019
05a9dc1
remove unused code
ghinks Jan 1, 2019
9d74999
add package-lock to change control
ghinks Jan 1, 2019
010da54
update the travis.yml file
ghinks Jan 1, 2019
6d82d7f
update travis, attempt node 4 onwards
ghinks Jan 1, 2019
3e0273c
add osx to the build os
ghinks Jan 1, 2019
9eba579
remove specifics for g++
ghinks Jan 1, 2019
b3ef31d
add all node versions for both osx and linux
ghinks Jan 1, 2019
a817a24
add windows os
ghinks Jan 1, 2019
f201e09
test of windows and linux as canary
ghinks Jan 1, 2019
59aefa9
add windows section of the build back in again ready for
ghinks Jan 1, 2019
63d9df7
log out the windows tzname
ghinks Jan 1, 2019
d7eaf23
add in non windows debug
ghinks Jan 1, 2019
cc71db3
take out the debug that shows how unix type systems and windows syste…
ghinks Jan 1, 2019
14b2cc6
fix then statement in yml file.
ghinks Jan 1, 2019
88e475b
remove the xyz obj test dead code.
ghinks Jan 3, 2019
a53b8f4
add node 6 and osx to unit tests
ghinks Jan 3, 2019
074897e
change to versions 8,10, lastest
ghinks Jan 3, 2019
400af56
change from "latest" to "node"
ghinks Jan 3, 2019
67774c4
merge windows travis branch back in
ghinks Jan 3, 2019
bb15d49
remove older time.cc file
ghinks Jan 4, 2019
4b8d16a
revert unit test changes that were used for break points in the debugger
ghinks Jan 4, 2019
b7f5217
update appveyor windows testing to node 8-11
ghinks Jan 4, 2019
3b06c85
remove gypfile true from the package.json as the presence of binding.…
ghinks Jan 15, 2019
95ec3ff
explicitly use node 11 and use 'node' to trigger a build against the …
ghinks Jan 15, 2019
da83f48
add comment on what travis mean by node version 'node'
ghinks Jan 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
sudo: false
os:
- linux
- windows
- osx

env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
sudo: false

language: node_js

node_js:
- "0.8"
- "0.10"
- "0.12"
- "1"
- "2"
- "3"
- "4"
- "5"
- "6"
- "7"
- "8"
- "10"
- "node"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this version?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also test 11 for now I think

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, node means the latest node and that presently is 11.6.0.


install:
- PATH="`npm bin`:`npm bin -g`:$PATH"
# Node 0.8 comes with a too obsolete npm
- if [[ "`node --version`" =~ ^v0\.8\. ]]; then npm install -g [email protected] ; fi
# Install dependencies and build
- npm install

# note, the original master branch using nan did not have a travis
# job on windows and when unit tested was found to have breaking
# tests. If these were fixed existing work arounds would be broken
# on windows.
script:
# Output useful info for debugging
- node --version
- npm --version
# Run tests
- npm test
- if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then npm test ; fi
13 changes: 4 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@ environment:
# Test against these versions of Node.js and io.js
matrix:
# node.js
- nodejs_version: "0.10"
- nodejs_version: "0.12"
# io.js
- nodejs_version: "2"
- nodejs_version: "3.2"
- nodejs_version: "4"
- nodejs_version: "5"
- nodejs_version: "6"
- nodejs_version: "7"
- nodejs_version: "8"
- nodejs_version: "9"
- nodejs_version: "10"
- nodejs_version: "11"

platform:
- x86
Expand Down
63 changes: 35 additions & 28 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
{
'targets': [
{
'target_name': 'time',
'include_dirs': [
'<!(node -e "require(\'nan\')")'
],
'sources': [ 'src/time.cc' ],
'conditions': [
['OS=="mac"', {
'defines': [
'__DARWIN_UNIX03', # For char* timezone
'HAVE_TM_GMTOFF'
]
}],
['OS=="linux"', {
'defines': [
'HAVE_TM_GMTOFF'
]
}],
['OS=="solaris"', {
'defines': [
'HAVE_ALTZONE',
'HAVE_TIMEZONE'
]
}]
]
}
]
'targets': [{
'target_name': 'time',
'sources': [ 'src/time_napi.cc' ],
'include_dirs': ["<!@(node -p \"require('node-addon-api').include\")"],
'dependencies': ["<!(node -p \"require('node-addon-api').gyp\")"],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'CLANG_CXX_LIBRARY': 'libc++',
'MACOSX_DEPLOYMENT_TARGET': '10.7'
},
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
},
'conditions': [
['OS=="mac"', {
'defines': [
'__DARWIN_UNIX03', # For char* timezone
'HAVE_TM_GMTOFF'
]
}],
['OS=="linux"', {
'defines': [
'HAVE_TM_GMTOFF'
]
}],
['OS=="solaris"', {
'defines': [
'HAVE_ALTZONE',
'HAVE_TIMEZONE'
]
}]
]
}]
}
14 changes: 10 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
var debug = require('debug')('time')
, fs = require('fs')
, path = require('path')
, bindings = require('bindings')('time.node')
, time = require('bindings')('time')
, MILLIS_PER_SECOND = 1000
, DAYS_OF_WEEK = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
, MONTHS = ['January','February','March','April','May','June','July','August','September','October','November','December']
, TZ_BLACKLIST = [ 'SystemV', 'Etc' ];

var bindings = new time.Time();
/**
* Extends a "Date" constructor with node-time's extensions.
* By default, `time.Date` is extended with this function.
Expand Down Expand Up @@ -38,9 +39,14 @@ exports.currentTimezone = process.env.TZ;
* Export the raw functions from the bindings.
*/

exports.time = bindings.time;
exports.localtime = bindings.localtime;
exports.mktime = bindings.mktime;
exports.localtime = function(t) {
debug('calling native localtime');
return bindings.localtime(t);
}
exports.mktime = function(o) {
debug('calling native mktime');
return bindings.mktime(o);
}

/**
* A "hack" of sorts to force getting our own Date instance.
Expand Down
215 changes: 215 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading