-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
80 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ coverage | |
public | ||
.env | ||
dependency-graph.html | ||
test-out.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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import tap from 'tap' | ||
import { hello } from './index.js' | ||
import getBookmarklet from './dist/out.js' | ||
|
||
tap.test('index export', async (t) => { | ||
t.equal(hello(), 'world') | ||
const bookmarkletText = getBookmarklet({ | ||
TARGET_URL: 'breadcrum.net', | ||
WINDOW_TITLE: 'Breadcrum' | ||
}) | ||
|
||
t.ok(bookmarkletText, 'Got the bookmarklet text') | ||
}) |
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,9 +1,9 @@ | ||
{ | ||
"name": "@breadcrum/bookmarklet", | ||
"description": "WIP - nothing to see here", | ||
"description": "Bookmarklet for breadcrum.net", | ||
"files": [ | ||
"*.js", | ||
"lib/*.js" | ||
"dist/*.js", | ||
"dist/*.js.map" | ||
], | ||
"version": "0.0.0", | ||
"author": "Bret Comnes <[email protected]> (https://bret.io)", | ||
|
@@ -32,22 +32,24 @@ | |
"type": "module", | ||
"module": "index.js", | ||
"exports": { | ||
"import": "./index.js" | ||
"import": "./dist/out.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/hifiwi-fi/bc-bookmarklet.git" | ||
}, | ||
"scripts": { | ||
"prepare": "rm -rf dist && run-s build", | ||
"prepublishOnly": "git push --follow-tags && gh-releas -y", | ||
"test": "run-s test:*", | ||
"test:deptree": "depcruise --validate .dependency-cruiser.json .", | ||
"test:standard": "standard --verbose | snazzy", | ||
"test:tap": "METRICS=0 c8 tap --no-coverage --color", | ||
"version": "run-s prepare version:*", | ||
"version:changelog": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING CHANGE:'", | ||
"version:git": "git add CHANGELOG.md", | ||
"deps": "depcruise --exclude '^node_modules' --output-type dot . | dot -T svg | depcruise-wrap-stream-in-html > dependency-graph.html" | ||
"version:git": "git add CHANGELOG.md dist", | ||
"deps": "depcruise --exclude '^node_modules' --output-type dot . | dot -T svg | depcruise-wrap-stream-in-html > dependency-graph.html", | ||
"build": "node scripts/build.js" | ||
}, | ||
"standard": { | ||
"ignore": [ | ||
|
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,19 @@ | ||
import { dirname } from 'desm' | ||
import { join } from 'path' | ||
import { writeFile } from 'fs/promises' | ||
import { makeBookmarklet } from './make-bookmarklet.js' | ||
|
||
const __dirname = dirname(import.meta.url) | ||
|
||
const inFile = join(__dirname, '../index.js') | ||
const outFile = join(__dirname, '../dist/out.js') | ||
|
||
const { dest } = await makeBookmarklet(inFile, outFile) | ||
|
||
const created = await import(dest) | ||
|
||
const bookmarkletFn = created.default({ TARGET_URL: 'breadcrum.net', WINDOW_TITLE: 'breadcrum' }) | ||
|
||
await writeFile(join(__dirname, '../test-out.js'), bookmarkletFn) | ||
|
||
console.log('done') |
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
File renamed without changes.
Oops, something went wrong.