1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.writeAppendError = exports.writeConfig = void 0;
|
7 | const util_1 = require("util");
|
8 | const fs_extra_1 = __importDefault(require("fs-extra"));
|
9 | function writeConfig(config) {
|
10 | console.debug('\ngatsby-plugin-purgecss: Writing config to gatsby-plugin-purgecss-debug-config.js');
|
11 | try {
|
12 | fs_extra_1.default.writeFileSync('gatsby-plugin-purgecss-debug-config.js', (0, util_1.inspect)(config, { depth: 15 }), 'utf8');
|
13 | return 0;
|
14 | }
|
15 | catch (error) {
|
16 | console.log('\nCould not write file.');
|
17 | console.log(error);
|
18 | return -1;
|
19 | }
|
20 | }
|
21 | exports.writeConfig = writeConfig;
|
22 | function writeAppendError(errorMessage) {
|
23 | console.debug('gatsby-plugin-purgecss: Writing errors to gatsby-plugin-purgecss-debug.js');
|
24 | try {
|
25 | fs_extra_1.default.appendFileSync('gatsby-plugin-purgecss-debug.js', (0, util_1.inspect)(errorMessage), 'utf8');
|
26 | return 0;
|
27 | }
|
28 | catch (error) {
|
29 | console.log('\nCould not write file.');
|
30 | console.log(error);
|
31 | return -1;
|
32 | }
|
33 | }
|
34 | exports.writeAppendError = writeAppendError;
|