Skip to content

Commit 9a32eb1

Browse files
committed
update npm tasks
1 parent ec42a6a commit 9a32eb1

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
},
1818
"scripts": {
1919
"build": "skpm-build",
20-
"watch": "skpm-build --watch",
21-
"start": "skpm-build --watch --run",
20+
"watch": "export DEBUG=1; skpm-build --watch",
21+
"start": "export DEBUG=1; skpm-build --watch --run",
2222
"postinstall": "npm run build && skpm-link"
2323
},
2424
"devDependencies": {

webpack.skpm.config.js

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
2+
let fs = require('fs');
23
let path = require('path');
4+
let process = require('process');
35
/**
46
* Function that mutates original webpack config.
57
* Supports asynchronous changes when promise is returned.
@@ -10,6 +12,17 @@ let path = require('path');
1012
module.exports = function (config, isPluginCommand) {
1113
/** you can change config here **/
1214
if (!isPluginCommand) return;
15+
let debug = !!process.env.DEBUG;
16+
if (!debug) {
17+
let dir = 'sketch-meaxure.sketchplugin/Contents/Sketch';
18+
fs.readdirSync(dir).forEach(file => {
19+
if (file.endsWith('.js.map')) {
20+
console.log('remove js map file', file);
21+
fs.unlinkSync(path.resolve(dir, file));
22+
}
23+
})
24+
}
25+
config.mode = debug ? 'development' : 'production';
1326
config.entry = {
1427
mark: './src/index.ts',
1528
};

0 commit comments

Comments
 (0)