Skip to content

Commit a1f449b

Browse files
committed
build: phoenix pro optional build and test injection
When `npm run build` is executed, if pro extension is there, we generate scirpts to load pro else pho extension isnt loaded as integrated extension
1 parent 911658c commit a1f449b

8 files changed

Lines changed: 60 additions & 27 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Thumbs.db
1111
/npm-debug.log
1212
/src/cacheManifest.json
1313
/src/appConfig.js
14+
/src/extensionsIntegrated/pro-loader.js
15+
/test/pro-test-suite.js
1416

1517
# ignore node_modules inside src
1618
/src/node_modules

docs/API-Reference/command/Commands.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,6 @@ Toggles live preview multi-browser mode
158158
## CMD\_RELOAD\_LIVE\_PREVIEW
159159
Reloads live preview
160160

161-
**Kind**: global variable
162-
<a name="FILE_LIVE_HIGHLIGHT"></a>
163-
164-
## FILE\_LIVE\_HIGHLIGHT
165-
Toggles live highlight
166-
167161
**Kind**: global variable
168162
<a name="FILE_PROJECT_SETTINGS"></a>
169163

docs/API-Reference/utils/ExtensionLoader.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,15 @@ Load extensions.
151151
| --- | --- | --- |
152152
| A | <code>Array.&lt;string&gt;</code> | list containing references to extension source location. A source location may be either (a) a folder name inside src/extensions or (b) an absolute path. |
153153

154+
<a name="uninstallExtension"></a>
155+
156+
## uninstallExtension(extensionID) ⇒ <code>Promise</code>
157+
Uninstall a deprecated extension
158+
159+
**Kind**: global function
160+
**Returns**: <code>Promise</code> - A promise that resolves when the extension is uninstalled successfully
161+
162+
| Param | Type | Description |
163+
| --- | --- | --- |
164+
| extensionID | <code>string</code> | The ID of the extension to uninstall |
165+

gulpfile.js/index.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ function cleanAll() {
5656
// Test artifacts
5757
'dist-test',
5858
'test/spec/test_folders.zip',
59+
'src/extensionsIntegrated/pro-loader.js',
60+
'test/pro-test-suite.js',
5961
...RELEASE_BUILD_ARTEFACTS
6062
]);
6163
}
@@ -903,6 +905,32 @@ function makeLoggerConfig() {
903905
});
904906
}
905907

908+
function generateProLoaderFiles() {
909+
return new Promise((resolve) => {
910+
// AMD module template for generated files
911+
const AMD_MODULE_TEMPLATE = `define(function (require, exports, module) {<CODE>});\n`;
912+
913+
const phoenixProExists = fs.existsSync('src/extensionsIntegrated/phoenix-pro');
914+
915+
// Generate test/pro-test-suite.js content
916+
const testSuiteCode = phoenixProExists ?
917+
'\n require("extensionsIntegrated/phoenix-pro/unittests");\n' : '';
918+
const testSuiteContent = AMD_MODULE_TEMPLATE.replace('<CODE>', testSuiteCode);
919+
920+
// Generate src/extensionsIntegrated/pro-loader.js content
921+
const loaderCode = phoenixProExists ? '\n require("./phoenix-pro/main");\n' : '';
922+
const loaderContent = AMD_MODULE_TEMPLATE.replace('<CODE>', loaderCode);
923+
924+
fs.writeFileSync('test/pro-test-suite.js', testSuiteContent);
925+
fs.writeFileSync('src/extensionsIntegrated/pro-loader.js', loaderContent);
926+
927+
console.log(`Generated pro-loader.js (phoenix-pro ${phoenixProExists ? 'found' : 'not found'})`);
928+
console.log(`Generated pro-test-suite.js (phoenix-pro ${phoenixProExists ? 'found' : 'not found'})`);
929+
930+
resolve();
931+
});
932+
}
933+
906934
function validatePackageVersions() {
907935
return new Promise((resolve, reject)=>{
908936
const mainPackageJson = require("../package.json", "utf8");
@@ -968,10 +996,10 @@ function _patchMinifiedCSSInDistIndex() {
968996

969997
const createDistTest = series(copyDistToDistTestFolder, copyTestToDistTestFolder, copyIndexToDistTestFolder);
970998

971-
exports.build = series(copyThirdPartyLibs.copyAll, makeLoggerConfig, zipDefaultProjectFiles, zipSampleProjectFiles,
999+
exports.build = series(copyThirdPartyLibs.copyAll, makeLoggerConfig, generateProLoaderFiles, zipDefaultProjectFiles, zipSampleProjectFiles,
9721000
makeBracketsConcatJS, _compileLessSrc, _cleanReleaseBuildArtefactsInSrc, // these are here only as sanity check so as to catch release build minify fails not too late
9731001
createSrcCacheManifest, validatePackageVersions);
974-
exports.buildDebug = series(copyThirdPartyLibs.copyAllDebug, makeLoggerConfig, zipDefaultProjectFiles,
1002+
exports.buildDebug = series(copyThirdPartyLibs.copyAllDebug, makeLoggerConfig, generateProLoaderFiles, zipDefaultProjectFiles,
9751003
makeBracketsConcatJS, _compileLessSrc, _cleanReleaseBuildArtefactsInSrc, // these are here only as sanity check so as to catch release build minify fails not too late
9761004
zipSampleProjectFiles, createSrcCacheManifest);
9771005
exports.clean = series(cleanDist);

src/extensionsIntegrated/loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ define(function (require, exports, module) {
4646
require("./TabBar/main");
4747
require("./CustomSnippets/main");
4848
require("./CollapseFolders/main");
49-
require("./phoenix-pro/main");
49+
require("./pro-loader");
5050
});

test/spec/LivePreviewEdit-test.js renamed to src/extensionsIntegrated/phoenix-pro/unit-tests/LivePreviewEdit-test.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
11
/*
2-
* GNU AGPL-3.0 License
3-
*
42
* Copyright (c) 2021 - present core.ai . All rights reserved.
5-
* Original work Copyright (c) 2014 - 2021 Adobe Systems Incorporated. All rights reserved.
6-
*
7-
* This program is free software: you can redistribute it and/or modify it
8-
* under the terms of the GNU Affero General Public License as published by
9-
* the Free Software Foundation, either version 3 of the License, or
10-
* (at your option) any later version.
11-
*
12-
* This program is distributed in the hope that it will be useful, but WITHOUT
13-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
15-
* for more details.
16-
*
17-
* You should have received a copy of the GNU Affero General Public License
18-
* along with this program. If not, see https://opensource.org/licenses/AGPL-3.0.
19-
*
3+
* Proprietary code, all rights reserved.
4+
*/
5+
/*
6+
* Copyright (c) 2021 - present core.ai . All rights reserved.
7+
* Proprietary code, all rights reserved.
208
*/
219

2210
/*global describe, beforeAll, afterAll, awaitsFor, it, awaitsForDone, expect, awaits, jsPromise*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright (c) 2021 - present core.ai . All rights reserved.
3+
* Proprietary code, all rights reserved.
4+
*/
5+
6+
define(function (require, exports, module) {
7+
require("./unit-tests/LivePreviewEdit-test");
8+
});

test/UnitTestSuite.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ define(function (require, exports, module) {
108108
require("spec/BeautificationManager-test");
109109
require("spec/Template-for-integ-test");
110110
require("spec/LiveDevelopmentMultiBrowser-test");
111-
// require("spec/LivePreviewEdit-test"); todo enable after tests working
112111
require("spec/LiveDevelopmentCustomServer-test");
113112
require("spec/NewFileContentManager-test");
114113
require("spec/InstallExtensionDialog-integ-test");
@@ -143,6 +142,8 @@ define(function (require, exports, module) {
143142
require("spec/Extn-Git-integ-test");
144143
// Node Tests
145144
require("spec/NodeConnection-test");
145+
// pro test suite optional components
146+
require("./pro-test-suite");
146147
// todo TEST_MODERN
147148
// require("spec/LanguageTools-test"); LSP tests. disabled for now
148149
// require("spec/Menu-native-integ-test"); evaluate after we have native menus in os installed builds

0 commit comments

Comments
 (0)