Skip to content

Commit 7d48b26

Browse files
committed
First commit
0 parents  commit 7d48b26

22 files changed

+148307
-0
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.github/workflows/ci.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: windows-2019
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [windows-2019]
19+
include:
20+
- os: windows-2019
21+
friendlyName: Windows
22+
timeout-minutes: 10
23+
steps:
24+
- uses: actions/checkout@v2
25+
with:
26+
submodules: recursive
27+
- name: Install Node.js
28+
uses: actions/[email protected]
29+
with:
30+
node-version: 12
31+
32+
# This step can be removed as soon as official Windows arm64 builds are published:
33+
# https://github.com/nodejs/build/issues/2450#issuecomment-705853342
34+
- run: |
35+
$NodeVersion = (node --version) -replace '^.'
36+
$NodeFallbackVersion = "15.8.0"
37+
& .\script\download-node-lib-win-arm64.ps1 $NodeVersion $NodeFallbackVersion
38+
name: Install Windows arm64 node.lib
39+
40+
- name: Install and build dependencies
41+
run: yarn
42+
- name: Lint
43+
run: yarn check-prettier
44+
- name: Build
45+
run: yarn build
46+
- name: Test
47+
run: yarn test
48+
- name: Prebuild x64
49+
run: npm run prebuild-napi-x64
50+
- name: Prebuild arm64
51+
run: npm run prebuild-napi-arm64
52+
- name: Prebuild x86
53+
run: npm run prebuild-napi-ia32
54+
- name: Publish
55+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
56+
run: yarn upload
57+
env:
58+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (http://nodejs.org/api/addons.html)
33+
build
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# Typescript v1 declaration files
40+
typings/
41+
42+
# Optional npm cache directory
43+
.npm
44+
45+
# Optional eslint cache
46+
.eslintcache
47+
48+
# Optional REPL history
49+
.node_repl_history
50+
51+
# Output of 'npm pack'
52+
*.tgz
53+
54+
# Yarn Integrity file
55+
.yarn-integrity
56+
57+
# dotenv environment variables file
58+
.env
59+
60+
# generated TS files
61+
dist/
62+
63+
# prebuild native modules for publishing
64+
prebuilds/

.npmignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ignore everything unrelated to the source code
2+
.vscode
3+
.prettierrc.yml
4+
benchmarks/
5+
docs/
6+
lib/
7+
script/
8+
test/
9+
.gitattributes
10+
tsconfig.json
11+
.yarnrc
12+
vendor/
13+
yarn-error.log
14+
*.tgz
15+
build
16+
jest.json
17+
.node-version
18+
.github
19+
dist/test

.prettierignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vscode
2+
.prettierrc.yml
3+
benchmarks/
4+
.gitattributes
5+
.yarnrc
6+
vendor/
7+
yarn-error.log
8+
build
9+
dist

.prettierrc.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
singleQuote: true
2+
trailingComma: es5
3+
semi: false
4+
proseWrap: always
5+
endOfLine: auto
6+
arrowParens: avoid

.yarnrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
yarn-path "./vendor/yarn-1.16.0.js"

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 GitHub Desktop
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# detect-arm64-translation
2+
3+
## A simple library to detect ARM64 translation on Windows

binding.gyp

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
'targets': [
3+
{
4+
'target_name': 'detect-arm64-translation',
5+
'cflags!': [ '-fno-exceptions' ],
6+
'cflags_cc!': [ '-fno-exceptions' ],
7+
'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
8+
'CLANG_CXX_LIBRARY': 'libc++',
9+
'MACOSX_DEPLOYMENT_TARGET': '10.7',
10+
},
11+
'msvs_settings': {
12+
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
13+
},
14+
'include_dirs': [
15+
'<!(node -p "require(\'node-addon-api\').include_dir")' ],
16+
'defines': [
17+
"NAPI_VERSION=<(napi_build_version)",
18+
],
19+
'conditions': [
20+
['OS=="win"', {
21+
'sources': [
22+
'src/main.cc',
23+
],
24+
'msvs_disabled_warnings': [
25+
4267, # conversion from 'size_t' to 'int', possible loss of data
26+
4530, # C++ exception handler used, but unwind semantics are not enabled
27+
4506, # no definition for inline function
28+
],
29+
}],
30+
],
31+
}
32+
]
33+
}

docs/releases.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Releases
2+
3+
## Release/Publishing
4+
5+
Before running the commands in 'Publishing to NPM', create a new release branch
6+
of the form `releases/x.x.x`
7+
8+
After running commands in 'Publishing to NPM', the release branch should be
9+
pushed. Now, you need to get it reviewed and merged.
10+
11+
After that, don't forget publish the release on the repo.
12+
13+
- Go to https://github.com/desktop/node-detect-arm64-translation/releases
14+
- Click click `Draft a New Release`
15+
- Fill in form
16+
- Hit `Publish release`
17+
18+
## Publishing to NPM
19+
20+
Releases are done to NPM, and are currently limited to the core team.
21+
22+
```sh
23+
# to ensure everything is up-to-date and tests pass
24+
npm ci
25+
npm test
26+
27+
# you might need to do a different sort of version bump here
28+
npm version minor
29+
30+
# this will also run the test suite and fail if any errors found
31+
# this will also run `git push --follow-tags` at the end
32+
npm publish
33+
```

jest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"testMatch": ["**/dist/**/*-test.js"]
3+
}

lib/detect-arm64-translation.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const nativeModule =
2+
process.platform === 'win32'
3+
? require('../../build/Release/detect-arm64-translation.node')
4+
: null
5+
6+
export function isRunningUnderARM64Translation(): boolean {
7+
return nativeModule.isRunningUnderARM64Translation()
8+
}

lib/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './detect-arm64-translation'

0 commit comments

Comments
 (0)