Skip to content

Commit 93aaf1a

Browse files
committed
ci: add ci.yml
1 parent 1e593aa commit 93aaf1a

File tree

7 files changed

+89
-17
lines changed

7 files changed

+89
-17
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
merge_group:
12+
types: [checks_requested]
13+
14+
jobs:
15+
analyze:
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
actions: read
20+
contents: read
21+
security-events: write
22+
23+
steps:
24+
- name: Git Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Initialize CodeQL
28+
uses: github/codeql-action/init@v3
29+
with:
30+
languages: javascript
31+
32+
- name: Autobuild
33+
uses: github/codeql-action/autobuild@v3
34+
35+
- name: Run CodeQL Analysis
36+
uses: github/codeql-action/analyze@v3
37+
38+
build:
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Git Checkout
43+
uses: actions/checkout@v4
44+
with:
45+
submodules: "recursive"
46+
47+
- name: Get Cache Dir
48+
id: yarn-cache-dir
49+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
50+
51+
- name: Use Cache
52+
uses: actions/cache@v4
53+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
54+
with:
55+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
56+
key: ${{ runner.os }}-yarn-
57+
restore-keys: |
58+
${{ runner.os }}-yarn-
59+
60+
- name: Use EMSDK
61+
uses: mymindstorm/setup-emsdk@v14
62+
with:
63+
version: 1.38.40
64+
actions-cache-folder: 'emsdk-cache'
65+
66+
- name: Use Node.js 20
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: 20
70+
cache: "yarn"
71+
72+
- name: Install Deps
73+
run: yarn install --immutable
74+
75+
- name: Build Package
76+
run: yarn build
77+
78+
- name: Run Linter
79+
run: yarn lint

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"scripts": {
1010
"lint": "eslint . --ext .js,.vue,.ts --format pretty",
1111
"fix": "yarn lint --fix",
12-
"test": "yarn workspaces foreach -A run test",
12+
"test": "yarn workspaces foreach -A --topological-dev run test",
1313
"build": "yarn workspaces foreach -A --topological-dev run build",
1414
"postinstall": "husky"
1515
},

packages/ghostscript/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ emmake make \
5555
mkdir -p "$ROOT/dist"
5656
cd "$ROOT/dist"
5757
cp $ROOT/ghostpdl/bin/gs.* .
58+
cp -r $ROOT/out/share/ghostscript/*/lib .
5859

5960
# Apply version & create d.ts
6061
node "$ROOT/build/post-build.js"

packages/ghostscript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@privyid/ghostscript",
33
"description": "Ghostscript compiled to WebAssembly",
4-
"version": "0.1.0-alpha.1",
4+
"version": "0.1.0-alpha.2",
55
"gsVersion": "10.03.1",
66
"packageManager": "yarn@4.3.1",
77
"type": "module",

packages/ghoulscript/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"version": "0.1.0-alpha.4",
55
"type": "module",
66
"main": "./dist/index.cjs",
7-
"module": "./dist/index.mjs",
7+
"module": "./dist/index.js",
88
"types": "./dist/index.d.ts",
99
"exports": {
1010
".": {
11-
"import": "./dist/index.mjs",
11+
"import": "./dist/index.js",
1212
"require": "./dist/index.cjs",
1313
"types": "./dist/index.d.ts"
1414
}

packages/ghoulscript/tests/core.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
removePassword,
1515
isRequirePassword,
1616
getInfo,
17-
} from '../dist/index.mjs'
17+
} from '../dist/index.js'
1818

1919
const _filename = fileURLToPath(import.meta.url)
2020
const _dirname = dirname(_filename)

packages/ghoulscript/vite.config.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,10 @@ export default defineConfig({
1212
build: {
1313
minify: false,
1414
lib : {
15-
entry : 'src/index',
16-
name : 'Ghoulscript',
17-
formats: ['cjs', 'es'],
18-
fileName (format, entryName) {
19-
const EXT: Record<string, string> = {
20-
cjs: '.cjs',
21-
es : '.mjs',
22-
umd: '.umd.cjs',
23-
}
24-
25-
return `${entryName}${EXT[format] ?? '.js'}`
26-
},
15+
entry : 'src/index',
16+
name : 'Ghoulscript',
17+
formats : ['cjs', 'es'],
18+
fileName: 'index',
2719
},
2820
},
2921
})

0 commit comments

Comments
 (0)