Skip to content

Commit ed23648

Browse files
committed
Merge branch 'fntags_0.3.1' of https://github.com/snowbldr/js-framework-benchmark into snowbldr-fntags_0.3.1
2 parents 0c2db0f + d6151e9 commit ed23648

File tree

6 files changed

+246
-103
lines changed

6 files changed

+246
-103
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ As you can see the mean duration for create 1000 rows was 144 msecs.
158158
You can also check whether the implementation appears to be compliant to the rules:
159159

160160
```
161-
npm run check keyed/vanillajs
161+
npm run isKeyed keyed/vanillajs
162162
```
163163

164164
If it finds anything it'll report an ERROR.
@@ -298,7 +298,7 @@ Contributions are very welcome. Please use the following rules:
298298
- Webdriver-ts must be able to run the perf tests for the contribution. This means that all buttons (like "Create 1,000 rows") must have the correct id e.g. like in vanillajs. Using shadow DOM is a real pain for webdriver. The closer you can get to polymer the higher the chances I can make that contribution work.
299299
- Don't change the ids in the index.html, since the automated benchmarking relies on those ids.
300300
- Please push only files in your framework folder (not index.html or results.json)
301-
- **Please make sure your implementation is validated by the test tool.** cd to webdriver-ts and invoke it with `npm run check [keyed|non-keyed]/[FrameworkName]`. It'll print an error if your framework behaves other as specified. It'll print a big ERROR explaining if it isn't happy with the implementation. Some common errors include:
301+
- **Please make sure your implementation is validated by the test tool.** cd to webdriver-ts and invoke it with `npm run isKeyed [keyed|non-keyed]/[FrameworkName]`. It'll print an error if your framework behaves other as specified. It'll print a big ERROR explaining if it isn't happy with the implementation. Some common errors include:
302302
- Your package.json is missing some required fields
303303
- Incorrect classification (Keyed/NonKeyed)
304304
- You have gzipped files in /dist (unfortunately the web server prefers these when they exist)

frameworks/keyed/fntags/build.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
const fs = require( 'fs-extra' )
22
const terser = require( 'terser' )
33

4-
if( fs.existsSync( 'dist' ) ) fs.removeSync( 'dist' )
5-
fs.mkdirSync( 'dist' )
4+
async function build() {
65

7-
const minify = ( file ) => {
8-
let content = fs.readFileSync( file, 'utf8' )
9-
if( process.argv[ 2 ] === 'dev' ) {
10-
return content
11-
} else {
12-
const code = terser.minify( content ).code
13-
if( !code ) throw new Error( `failed to minify ${file}` ).stack
14-
return code
6+
if( await fs.exists( 'dist' ) ) await fs.remove( 'dist' )
7+
await fs.mkdir( 'dist' )
8+
9+
const minify = async ( file ) => {
10+
let content = await fs.readFile( file, 'utf8' )
11+
if( process.argv[2] === 'dev' ) {
12+
return content
13+
} else {
14+
let minifyOutput = await terser.minify( content, {module: true, ecma: 2015} );
15+
if( minifyOutput.error ) {
16+
const err = new Error( `failed to minify ${file}` )
17+
err.stack += `\nCaused By: ${minifyOutput.error.stack}`
18+
throw err
19+
}
20+
return minifyOutput.code
21+
}
1522
}
23+
await fs.writeFile( 'dist/fntags.min.js', await minify( 'node_modules/@srfnstack/fntags/src/fntags.mjs' ) )
24+
await fs.writeFile( 'dist/Main.js', await minify( 'src/Main.js' ) )
1625
}
17-
fs.writeFileSync('dist/fntags.min.js', minify('node_modules/@srfnstack/fntags/src/fntags.mjs'))
18-
fs.writeFileSync( 'dist/Main.js', minify( 'src/Main.js' ) )
26+
27+
build().catch(e => {throw e})

frameworks/keyed/fntags/package-lock.json

Lines changed: 147 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/keyed/fntags/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
},
1313
"author": "Robert Kempton",
1414
"dependencies": {
15-
"@srfnstack/fntags": "0.1.7"
15+
"@srfnstack/fntags": "0.3.3"
1616
},
1717
"devDependencies": {
1818
"fs-extra": "8.1.0",
19-
"terser": "4.3.8"
19+
"terser": "5.10.0"
2020
}
2121
}

0 commit comments

Comments
 (0)