├── test
├── node.ts
├── browser.ts
├── modules.ts
└── index.html
├── website
├── src
│ ├── about.md
│ ├── theme.json
│ └── home.md
├── .eslintignore
├── static
│ └── images
│ │ ├── hero.jpg
│ │ ├── favicon.ico
│ │ ├── uber-logo.png
│ │ ├── icon-target.svg
│ │ ├── icon-custom.svg
│ │ └── icon-react.svg
├── package.json
├── .gitignore
└── gatsby-config.js
├── docs
├── BASEURL
├── wip
│ └── gatsby-theme-ocular
│ │ ├── upgrade-guide.md
│ │ ├── get-started.md
│ │ └── README.md
├── README.md
└── table-of-contents.json
├── .eslintignore
├── .prettierignore
├── modules
└── dev-tools
│ ├── templates
│ ├── .prettierignore
│ ├── .eslintignore
│ ├── .prettierrc
│ ├── .nycrc
│ ├── tsconfig.json
│ └── .eslintrc.gatsby-todo
│ ├── docs
│ ├── cli
│ │ ├── ocular-clean.md
│ │ ├── ocular-build.md
│ │ ├── ocular-metrics.md
│ │ ├── ocular-bootstrap.md
│ │ ├── ocular-lint.md
│ │ ├── ocular-publish.md
│ │ ├── ocular-bump.md
│ │ ├── ocular-test.md
│ │ └── ocular-tsify.md
│ ├── upgrade-guide.md
│ ├── faq.md
│ ├── api-reference
│ │ ├── get-prettier-config.md
│ │ ├── get-eslint-config.md
│ │ └── get-babel-config.md
│ ├── whats-new.md
│ └── README.md
│ ├── src
│ ├── configuration
│ │ ├── eslint-config-uber-es2015
│ │ │ ├── miscellaneous.json
│ │ │ ├── best-practices.json
│ │ │ ├── stylistic-issues.json
│ │ │ ├── ecmascript-6.json
│ │ │ └── eslintrc.json
│ │ ├── eslint-config-uber-jsx
│ │ │ ├── best-practices.json
│ │ │ ├── stylistic-issues.json
│ │ │ ├── miscellaneous.json
│ │ │ └── eslintrc.json
│ │ ├── eslint-config-uber-es5
│ │ │ ├── strict-mode.json
│ │ │ ├── miscellaneous.json
│ │ │ ├── variables.json
│ │ │ ├── node-js-and-common-js.json
│ │ │ ├── eslintrc.json
│ │ │ ├── best-practices.json
│ │ │ ├── stylistic-issues.json
│ │ │ └── errors.json
│ │ ├── index.ts
│ │ ├── get-prettier-config.ts
│ │ ├── vite.config.js
│ │ ├── get-babel-config.ts
│ │ ├── get-esbuild-config.ts
│ │ └── get-eslint-config.ts
│ ├── index.ts
│ ├── utils
│ │ ├── types.ts
│ │ └── utils.ts
│ ├── helpers
│ │ ├── cjs-register.cjs
│ │ ├── get-config.ts
│ │ ├── get-cjs-entry-points.ts
│ │ ├── aliases.ts
│ │ ├── esm-loader.js
│ │ └── get-ocular-config.ts
│ ├── build-cjs.ts
│ ├── ts-plugins
│ │ ├── ts-transform-inline-webgl-constants
│ │ │ └── index.ts
│ │ ├── ts-transform-version-inline
│ │ │ └── index.ts
│ │ ├── ts-transform-append-extension
│ │ │ └── index.ts
│ │ └── ts-transform-remove-glsl-comments
│ │ │ └── index.ts
│ └── test.ts
│ ├── README.md
│ ├── test
│ ├── ts-plugins
│ │ ├── ts-transform-remove-glsl-comments
│ │ │ ├── test-case-0.ts
│ │ │ ├── test-case-0-expected.ts
│ │ │ ├── test-case-2-expected.ts
│ │ │ ├── test-case-2.ts
│ │ │ ├── test-case-1-expected.ts
│ │ │ ├── test-case-1.ts
│ │ │ └── index.spec.ts
│ │ ├── ts-transform-version-inline.spec.ts
│ │ ├── ts-transform-inline-webgl-constants.spec.ts
│ │ ├── ts-transform-append-extension.spec.ts
│ │ └── test-transformer.ts
│ ├── lib
│ │ ├── utils.spec.ts
│ │ └── configuration.spec.ts
│ └── index.ts
│ ├── scripts
│ ├── shell.js
│ ├── lint.js
│ ├── test.js
│ ├── build.js
│ ├── clean.js
│ ├── metrics.js
│ ├── publish.js
│ ├── bootstrap.js
│ ├── clean.sh
│ ├── bootstrap.sh
│ ├── bundle.js
│ ├── test.sh
│ ├── metrics.sh
│ ├── publish.sh
│ ├── lint.sh
│ ├── bump.js
│ └── build.sh
│ ├── tsconfig.json
│ ├── package.json
│ └── CHANGELOG.md
├── .prettierrc.cjs
├── scripts
└── remove-refs-to-unpm.pl
├── .travis.yml
├── babel.config.cjs
├── tsconfig.build.json
├── .markdownlintrc
├── examples
└── dev-tools
│ ├── .eslintrc.js
│ ├── .prettierrc.js
│ ├── babel.config.js
│ ├── ocular-dev-tools.config.js
│ ├── src
│ └── app.js
│ ├── index.html
│ ├── package.json
│ ├── dist
│ ├── es5
│ │ ├── app.js.map
│ │ └── app.js
│ └── esm
│ │ ├── app.js.map
│ │ └── app.js
│ └── webpack.config.js
├── .gitignore
├── README.md
├── .ocularrc.js
├── tsconfig.json
├── dev-docs
└── RFCs
│ ├── README.md
│ └── v1.0
│ └── gatsby-rfc.md
├── .eslintrc.cjs
├── .github
└── workflows
│ └── test.yml
├── LICENSE
└── package.json
/test/node.ts:
--------------------------------------------------------------------------------
1 | import './modules';
2 |
--------------------------------------------------------------------------------
/website/src/about.md:
--------------------------------------------------------------------------------
1 | # About us
2 |
--------------------------------------------------------------------------------
/test/browser.ts:
--------------------------------------------------------------------------------
1 | import './modules';
2 |
--------------------------------------------------------------------------------
/docs/BASEURL:
--------------------------------------------------------------------------------
1 | https://uber-web.github.io/ocular
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | dist/
2 | test/
3 | test-case-*.ts
4 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | **/dist*/**/*.js
2 | test-case-*.ts
--------------------------------------------------------------------------------
/website/.eslintignore:
--------------------------------------------------------------------------------
1 | dist/
2 | node_modules/
3 |
--------------------------------------------------------------------------------
/test/modules.ts:
--------------------------------------------------------------------------------
1 | import '../modules/dev-tools/test';
2 |
--------------------------------------------------------------------------------
/website/src/theme.json:
--------------------------------------------------------------------------------
1 | {
2 | "primary400": "#FFC000"
3 | }
--------------------------------------------------------------------------------
/modules/dev-tools/templates/.prettierignore:
--------------------------------------------------------------------------------
1 | **/dist*/**/*.js
2 |
--------------------------------------------------------------------------------
/modules/dev-tools/templates/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules/*
2 | dist/*
3 | coverage/*
4 |
--------------------------------------------------------------------------------
/website/static/images/hero.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/donmccurdy/ocular/master/website/static/images/hero.jpg
--------------------------------------------------------------------------------
/website/static/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/donmccurdy/ocular/master/website/static/images/favicon.ico
--------------------------------------------------------------------------------
/website/static/images/uber-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/donmccurdy/ocular/master/website/static/images/uber-logo.png
--------------------------------------------------------------------------------
/modules/dev-tools/docs/cli/ocular-clean.md:
--------------------------------------------------------------------------------
1 | # ocular-clean
2 |
3 | Remove all transpiled files in preparation for a new build.
4 |
--------------------------------------------------------------------------------
/.prettierrc.cjs:
--------------------------------------------------------------------------------
1 | const {getPrettierConfig} = require('ocular-dev-tools/configuration');
2 |
3 | module.exports = getPrettierConfig();
4 |
--------------------------------------------------------------------------------
/modules/dev-tools/docs/cli/ocular-build.md:
--------------------------------------------------------------------------------
1 | # ocular-build
2 |
3 | Build the source.
4 |
5 | ```bash
6 | ocular-build [module_name]
7 | ```
8 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/eslint-config-uber-es2015/miscellaneous.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "prefer-reflect": 0
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/eslint-config-uber-jsx/best-practices.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "no-invalid-this": 0
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/modules/dev-tools/templates/.prettierrc:
--------------------------------------------------------------------------------
1 | printWidth: 100
2 | semi: true
3 | singleQuote: true
4 | trailingComma: none
5 | bracketSpacing: false
6 |
--------------------------------------------------------------------------------
/scripts/remove-refs-to-unpm.pl:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | perl -pi -e 's/unpm\.uberinternal\.com/registry\.yarnpkg\.com/g' `find . -name yarn.lock`
4 |
--------------------------------------------------------------------------------
/modules/dev-tools/docs/upgrade-guide.md:
--------------------------------------------------------------------------------
1 | # Upgrade Guide
2 |
3 | ## ocular-dev-tools 1.0.0
4 |
5 | Functional entry points replace subpath imports
6 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/index.ts:
--------------------------------------------------------------------------------
1 | export {getOcularConfig} from './helpers/get-ocular-config.js';
2 |
3 | export type {OcularConfig} from './helpers/get-ocular-config.js';
4 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/eslint-config-uber-es5/strict-mode.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "strict": [
4 | 2,
5 | "global"
6 | ]
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/docs/faq.md:
--------------------------------------------------------------------------------
1 | # FAQ
2 |
3 | ## How to debug ocular builds
4 |
5 | * Set `logLevel` in ocular-config.js, numbers between `1`-`4` give increasing levels of logging.
6 |
--------------------------------------------------------------------------------
/modules/dev-tools/README.md:
--------------------------------------------------------------------------------
1 | # ocular-dev-tools
2 |
3 | Experimental dev tools for our open source Javascript frameworks
4 |
5 | For documentation, see [https://uber-web.github.io/ocular]
6 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/eslint-config-uber-jsx/stylistic-issues.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "jsx-quotes": [
4 | 2,
5 | "prefer-double"
6 | ]
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/docs/cli/ocular-metrics.md:
--------------------------------------------------------------------------------
1 | # ocular-metrics
2 |
3 | Bundle the source and report the bundle size.
4 |
5 | ## Configuration
6 |
7 | [Configurations](#ocular-dev-tools-1): `entry`
8 |
--------------------------------------------------------------------------------
/modules/dev-tools/docs/cli/ocular-bootstrap.md:
--------------------------------------------------------------------------------
1 | # ocular-bootstrap
2 |
3 | Installing dependencies for a monorepo.
4 |
5 |
6 | ## Remarks
7 |
8 | Uses yarn workspaces and lerna to initialize monorepos.
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/test/ts-plugins/ts-transform-remove-glsl-comments/test-case-0.ts:
--------------------------------------------------------------------------------
1 | export function getTime() {
2 | // Template literal that is not shader
3 | return `The time is ${Date.now()}`;
4 | }
5 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | os: linux
3 | sudo: required
4 | dist: trusty
5 | addons:
6 | node_js:
7 | - '12'
8 | - '14'
9 | install:
10 | - yarn bootstrap
11 | script:
12 | - npm run test
13 |
--------------------------------------------------------------------------------
/modules/dev-tools/test/ts-plugins/ts-transform-remove-glsl-comments/test-case-0-expected.ts:
--------------------------------------------------------------------------------
1 | export function getTime() {
2 | // Template literal that is not shader
3 | return `The time is ${Date.now()}`;
4 | }
5 |
--------------------------------------------------------------------------------
/test/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | luma.gl tests
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/babel.config.cjs:
--------------------------------------------------------------------------------
1 | const {getBabelConfig} = require('ocular-dev-tools/configuration');
2 |
3 | module.exports = getBabelConfig({
4 | react: true,
5 | overrides: {
6 | plugins: ['@babel/syntax-import-assertions']
7 | }
8 | });
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/eslint-config-uber-es2015/best-practices.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "accessor-pairs": [
4 | 2,
5 | {
6 | "getWithoutSet": true
7 | }
8 | ]
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/eslint-config-uber-es5/miscellaneous.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "no-native-reassign": 2,
4 | "no-negated-in-lhs": 2,
5 | "no-reserved-keys": 0,
6 | "no-spaced-func": 2
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | },
5 | "include":[
6 | "modules/*/src"
7 | ],
8 | "references": [
9 | {"path": "modules/dev-tools"}
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/index.ts:
--------------------------------------------------------------------------------
1 | // JS Tool Configurations
2 | export {getBabelConfig} from './get-babel-config.js';
3 | export {getESLintConfig} from './get-eslint-config.js';
4 | export {getPrettierConfig} from './get-prettier-config.js';
5 |
--------------------------------------------------------------------------------
/.markdownlintrc:
--------------------------------------------------------------------------------
1 | {
2 | "default": true,
3 | "colors": true,
4 | "line-length": false,
5 | "ul-style": {"style": "sublist"},
6 | "no-duplicate-header": false,
7 | "no-inline-html": false,
8 | "no-hard-tabs": false,
9 | "whitespace": false
10 | }
11 |
--------------------------------------------------------------------------------
/website/src/home.md:
--------------------------------------------------------------------------------
1 | ## Uber's open source documentation system
2 |
3 | -  Designed for React
4 | -  Highly customizable
5 | -  Totally ready for production
6 |
--------------------------------------------------------------------------------
/modules/dev-tools/test/lib/utils.spec.ts:
--------------------------------------------------------------------------------
1 | import test from 'tape-promise/tape';
2 | // @ts-expect-error Aliased import
3 | import {shallowMerge} from 'ocular-dev-tools/utils/utils';
4 |
5 | test('dev-tools#utils', (t) => {
6 | t.equals(typeof shallowMerge, 'function');
7 |
8 | t.end();
9 | });
10 |
--------------------------------------------------------------------------------
/examples/dev-tools/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const {getESLintConfig} = require('ocular-dev-tools');
2 |
3 | const config = getESLintConfig({react: '16.8.2'});
4 |
5 | // Make any changes to default config here
6 |
7 | // Uncomment to log the eslint config
8 | // console.debug(config);
9 |
10 | module.exports = config;
11 |
--------------------------------------------------------------------------------
/modules/dev-tools/scripts/shell.js:
--------------------------------------------------------------------------------
1 | import {execSync} from 'child_process';
2 |
3 | export function execShellCommand(command, args = []) {
4 | try {
5 | execSync(`${command} ${args.join(' ')}`, {
6 | stdio: 'inherit'
7 | });
8 | } catch (err) {
9 | process.exit(err.status);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/examples/dev-tools/.prettierrc.js:
--------------------------------------------------------------------------------
1 | const {getPrettierConfig} = require('ocular-dev-tools');
2 |
3 | const config = getPrettierConfig({react: '16.8.2'});
4 |
5 | // Make any changes to default config here
6 |
7 | // Uncomment to log the eslint config
8 | // console.debug(config);
9 |
10 | module.exports = config;
11 |
--------------------------------------------------------------------------------
/examples/dev-tools/babel.config.js:
--------------------------------------------------------------------------------
1 | const {getBabelConfig} = require('ocular-dev-tools');
2 |
3 | module.exports = (api) => {
4 | const config = getBabelConfig(api, {react: true});
5 |
6 | // Make any changes to default config here
7 |
8 | // Uncomment to log the config
9 | // console.debug(config);
10 |
11 | return config;
12 | };
13 |
--------------------------------------------------------------------------------
/modules/dev-tools/scripts/lint.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | import {execShellCommand} from './shell.js';
4 | import {join} from 'path';
5 |
6 | const scriptDir = new URL(import.meta.url).pathname;
7 | // Runs the bash script and forward the arguments, exiting with the same code
8 | execShellCommand(join(scriptDir, '../lint.sh'), process.argv.slice(2));
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/scripts/test.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | import {execShellCommand} from './shell.js';
4 | import {join} from 'path';
5 |
6 | const scriptDir = new URL(import.meta.url).pathname;
7 | // Runs the bash script and forward the arguments, exiting with the same code
8 | execShellCommand(join(scriptDir, '../test.sh'), process.argv.slice(2));
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/scripts/build.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | import {execShellCommand} from './shell.js';
4 | import {join} from 'path';
5 |
6 | const scriptDir = new URL(import.meta.url).pathname;
7 | // Runs the bash script and forward the arguments, exiting with the same code
8 | execShellCommand(join(scriptDir, '../build.sh'), process.argv.slice(2));
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/scripts/clean.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | import {execShellCommand} from './shell.js';
4 | import {join} from 'path';
5 |
6 | const scriptDir = new URL(import.meta.url).pathname;
7 | // Runs the bash script and forward the arguments, exiting with the same code
8 | execShellCommand(join(scriptDir, '../clean.sh'), process.argv.slice(2));
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/scripts/metrics.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | import {execShellCommand} from './shell.js';
4 | import {join} from 'path';
5 |
6 | const scriptDir = new URL(import.meta.url).pathname;
7 | // Runs the bash script and forward the arguments, exiting with the same code
8 | execShellCommand(join(scriptDir, '../metrics.sh'), process.argv.slice(2));
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/scripts/publish.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | import {execShellCommand} from './shell.js';
4 | import {join} from 'path';
5 |
6 | const scriptDir = new URL(import.meta.url).pathname;
7 | // Runs the bash script and forward the arguments, exiting with the same code
8 | execShellCommand(join(scriptDir, '../publish.sh'), process.argv.slice(2));
9 |
--------------------------------------------------------------------------------
/modules/dev-tools/test/index.ts:
--------------------------------------------------------------------------------
1 | import './lib/utils.spec';
2 | import './lib/configuration.spec';
3 |
4 | import './ts-plugins/ts-transform-version-inline.spec';
5 | import './ts-plugins/ts-transform-append-extension.spec';
6 | import './ts-plugins/ts-transform-remove-glsl-comments/index.spec';
7 | import './ts-plugins/ts-transform-inline-webgl-constants.spec';
8 |
--------------------------------------------------------------------------------
/modules/dev-tools/scripts/bootstrap.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | import {execShellCommand} from './shell.js';
4 | import {join} from 'path';
5 |
6 | const scriptDir = new URL(import.meta.url).pathname;
7 | // Runs the bash script and forward the arguments, exiting with the same code
8 | execShellCommand(join(scriptDir, '../bootstrap.sh'), process.argv.slice(2));
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/
3 |
4 | .idea/
5 | yarn-error.log
6 | .DS_Store
7 | .vscode/
8 | website/dist
9 | website/.DS_Store
10 | website/node_modules
11 | website/yarn-error.log
12 |
13 | package-lock.json
14 |
15 | website-test/*
16 |
17 | .reify-cache
18 | modules/dev-tools/.alias.json
19 | coverage/
20 | .nyc_output/
21 | tsconfig.tsbuildinfo
22 |
--------------------------------------------------------------------------------
/modules/dev-tools/templates/.nycrc:
--------------------------------------------------------------------------------
1 | {
2 | "all": true,
3 | "sourceMap": false,
4 | "instrument": true,
5 | "include": [
6 | "src/**/*.+(js|jsx|cjs|mjs|ts|tsx)",
7 | "modules/**/src/**/*.+(js|jsx|cjs|mjs|ts|tsx)"
8 | ],
9 | "exclude": [
10 | "**/deprecated",
11 | "**/wip",
12 | "**/*.spec.+(js|ts)",
13 | "**/*.d.ts"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/modules/dev-tools/docs/cli/ocular-lint.md:
--------------------------------------------------------------------------------
1 | # ocular-lint
2 |
3 | Run eslint & prettier on the code base.
4 |
5 | ```bash
6 | ocular-lint [mode]
7 | ```
8 |
9 | ## Modes
10 |
11 | - `full` (default) - run on all files.
12 | - `pre-commit` - only run on changed files since the last commit.
13 | - `fix` - run prettier and eslint --fix on all files.
14 |
15 | ## Configuration
16 |
17 | [Configurations](#ocular-dev-tools-1): `lint`
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ocular
2 |
3 | Ocular is a monorepo for development tools primarily designed for building github-based javascript frameworks.
4 |
5 | It currently contains:
6 |
7 | - `gatsby-theme-ocular` - A documentation generator packaged as a pluggable theme for gatsbyjs documentation generation system.
8 | - `ocular-dev-tools` - A set tools that packages up extensive installation and configuration of babel, webpack, lint, prettier and other state-of-the art JS build tools.
9 |
--------------------------------------------------------------------------------
/examples/dev-tools/ocular-dev-tools.config.js:
--------------------------------------------------------------------------------
1 | const {resolve} = require('path');
2 |
3 | module.exports = {
4 | lint: {
5 | paths: ['./src'],
6 | extensions: ['js']
7 | },
8 |
9 | aliases: {
10 | test: resolve(__dirname, 'test')
11 | },
12 |
13 | entry: {
14 | test: 'test/node.js',
15 | 'test-browser': 'test/browser.js',
16 | bench: 'test/bench/node.js',
17 | 'bench-browser': 'test/bench/browser.js',
18 | size: 'test/size/import-nothing.js'
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/modules/dev-tools/docs/api-reference/get-prettier-config.md:
--------------------------------------------------------------------------------
1 | # getPrettierConfig
2 |
3 | Get `ocular-dev-tools` default prettier config.
4 |
5 | ## Usage
6 |
7 | ```js
8 | // .prettierrc.js
9 | const {getPrettierConfig} = requre('ocular-dev-tools/configuration');
10 |
11 | modules.export = getPrettierConfig({
12 | /** This will be deep merged with the default config */
13 | overrides: {
14 | // custom config
15 | },
16 | /** Print full config JSON for inspection */
17 | debug: true
18 | });
19 | ```
20 |
--------------------------------------------------------------------------------
/modules/dev-tools/test/ts-plugins/ts-transform-remove-glsl-comments/test-case-2-expected.ts:
--------------------------------------------------------------------------------
1 | const glsl = (x) => `${x}`;
2 | export default {
3 | name: 'shader-module',
4 | getUniforms: () => ({
5 | useFloatColors: false
6 | }),
7 | inject: {
8 | 'vs:DECKGL_FILTER_COLOR': `
9 | picking_setPickingColor(geometry.pickingColor);
10 | `,
11 | 'fs:DECKGL_FILTER_COLOR': {
12 | order: 99,
13 | injection: `
14 | color = picking_filterHighlightColor(color);
15 | color = picking_filterPickingColor(color);
16 | `
17 | }
18 | }
19 | };
20 |
--------------------------------------------------------------------------------
/modules/dev-tools/scripts/clean.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | clean() {
6 | if [ -z "$1" ]; then
7 | (set -x; rm -fr dist && mkdir -p dist)
8 | elif [ "$1" = "all" ]; then
9 | (set -x; rm -fr dist)
10 | else
11 | echo -e "\033[91mUnknown option $1. ocular-clean [all]\033[0m"
12 | exit 1
13 | fi
14 | }
15 |
16 | if [ -d "modules" ]; then
17 | # Monorepo
18 | cd modules
19 |
20 | for D in *; do (
21 | cd $D
22 | clean $1
23 | ); done
24 | else
25 | clean $1
26 | fi
27 |
28 | find . -name tsconfig.tsbuildinfo -exec rm {} \;
29 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/eslint-config-uber-es5/variables.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "no-catch-shadow": 2,
4 | "no-delete-var": 2,
5 | "no-label-var": 2,
6 | "no-shadow": 2,
7 | "no-shadow-restricted-names": 2,
8 | "no-undef-init": 2,
9 | "no-undef": 2,
10 | "no-undefined": 0,
11 | "no-unused-vars": [
12 | 2,
13 | {
14 | "vars": "all",
15 | "args": "none"
16 | }
17 | ],
18 | "no-use-before-define": [
19 | 2,
20 | "nofunc"
21 | ],
22 | "init-declarations": 0
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/modules/dev-tools/templates/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "noEmit": true,
4 | "module": "commonjs",
5 | "esModuleInterop": true,
6 | "outDir": "dist",
7 | "declaration": true,
8 | "declarationMap": true,
9 | "sourceMap": true,
10 | "skipLibCheck": true,
11 | "strict": true,
12 | "noImplicitReturns": true,
13 | "noFallthroughCasesInSwitch": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "lib": [
16 | "esnext",
17 | "dom"
18 | ]
19 | },
20 | "include": [
21 | "src/**/*"
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/.ocularrc.js:
--------------------------------------------------------------------------------
1 | /** @typedef {import('ocular-dev-tools').OcularConfig} OcularConfig */
2 | import {resolve} from 'path';
3 |
4 | /** @type {OcularConfig} */
5 | let ocularConfig = {
6 | typescript: {
7 | project: 'tsconfig.build.json'
8 | },
9 |
10 | babel: false,
11 |
12 | lint: {
13 | paths: ['modules']
14 | },
15 |
16 | aliases: {
17 | test: resolve('./test')
18 | },
19 |
20 | entry: {
21 | test: 'test/node.ts',
22 | 'test-browser': 'test/index.html',
23 | size: 'test/size/import-nothing.js'
24 | }
25 | };
26 |
27 | export default ocularConfig;
28 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2020",
4 | "module": "esnext",
5 | "jsx": "react",
6 | "strict": true,
7 | "noImplicitAny": false,
8 | "allowJs": true,
9 | "checkJs": false,
10 | "moduleResolution": "node",
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "noEmit": true,
14 | "resolveJsonModule": true,
15 | "baseUrl": ".",
16 | "skipLibCheck": true
17 | },
18 | "include": [
19 | "modules",
20 | "test"
21 | ],
22 | "exclude":[
23 | "node_modules"
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/modules/dev-tools/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "module": "esnext",
5 | "noImplicitAny": false,
6 | "allowJs": true,
7 | "checkJs": false,
8 | "declaration": true,
9 | "declarationMap": true,
10 | "moduleResolution": "node",
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "baseUrl": ".",
14 | "rootDir": "src",
15 | "outDir": "dist",
16 | "composite": true,
17 | "skipLibCheck": true,
18 | "strict": true
19 | },
20 | "include":[
21 | "src/**/*"
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/utils/types.ts:
--------------------------------------------------------------------------------
1 | // https://docs.npmjs.com/cli/v10/configuring-npm/package-json
2 | // Only relevant fields are typed
3 | export type PackageJson = {
4 | name: string;
5 | version: string;
6 | type?: 'module' | 'commonjs';
7 | main?: string;
8 | module?: string;
9 | exports?: {
10 | [path: string]: string | {import?: string; require?: string; type?: string; default?: string};
11 | };
12 | dependencies?: {[name: string]: string};
13 | devDependencies?: {[name: string]: string};
14 | peerDependencies?: {[name: string]: string};
15 | [key: string]: unknown;
16 | };
17 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/get-prettier-config.ts:
--------------------------------------------------------------------------------
1 | import deepMerge from 'deepmerge';
2 |
3 | const DEFAULT_CONFIG = {
4 | printWidth: 100,
5 | semi: true,
6 | singleQuote: true,
7 | trailingComma: 'none',
8 | bracketSpacing: false
9 | };
10 |
11 | export function getPrettierConfig(options: {overrides?: any; debug?: boolean} = {}) {
12 | let config = {...DEFAULT_CONFIG};
13 | if (options.overrides) {
14 | config = deepMerge(config, options.overrides);
15 | }
16 | if (options.debug) {
17 | // eslint-disable-next-line
18 | console.log(config);
19 | }
20 | return config;
21 | }
22 |
--------------------------------------------------------------------------------
/examples/dev-tools/src/app.js:
--------------------------------------------------------------------------------
1 | import React, {PureComponent} from 'react';
2 | import {render} from 'react-dom';
3 |
4 | export default class App extends PureComponent {
5 | constructor(props) {
6 | super(props);
7 | this.state = {};
8 | }
9 |
10 | render() {
11 | return (
12 |
13 |
This is a minimal React example
14 |
Line...
15 |
Line...
16 |
Line...
17 |
Line...
18 |
19 | );
20 | }
21 | }
22 |
23 | export function renderToDOM(container) {
24 | render(, container);
25 | }
26 |
--------------------------------------------------------------------------------
/modules/dev-tools/src/configuration/eslint-config-uber-es5/node-js-and-common-js.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "no-mixed-requires": [
4 | 2,
5 | false
6 | ],
7 | "no-new-require": 2,
8 | "no-path-concat": 2,
9 | "no-process-env": 2,
10 | "no-process-exit": 2,
11 | "no-restricted-modules": 0,
12 | "no-sync": 0,
13 | "callback-return": [
14 | 2,
15 | [
16 | "callback",
17 | "cb",
18 | "next",
19 | "done"
20 | ]
21 | ],
22 | "handle-callback-err": [
23 | 2,
24 | "^(err|error|anySpecificError)$"
25 | ]
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/modules/dev-tools/docs/cli/ocular-publish.md:
--------------------------------------------------------------------------------
1 | # ocular-publish
2 |
3 | Publish the packages, create git tag and push.
4 |
5 | ## Usage
6 |
7 | This script will usually be mapped to `publish`:
8 | ```bash
9 | yarn publish [mode] [npm-tag]
10 | ```
11 |
12 | To run it directly
13 | ```bash
14 | npx ocular-publish [mode] [npm-tag]
15 | ```
16 |
17 | ## mode
18 |
19 | - `beta` - bump pre-release version and publish with beta flag.
20 | - `prod` - bump patch version and publish.
21 |
22 | ## npm-tag
23 |
24 | Custom tag for the release. If not specified, the release is tagged with `beta` if `mode: beta` and `latest` if `mode: prod`.
25 |
--------------------------------------------------------------------------------
/modules/dev-tools/test/lib/configuration.spec.ts:
--------------------------------------------------------------------------------
1 | import test from 'tape-promise/tape';
2 | // @ts-expect-error Aliased import
3 | import {getBabelConfig, getESLintConfig, getPrettierConfig} from 'ocular-dev-tools/configuration';
4 |
5 | test('dev-tools#getConfig', (t) => {
6 | const mockBabelApi = {cache: {using: () => {}}, env: (env) => env};
7 |
8 | let config = getESLintConfig();
9 | t.equals(typeof config, 'object');
10 |
11 | config = getPrettierConfig();
12 | t.equals(typeof config, 'object');
13 |
14 | config = getBabelConfig(mockBabelApi);
15 | t.equals(typeof config, 'function');
16 |
17 | t.end();
18 | });
19 |
--------------------------------------------------------------------------------
/examples/dev-tools/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | minimal ocular example
6 |
16 |
17 |