<p dir="auto">There is discussion around "lockfiles" and sub-resource integrity (see: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="330377106" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/200" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/200/hovercard" href="https://github.com/denoland/deno/issues/200">#200</a>).</p>
<p dir="auto">There are also other "external" data that might be needed to describe a workload in Deno, like what the main module is, a custom TypeScript configuration, permissions and other command line options, import-maps, etc.  While Deno should always <em>just work</em> without a meta data file, there are lots of use cases where external meta data is necessary or desired.</p>
<p dir="auto">Providing a single file way of describing that meta data would be a desirable feature.</p>
<p dir="auto">I propose the following:</p>
<ul dir="auto">
<li>Deno supports a single file meta-data schema that fully describes a workload.</li>
<li>That the format of this file would be <code class="notranslate">.json</code></li>
<li>That when a command resolves an argument to a <code class="notranslate">.json</code> file, it assumes that it adheres to the meta-data schema, meaning that <code class="notranslate">deno run app.json</code> would read the meta data file and utilise that to determine how to cache and execute the app.  This would also mean something like <code class="notranslate">deno run https://example.com/app.json</code> would also <em>just work</em>.</li>
</ul>
<p dir="auto">As this proposal evolves, the definition of the schema would be detailed, but would include all the functional areas mentioned above.  Specifically for the "lockfile" mechanism, if an application is loaded and the <code class="notranslate">.json</code> file is writable (local) and there is no cache of the hashes of the modules, then Deno will write out the hashes of all dependent modules to the file.  Upon subsequent invocations where the cache of the hashes is present, Deno will validate that all modules loaded match that cache, and if they don't they will throw and the workload would terminate.</p>
<p dir="auto">Support a command like <code class="notranslate">deno write main.ts app.json</code> would scaffold out the meta data file, but not run the workload.  Any arguments passed on the CLI could be automatically written to the file as well.</p>
<p dir="auto">I just ran <code class="notranslate">./tools/format.py</code> when submitting a PR and it picked up a trivial formatting change:</p>
<div class="highlight highlight-source-diff notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="diff --git a/js/mkdir_test.ts b/js/mkdir_test.ts
index 4f82401..27da93c 100644
--- a/js/mkdir_test.ts
+++ b/js/mkdir_test.ts
@@ -13,7 +13,8 @@ testPerm({ write: true }, function mkdirSyncMode() {
   const path = deno.makeTempDirSync() + &quot;/dir/subdir&quot;;
   deno.mkdirSync(path, 0o755); // no perm for x
   const pathInfo = deno.statSync(path);
-  if (pathInfo.mode !== null) { // Skip windows
+  if (pathInfo.mode !== null) {
+    // Skip windows
     assertEqual(pathInfo.mode &amp; 0o777, 0o755);
   }
 });"><pre class="notranslate"><span class="pl-c1">diff --git a/js/mkdir_test.ts b/js/mkdir_test.ts</span>
index 4f82401..27da93c 100644
<span class="pl-md">--- a/js/mkdir_test.ts</span>
<span class="pl-mi1">+++ b/js/mkdir_test.ts</span>
<span class="pl-mdr">@@ -13,7 +13,8 @@</span> testPerm({ write: true }, function mkdirSyncMode() {
   const path = deno.makeTempDirSync() + "/dir/subdir";
   deno.mkdirSync(path, 0o755); // no perm for x
   const pathInfo = deno.statSync(path);
<span class="pl-md"><span class="pl-md">-</span>  if (pathInfo.mode !== null) { // Skip windows</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>  if (pathInfo.mode !== null) {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>    // Skip windows</span>
     assertEqual(pathInfo.mode &amp; 0o777, 0o755);
   }
 });</pre></div>
<p dir="auto">It feels like this things should fail the CI.  I am not sure why they don't.</p>