Skip to content

Commit 0894ce2

Browse files
Merge pull request #138 from opencomponents/v2
V2
2 parents 7324c08 + 6afb11c commit 0894ce2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5167
-23464
lines changed

.eslintrc.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/node.js.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [18.x, 20.x]
19+
node-version: [18.x, 20.x, 22.x]
2020
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2121

2222
steps:
23-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v4
2424
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v2
25+
uses: actions/setup-node@v4
2626
with:
2727
node-version: ${{ matrix.node-version }}
2828
cache: 'npm'
2929
- run: npm ci
30+
- run: npx playwright install --with-deps
3031
- run: npm run build --if-present
3132
- run: npm test

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ coverage
66
dist
77
yarn-error.log
88
yarn.lock
9+
10+
# Playwright
11+
/test-results/
12+
/playwright-report/
13+
/blob-report/
14+
/playwright/.cache/

.husky/pre-commit

100644100755
Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,57 @@
11
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
32

4-
npx --no-install lint-staged
3+
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
4+
set -x
5+
fi
6+
7+
if [ "$LEFTHOOK" = "0" ]; then
8+
exit 0
9+
fi
10+
11+
call_lefthook()
12+
{
13+
if test -n "$LEFTHOOK_BIN"
14+
then
15+
"$LEFTHOOK_BIN" "$@"
16+
elif lefthook -h >/dev/null 2>&1
17+
then
18+
lefthook "$@"
19+
else
20+
dir="$(git rev-parse --show-toplevel)"
21+
osArch=$(uname | tr '[:upper:]' '[:lower:]')
22+
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
23+
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
24+
then
25+
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
26+
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
27+
then
28+
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
29+
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
30+
then
31+
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
32+
elif test -f "$dir/node_modules/lefthook/bin/index.js"
33+
then
34+
"$dir/node_modules/lefthook/bin/index.js" "$@"
35+
36+
elif bundle exec lefthook -h >/dev/null 2>&1
37+
then
38+
bundle exec lefthook "$@"
39+
elif yarn lefthook -h >/dev/null 2>&1
40+
then
41+
yarn lefthook "$@"
42+
elif pnpm lefthook -h >/dev/null 2>&1
43+
then
44+
pnpm lefthook "$@"
45+
elif swift package plugin lefthook >/dev/null 2>&1
46+
then
47+
swift package --disable-sandbox plugin lefthook "$@"
48+
elif command -v mint >/dev/null 2>&1
49+
then
50+
mint run csjones/lefthook-plugin "$@"
51+
else
52+
echo "Can't find lefthook in PATH"
53+
fi
54+
fi
55+
}
56+
57+
call_lefthook run "pre-commit" "$@"

.husky/prepare-commit-msg

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/sh
2+
3+
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
4+
set -x
5+
fi
6+
7+
if [ "$LEFTHOOK" = "0" ]; then
8+
exit 0
9+
fi
10+
11+
call_lefthook()
12+
{
13+
if test -n "$LEFTHOOK_BIN"
14+
then
15+
"$LEFTHOOK_BIN" "$@"
16+
elif lefthook -h >/dev/null 2>&1
17+
then
18+
lefthook "$@"
19+
else
20+
dir="$(git rev-parse --show-toplevel)"
21+
osArch=$(uname | tr '[:upper:]' '[:lower:]')
22+
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
23+
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
24+
then
25+
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
26+
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
27+
then
28+
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
29+
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
30+
then
31+
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
32+
elif test -f "$dir/node_modules/lefthook/bin/index.js"
33+
then
34+
"$dir/node_modules/lefthook/bin/index.js" "$@"
35+
36+
elif bundle exec lefthook -h >/dev/null 2>&1
37+
then
38+
bundle exec lefthook "$@"
39+
elif yarn lefthook -h >/dev/null 2>&1
40+
then
41+
yarn lefthook "$@"
42+
elif pnpm lefthook -h >/dev/null 2>&1
43+
then
44+
pnpm lefthook "$@"
45+
elif swift package plugin lefthook >/dev/null 2>&1
46+
then
47+
swift package --disable-sandbox plugin lefthook "$@"
48+
elif command -v mint >/dev/null 2>&1
49+
then
50+
mint run csjones/lefthook-plugin "$@"
51+
else
52+
echo "Can't find lefthook in PATH"
53+
fi
54+
fi
55+
}
56+
57+
call_lefthook run "prepare-commit-msg" "$@"

Gruntfile.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

biome.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": false,
5+
"clientKind": "git",
6+
"useIgnoreFile": false
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": ["vendor/*.js", "dist/*.js"]
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "tab"
15+
},
16+
"organizeImports": {
17+
"enabled": true
18+
},
19+
"linter": {
20+
"enabled": true,
21+
"rules": {
22+
"recommended": true,
23+
"performance": {
24+
"noDelete": "off"
25+
},
26+
"style": {
27+
"useConst": "off",
28+
"useTemplate": "off",
29+
"noParameterAssign": "off",
30+
"useSingleVarDeclarator": "off"
31+
},
32+
"complexity": {
33+
"useLiteralKeys": "off"
34+
},
35+
"suspicious": {
36+
"noDoubleEquals": "off"
37+
},
38+
"security": {
39+
"noGlobalEval": "off"
40+
}
41+
}
42+
},
43+
"javascript": {
44+
"formatter": {
45+
"quoteStyle": "double"
46+
}
47+
}
48+
}

index.d.ts

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,51 @@
11
type Callback<T> = (err: NodeJS.ErrnoException | null, data: T) => void;
22

33
interface External {
4-
global: string | string[];
5-
url: string;
4+
global: string | string[];
5+
url: string;
66
}
77
interface ExtendedExternal extends External {
8-
name: string;
9-
devUrl?: string;
8+
name: string;
9+
devUrl?: string;
1010
}
1111

1212
interface TemplateRenderer {
13-
getInfo: () => {
14-
externals: ExtendedExternal[];
15-
type: string;
16-
version: string;
17-
};
13+
getInfo: () => {
14+
externals: ExtendedExternal[];
15+
type: string;
16+
version: string;
17+
};
1818
}
1919

2020
type Template = {
21-
externals: External[];
21+
externals: External[];
2222
};
2323
interface CompileOptions {
24-
templates?: Record<string, Template> | TemplateRenderer[];
25-
retryInterval?: number;
26-
retryLimit?: number;
27-
disableLoader?: boolean;
28-
disableLegacyTemplates?: boolean;
29-
externals?: External[];
24+
templates?: Record<string, Template> | TemplateRenderer[];
25+
retryInterval?: number;
26+
retryLimit?: number;
27+
disableLoader?: boolean;
28+
disableLegacyTemplates?: boolean;
29+
externals?: External[];
3030
}
3131
type Compiled = { code: string; map: string; dev: string };
3232

3333
declare const ocClient: {
34-
compile: {
35-
(options?: CompileOptions): Promise<Compiled>;
36-
};
37-
compileSync: {
38-
(options?: CompileOptions): Compiled;
39-
};
40-
getLib: {
41-
(cb: Callback<string>): void;
42-
(): Promise<string>;
43-
};
44-
getLibs: {
45-
(cb: Callback<{ dev: string; prod: string }>): void;
46-
(): Promise<{ dev: string; prod: string }>;
47-
};
48-
getMap: {
49-
(cb: Callback<string>): void;
50-
(): Promise<string>;
51-
};
52-
version: string;
34+
compile: (options?: CompileOptions) => Promise<Compiled>;
35+
compileSync: (options?: CompileOptions) => Compiled;
36+
getLib: {
37+
(cb: Callback<string>): void;
38+
(): Promise<string>;
39+
};
40+
getLibs: {
41+
(cb: Callback<{ dev: string; prod: string }>): void;
42+
(): Promise<{ dev: string; prod: string }>;
43+
};
44+
getMap: {
45+
(cb: Callback<string>): void;
46+
(): Promise<string>;
47+
};
48+
version: string;
5349
};
5450

5551
export = ocClient;

index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<script>
5+
var oc = oc || {};
6+
oc.conf = oc.conf || {};
7+
oc.conf.retryInterval = 1;
8+
oc.conf.loadingMessage = 'Loading';
9+
</script>
10+
</head>
11+
<body>
12+
<script src="/vendor/handlebars.runtime.js"></script>
13+
<script src="/vendor/jade.runtime.js"></script>
14+
<script src="/dist/oc-client.min.js"></script>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)