Skip to content
Open

Wasm #39

Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"presets": [
"@babel/preset-env",
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
"@babel/preset-typescript"
]
}
35 changes: 35 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# EditorConfig helps maintain consistent coding styles
# https://editorconfig.org

root = true

# All files
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# JavaScript, TypeScript
[*.{js,jsx,ts,tsx,mjs,cjs}]
indent_style = space
indent_size = 4

# JSON, YAML
[*.{json,yml,yaml}]
indent_style = space
indent_size = 2

# Markdown
[*.md]
trim_trailing_whitespace = false
max_line_length = 80

# Package files
[{package.json,*.lock}]
indent_style = space
indent_size = 2

# Makefiles
[Makefile]
indent_style = tab
21 changes: 21 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Dependencies
node_modules/

# Build output
dist/
build/
coverage/

# Generated files
*.min.js
*.bundle.js
wasm/bclibc.js

# WASM
*.wasm

# Logs
*.log

# OS
.DS_Store
38 changes: 26 additions & 12 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,40 @@ on:
types: [created]

jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 16
- run: npm ci
- run: npm test
node-version: 20
cache: "yarn"
- run: yarn install --frozen-lockfile
- run: yarn test

publish-npm:
needs: build
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v6

- name: Init C++ source submodule
run: git submodule update --init lib/py-ballisticcalc

- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@v14

- name: Create emsdk stub for Makefile compatibility
run: mkdir -p lib/emsdk && echo "" > lib/emsdk/emsdk_env.sh

- uses: actions/setup-node@v6
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
cache: "yarn"

- run: yarn install --frozen-lockfile

- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
17 changes: 9 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ name: Jest

on:
pull_request:
branches:
- '*'
branches:
- '*'
workflow_dispatch:

jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 16
- run: npm ci
- run: npm test
node-version: 20
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,7 @@ dist
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.pnp.*

build/
dist/
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "emsdk"]
path = lib/emsdk
url = https://github.com/emscripten-core/emsdk.git
[submodule "lib/bclibc"]
path = lib/bclibc
url = https://github.com/ballistics-lab/bclibc
48 changes: 48 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Dependencies
node_modules/
dist/
build/

# Git submodules (add your submodule paths here)
**/submodules/
vendor/
third-party/
# Add specific submodule paths if needed:
# path/to/your/submodule/

# Generated files
*.wasm
*.min.js
*.bundle.js

# Coverage
coverage/
.nyc_output/

# Logs
*.log

# OS
.DS_Store
Thumbs.db

# IDE
.vscode/
.idea/

# Emscripten generated
wasm/bclibc.js
wasm/*.wasm

# Package manager
package-lock.json
yarn.lock
pnpm-lock.yaml

# Git
.git/
.gitmodules

# Submodules
bclibc/
emsdk/
34 changes: 33 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
{
"tabWidth": 4,
"useTabs": false,
"jsxBracketSameLine": false
"semi": true,
"singleQuote": false,
"quoteProps": "as-needed",
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "always",
"printWidth": 100,
"endOfLine": "lf",
"overrides": [
{
"files": "*.md",
"options": {
"printWidth": 80,
"proseWrap": "always"
}
},
{
"files": "*.json",
"options": {
"tabWidth": 2
}
},
{
"files": [
"*.yml",
"*.yaml"
],
"options": {
"tabWidth": 2
}
}
],
"bracketSameLine": false
}
19 changes: 19 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/lib/**/",
"${workspaceFolder}/lib/emsdk/upstream/emscripten/cache/sysroot/include/**",
"${workspaceFolder}/lib/emsdk/upstream/emscripten/system/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
46 changes: 28 additions & 18 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
{
"cSpell.words": [
"atmo"
],
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"[javascript]": {
"editor.tabSize": 4,
"editor.insertSpaces": true
"jest.jestCommandLine": "yarn jest",
"jest.runMode": "watch",
"jest.nodeEnv": {
"NODE_OPTIONS": "--experimental-vm-modules --no-warnings"
},
"[typescript]": {
"editor.tabSize": 4,
"editor.insertSpaces": true
// TypeScript/JavaScript specific
"js/ts.tsdk.path": "node_modules/typescript/lib",
"js/ts.tsdk.promptToUseWorkspaceVersion": true,
"js/ts.inlayHints.parameterNames.enabled": "all",
"js/ts.inlayHints.variableTypes.enabled": true,
"js/ts.inlayHints.propertyDeclarationTypes.enabled": true,
"js/ts.inlayHints.functionLikeReturnTypes.enabled": true,
"js/ts.preferences.includePackageJsonAutoImports": "auto",
"js/ts.suggest.autoImports": true,
"js/ts.updateImportsOnFileMove.enabled": "always",
"js/ts.preferences.importModuleSpecifier": "relative",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"editor.suggest.showWords": true,
"editor.suggest.showKeywords": true,
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
},
"[javascriptreact]": {
"editor.tabSize": 4,
"editor.insertSpaces": true
},
"[typescriptreact]": {
"editor.tabSize": 4,
"editor.insertSpaces": true
}
}
"editor.parameterHints.enabled": true,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"cmake.sourceDirectory": "${workspaceFolder}/lib/bclibc"
}
Loading
Loading