-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tram-One, now with Types! Typescript! v11.0.0 (#175)
- Loading branch information
Showing
96 changed files
with
27,217 additions
and
44,586 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
env: { | ||
// allow document, window, etc (these are expected as a frontend-library) | ||
browser: true, | ||
}, | ||
plugins: ['jest', '@typescript-eslint'], | ||
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], | ||
rules: { | ||
// some of the dependencies do not support module imports... yet | ||
'@typescript-eslint/no-var-requires': 'off', | ||
// as a framework, we have to sometimes just expect anything | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
// we shouldn't have console logs in our project | ||
'no-console': 'error', | ||
}, | ||
overrides: [ | ||
// allow module.exports for config, testing, and docs | ||
{ | ||
files: [ | ||
'**/*.cjs', // any file with the cjs extension | ||
'./*.js', // top level config | ||
'./docs/runkit_example.js', // runkit example | ||
'./integration-tests/broken-app/**.js', // tests that still need runtime import/export | ||
], | ||
env: { | ||
commonjs: true, | ||
}, | ||
}, | ||
|
||
// configure test files to be in the jest environment | ||
{ | ||
files: ['integration-tests/**/*', 'performance-tests/**/*'], | ||
env: { | ||
jest: true, | ||
}, | ||
rules: { | ||
'@typescript-eslint/no-empty-function': 'off', | ||
}, | ||
}, | ||
|
||
// local scripts are expected to run on local machines with node | ||
{ | ||
files: ['dev-scripts/**/*.js'], | ||
env: { | ||
node: true, | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
useTabs: true, | ||
singleQuote: true, | ||
printWidth: 120, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,17 @@ | ||
const filesize = require('rollup-plugin-filesize') | ||
const commonjs = require('rollup-plugin-commonjs') | ||
const pkg = require('../package.json') | ||
import filesize from 'rollup-plugin-filesize'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import pkg from '../package.json'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
|
||
const external = Object.keys(pkg.dependencies) | ||
.concat([ | ||
'type/function/ensure', | ||
'type/object/ensure', | ||
'type/string/ensure', | ||
'type/value/ensure' | ||
]) | ||
|
||
const plugins = [ | ||
commonjs(), | ||
filesize() | ||
] | ||
const plugins = [typescript(), commonjs(), filesize()]; | ||
|
||
export default { | ||
input: 'src/tram-one', | ||
external, | ||
input: 'src/tram-one.ts', | ||
plugins, | ||
output: { | ||
file: pkg.commonjs, | ||
exports: 'named', | ||
format: 'cjs', | ||
interop: false | ||
} | ||
} | ||
interop: 'auto', | ||
sourcemap: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import filesize from 'rollup-plugin-filesize'; | ||
import dts from 'rollup-plugin-dts'; | ||
|
||
import pkg from '../load-package.cjs'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
|
||
export default [ | ||
{ | ||
input: 'src/tram-one.ts', | ||
plugins: [typescript(), filesize()], | ||
output: { | ||
file: pkg.module, | ||
format: 'es', | ||
sourcemap: true, | ||
}, | ||
}, | ||
{ | ||
input: 'src/tram-one.ts', | ||
plugins: [dts()], | ||
output: { | ||
file: pkg.types, | ||
format: 'es', | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
const builtins = require('rollup-plugin-node-builtins') | ||
const commonjs = require('rollup-plugin-commonjs') | ||
const filesize = require('rollup-plugin-filesize') | ||
const globals = require('rollup-plugin-node-globals') | ||
const resolve = require('rollup-plugin-node-resolve') | ||
const { terser } = require('rollup-plugin-terser') | ||
// const sizes = require('rollup-plugin-sizes') | ||
import builtins from 'rollup-plugin-node-builtins'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import filesize from 'rollup-plugin-filesize'; | ||
import globals from 'rollup-plugin-node-globals'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
// import sizes from 'rollup-plugin-sizes' | ||
|
||
const pkg = require('../package.json') | ||
import pkg from '../package.json'; | ||
|
||
const plugins = [ | ||
typescript(), | ||
resolve({ | ||
preferBuiltins: true, | ||
browser: true | ||
browser: true, | ||
}), | ||
builtins(), | ||
commonjs(), | ||
globals(), | ||
builtins(), | ||
terser(), | ||
// sizes(), // useful for finding large dependencies | ||
filesize() | ||
] | ||
filesize(), | ||
]; | ||
|
||
// domino is a package used by belit to support server side rendering, | ||
// it does not need to be included in browser builds, which will have document | ||
export default { | ||
input: 'src/tram-one', | ||
external: ['domino'], | ||
input: 'src/tram-one.ts', | ||
output: { | ||
name: 'tram-one', | ||
exports: 'named', | ||
file: pkg.umd, | ||
globals: { domino: 'domino' }, | ||
format: 'umd' | ||
format: 'umd', | ||
}, | ||
plugins | ||
} | ||
plugins, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const badge = require('./badge.cjs'); | ||
|
||
const buildPath = 'dist'; | ||
const destPath = 'docs/badges'; | ||
const units = ['B', 'kB', 'MB', 'GB']; | ||
|
||
// get filesize and transform to correct unit | ||
const getSize = (fileName) => { | ||
const bytes = fs.statSync(path.resolve(buildPath, fileName)).size; | ||
const n = Math.floor(Math.log(bytes) / Math.log(1024)); | ||
const formatted = (bytes / 1024 ** n).toFixed(2); | ||
return `${formatted} ${units[n]}`; | ||
}; | ||
|
||
// generate an SVG string and write it to dest | ||
const generateBadge = (label, fileName) => { | ||
const value = getSize(fileName); | ||
const svg = badge(label, value); | ||
const dest = path.resolve(destPath, `${label}.svg`); | ||
fs.writeFile(dest, svg, (err) => err && process.stdout.write(err)); | ||
}; | ||
|
||
generateBadge('cjs', 'tram-one.cjs'); | ||
generateBadge('umd', 'tram-one.js'); | ||
generateBadge('mjs', 'tram-one.mjs'); |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.