Skip to content

Commit

Permalink
Merge 5c2897b in staging-28
Browse files Browse the repository at this point in the history
Co-authored-by: Benoît Zugmeyer <benoit.zugmeyer@datadoghq.com>
  • Loading branch information
dd-mergequeue[bot] and BenoitZugmeyer authored Jul 11, 2023
2 parents 423668d + 5c2897b commit cc6e14f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions packages/worker/.npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*
!/bundle/worker.js
!/string/**/*
!/cjs/**/*
!/esm/**/*
!/src/**/*
/src/**/*.spec.ts
/src/**/*.specHelper.ts
11 changes: 6 additions & 5 deletions packages/worker/scripts/build-worker-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ const bundlePath = path.resolve(__dirname, '../bundle')
const workerBundlePath = path.join(bundlePath, 'worker.js')
const workerBundleContent = fs.readFileSync(workerBundlePath, { encoding: 'utf-8' })

writeOutput('cjs', `exports.workerString = ${JSON.stringify(workerBundleContent)}\n`)
writeOutput('esm', `export const workerString = ${JSON.stringify(workerBundleContent)}\n`)
const workerString = `${JSON.stringify(workerBundleContent)}\n`
writeOutput('cjs', `exports.workerString = ${workerString}`)
writeOutput('esm', `export const workerString = ${workerString}`)

function writeOutput(moduleType, content) {
const outputPath = path.resolve(__dirname, path.join('..', 'string', moduleType))
const outputPath = path.resolve(__dirname, path.join('..', moduleType, 'entries'))
fs.mkdirSync(outputPath, { recursive: true })
fs.writeFileSync(path.join(outputPath, 'main.js'), content)
fs.writeFileSync(path.join(outputPath, 'main.d.ts'), 'export declare const workerString: string\n')
fs.writeFileSync(path.join(outputPath, 'string.js'), content)
fs.writeFileSync(path.join(outputPath, 'string.d.ts'), 'export declare const workerString: string\n')
}
6 changes: 3 additions & 3 deletions packages/worker/string/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"main": "cjs/main.js",
"module": "esm/main.js",
"types": "cjs/main.d.ts"
"main": "../cjs/entries/string.js",
"module": "../esm/entries/string.js",
"types": "../cjs/entries/string.d.ts"
}

0 comments on commit cc6e14f

Please sign in to comment.