diff --git a/.env-example b/.env-example deleted file mode 100644 index e69de29..0000000 diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..2233ce9 --- /dev/null +++ b/.npmignore @@ -0,0 +1,105 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + diff --git a/Makefile b/Makefile index 8e99b3d..a3caeb9 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # @link https://makefiletutorial.com/ -BIN_FOR_APP = dist/app.js +BIN_FOR_APP = dist/index.js BIN_FOR_NODE = node BIN_FOR_MADGE = madge BIN_FOR_NPM = npm diff --git a/package.json b/package.json index b979dbb..fd37763 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,10 @@ { "name": "tabnab", + "main": "dist/index.js", + "types": "dist/index.d.ts", "version": "1.0.0", "description": "", + "prepublish": "npm run build", "scripts": { "build": "make build", "clean": "make clean", diff --git a/scripts/esbuild.config.mjs b/scripts/esbuild.config.mjs index 5b92174..3d73570 100644 --- a/scripts/esbuild.config.mjs +++ b/scripts/esbuild.config.mjs @@ -22,7 +22,7 @@ esbuild.build({ }, entryPoints: ['src/index.ts'], bundle: true, - outfile: 'dist/app.js', + outfile: 'dist/index.js', target: 'es2020', external: [ ...builtins diff --git a/src/chrome-tab.ts b/src/chrome-tab.ts index 4263cbc..cb82a88 100644 --- a/src/chrome-tab.ts +++ b/src/chrome-tab.ts @@ -11,7 +11,7 @@ import { runAppleScript } from "spawn-applescript"; */ async function renderApplescript( relpath: string, - model: { [key: string]: string }, + model: { [key: string]: string } ) { const templatePath = path.join(__dirname, relpath); const template = fs.readFileSync(templatePath, "utf8"); @@ -54,7 +54,7 @@ export class ChromeTab { async getHtmlSource(): Promise { if (!this._source) { this._source = await renderApplescript("chrome-tab-source.scpt", { - target_url: this.url, + target_url: this.url.toString(), }); } diff --git a/tsconfig.json b/tsconfig.json index 36e6f86..29bb79c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,6 +17,7 @@ "isolatedModules": true, "strictNullChecks": true, "skipLibCheck": true, + "declaration": true, "lib": ["DOM", "ES5", "ES6", "ES7", "ESNext"] }, "include": ["src/**/*.ts", "tests/**/*.ts", "docs/**/*"]