Skip to content

Commit

Permalink
chore(init-templates): remove v1 init templates (aws#21019)
Browse files Browse the repository at this point in the history
A v1 app or library cannot be created from the v2 cli. This cleans up the v1 init template code.

This is stupidly long because of the amount of files deleted and moved so here's a rundown of the changes:
- v1 templates deleted (github is showing some of these as renamed because they were duplicates of the v2 files that did get moved)
- v2 templates removed from `v2` folder and moved directly under `init-templates`
- hook files imports updated (another place where it shows the change to v1 instead of v2 because the contents were the same) for templates and sample apps
- `init.ts`: updated file paths to flattened directory
- `init.test.ts`: 
    - updated tests to only run for v2 templates
    - added test for `fsharp` since it was missing
    - updated .NET tests to look in the contents of the `.sln` file for the project information. I noticed that this test sometimes still passed when the `init` actually failed.


Note: This is the first of two PRs to fix the bug for creating .NET projects with spaces in the file path (issue aws#18803). This PR was done separately so the bug fix didn't get lost in the 300 file changes due to the cleanup.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
TheRealAmazonKendra authored and daschaa committed Jul 9, 2022
1 parent 174b77b commit 2b4d28e
Show file tree
Hide file tree
Showing 289 changed files with 85 additions and 3,899 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as child_process from 'child_process';
import * as path from 'path';
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (targetDirectory: string) => {
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as child_process from 'child_process';
import * as path from 'path';
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (targetDirectory: string) => {
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (_, context) => {
// File cannot be named like regular template because it needs to be
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (_, context) => {
// File cannot be named like regular template because it needs to be
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (_, context) => {
// File cannot be named like regular template because it needs to be
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (_, context) => {
// File cannot be named like regular template because it needs to be
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (_, context) => {
// File cannot be named like regular template because it needs to be
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as child_process from 'child_process';
import * as path from 'path';
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (targetDirectory: string) => {
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as child_process from 'child_process';
import * as path from 'path';
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (targetDirectory: string) => {
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (_, context) => {
// File cannot be named like regular template because it needs to be
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (_, context) => {
// File cannot be named like regular template because it needs to be
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InvokeHook } from '../../../../init';
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (_, context) => {
// File cannot be named like regular template because it needs to be
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { InvokeHook } from '../../../init';

export const invoke: InvokeHook = async (_, context) => {
// File cannot be named like regular template because it needs to be
// processed by dependency updaters.
await context.substitutePlaceholdersIn('package.json');
};

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

68 changes: 0 additions & 68 deletions packages/aws-cdk/lib/init-templates/v1/app/go/%name%.template.go

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions packages/aws-cdk/lib/init-templates/v1/app/go/go.template.mod

This file was deleted.

60 changes: 0 additions & 60 deletions packages/aws-cdk/lib/init-templates/v1/app/java/pom.xml

This file was deleted.

Loading

0 comments on commit 2b4d28e

Please sign in to comment.