Skip to content

Commit

Permalink
Remove .ts files, migrate to vanilla javascript
Browse files Browse the repository at this point in the history
I am removing the Typescript transpilation part, the project will have full typescript support, Typescript support will not be removed.
  • Loading branch information
Sirherobrine23 committed Sep 12, 2023
1 parent 1ed4fca commit 92c740c
Show file tree
Hide file tree
Showing 39 changed files with 1,926 additions and 1,509 deletions.
122 changes: 90 additions & 32 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,110 @@ on:
- prereleased

jobs:
build:
strategy:
matrix:
os:
- windows
- macos
runs-on: ${{ matrix.os }}-latest
linux_build:
runs-on: ubuntu-latest
name: Build for Linux
steps:
- uses: actions/checkout@v4
name: Code checkout
name: Checkout

- uses: actions/setup-node@v3
name: Setup Node.js
with:
node-version: 20.x

- name: Install dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt update
sudo apt install -y binutils-multiarch gcc-*aarch64-linux-gnu gcc-*aarch64-linux-gnu-base g++-*aarch64-linux-gnu libc6-arm64-cross
npm install --no-save --ignore-scripts
- name: Build addon
run: npm run prebuildify -- -v

- name: Upload prebuilds interface
uses: actions/upload-artifact@v3
with:
submodules: true
retention-days: 7
name: prebuilds_${{ runner.os }}
path: "prebuilds/**"

macos_build:
runs-on: macos-latest
name: Build for MacOS
steps:
- uses: actions/checkout@v4
name: Checkout

# Install basic tools
- uses: actions/setup-node@v3
name: Setup node.js
name: Setup Node.js
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
node-version: 20.x

- name: Install dependencies
run: npm install --no-save --ignore-scripts

- run: npm install --no-save --ignore-scripts
- run: npm run prebuildify -- -v
- name: Build addon
run: npm run prebuildify -- -v

- name: Upload generate interface
- name: Upload prebuilds interface
uses: actions/upload-artifact@v3
with:
retention-days: 7
name: prebuilds_${{ matrix.os }}
name: prebuilds_${{ runner.os }}
path: "prebuilds/**"

pack_package:
needs: build
win_build:
runs-on: windows-latest
name: Build for Windows
steps:
- uses: actions/checkout@v4
name: Checkout

- uses: actions/setup-node@v3
name: Setup Node.js
with:
node-version: 20.x

- name: Install dependencies
run: npm install --no-save --ignore-scripts

- name: Build addon
run: npm run prebuildify -- -v

- name: Upload prebuilds interface
uses: actions/upload-artifact@v3
with:
retention-days: 7
name: prebuilds_${{ runner.os }}
path: "prebuilds/**"

publish:
needs: [ linux_build, macos_build, win_build ]
runs-on: ubuntu-latest
name: Pack npm package
name: Publish to npm registry
permissions:
id-token: write
pull-requests: write
issues: write
contents: write
env:
PACKAGE_VERSION: ${{ github.ref }}
steps:
- uses: actions/checkout@v4
name: Code checkout
with:
submodules: true

- name: Ubuntu dependecies
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt install -y binutils-multiarch gcc-*aarch64-linux-gnu gcc-*aarch64-linux-gnu-base g++-*aarch64-linux-gnu libc6-arm64-cross

# Install basic tools
- uses: actions/setup-node@v3
name: Setup node.js
with:
node-version: 18.x
node-version: 20.x
registry-url: https://registry.npmjs.org/

- name: Download all artefacts
uses: actions/download-artifact@v3
with:
path: ./prebuilds
name:

- name: Edit version and install depencies
run: |
Expand All @@ -75,9 +120,22 @@ jobs:
mv -fv package2.json package.json
# Install depencides and build
npm install --no-save
npm install --no-save --ignore-scripts
node libs/build.mjs
# Publish npm
- run: npm publish --access public --tag ${{ github.event.release.prerelease && 'next' || 'latest' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}

- uses: peter-evans/create-pull-request@v5
name: Create Pull Request
with:
commit-message: Update to (${{ env.PACKAGE_VERSION }})
delete-branch: true
assignees: SirHerobrine23
reviewers: SirHerobrine23
branch: version_update_${{ env.PACKAGE_VERSION }}
title: new release version v${{ env.PACKAGE_VERSION }}
body: Auto update version, created with GitHub Actions
add-paths: "."
14 changes: 7 additions & 7 deletions .github/workflows/testProject.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [ 16.x, 17.x, 18.x, 19.x ]
node_version: [ 16.x, 17.x, 18.x, 19.x, 20.x ]
steps:
- uses: actions/checkout@v4
name: Checkout
Expand All @@ -38,7 +38,7 @@ jobs:
name: addrs_${{ runner.os }}_${{ matrix.node_version }}
path: "*.addrs.json"

- name: Upload generate interface
- name: Upload prebuilds interface
uses: actions/upload-artifact@v3
with:
retention-days: 7
Expand All @@ -49,7 +49,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
node_version: [ 16.x, 17.x, 18.x, 19.x ]
node_version: [ 16.x, 17.x, 18.x, 19.x, 20.x ]
steps:
- uses: actions/checkout@v4
name: Checkout
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
name: addrs_${{ runner.os }}_${{ matrix.node_version }}
path: "*.addrs.json"

- name: Upload generate interface
- name: Upload prebuilds interface
uses: actions/upload-artifact@v3
with:
retention-days: 7
Expand All @@ -94,7 +94,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
node_version: [ 16.x, 17.x, 18.x, 19.x ]
node_version: [ 16.x, 17.x, 18.x, 19.x, 20.x ]
steps:
- uses: actions/checkout@v4
name: Checkout
Expand All @@ -116,7 +116,7 @@ jobs:
name: addrs_${{ runner.os }}_${{ matrix.node_version }}
path: "*.addrs.json"

- name: Upload generate interface
- name: Upload prebuilds interface
uses: actions/upload-artifact@v3
with:
retention-days: 7
Expand All @@ -136,7 +136,7 @@ jobs:
- uses: actions/setup-node@v3
name: Setup node.js
with:
node-version: 18.x
node-version: 20.x
registry-url: https://registry.npmjs.org/

- name: Download all artefacts
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ node_modules/
/*.tgz
*.node

# Typescript
src/**/*.js
src/**/*.d.ts

# Anothers
.vscode-ctags*
*.addrs.json
Expand Down
4 changes: 1 addition & 3 deletions .mocharc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ full-trace: true
recursive: true
parallel: false
timeout: 0
extension: [ "test.ts" ]
node-option:
- "loader=ts-node/register"
extension: [ "test.mjs" ]
4 changes: 0 additions & 4 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ node_modules/
.vscode/
.vscode-ctags

# Typescript
src/**/*.ts
!src/**/*.d.ts

# Github and Git
.github/
.git*
Expand Down
10 changes: 2 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
},
"files.exclude": {
"**/node_modules/": true,
"**/src/**/*.js": true,
"**/src/**/*.d.ts": true,
"**/build/": false
"**/**.d.ts": true,
"**/build/": true
},
"terminal.integrated.env.windows": {
"PATH": "${workspaceFolder}/node_modules/.bin;${env:PATH}"
Expand All @@ -25,10 +24,5 @@
},
"terminal.integrated.env.osx": {
"PATH": "${workspaceFolder}/node_modules/.bin:${env:PATH}"
},
"files.associations": {
"*.dsc": "ini",
"*.gyp": "python",
"vector": "cpp"
}
}
Loading

0 comments on commit 92c740c

Please sign in to comment.