-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tram-One, now with Types! Typescript! v11.0.0 #175
Changes from 11 commits
dc2bf8c
a43298e
e56dc64
64dab27
1b76e38
1ca3030
349d159
839e459
029217e
fdcadee
30f8370
f18e844
7e8d7fd
c6842cf
c8a677e
771d55e
ca74d2a
31024f5
8195f6b
da0e1fb
74e2788
2edd8c2
d7727f9
1df7179
0968852
2914e36
eb88229
adef448
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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 library, we have to sometimes just expect anything | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
overrides: [ | ||
// allow module.exports for config, testing, and docs | ||
{ | ||
files: [ | ||
'./*.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, | ||
}, | ||
}, | ||
], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,8 @@ dist | |
# Coverage Report | ||
coverage | ||
|
||
# docma docs | ||
docs/website | ||
|
||
# Logs | ||
logs | ||
*.log | ||
*.log.* | ||
|
||
# Dependency directory | ||
node_modules | ||
|
||
# SSL certificates | ||
.ssl | ||
|
||
Comment on lines
-18
to
-20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was most certainly an artifact of when we had the website hosted from this repo, since that is no longer a thing, we can remove this |
||
# parcel test app files | ||
dist | ||
.parcel-cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
useTabs: true, | ||
singleQuote: true, | ||
printWidth: 120, | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using prettier instead of xo. The prettier config is more known to work with typescript, and xo was breaking too much. Eventually I'd like to rip out the eslint config for tram-one projects as it is today. It really should be something that validates tram-one things (e.g., I would love to lint template spacing, and hook placement). Right now, it's just silly opinions, and that doesn't really help anyone. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This includes using semicolons (which sadly blows the number of lines changed for the project super high). ASI has burned me enough times (read, more than 0 times), and I think with the new Typescript syntax, it's easier if we are on the same standard as everyone else. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,25 @@ | ||
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 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', | ||
input: 'src/tram-one.ts', | ||
external, | ||
plugins, | ||
output: { | ||
file: pkg.commonjs, | ||
exports: 'named', | ||
format: 'cjs', | ||
interop: false | ||
} | ||
} | ||
interop: false, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,40 @@ | ||
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', | ||
input: 'src/tram-one.ts', | ||
external: ['domino'], | ||
output: { | ||
name: 'tram-one', | ||
exports: 'named', | ||
file: pkg.umd, | ||
globals: { domino: 'domino' }, | ||
format: 'umd' | ||
format: 'umd', | ||
}, | ||
plugins | ||
} | ||
plugins, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
const path = require('path') | ||
const fs = require('fs') | ||
const badge = require('./badge') | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const badge = require('./badge'); | ||
|
||
const buildPath = 'dist' | ||
const destPath = 'docs/badges' | ||
const units = ['B', 'kB', 'MB', 'GB'] | ||
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]}` | ||
} | ||
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 => { | ||
const value = getSize(`tram-one.${label}.js`) | ||
const svg = badge(label, value) | ||
const dest = path.resolve(destPath, `${label}.svg`) | ||
fs.writeFile(dest, svg, err => err && process.stdout.write(err)) | ||
} | ||
const generateBadge = (label) => { | ||
const value = getSize(`tram-one.${label}.js`); | ||
const svg = badge(label, value); | ||
const dest = path.resolve(destPath, `${label}.svg`); | ||
fs.writeFile(dest, svg, (err) => err && process.stdout.write(err)); | ||
}; | ||
|
||
generateBadge('cjs') | ||
generateBadge('umd') | ||
generateBadge('cjs'); | ||
generateBadge('umd'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
const { registerHtml } = require('tram-one') | ||
const { registerHtml } = require('tram-one'); | ||
|
||
const html = registerHtml() | ||
const html = registerHtml(); | ||
const home = () => { | ||
return html` | ||
<main> | ||
<h1> Tram-One </h1> | ||
<h2> A Modern View Framework for Vanilla Javascript </h2> | ||
<h1>Tram-One</h1> | ||
<h2>A Modern View Framework for Vanilla Javascript</h2> | ||
</main> | ||
` | ||
} | ||
`; | ||
}; | ||
|
||
home().outerHTML | ||
home().outerHTML; |
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this project originally predated
npm ci
, but now that it exists, we should be using that, and not regenerating the lock file on every PR.