@linktr.ee/create-link-app 1.7.1 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/deploy.js +16 -7
- package/dist/lib/deploy/pack-project.js +10 -10
- package/oclif.manifest.json +8 -1
- package/package.json +1 -1
package/dist/commands/deploy.js
CHANGED
|
@@ -23,7 +23,8 @@ class Deploy extends base_1.default {
|
|
|
23
23
|
const accessToken = (0, access_token_1.getAccessToken)(appConfig.auth.audience);
|
|
24
24
|
const linkTypeServiceUrl = `${flags.endpoint ?? appConfig.link_types_url}/link-types`;
|
|
25
25
|
const isForceUpdate = !!flags['force-update'];
|
|
26
|
-
const
|
|
26
|
+
const isQa = !!flags.qa;
|
|
27
|
+
const packedFiles = await (0, pack_project_1.default)(flags.path);
|
|
27
28
|
this.log(`\n===`);
|
|
28
29
|
if (isForceUpdate) {
|
|
29
30
|
this.log('⚠️ "--force-update" flag will impact the existing PUBLISHED Link Apps.\n');
|
|
@@ -34,10 +35,12 @@ class Deploy extends base_1.default {
|
|
|
34
35
|
this.log(` - ${file}`);
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
if (!flags['skip-confirm']) {
|
|
39
|
+
const userConfirmDeploy = await core_1.CliUx.ux.prompt(`❓ ${isQa ? '[QA]' : ''} Do you want to proceed? (Y/n)`, { required: false });
|
|
40
|
+
if (userConfirmDeploy?.toLowerCase() !== 'y') {
|
|
41
|
+
this.log('Aborted!');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
41
44
|
}
|
|
42
45
|
const form = (0, create_form_data_1.default)(flags.path);
|
|
43
46
|
let linkTypeErrorCode = null;
|
|
@@ -93,7 +96,7 @@ class Deploy extends base_1.default {
|
|
|
93
96
|
this.log(`\n===`);
|
|
94
97
|
this.log(JSON.stringify(result, null, 2));
|
|
95
98
|
const linkTypeId = result.linkType.linkTypeId;
|
|
96
|
-
const buildId = result.build
|
|
99
|
+
const buildId = result.build?.id;
|
|
97
100
|
const linkAppBuildUrl = flags.qa
|
|
98
101
|
? `https://buildkite.com/linktree/link-types-ci-service/builds/${buildId}`
|
|
99
102
|
: `https://linkapp-ci.replit.app/?linkTypeId=${linkTypeId}&buildId=${buildId}`;
|
|
@@ -103,7 +106,9 @@ class Deploy extends base_1.default {
|
|
|
103
106
|
this.log(`\n===`);
|
|
104
107
|
this.log(`✅ Draft Link App successfully ${flags.update ? 'updated' : 'uploaded'}`);
|
|
105
108
|
this.log(` - Link App ID: ${linkTypeId}`);
|
|
106
|
-
|
|
109
|
+
if (buildId) {
|
|
110
|
+
this.log(` - Check Link App build: ${linkAppBuildUrl}`);
|
|
111
|
+
}
|
|
107
112
|
this.log(` - Create Link App: ${linkAppCreateUrl}`);
|
|
108
113
|
}
|
|
109
114
|
}
|
|
@@ -130,4 +135,8 @@ Deploy.flags = {
|
|
|
130
135
|
description: 'Allow Link Type Admins to push updates to Link Apps in PUBLISHED state. Admin use only.',
|
|
131
136
|
hidden: true,
|
|
132
137
|
}),
|
|
138
|
+
'skip-confirm': core_1.Flags.boolean({
|
|
139
|
+
description: 'Skip confirmation prompt',
|
|
140
|
+
hidden: true,
|
|
141
|
+
}),
|
|
133
142
|
};
|
|
@@ -32,7 +32,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
32
32
|
/**
|
|
33
33
|
* Pack the Link App source files into `package.tgz`. This includes the above required/optional directories and files.
|
|
34
34
|
*/
|
|
35
|
-
async function packProject() {
|
|
35
|
+
async function packProject(givenPath) {
|
|
36
36
|
const requiredFiles = ['manifest.json'];
|
|
37
37
|
const optionalDirs = ['src']; // For legacy LinkApp, it could have no src code.
|
|
38
38
|
const optionalFiles = [
|
|
@@ -40,13 +40,13 @@ async function packProject() {
|
|
|
40
40
|
'package-lock.json',
|
|
41
41
|
'yarn.lock',
|
|
42
42
|
'tsconfig.json',
|
|
43
|
-
'
|
|
43
|
+
'url_match_rules.json',
|
|
44
44
|
'settings.json',
|
|
45
45
|
'icon.svg',
|
|
46
46
|
];
|
|
47
47
|
const packedFiles = [];
|
|
48
48
|
await new Promise((resolve, reject) => {
|
|
49
|
-
const outputPath = resolveProjPath('package.tgz');
|
|
49
|
+
const outputPath = resolveProjPath(givenPath, 'package.tgz');
|
|
50
50
|
const outputWriteStream = fs_1.default.createWriteStream(outputPath);
|
|
51
51
|
const handleSuccess = () => resolve();
|
|
52
52
|
const handleFailure = (err) => {
|
|
@@ -67,21 +67,21 @@ async function packProject() {
|
|
|
67
67
|
});
|
|
68
68
|
archive.pipe(outputWriteStream);
|
|
69
69
|
requiredFiles.forEach((fileName) => {
|
|
70
|
-
if (!fs_1.default.existsSync(resolveProjPath(fileName))) {
|
|
70
|
+
if (!fs_1.default.existsSync(resolveProjPath(givenPath, fileName))) {
|
|
71
71
|
handleFailure(new archiver_1.ArchiverError(`File ${fileName} does not exist`, 'ENOENT'));
|
|
72
72
|
}
|
|
73
|
-
archive.file(resolveProjPath(fileName), { name: fileName });
|
|
73
|
+
archive.file(resolveProjPath(givenPath, fileName), { name: fileName });
|
|
74
74
|
packedFiles.push(fileName);
|
|
75
75
|
});
|
|
76
76
|
optionalFiles.forEach((fileName) => {
|
|
77
|
-
if (fs_1.default.existsSync(resolveProjPath(fileName))) {
|
|
78
|
-
archive.file(resolveProjPath(fileName), { name: fileName });
|
|
77
|
+
if (fs_1.default.existsSync(resolveProjPath(givenPath, fileName))) {
|
|
78
|
+
archive.file(resolveProjPath(givenPath, fileName), { name: fileName });
|
|
79
79
|
packedFiles.push(fileName);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
optionalDirs.forEach((dirName) => {
|
|
83
|
-
if (fs_1.default.existsSync(resolveProjPath(dirName)) && fs_1.default.statSync(resolveProjPath(dirName)).isDirectory()) {
|
|
84
|
-
archive.directory(resolveProjPath(`${dirName}/`), dirName);
|
|
83
|
+
if (fs_1.default.existsSync(resolveProjPath(givenPath, dirName)) && fs_1.default.statSync(resolveProjPath(givenPath, dirName)).isDirectory()) {
|
|
84
|
+
archive.directory(resolveProjPath(givenPath, `${dirName}/`), dirName);
|
|
85
85
|
packedFiles.push(`${dirName}/`);
|
|
86
86
|
}
|
|
87
87
|
});
|
|
@@ -90,5 +90,5 @@ async function packProject() {
|
|
|
90
90
|
packedFiles.sort();
|
|
91
91
|
return packedFiles;
|
|
92
92
|
}
|
|
93
|
-
const resolveProjPath = (relativePath) => path_1.default.resolve(process.cwd(), relativePath);
|
|
93
|
+
const resolveProjPath = (givenPath, relativePath) => path_1.default.resolve(givenPath ?? process.cwd(), relativePath);
|
|
94
94
|
exports.default = packProject;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.7.
|
|
2
|
+
"version": "1.7.3",
|
|
3
3
|
"commands": {
|
|
4
4
|
"build": {
|
|
5
5
|
"id": "build",
|
|
@@ -119,6 +119,13 @@
|
|
|
119
119
|
"description": "Allow Link Type Admins to push updates to Link Apps in PUBLISHED state. Admin use only.",
|
|
120
120
|
"hidden": true,
|
|
121
121
|
"allowNo": false
|
|
122
|
+
},
|
|
123
|
+
"skip-confirm": {
|
|
124
|
+
"name": "skip-confirm",
|
|
125
|
+
"type": "boolean",
|
|
126
|
+
"description": "Skip confirmation prompt",
|
|
127
|
+
"hidden": true,
|
|
128
|
+
"allowNo": false
|
|
122
129
|
}
|
|
123
130
|
},
|
|
124
131
|
"args": {}
|