-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fix publishing of manifests (#35)
Updates the publish flow a little so we no longer rely on importing JSON files. Instead, we use sync FS calls to read the files at runtime. This will be slower I imagine, but means we can ship one copy of the manifests.
- Loading branch information
Showing
9 changed files
with
71 additions
and
31 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
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,16 @@ | ||
import {readFile, writeFile} from 'node:fs/promises'; | ||
import {fileURLToPath} from 'node:url'; | ||
import * as path from 'node:path'; | ||
|
||
const scriptDir = fileURLToPath(new URL('.', import.meta.url)); | ||
const distPath = path.resolve(scriptDir, '../dist'); | ||
const flavours = ['esm', 'commonjs'] | ||
|
||
for (const flavour of flavours) { | ||
const flavourPath = `${distPath}/${flavour}/manifests-dir.js`; | ||
const contents = await readFile(flavourPath, 'utf8'); | ||
await writeFile(flavourPath, contents.replaceAll( | ||
'../manifests', | ||
'../../manifests' | ||
)); | ||
} |
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,4 @@ | ||
import * as path from 'node:path'; | ||
|
||
const currentDir = __dirname; | ||
export const manifestsDir = path.resolve(currentDir, '../manifests'); |
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 @@ | ||
import {fileURLToPath} from 'node:url'; | ||
import * as path from 'node:path'; | ||
|
||
// @ts-ignore filthy cjs/esm polyfill hacks so we can have import.meta | ||
const currentDir = fileURLToPath(new URL('.', import.meta.url)); | ||
export const manifestsDir = path.resolve(currentDir, '../manifests'); |
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