Skip to content

Commit

Permalink
Merge pull request #291 from pantheon-systems/PCC-1540-deprecate-gats…
Browse files Browse the repository at this point in the history
…by-and-nuxt-starter-kits

PCC-1540 Deprecate vue and gatsby starter kits, and vue SDK
  • Loading branch information
kevinstubbs authored Aug 19, 2024
2 parents bf30f6a + c8cf843 commit 72491b1
Show file tree
Hide file tree
Showing 17 changed files with 2,127 additions and 1,293 deletions.
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
"preinstall": "npx only-allow pnpm",
"pre-commit": "pnpm install && pnpm lint && pnpm build && pnpm build:starters",
"dev": "turbo run dev --concurrency=20",
"build": "turbo run build --filter=./packages/*",
"lint": "turbo run lint --filter=./{packages,starters}/*",
"lint:fix": "turbo run lint:fix --filter=./{packages}/*",
"test": "turbo run test --filter=./{packages,starters}/*",
"build:starters": "turbo run build --filter=./starters/*",
"lint:starters": "turbo run lint --filter=./starters/*",
"build": "turbo run build --filter='./packages/*' --filter='!./packages/vue-sdk'",
"lint": "turbo run lint --filter='./packages/*' --filter='!./packages/vue-sdk' --filter='./starters/nextjs*'",
"lint:fix": "turbo run lint:fix --filter='./packages/*' --filter='!./packages/vue-sdk' --filter='./starters/nextjs*'",
"test": "turbo run test --filter='./packages/*' --filter='!./packages/vue-sdk' --filter='./starters/nextjs*'",
"build:starters": "turbo run build --filter='./starters/nextjs*'",
"lint:starters": "turbo run lint --filter='./starters/nextjs*'",
"ci:version": "changeset version",
"ci:publish": "changeset publish",
"publish:packages": "pnpm build && pnpm ci:publish",
"publish:npm": "pnpm build && pnpm -r --filter \"{./packages/**/*,!./packages/vue-sdk}\" publish",
"prepare": "husky"
},
"dependencies": {
Expand Down
51 changes: 0 additions & 51 deletions packages/cli/src/cli/commands/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,6 @@ test("should be able to init starter kit for nextjs template", async () => {
fs.rmSync(appFolder, { recursive: true, force: true });
});

test("should be able to init starter kit for gatsby template", async () => {
const appFolder = tmp.tmpNameSync();

await executePCC("init", [appFolder, "--template", "gatsby", "--use-pnpm"]);

// Eslint should not be initialized
expect(fs.existsSync(`${appFolder}/.eslintrc.json`)).toBe(false);

// Checking if primary required files for Gatsby starter kit are created.
expect(fs.existsSync(`${appFolder}/gatsby-browser.js`)).toBe(true);
expect(fs.existsSync(`${appFolder}/gatsby-config.js`)).toBe(true);
expect(fs.existsSync(`${appFolder}/gatsby-browser.js`)).toBe(true);

// package.json checks
expect(fs.existsSync(`${appFolder}/package.json`)).toBe(true);
const packageJson = JSON.parse(
readFileSync(`${appFolder}/package.json`).toString(),
);
expect(packageJson.name).toBe(path.parse(appFolder).base);

// Remove app folder
fs.rmSync(appFolder, { recursive: true, force: true });
});

test("should be able to init starter kit for nextjs template with typescript", async () => {
const appFolder = tmp.tmpNameSync();

Expand Down Expand Up @@ -99,33 +75,6 @@ test("should be able to init starter kit for nextjs template with typescript", a
fs.rmSync(appFolder, { recursive: true, force: true });
});

test("should be able to init starter kit for gatsby template with typescript", async () => {
const appFolder = tmp.tmpNameSync();

await executePCC("init", [appFolder, "--template", "gatsby", "--ts"]);

// Check that TypesScript source files exist.
expect(fs.existsSync(`${appFolder}/src/templates/index.tsx`)).toBe(true);

// Eslint should not be initialized
expect(fs.existsSync(`${appFolder}/.eslintrc.json`)).toBe(false);

// Checking if primary required files for Gatsby starter kit are created
expect(fs.existsSync(`${appFolder}/gatsby-browser.js`)).toBe(true);
expect(fs.existsSync(`${appFolder}/gatsby-config.js`)).toBe(true);
expect(fs.existsSync(`${appFolder}/gatsby-browser.js`)).toBe(true);

// package.json checks
expect(fs.existsSync(`${appFolder}/package.json`)).toBe(true);
const packageJson = JSON.parse(
readFileSync(`${appFolder}/package.json`).toString(),
);
expect(packageJson.name).toBe(path.parse(appFolder).base);

// Remove app folder
fs.rmSync(appFolder, { recursive: true, force: true });
});

test("should be able to init starter kit with eslint and app name", async () => {
const appFolder = tmp.tmpNameSync();

Expand Down
17 changes: 3 additions & 14 deletions packages/cli/src/cli/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import { errorHandler } from "../exceptions";

const TEMPLATE_FOLDER_MAP = {
nextjs: "nextjs-starter",
gatsby: "gatsby-starter",
vue: "vue-starter",
};

const ESLINT_DEPENDENCIES = {
Expand Down Expand Up @@ -138,13 +136,8 @@ const init = async ({

setupProj.succeed("Completed setting up project!");

// Create .env.local/.env.development
const localEnvFileName =
template === "gatsby"
? ".env.development"
: template === "vue"
? ".env"
: ".env.local";
// Create .env.local
const localEnvFileName = ".env.local";

copyFileSync(
path.join(absoluteProjectPath, ".env.example"),
Expand Down Expand Up @@ -249,7 +242,7 @@ const init = async ({
logger.log(chalk.green(` cd ${dirName}`));
}

if (template === "nextjs" || template === "vue")
if (template === "nextjs")
logger.log(chalk.green(` ${packageManager} run dev`));
else logger.log(chalk.green(` ${packageManager} run start`));
};
Expand Down Expand Up @@ -281,10 +274,6 @@ export const INIT_EXAMPLES = [
description: "Create project with nextjs template",
command: "pcc init new_proj",
},
{
description: "Create project with gatsby template",
command: "pcc init new_proj --template=gatsby",
},
{
description: "Create project using pnpm package manager",
command: "pcc init new_proj --use-pnpm",
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ yargs(hideBin(process.argv))
const useTypescript = args.ts as boolean;
const printVerbose = args.verbose as boolean;

if (args.template === "vue" || args.template === "gatsby") {
throw new Error(
`The ${args.template} starter kit is no longer supported or maintained. You may manually reference the deprecated source code for it in our github repo (https://github.com/pantheon-systems/pantheon-content-cloud-sdk/tree/main/starters).`,
);
}

// Deriving package manager from CLI flags in [NPM, PNPM, Yarn] order
let packageManager: PackageManager;
if (useYarn) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare type CliTemplateOptions = "nextjs" | "gatsby" | "vue";
declare type CliTemplateOptions = "nextjs";

declare type Article = {
id: string;
Expand Down
8 changes: 4 additions & 4 deletions packages/react-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
"node": ">=18.10.0"
},
"devDependencies": {
"@babel/core": "7.21.8",
"@babel/preset-env": "7.21.5",
"@babel/preset-react": "7.18.6",
"@babel/preset-typescript": "7.21.5",
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@types/jest": "29.5.1",
"@types/node": "18.16.9",
"@types/react-test-renderer": "18.0.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/vue-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### IMPORTANT NOTE

This package has been **deprecated**, but remains here in case there is a developer who may benefit from using this as an (outdated) integration reference in the future.

<div align="center">
<h1>Pantheon Content Cloud SDK for Vue.js</h1>
<p>
Expand Down
1 change: 1 addition & 0 deletions packages/vue-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"private": true,
"exports": {
".": {
"types": "./dist/index.d.ts",
Expand Down
Loading

0 comments on commit 72491b1

Please sign in to comment.