Skip to content

Commit

Permalink
chore: use @vis.gl/dev-tools (#2229)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress authored Sep 2, 2024
1 parent 9afa43d commit 7f99191
Show file tree
Hide file tree
Showing 27 changed files with 269 additions and 2,205 deletions.
53 changes: 13 additions & 40 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
const {getESLintConfig} = require('ocular-dev-tools/configuration');
const {getESLintConfig} = require('@vis.gl/dev-tools/configuration');

// Make any changes to default config here
module.exports = getESLintConfig({
overrides: {
parser: '',
parserOptions: {
project: ['./tsconfig.json']
},

plugins: ['tree-shaking','import'],
plugins: ['tree-shaking'],

env: {
browser: true,
Expand All @@ -17,38 +12,30 @@ module.exports = getESLintConfig({
},

rules: {
// Definitely disable
'no-use-before-define': 0,
// disabled after ocular upgrade to unbreak build
'prefer-rest-params': 'warn',
'import/named': 'off',
'no-shadow': 'warn',
'@typescript-eslint/no-explicit-any': 'off', // 'warn',
// desiabled by choice
// disabled by choice
'no-unused-expressions': 'warn',
'no-console': 1,
'no-continue': ['warn'],
'no-console': 'warn',
'no-continue': 'warn',
'callback-return': 0,
'accessor-pairs': 0,
'max-depth': ['warn', 4],
camelcase: 'off',
complexity: 'off',
'max-statements': 'off',
'default-case': ['warn'],
'no-eq-null': ['warn'],
eqeqeq: ['warn'],
camelcase: 0,
complexity: 0,
'max-statements': 0,
'default-case': 'warn',
radix: 0,
'spaced-comment': ["error", "always", { "exceptions": ["/ <"] }]
// 'accessor-pairs': ['error', {getWithoutSet: false, setWithoutGet: false}]
// handled by prettier
quotes: 0,
indent: 0
},

overrides: [
{
files: ['**/*.ts', '**/*.tsx', '**/*.d.ts'],
rules: {
'quotes': 0, // handled by prettier
'indent': 0, // handled by prettier

'@typescript-eslint/no-explicit-any': 'off', // 'warn',
// typescript-eslint 6.0
'@typescript-eslint/no-unsafe-argument': 0,
Expand All @@ -61,9 +48,6 @@ module.exports = getESLintConfig({

'consistent-return': 0, // We use typescript noImplicitReturn
'default-case': 0, // We rely on typescript
'import/no-unresolved': 'error',
'import/no-extraneous-dependencies': 'error',
'no-unused-expressions': 'warn',
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-misused-promises': 0,
'@typescript-eslint/no-floating-promises': 0,
Expand All @@ -80,25 +64,14 @@ module.exports = getESLintConfig({
'warn',
{vars: 'all', args: 'none', ignoreRestSiblings: false}
],
// Warn instead of error
// 'max-params': ['warn'],
// 'no-undef': ['warn'],
// camelcase: ['warn'],
// '@typescript-eslint/no-floating-promises': ['warn'],
// '@typescript-eslint/await-thenable': ['warn'],
// '@typescript-eslint/no-misused-promises': ['warn'],
// '@typescript-eslint/no-empty-function': ['warn', {allow: ['arrowFunctions']}],
// We use function hoisting
'@typescript-eslint/no-use-before-define': 0,
// We always want explicit typing, e.g `field: string = ''`
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/restrict-template-expressions': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/require-await': 0,
'@typescript-eslint/no-unsafe-return': 0,
'@typescript-eslint/no-unsafe-call': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/restrict-plus-operands': 0
'@typescript-eslint/no-empty-interface': 0
}
},
// tests are run with aliases set up in node and webpack.
Expand Down
26 changes: 11 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
id: permitted
run: |
result=
branchName=$(git branch -a --contains $GITHUB_SHA | grep 'remotes/origin/' || echo "")
if [[ $branchName == *"master" || $branchName == *"-release" ]]; then
if git branch -a --contains $GITHUB_SHA | grep -q 'remotes/origin/master$'; then
result=true
elif git branch -a --contains $GITHUB_SHA | grep -q 'remotes/origin/.*-release$'; then
result=true
fi
echo "result=${result}" >> "$GITHUB_OUTPUT"
Expand All @@ -42,26 +43,21 @@ jobs:

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: volta-cli/action@2d68418f32546fd191eb666e232b321d5726484d # v4.1.1
with:
cache: 'yarn'

- name: Create GitHub release entry
run: |
body=$(node scripts/github-release.js) &&
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/visgl/luma.gl/releases \
-d "${body}" \
-H "Authorization: token ${GITHUB_TOKEN}"
- name: Install dependencies
run: yarn

- name: Build packages
run: npm run build

- name: Run tests from transpiled code
run: npx ocular-test dist

- name: Login to NPM
run: npm config set "//registry.npmjs.org/:_authToken=${NPM_ACCESS_TOKEN}"

- name: Install dependencies
run: yarn

- name: Publish to NPM
run: npx ocular-publish from-git
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ jobs:
- name: Run tests in Puppeteer and generage Coverage
run: |
yarn test-cover
yarn test cover
- name: Run tests on Node
run: |
yarn test-node
yarn test node
- name: Run lint
run: |
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ jobs:
should_deploy: ${{ endsWith(github.ref, steps.get_version.outputs.latest) }}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Get version
id: get_version
run: |
LATEST=$(npm show @luma.gl/core@latest version | grep -o -E "^[0-9]+\.[0-9]+")
packageFile=$(if [ -d modules ]; then ls modules/*/package.json | head -n 1; else echo package.json; fi)
packageName=$(jq -r '.name' $packageFile)
LATEST=$(npm show "${packageName}@latest" version | grep -o -E "^[0-9]+\.[0-9]+")
echo "latest=${LATEST}-release" >> "$GITHUB_OUTPUT"
deploy:
Expand All @@ -31,7 +35,6 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: ${{ secrets.WEBSITE_DEPLOY_TOKEN }}

- uses: volta-cli/action@2d68418f32546fd191eb666e232b321d5726484d # v4.1.1
with:
cache: 'yarn'
Expand All @@ -49,5 +52,5 @@ jobs:
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: website/public
FOLDER: website/build
CLEAN: true
9 changes: 2 additions & 7 deletions .ocularrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ const testDir = join(packageRoot, 'test');

/** @type {OcularConfig} */
const config = {
babel: false,

lint: {
paths: ['modules', 'docs', 'test'], // 'examples'], module resolution errors
paths: ['modules', 'test'], // 'docs', 'examples'], module resolution errors
extensions: ['js', 'ts', 'jsx', 'tsx']
},

typescript: {
project: 'tsconfig.build.json'
},

aliases: {
// DEV MODULES
'dev-modules': devModules,
Expand All @@ -44,7 +39,7 @@ const config = {

entry: {
test: 'test/index.ts',
'test-browser': 'index.html',
'test-browser': 'test/index.html',
bench: 'test/bench/index.js',
'bench-browser': 'test/bench/index.html',
size: 'test/size/import-nothing.js'
Expand Down
2 changes: 1 addition & 1 deletion modules/constants/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.module.json",
"extends": "../../tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules"],
"compilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion modules/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.module.json",
"extends": "../../tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules"],
"compilerOptions": {
Expand Down
5 changes: 2 additions & 3 deletions modules/engine/src/passes/shader-pass-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,10 @@ void main() {
}
first = false;

// eslint-disable-next-line no-shadow
const sourceTexture = this.swapFramebuffers.current.colorAttachments[0].texture;
const swapBufferTexture = this.swapFramebuffers.current.colorAttachments[0].texture;

const bindings = {
sourceTexture
sourceTexture: swapBufferTexture
// texSize: [sourceTextures.width, sourceTextures.height]
};

Expand Down
2 changes: 1 addition & 1 deletion modules/engine/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.module.json",
"extends": "../../tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules"],
"compilerOptions": {
Expand Down
7 changes: 4 additions & 3 deletions modules/gltf/test/gltf/gltf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import {createScenegraphsFromGLTF, loadPBREnvironment} from '@luma.gl/gltf';

test('gltf#loading', async t => {
const webglDevice = await getWebGLTestDevice();
// path is relative to /test/index.html
const gltf = await load('data/box.glb', GLTFLoader);

const gltf = await load('test/data/box.glb', GLTFLoader);
const processedGLTF = gltf.json ? postProcessGLTF(gltf) : gltf;

const result = createScenegraphsFromGLTF(webglDevice, processedGLTF);
Expand All @@ -27,7 +28,7 @@ test('gltf#loading', async t => {
test('gltf#animator', async t => {
const webglDevice = await getWebGLTestDevice();

const gltf = await load('test/data/BoxAnimated.glb', GLTFLoader);
const gltf = await load('data/BoxAnimated.glb', GLTFLoader);
const processedGLTF = gltf.json ? postProcessGLTF(gltf) : gltf;

const {scenes, animator} = createScenegraphsFromGLTF(webglDevice, processedGLTF);
Expand All @@ -52,7 +53,7 @@ test.skip('gltf#environment', async t => {
const webglDevice = await getWebGLTestDevice();

const environment = loadPBREnvironment(webglDevice, {
brdfLutUrl: 'test/data/webgl-logo-0.png',
brdfLutUrl: 'data/webgl-logo-0.png',
getTexUrl: (type, dir, mipLevel) => `test/data/webgl-logo-${mipLevel}.png`,
specularMipLevels: 9
});
Expand Down
2 changes: 1 addition & 1 deletion modules/gltf/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.module.json",
"extends": "../../tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules"],
"compilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion modules/shadertools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.module.json",
"extends": "../../tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules", "test"],
"compilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion modules/test-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.module.json",
"extends": "../../tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules"],
"compilerOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ export const GL_HOOKED_SETTERS = {
update({
[pname]: value
}),
hint: (update: UpdateFunc, pname: GL, hint: GL) =>
hint: (update: UpdateFunc, pname: GL, value: GL) =>
update({
[pname]: hint
[pname]: value
}),

// SPECIFIC SETTERS
Expand Down
2 changes: 1 addition & 1 deletion modules/webgl/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.module.json",
"extends": "../../tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules"],
"compilerOptions": {
Expand Down
2 changes: 1 addition & 1 deletion modules/webgpu/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.module.json",
"extends": "../../tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules"],
"compilerOptions": {
Expand Down
22 changes: 5 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,15 @@
"fs": false
},
"scripts": {
"bootstrap": "ocular-bootstrap",
"postinstall": "echo postinstall",
"bootstrap": "yarn && ocular-bootstrap && yarn build",
"start": "open https://luma.gl/docs/getting-started",
"clean": "ocular-clean",
"build": "ocular-clean && (cd modules/constants && yarn pre-build) && ocular-build",
"cover": "ocular-test cover",
"lint": "ocular-lint",
"publish-beta": "ocular-publish version-only-beta",
"publish-prod": "ocular-publish version-only-prod",
"version": "node scripts/verify-changelog.js && git add CHANGELOG.md",
"test": "ocular-test",
"test-ci": "ocular-lint && ocular-test node && ocular-test cover",
"test-node": "ocular-test node",
"test-cover": "ocular-test cover",
"test-fast": "ocular-test fast",
"test-browser": "ocular-test browser",
"test-browser-headless": "ocular-test browser-headless | tap-spec",
"test-fast": "ocular-lint && ocular-test node",
"test-website": "cd website && yarn && yarn build && cd ..",
"perf": "ocular-test perf-browser",
"bench": "ocular-test bench",
"bench-browser": "ocular-test bench-browser",
"metrics": "./scripts/metrics.sh && ocular-metrics"
},
"devDependencies": {
Expand All @@ -53,13 +41,13 @@
"@probe.gl/stats-widget": "^4.0.8",
"@probe.gl/test-utils": "^4.0.8",
"@types/tape-promise": "^4.0.1 ",
"@vis.gl/dev-tools": "1.0.0-alpha.19",
"@vis.gl/ts-plugins": "1.0.0-alpha.19",
"eslint-plugin-tree-shaking": "^1.9.2",
"nyc": "^15.1.0",
"ocular-dev-tools": "2.0.0-alpha.34",
"pre-commit": "^1.2.2",
"pre-push": "^0.1.1",
"puppeteer": "^22.0.0",
"tap-spec": "^5.0.0"
"puppeteer": "^22.0.0"
},
"resolutions": {
"typescript": "^5.5.0",
Expand Down
Loading

0 comments on commit 7f99191

Please sign in to comment.