Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
94368b9
move to esbuild
ricardo-devis-agullo Feb 24, 2025
c2069ba
fix temp changes
ricardo-devis-agullo Feb 25, 2025
d3bb993
add playwright
ricardo-devis-agullo Feb 25, 2025
34001d4
more tests
ricardo-devis-agullo Feb 25, 2025
da983de
fix tests
ricardo-devis-agullo Feb 25, 2025
b29f27e
remove unused pkgs
ricardo-devis-agullo Feb 25, 2025
1747fdf
remove old test files
ricardo-devis-agullo Feb 25, 2025
38380ea
Merge pull request #126 from opencomponents/playwright
ricardo-devis-agullo Feb 25, 2025
fe67cc3
esbuildv2:
ricardo-devis-agullo Feb 26, 2025
1457639
fix tests
ricardo-devis-agullo Feb 27, 2025
c86a6ec
Merge pull request #127 from opencomponents/esbuildv2
ricardo-devis-agullo Feb 27, 2025
cc80fcc
move to biome
ricardo-devis-agullo Feb 27, 2025
d69037d
remove eslintrc.json
ricardo-devis-agullo Feb 27, 2025
3480a62
cange lint staged tasks
ricardo-devis-agullo Feb 27, 2025
a6c5b79
move to lefthook
ricardo-devis-agullo Feb 27, 2025
8925735
Merge pull request #129 from opencomponents/biome
ricardo-devis-agullo Feb 27, 2025
94262f6
replace ajax with fetch
ricardo-devis-agullo Feb 27, 2025
fe73ce3
remove prepare
ricardo-devis-agullo Feb 27, 2025
99fb5c2
audit fix
ricardo-devis-agullo Feb 27, 2025
eac2e5a
Merge branch 'v2' into replace-fetch
ricardo-devis-agullo Feb 27, 2025
6430fdd
merge
ricardo-devis-agullo Feb 27, 2025
8f4d2c1
remove most jquery usage
ricardo-devis-agullo Feb 27, 2025
156e6aa
Merge pull request #130 from opencomponents/remove-most-jquery
ricardo-devis-agullo Feb 27, 2025
0ccafc7
merge
ricardo-devis-agullo Feb 27, 2025
582f296
fix test
ricardo-devis-agullo Feb 27, 2025
1f8a40e
fix tests
ricardo-devis-agullo Feb 27, 2025
9645d1b
Merge pull request #131 from opencomponents/replace-fetch
ricardo-devis-agullo Feb 27, 2025
a146f98
remove more jquery
ricardo-devis-agullo Feb 27, 2025
d9d62aa
remove 1 more
ricardo-devis-agullo Feb 27, 2025
c3a7e69
reanimate
ricardo-devis-agullo Feb 27, 2025
f2b9250
Merge pull request #132 from opencomponents/remove-more-jquery
ricardo-devis-agullo Feb 27, 2025
64f1364
replace jquery events
ricardo-devis-agullo Feb 27, 2025
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
21 changes: 0 additions & 21 deletions .eslintrc.json

This file was deleted.

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ coverage
dist
yarn-error.log
yarn.lock

# Playwright
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
57 changes: 55 additions & 2 deletions .husky/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,57 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
set -x
fi

if [ "$LEFTHOOK" = "0" ]; then
exit 0
fi

call_lefthook()
{
if test -n "$LEFTHOOK_BIN"
then
"$LEFTHOOK_BIN" "$@"
elif lefthook -h >/dev/null 2>&1
then
lefthook "$@"
else
dir="$(git rev-parse --show-toplevel)"
osArch=$(uname | tr '[:upper:]' '[:lower:]')
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
then
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"

elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook "$@"
elif yarn lefthook -h >/dev/null 2>&1
then
yarn lefthook "$@"
elif pnpm lefthook -h >/dev/null 2>&1
then
pnpm lefthook "$@"
elif swift package plugin lefthook >/dev/null 2>&1
then
swift package --disable-sandbox plugin lefthook "$@"
elif command -v mint >/dev/null 2>&1
then
mint run csjones/lefthook-plugin "$@"
else
echo "Can't find lefthook in PATH"
fi
fi
}

call_lefthook run "pre-commit" "$@"
57 changes: 57 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/sh

if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then
set -x
fi

if [ "$LEFTHOOK" = "0" ]; then
exit 0
fi

call_lefthook()
{
if test -n "$LEFTHOOK_BIN"
then
"$LEFTHOOK_BIN" "$@"
elif lefthook -h >/dev/null 2>&1
then
lefthook "$@"
else
dir="$(git rev-parse --show-toplevel)"
osArch=$(uname | tr '[:upper:]' '[:lower:]')
cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/')
if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook"
then
"$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@"
elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook"
then
"$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@"
elif test -f "$dir/node_modules/lefthook/bin/index.js"
then
"$dir/node_modules/lefthook/bin/index.js" "$@"

elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook "$@"
elif yarn lefthook -h >/dev/null 2>&1
then
yarn lefthook "$@"
elif pnpm lefthook -h >/dev/null 2>&1
then
pnpm lefthook "$@"
elif swift package plugin lefthook >/dev/null 2>&1
then
swift package --disable-sandbox plugin lefthook "$@"
elif command -v mint >/dev/null 2>&1
then
mint run csjones/lefthook-plugin "$@"
else
echo "Can't find lefthook in PATH"
fi
fi
}

call_lefthook run "prepare-commit-msg" "$@"
30 changes: 0 additions & 30 deletions Gruntfile.js

This file was deleted.

47 changes: 47 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": ["vendor/*.js", "dist/*.js"]
},
"formatter": {
"enabled": true,
"indentStyle": "tab"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"performance": {
"noDelete": "off"
},
"style": {
"useTemplate": "off",
"noParameterAssign": "off",
"useSingleVarDeclarator": "off"
},
"complexity": {
"useLiteralKeys": "off"
},
"suspicious": {
"noDoubleEquals": "off"
},
"security": {
"noGlobalEval": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
}
}
66 changes: 31 additions & 35 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,51 @@
type Callback<T> = (err: NodeJS.ErrnoException | null, data: T) => void;

interface External {
global: string | string[];
url: string;
global: string | string[];
url: string;
}
interface ExtendedExternal extends External {
name: string;
devUrl?: string;
name: string;
devUrl?: string;
}

interface TemplateRenderer {
getInfo: () => {
externals: ExtendedExternal[];
type: string;
version: string;
};
getInfo: () => {
externals: ExtendedExternal[];
type: string;
version: string;
};
}

type Template = {
externals: External[];
externals: External[];
};
interface CompileOptions {
templates?: Record<string, Template> | TemplateRenderer[];
retryInterval?: number;
retryLimit?: number;
disableLoader?: boolean;
disableLegacyTemplates?: boolean;
externals?: External[];
templates?: Record<string, Template> | TemplateRenderer[];
retryInterval?: number;
retryLimit?: number;
disableLoader?: boolean;
disableLegacyTemplates?: boolean;
externals?: External[];
}
type Compiled = { code: string; map: string; dev: string };

declare const ocClient: {
compile: {
(options?: CompileOptions): Promise<Compiled>;
};
compileSync: {
(options?: CompileOptions): Compiled;
};
getLib: {
(cb: Callback<string>): void;
(): Promise<string>;
};
getLibs: {
(cb: Callback<{ dev: string; prod: string }>): void;
(): Promise<{ dev: string; prod: string }>;
};
getMap: {
(cb: Callback<string>): void;
(): Promise<string>;
};
version: string;
compile: (options?: CompileOptions) => Promise<Compiled>;
compileSync: (options?: CompileOptions) => Compiled;
getLib: {
(cb: Callback<string>): void;
(): Promise<string>;
};
getLibs: {
(cb: Callback<{ dev: string; prod: string }>): void;
(): Promise<{ dev: string; prod: string }>;
};
getMap: {
(cb: Callback<string>): void;
(): Promise<string>;
};
version: string;
};

export = ocClient;
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<script>
var oc = oc || {};
oc.conf = oc.conf || {};
oc.conf.retryInterval = 1;
oc.conf.loadingMessage = 'Loading';
</script>
</head>
<body>
<script src="/vendor/handlebars.runtime.js"></script>
<script src="/vendor/jade.runtime.js"></script>
<script src="/dist/oc-client.min.js"></script>
</body>
</html>
45 changes: 22 additions & 23 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
'use strict';
const { readFile } = require('fs/promises');
const path = require('path');
const { fromPromise } = require('universalify');
const { compile, compileSync } = require('./tasks/compile');
const { readFile } = require("node:fs/promises");
const path = require("node:path");
const { fromPromise } = require("universalify");
const { compile, compileSync } = require("./tasks/compile");

const distDir = 'dist';
const clientDevLibFileName = 'oc-client.js';
const clientLibFileName = 'oc-client.min.js';
const clientMapFileName = 'oc-client.min.map';
const version = require('./package.json').version;
const distDir = "dist";
const clientDevLibFileName = "oc-client.js";
const clientLibFileName = "oc-client.min.js";
const clientMapFileName = "oc-client.min.map";
const version = require("./package.json").version;

function getLib() {
return readFile(path.join(__dirname, distDir, clientLibFileName), 'utf-8');
return readFile(path.join(__dirname, distDir, clientLibFileName), "utf-8");
}

async function getLibs() {
const [dev, prod] = await Promise.all([
readFile(path.join(__dirname, distDir, clientDevLibFileName), 'utf-8'),
readFile(path.join(__dirname, distDir, clientLibFileName), 'utf-8')
]);
const [dev, prod] = await Promise.all([
readFile(path.join(__dirname, distDir, clientDevLibFileName), "utf-8"),
readFile(path.join(__dirname, distDir, clientLibFileName), "utf-8"),
]);

return { dev, prod };
return { dev, prod };
}

function getMap() {
return readFile(path.join(__dirname, distDir, clientMapFileName), 'utf8');
return readFile(path.join(__dirname, distDir, clientMapFileName), "utf8");
}

module.exports = {
compile: fromPromise(compile),
compileSync,
getLib: fromPromise(getLib),
getLibs: fromPromise(getLibs),
getMap: fromPromise(getMap),
version
compile: fromPromise(compile),
compileSync,
getLib: fromPromise(getLib),
getLibs: fromPromise(getLibs),
getMap: fromPromise(getMap),
version,
};
1 change: 1 addition & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading
Loading