@contentful/app-scripts 2.4.0-alpha.0 → 2.4.0
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function cloneFunction(localPath: string, settings:
|
|
3
|
-
export declare function getCloneURL(settings:
|
|
4
|
-
export declare function touchupAppManifest(localPath: string, settings:
|
|
1
|
+
import { GenerateFunctionSettingsInput } from '../types';
|
|
2
|
+
export declare function cloneFunction(localPath: string, settings: GenerateFunctionSettingsInput): Promise<void>;
|
|
3
|
+
export declare function getCloneURL(settings: GenerateFunctionSettingsInput): string;
|
|
4
|
+
export declare function touchupAppManifest(localPath: string, settings: GenerateFunctionSettingsInput, renameFunctionFile: string): Promise<void>;
|
|
5
5
|
export declare function moveFilesToFinalDirectory(localTmpPath: string, localFunctionsPath: string, localPath: string): void;
|
|
6
|
-
export declare function renameClonedFiles(localTmpPath: string, settings:
|
|
6
|
+
export declare function renameClonedFiles(localTmpPath: string, settings: GenerateFunctionSettingsInput): string;
|
|
7
7
|
export declare function resolvePaths(localPath: string): {
|
|
8
8
|
localTmpPath: string;
|
|
9
9
|
localFunctionsPath: string;
|
|
@@ -32,7 +32,7 @@ async function cloneFunction(localPath, settings) {
|
|
|
32
32
|
const { localTmpPath, localFunctionsPath } = resolvePaths(localPath);
|
|
33
33
|
const cloneURL = getCloneURL(settings);
|
|
34
34
|
// Pass keepPackageJson if available in settings (from GenerateFunctionSettingsCLI)
|
|
35
|
-
const keepPackageJson = 'keepPackageJson' in settings ? settings.keepPackageJson :
|
|
35
|
+
const keepPackageJson = 'keepPackageJson' in settings && typeof settings.keepPackageJson === 'boolean' ? settings.keepPackageJson : false;
|
|
36
36
|
await cloneAndResolveManifests(cloneURL, localTmpPath, localPath, localFunctionsPath, keepPackageJson);
|
|
37
37
|
// now rename the function file. Find the file with a .ts or .js extension
|
|
38
38
|
const renameFunctionFile = renameClonedFiles(localTmpPath, settings);
|
|
@@ -96,19 +96,18 @@ function resolvePaths(localPath) {
|
|
|
96
96
|
const localFunctionsPath = (0, node_path_1.resolve)(localPath, 'functions');
|
|
97
97
|
return { localTmpPath, localFunctionsPath };
|
|
98
98
|
}
|
|
99
|
-
async function cloneAndResolveManifests(cloneURL, localTmpPath, localPath, localFunctionsPath, keepPackageJson) {
|
|
99
|
+
async function cloneAndResolveManifests(cloneURL, localTmpPath, localPath, localFunctionsPath, keepPackageJson = false) {
|
|
100
100
|
const tigedInstance = await clone(cloneURL, localTmpPath);
|
|
101
101
|
// merge the manifest from the template folder to the root folder
|
|
102
102
|
await mergeAppManifest(localPath, localTmpPath);
|
|
103
|
-
//
|
|
103
|
+
// create a deep copy of the IGNORED_CLONED_FILES array
|
|
104
|
+
const ignoredFiles = Array.from(constants_1.IGNORED_CLONED_FILES);
|
|
104
105
|
if (!keepPackageJson) {
|
|
106
|
+
// modify package.json build commands
|
|
105
107
|
await updatePackageJsonWithBuild(localPath, localTmpPath);
|
|
106
|
-
}
|
|
107
|
-
// check if a tsconfig.json file exists already
|
|
108
|
-
const ignoredFiles = [...constants_1.IGNORED_CLONED_FILES];
|
|
109
|
-
if (!keepPackageJson) {
|
|
110
108
|
ignoredFiles.push('package.json');
|
|
111
109
|
}
|
|
110
|
+
// check if a tsconfig.json file exists already
|
|
112
111
|
const tsconfigExists = await (0, file_1.exists)((0, node_path_1.resolve)(localFunctionsPath, 'tsconfig.json'));
|
|
113
112
|
if (tsconfigExists) {
|
|
114
113
|
ignoredFiles.push('tsconfig.json');
|
package/lib/types.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export interface GenerateFunctionSettings {
|
|
|
81
81
|
export interface GenerateFunctionSettingsCLI extends GenerateFunctionSettings {
|
|
82
82
|
keepPackageJson?: boolean;
|
|
83
83
|
}
|
|
84
|
+
export type GenerateFunctionSettingsInput = GenerateFunctionSettings | GenerateFunctionSettingsCLI;
|
|
84
85
|
export interface AddLocationsOptions {
|
|
85
86
|
organizationId?: string;
|
|
86
87
|
definitionId?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/app-scripts",
|
|
3
|
-
"version": "2.4.0
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "A collection of scripts for building Contentful Apps",
|
|
5
5
|
"author": "Contentful GmbH",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"tiged": "^2.12.7",
|
|
68
68
|
"zod": "^3.24.1"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "571371b92e6f7a3542d76192a15f002771708a86",
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/adm-zip": "0.5.7",
|
|
73
73
|
"@types/analytics-node": "3.1.14",
|