1 | ;
|
2 | /*
|
3 | * @adonisjs/sink
|
4 | *
|
5 | * (c) Harminder Virk <virk@adonisjs.com>
|
6 | *
|
7 | * For the full copyright and license information, please view the LICENSE
|
8 | * file that was distributed with this source code.
|
9 | */
|
10 | Object.defineProperty(exports, "__esModule", { value: true });
|
11 | exports.JsonFile = void 0;
|
12 | const mrm_core_1 = require("mrm-core");
|
13 | const KeyValuePair_1 = require("../Base/KeyValuePair");
|
14 | /**
|
15 | * Exposes the API to work with JSON files.
|
16 | *
|
17 | * ```ts
|
18 | * const json = new JsonFile(__dirname, 'tsconfig.json')
|
19 | * json.set('compilerOptions.lib', ['es2017'])
|
20 | *
|
21 | * json.commit()
|
22 | * ```
|
23 | */
|
24 | class JsonFile extends KeyValuePair_1.KeyValuePair {
|
25 | constructor(basePath, filename) {
|
26 | super(basePath);
|
27 | this.cdIn();
|
28 | this.filePointer = (0, mrm_core_1.json)(filename);
|
29 | this.cdOut();
|
30 | }
|
31 | }
|
32 | exports.JsonFile = JsonFile;
|