-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source map referenced but not included in published package. Fixes #4
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
function deleteRefs(dir) { | ||
const files = fs.readdirSync(dir); | ||
for (let file of files) { | ||
const filePath = path.join(dir, file); | ||
const stat = fs.statSync(filePath); | ||
if (stat.isDirectory()) { | ||
deleteRefs(filePath); | ||
} else if (path.extname(file) === '.js') { | ||
const content = fs.readFileSync(filePath, 'utf8'); | ||
const newContent = content.replace(/\/\/\# sourceMappingURL=[^]+.js.map/, '') | ||
if (content.length !== newContent.length) { | ||
console.log('remove sourceMappingURL in ' + filePath); | ||
fs.writeFileSync(filePath, newContent); | ||
} | ||
} else if (path.extname(file) === '.map') { | ||
fs.unlinkSync(filePath) | ||
console.log('remove ' + filePath); | ||
} | ||
} | ||
} | ||
|
||
let location = path.join(__dirname, '..', 'lib'); | ||
console.log('process ' + location); | ||
deleteRefs(location); |
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