-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
ffddd11
commit 29e8be3
Showing
7 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,24 @@ | ||
const maki = require('..'); | ||
const { writeFile } = require('fs'); | ||
|
||
writeFile( | ||
'./browser.cjs.js', | ||
'/* eslint-disable */\nmodule.exports = ' + JSON.stringify(maki), | ||
function(err) { | ||
if (err) console.log(err); | ||
console.log('✓ Successfully generated browser.js'); | ||
} | ||
); | ||
|
||
writeFile( | ||
'./browser.esm.js', | ||
[ | ||
'/* eslint-disable */', | ||
'export const layouts = ' + JSON.stringify(maki.layouts), | ||
'export const svgArray = ' + JSON.stringify(maki.svgArray) | ||
].join('\n'), | ||
function(err) { | ||
if (err) console.log(err); | ||
console.log('✓ Successfully generated esm.js'); | ||
} | ||
); |
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,13 @@ | ||
const test = require('tape'); | ||
|
||
const maki = require('../'); | ||
const makiBrowser = require('../browser.cjs'); | ||
|
||
test('index', function(t) { | ||
t.deepEqual( | ||
maki, | ||
makiBrowser, | ||
'browser bundle is the parseable and the same' | ||
); | ||
t.end(); | ||
}); |
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 test = require('tape'); | ||
const esbuild = require('esbuild'); | ||
|
||
const maki = require('../'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const browserEsmText = fs | ||
.readFileSync(path.resolve(__dirname, '..', './browser.esm.js')) | ||
.toString('utf8'); | ||
|
||
const transformed = esbuild.transformSync(browserEsmText, { | ||
format: 'cjs' | ||
}); | ||
|
||
test('index', function(t) { | ||
t.assert(transformed.warnings.length === 0, 'no esbuild warnings'); | ||
|
||
eval(transformed.code); | ||
t.deepEqual( | ||
maki, | ||
// Ran through eval. | ||
exports, | ||
'ESM bundle is the parseable and the same' | ||
); | ||
t.end(); | ||
}); |