From 395c31eb71954e2a8af09c78a1e20ee32ac3f3ea Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 13 Nov 2020 12:57:03 -0800 Subject: [PATCH] build: add CI --- .circleci/config.yml | 46 ++++++++++++++++++++++++++++++++++++++++++ package.json | 6 +++--- src/index.ts | 16 +-------------- yarn.lock | 48 ++------------------------------------------ 4 files changed, 52 insertions(+), 64 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..5b81043 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,46 @@ +step-restore-cache: &step-restore-cache + restore_cache: + keys: + - v1-dependencies-{{ arch }}-{{ checksum "yarn.lock" }} + - v1-dependencies-{{ arch }} + +steps-test: &steps-test + steps: + - checkout + - *step-restore-cache + - run: yarn --frozen-lockfile + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ arch }}-{{ checksum "yarn.lock" }} + - run: yarn build + - run: yarn test + +version: 2.1 +jobs: + test: + macos: + xcode: "12.2.0" + <<: *steps-test + + release: + docker: + - image: circleci/node:10.15 + steps: + - checkout + - *step-restore-cache + - run: yarn --frozen-lockfile + - run: npx semantic-release +workflows: + version: 2 + test_and_release: + jobs: + - test + - release: + requires: + - test + filters: + branches: + only: + - master + diff --git a/package.json b/package.json index 8586ba5..248568b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "scripts": { "build": "tsc && tsc -p tsconfig.esm.json", "lint": "prettier --check \"src/**/*.ts\"", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "test": "exit 0" }, "devDependencies": { "@continuous-auth/semantic-release-npm": "^2.0.0", @@ -36,7 +37,6 @@ "dependencies": { "@malept/cross-spawn-promise": "^1.1.0", "asar": "^3.0.3", - "fs-extra": "^9.0.1", - "macho": "^1.4.0" + "fs-extra": "^9.0.1" } } diff --git a/src/index.ts b/src/index.ts index 720d40e..0a22e79 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,19 +6,6 @@ import * as os from 'os'; import * as path from 'path'; const MACHO_PREFIX = 'Mach-O '; -const macho = require('macho'); - -const machoParse = async ( - p: string, -): Promise<{ - bits: number; - cpu: { - type: 'x86_64' | 'arm64'; - subtype: string; - }; -}> => { - return macho.parse(await fs.readFile(p)); -}; type MakeUniversalOpts = { /** @@ -46,9 +33,8 @@ enum AsarMode { HAS_ASAR, } -const detectAsarMode = async (appPath: string) => { +export const detectAsarMode = async (appPath: string) => { const asarPath = path.resolve(appPath, 'Contents', 'Resources', 'app.asar'); - const asarUnpackedPath = path.resolve(appPath, 'Contents', 'Resources', 'app.asar.unpacked'); if (!(await fs.pathExists(asarPath))) return AsarMode.NO_ASAR; diff --git a/yarn.lock b/yarn.lock index a8d88cf..1954cdf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1131,7 +1131,7 @@ debug@^3.1.0: dependencies: ms "^2.1.1" -debuglog@*, debuglog@^1.0.1: +debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -1296,11 +1296,6 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" -endian-reader@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/endian-reader/-/endian-reader-0.1.0.tgz#eed61ec564aa5f6285248f36245e2c89156d94ac" - integrity sha1-7tYexWSqX2KFJI82JF4siRVtlKw= - enquirer@^2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" @@ -2007,7 +2002,7 @@ import-lazy@^2.1.0: resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM= -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -2612,11 +2607,6 @@ lockfile@^1.0.4: dependencies: signal-exit "^3.0.2" -lodash._baseindexof@*: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" - integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw= - lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -2625,33 +2615,11 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" -lodash._bindcallback@*: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" - integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4= - -lodash._cacheindexof@*: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" - integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI= - -lodash._createcache@*: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" - integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM= - dependencies: - lodash._getnative "^3.0.0" - lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= -lodash._getnative@*, lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= - lodash._root@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" @@ -2687,11 +2655,6 @@ lodash.isstring@^4.0.1: resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE= -lodash.restparam@*: - version "3.6.1" - resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" - integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU= - lodash.toarray@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561" @@ -2766,13 +2729,6 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -macho@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/macho/-/macho-1.4.0.tgz#a215a925102cebfd3941c0fa9bd79dc37147be56" - integrity sha512-PT3YMEKYogCeVYEA2bCFRZASNyn/JaOhjq6eV8SzBQ3RFia7XU8ASQCgGx+f3RnJFHT+xavLP+Qds48jQb0J5Q== - dependencies: - endian-reader "^0.1.0" - macos-release@^2.2.0: version "2.4.1" resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.4.1.tgz#64033d0ec6a5e6375155a74b1a1eba8e509820ac"