-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(remix): Sourcemaps upload script is missing in the tarball (#5356)
Add the sourcemaps upload script to the tarball, which required the following changes: * Add a package-specific `prepack.ts` script which is invoked by the main `prepack.ts` script. This is similar to how we do it with the Gatsby SDK where - just as with Remix - we need to copy over additional files to the `build` directory that are not part of our other packages. The newly added files are: * `scripts/sentry-upload-sourcemaps.js` * `scripts/createRelease.js` * Add a package-specific `.npmignore` which extends the root level `.npmignore` file to not ignore the `scripts` directory in the `build` directory.
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 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
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 @@ | ||
# The paths in this file are specified so that they align with the file structure in `./build` after this file is copied | ||
# into it by the prepack script `scripts/prepack.ts`. | ||
|
||
!/scripts/**/* |
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,34 @@ | ||
/* eslint-disable no-console */ | ||
|
||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
const PACKAGE_ASSETS = ['scripts/sentry-upload-sourcemaps.js', 'scripts/createRelease.js']; | ||
|
||
export function prepack(buildDir: string): boolean { | ||
// copy package-specific assets to build dir | ||
return PACKAGE_ASSETS.every(asset => { | ||
const assetPath = path.resolve(asset); | ||
const destinationPath = path.resolve(buildDir, asset); | ||
try { | ||
if (!fs.existsSync(assetPath)) { | ||
console.error(`\nERROR: Asset '${asset}' does not exist.`); | ||
return false; | ||
} | ||
const scriptsDir = path.resolve(buildDir, 'scripts'); | ||
if (!fs.existsSync(scriptsDir)) { | ||
console.log('Creating missing directory', scriptsDir); | ||
fs.mkdirSync(scriptsDir); | ||
} | ||
console.log(`Copying ${path.basename(asset)} to ${path.relative('../..', destinationPath)}.`); | ||
fs.copyFileSync(assetPath, destinationPath); | ||
} catch (error) { | ||
console.error( | ||
`\nERROR: Error while copying ${path.basename(asset)} to ${path.relative('../..', destinationPath)}:\n`, | ||
error, | ||
); | ||
return false; | ||
} | ||
return true; | ||
}); | ||
} |