Skip to content

Commit

Permalink
fix: swap to tiged instead of degit [] (#1961)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjolton-contentful authored Apr 30, 2024
1 parent 4b09838 commit b9760b4
Show file tree
Hide file tree
Showing 8 changed files with 4,122 additions and 15,845 deletions.
16,520 changes: 3,230 additions & 13,290 deletions package-lock.json

Large diffs are not rendered by default.

3,417 changes: 877 additions & 2,540 deletions packages/contentful--create-contentful-app/package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions packages/contentful--create-contentful-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
"analytics-node": "^6.2.0",
"chalk": "4.1.2",
"commander": "12.0.0",
"degit": "2.8.4",
"inquirer": "8.2.6",
"merge-options": "^3.0.4",
"node-fetch": "2.6.7",
"rimraf": "5.0.5",
"tiged": "^2.12.7",
"tildify": "2.0.0",
"validate-npm-package-name": "5.0.0"
},
Expand All @@ -59,11 +59,10 @@
"access": "public"
},
"devDependencies": {
"@tsconfig/node16": "16.1.3",
"@tsconfig/node20": "^20.1.4",
"@types/analytics-node": "^3.1.9",
"@types/chai-as-promised": "^7.1.5",
"@types/chalk": "2.2.0",
"@types/degit": "2.8.6",
"@types/inquirer": "8.2.1",
"@types/mocha": "^10.0.1",
"@types/node": "14.18.63",
Expand All @@ -79,7 +78,7 @@
"mocha": "^10.2.0",
"sinon": "^17.0.0",
"sinon-chai": "^3.7.0",
"ts-node": "^10.9.1"
"ts-node": "^10.9.2"
},
"gitHead": "4c3506be3f52c7a8aae17deaa75acefc9a805b42"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import inquirer from 'inquirer';
import { rename } from 'fs/promises';
import { resolve, join } from 'path';
import { CONTENTFUL_APP_MANIFEST, IGNORED_CLONED_FILES } from './constants';
import degit from 'degit';
import tiged from 'tiged';
import { highlight } from './logger';
import { getAddBuildCommandFn } from './utils/package';
import { exists, mergeJsonIntoFile } from './utils/file';
Expand All @@ -23,7 +23,7 @@ export async function cloneAppAction(destination: string, templateIsJavascript:

const appActionDirectoryPath = resolve(`${destination}/actions`);

const d = await degit(templateSource, { mode: 'tar', cache: false });
const d = await tiged(templateSource, { mode: 'tar', cache: false });
await d.clone(appActionDirectoryPath);

// move the manifest from the actions folder to the root folder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { rename } from 'fs/promises';
import { resolve, join } from 'path';
import { CONTENTFUL_APP_MANIFEST, IGNORED_CLONED_FILES } from './constants';
import degit from 'degit';
import tiged from 'tiged';
import { highlight } from './logger';
import { exists, mergeJsonIntoFile } from './utils/file';
import { getAddBuildCommandFn } from './utils/package';
Expand Down Expand Up @@ -47,7 +47,7 @@ export async function cloneFunction(

const functionDirectoryPath = resolve(`${destination}/functions`);

const d = degit(templateSource, { mode: 'tar', cache: false });
const d = tiged(templateSource, { mode: 'tar', cache: false });
await d.clone(functionDirectoryPath);

// merge the manifest from the template folder to the root folder
Expand Down
8 changes: 4 additions & 4 deletions packages/contentful--create-contentful-app/src/template.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { resolve } from 'path';
import { existsSync, readFileSync } from 'fs';
import degit from 'degit';
import tiged from 'tiged';
import * as rimraf from 'rimraf';
import { success } from './logger';
import { rmIfExists } from './utils';

async function clone(source: string, destination: string) {
const d = degit(source, { mode: 'tar', cache: false });
const d = tiged(source, { mode: 'tar', cache: false });

try {
await d.clone(destination);
} catch (e: any) {
if (e.code === 'DEST_NOT_EMPTY') {
// In this case, we know that degit will suggest users
// provide a 'force' flag - this is a flag for degit though
// In this case, we know that tiged will suggest users
// provide a 'force' flag - this is a flag for tiged though
// and not CCA. So we swallow the details of this error
// to avoid confusing people.
throw new Error('Destination directory is not empty.');
Expand Down
6 changes: 3 additions & 3 deletions packages/contentful--create-contentful-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "@tsconfig/node16/tsconfig.json",
"extends": "@tsconfig/node20/tsconfig.json",
"exclude": ["node_modules", "**/*.spec.ts", "app-actions"],
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"target": "es2020",
"module": "NodeNext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'tiged';

0 comments on commit b9760b4

Please sign in to comment.