-
Notifications
You must be signed in to change notification settings - Fork 12
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
1 parent
b556374
commit d5aec2d
Showing
6 changed files
with
95 additions
and
1 deletion.
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
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,28 @@ | ||
const bareInspector = require('bare-inspector') | ||
const { Inspector } = require('pear-inspect') | ||
const fsp = require('bare-fs/promises') | ||
const readAssetFromUtils = require('./lib/utils.js') | ||
|
||
const inspector = new Inspector({ inspector: bareInspector }) | ||
|
||
async function readAsset () { | ||
const text = await fsp.readFile(require.asset('./text-file.txt')) | ||
return text.toString() | ||
} | ||
|
||
async function run () { | ||
const key = await inspector.enable() | ||
const inspectorKey = key.toString('hex') | ||
console.log(`{ "tag": "inspector", "data": { "key": "${inspectorKey}" }}`) | ||
} | ||
|
||
run() | ||
|
||
|
||
function disableInspector () { | ||
inspector.disable() | ||
} | ||
|
||
global.disableInspector = disableInspector | ||
global.readAsset = readAsset | ||
global.readAssetFromUtils = readAssetFromUtils |
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,6 @@ | ||
const fsp = require('bare-fs/promises') | ||
|
||
module.exports = async () => { | ||
const text = await fsp.readFile(require.asset('../text-file.txt')) | ||
return text.toString() | ||
} |
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,15 @@ | ||
{ | ||
"name": "app-with-assets", | ||
"main": "index.js", | ||
"pear": { | ||
"name": "app-with-assets", | ||
"type": "terminal" | ||
}, | ||
"devDependencies": { | ||
"bare-inspector": "^3.0.1", | ||
"pear-inspect": "^1.2.2" | ||
}, | ||
"dependencies": { | ||
"bare-fs": "^3.1.1" | ||
} | ||
} |
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 @@ | ||
This is the content of the asset |