-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (39 loc) · 1.11 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
const fs = require('fs-extra');
const path = require('path');
module.exports = {
description:
'Define an actor deployed to a canister on the Internet Computer',
availableOptions: [
{
name: 'declaration',
type: String,
},
],
locals(options) {
return {
declaration: options.declaration || options.entity.name,
hasDeclaration: options.declaration !== undefined,
};
},
afterInstall(options) {
if (options.declaration !== undefined) {
// There is a local declaration. We are going to import the declaration into our project
// by linking to it. This will help keep the declaration consistent as it changes.
const declaration = options.declaration || options.entity.name;
const candidFileName = `${declaration}.did.js`;
const target = path.resolve(
options.target,
'../declarations',
declaration,
candidFileName
);
const link = path.resolve(
options.target,
'./app/declarations',
candidFileName
);
fs.ensureSymlinkSync(target, link, 'file');
}
},
};