-
Notifications
You must be signed in to change notification settings - Fork 44
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
start of ES6 modules: move to rollup #183
base: main
Are you sure you want to change the base?
Changes from 14 commits
02bca34
5a51d4a
a91ebd2
1a183a3
da17a11
5ab22fd
38c2637
2428e8c
d3f688a
1e68e0e
b8d87b4
3a5601f
e68fe02
96df19d
e15d00c
3c68511
4d9ea3a
8189d2f
da65ab1
a893dc5
b790892
f4a992e
6f61769
64b5740
f296cba
de8b52b
2d040e8
8e2a468
5f9d9a9
a01fadf
88b5026
3bd5a16
93ba59f
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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
language: node_js | ||
node_js: 10 | ||
script: | ||
- npm run-script build | ||
- npm test | ||
- npm run-script check-format | ||
- make lint build test check-format |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,25 +21,25 @@ | |
"node": ">= 5.6.0" | ||
}, | ||
"scripts": { | ||
"build": "eslint --cache --quiet src src-ui && ./git-hash.sh && grunt default", | ||
"build": "./git-hash.sh && grunt default", | ||
"release": "npm run clean && eslint --cache --quiet src && grunt release", | ||
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. is this (still) used anywhere? 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. It's referenced in Gruntfile:
But the only difference seems to be that if PRODUCTION is true it copies over .map files, which is fine anyway? 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. It's at least fine in the sense that I'm currently deploying those anyway... https://puzz.link/js/list.js.map |
||
"clean": "del dist/* pzpr-*.{zip,tar.gz,tar.bz2,tgz}", | ||
"format": "prettier --write \"{src,src-ui,test}/**/*.{js,css}\"", | ||
"check-format": "prettier --check \"{src,src-ui,test}/**/*.{js,css}\"", | ||
"lint": "eslint src src-ui test sample", | ||
"test": "eslint --quiet src src-ui test sample && mocha -r source-map-support/register -R progress --recursive test", | ||
"test": "mocha -r esm -r pzpr-canvas -r source-map-support/register -R progress --recursive test", | ||
"prepublishOnly": "npm test" | ||
}, | ||
"devDependencies": { | ||
"del-cli": "^2.0.0", | ||
"eslint": "^5.16.0", | ||
"esm": "^3.2.25", | ||
"grunt": "^1.1.0", | ||
"grunt-contrib-concat": "^1.0.1", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-contrib-uglify": "^2.0.0", | ||
"grunt-newer": "^1.1.1", | ||
"mocha": "^6.2.3", | ||
"prettier": "^1.19.1" | ||
"prettier": "^1.19.1", | ||
"rollup": "^2.6.0", | ||
"rollup-plugin-terser": "^5.3.0" | ||
}, | ||
"dependencies": { | ||
"pzpr-canvas": "^0.8.2", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { terser } from 'rollup-plugin-terser'; | ||
|
||
// `npm run build` -> `production` is true | ||
// `npm run dev` -> `production` is false | ||
const production = !process.env.ROLLUP_WATCH; | ||
|
||
export default { | ||
input: 'dist/js/pzpr.concat.js', | ||
output: { | ||
file: 'dist/js/pzpr.js', | ||
name: 'pzpr', | ||
format: 'iife', | ||
sourcemap: true, | ||
globals: { | ||
"pzpr-canvas": "Candle" | ||
} | ||
}, | ||
context: "window", | ||
plugins: [ | ||
production && terser() // minify, but only in production | ||
] | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
{ | ||
"env": { | ||
"browser": true, // Allow to use browser defined variable (not console, alert etc.) | ||
"node": true // Allow to use node defined variable (require, process etc.) | ||
"browser": true, // Allow to use browser defined variable (not console, alert etc.) | ||
"node": true // Allow to use node defined variable (require, process etc.) | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 5 | ||
"ecmaVersion": 5, | ||
"sourceType": "module" | ||
}, | ||
"globals": { | ||
"pzpr": "readonly" | ||
}, | ||
"extends": "eslint:recommended", // Implement recommended rules | ||
"extends": "eslint:recommended", // Implement recommended rules | ||
"rules": { | ||
"curly": ["error", "all"], // Error for no curly brancket in loop or conditions | ||
"no-unused-vars": // Error for unused variables, not detect arguments | ||
["error", {"args": "none"}], | ||
"no-undef": "error", // Error for unused variable (that will become global variable) | ||
"new-cap": "error", // Error for lowercase first letter or constructor call as function | ||
"eqeqeq": ["error", "always"], // Error for ==, != to compare | ||
"no-use-before-define": // Error for using variable before definition | ||
["error", {"functions":false, "classes":false}], | ||
"curly": ["error", "all"], // Error for no curly brancket in loop or conditions | ||
// Error for unused variables, not detect arguments | ||
"no-unused-vars": ["error", { "args": "none" }], | ||
"no-undef": "error", // Error for unused variable (that will become global variable) | ||
"new-cap": "error", // Error for lowercase first letter or constructor call as function | ||
"eqeqeq": ["error", "always"], // Error for ==, != to compare | ||
// Error for using variable before definition | ||
"no-use-before-define": ["error", { "functions": false, "classes": false }], | ||
"comma-dangle": ["error", "never"], // Error for trailing comma | ||
"no-redeclare": "warn", // Warn redefine variable (TODO: make this rule error) | ||
"no-redeclare": "warn", // Warn redefine variable (TODO: make this rule error) | ||
//"block-scoped-var": "warn", // Warn var declaration inside block scope | ||
"no-empty": "off", // Allow empty block statements | ||
"no-constant-condition": // Allow constant condition in conditions | ||
["error", {"checkLoops": false}], | ||
"no-useless-escape": "off", // Allow unnessesary escape charactors | ||
"no-extra-boolean-cast": "off", // Allow to use boolean cast for boolean value | ||
"no-mixed-spaces-and-tabs": "off", // Allow to use spaces and tabs for indent | ||
"dot-notation": "off", // Allow object access via obj["name"] | ||
"no-loop-func": "off" // Allow function definition in loop | ||
"no-empty": "off", // Allow empty block statements | ||
// Allow constant condition in conditions | ||
"no-constant-condition": ["error", { "checkLoops": false }], | ||
"no-useless-escape": "off", // Allow unnessesary escape charactors | ||
"no-extra-boolean-cast": "off", // Allow to use boolean cast for boolean value | ||
"no-mixed-spaces-and-tabs": "off", // Allow to use spaces and tabs for indent | ||
"dot-notation": "off", // Allow object access via obj["name"] | ||
"no-loop-func": "off" // Allow function definition in loop | ||
} | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var pzpr = { | ||
version: "<%= git.hash %>" | ||
}; | ||
export default pzpr; | ||
|
||
import Candle from "pzpr-canvas"; | ||
pzpr.Candle = Candle; | ||
|
||
//eslint-disable-next-line no-unused-vars | ||
var document = this.document || pzpr.Candle.document; | ||
//eslint-disable-next-line no-unused-vars | ||
var DOMParser = this.DOMParser || pzpr.Candle.DOMParser; | ||
//eslint-disable-next-line no-unused-vars | ||
var XMLSerializer = this.XMLSerializer || pzpr.Candle.XMLSerializer; |
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.
the git-hash part here seems like it should be redundant with the new Makefile target
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.
could we get rid of this script entirely and call
npx grunt default
from the Makefile instead?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.
p.html and the examples and such are still copied with Grunt. I thought is was a bit too much to also change that in this PR. But we could.
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 didn't mean to get rid of Grunt, I meant to get rid of the
"build"
script inpackage.json
, and to call Grunt directly from the Makefile.