Skip to content

Commit 463678d

Browse files
committed
Merge branch 'development' into fix/clone-bug
2 parents 03f59bb + fa33e52 commit 463678d

File tree

39 files changed

+2301
-1793
lines changed

39 files changed

+2301
-1793
lines changed

.github/workflows/unit-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
working-directory: ./packages/contentstack-command
2525
run: npm run test:unit
2626

27+
- name: Run tests for Contentstack Command
28+
working-directory: ./packages/contentstack-command
29+
run: npm run test:unit
30+
2731
- name: Run tests for Audit plugin
2832
working-directory: ./packages/contentstack-audit
2933
run: npm run test:unit

.talismanrc

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
fileignoreconfig:
22
- filename: package-lock.json
3-
checksum: acd0c006f11dc01dcf578cc783843c64b2e002a8f6b654a8b5513362303a3590
3+
checksum: e18f2c44cd17fe67afa33290fc6e3ebd8e77be4cd85541b967792a03ea6b4279
44
- filename: pnpm-lock.yaml
5-
checksum: 006cd155027af9b70649f4e9295e7a158a960d7c87a74fad0710443fb3b814bc
5+
checksum: 8ac9a74de5b8971d85a0471444233205d66fdc90ab8f68ab74053582bbb274f7
66
- filename: packages/contentstack-import-setup/test/unit/backup-handler.test.ts
77
checksum: 0582d62b88834554cf12951c8690a73ef3ddbb78b82d2804d994cf4148e1ef93
88
- filename: packages/contentstack-import-setup/test/config.json
@@ -63,8 +63,22 @@ fileignoreconfig:
6363
checksum: bb8093633dc7de888541990623c3e02a482b7e6f5db0ba396bedc20c4c74b782
6464
- filename: packages/contentstack-import/src/utils/setup-branch.ts
6565
checksum: a4a968a20d5ab7cbc08c266819907541bbf793cc098521a5e810ada3cbacbee6
66+
- filename: packages/contentstack-bulk-publish/src/producer/publish-unpublished-env.js
67+
checksum: 96fd15e027f38b156c69f10943ea1d5a70e580fa8a5efeb3286cd7132145c72d
68+
- filename: packages/contentstack-import/src/import/modules/entries.ts
69+
checksum: 2fd4e8ecf75e077632a6408d09997f0921d2a3508f9f2cb8f47fe79a28592300
70+
- filename: packages/contentstack-utilities/src/logger/logger.ts
71+
checksum: 76429bc87e279624b386f00e7eb3f4ec25621ace7056289f812b9a076d6e184e
72+
- filename: packages/contentstack-bootstrap/src/bootstrap/utils.ts
73+
checksum: e66a08cb3cd444071688fbad1e14da309f8504f584cfaed85499d32b623e29e8
74+
- filename: packages/contentstack-bootstrap/messages/index.json
75+
checksum: c435ceaa709a7504da303a6ea674e07a89030d8ad4152e7917cd17e7f3e58052
76+
- filename: packages/contentstack-bootstrap/src/config.ts
77+
checksum: 65d300dc729fb84f5446c0b14921555db01fe5c90be3d297e3d0418a37b3696a
6678
- filename: packages/contentstack-clone/src/commands/cm/stacks/clone.js
6779
checksum: 433a84a882ea3f12b27127d47d289dfc64dda6b6fc956369f5851daaa57ae493
6880
- filename: packages/contentstack-clone/src/lib/util/clone-handler.js
6981
checksum: 89215a2549276407db2dbd25506acabdeb6f9bc53984a7c8b4456cd4df77cf43
70-
version: "1.0"
82+
- filename: packages/contentstack-bulk-publish/src/util/generate-bulk-publish-url.js
83+
checksum: 5f7c1e2fac3e7fab21e861d609c54ca7191ee09fd076dd0adc66604043bf7a43
84+
version: "1.0"

package-lock.json

Lines changed: 1430 additions & 1502 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/contentstack-audit/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
1919
$ csdx COMMAND
2020
running command...
2121
$ csdx (--version|-v)
22-
@contentstack/cli-audit/1.14.0 darwin-x64 node-v22.17.0
22+
@contentstack/cli-audit/1.14.1 darwin-arm64 node-v22.14.0
2323
$ csdx --help [COMMAND]
2424
USAGE
2525
$ csdx COMMAND

packages/contentstack-auth/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
1818
$ csdx COMMAND
1919
running command...
2020
$ csdx (--version)
21-
@contentstack/cli-auth/1.6.0 darwin-arm64 node-v22.14.0
21+
@contentstack/cli-auth/1.5.1 darwin-arm64 node-v22.13.1
2222
$ csdx --help [COMMAND]
2323
USAGE
2424
$ csdx COMMAND

packages/contentstack-bootstrap/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap
1515
$ csdx COMMAND
1616
running command...
1717
$ csdx (--version)
18-
@contentstack/cli-cm-bootstrap/1.15.0 darwin-arm64 node-v22.13.1
18+
@contentstack/cli-cm-bootstrap/1.15.1 darwin-arm64 node-v22.14.0
1919
$ csdx --help [COMMAND]
2020
USAGE
2121
$ csdx COMMAND
@@ -45,18 +45,19 @@ Bootstrap contentstack apps
4545
```
4646
USAGE
4747
$ csdx cm:bootstrap [--app-name <value>] [--project-dir <value>] [-k <value> | --org <value> | -n <value>] [-y
48-
<value>] [-a <value>]
48+
<value>] [--run-dev-server] [-a <value>]
4949
5050
FLAGS
5151
-a, --alias=<value> Alias of the management token
5252
-k, --stack-api-key=<value> Provide stack API key to seed content
5353
-n, --stack-name=<value> Name of the new stack that will be created.
5454
-y, --yes=<value> [Optional] Skip stack confirmation
55-
--app-name=<value> App name, reactjs-starter, nextjs-starter, gatsby-starter, angular-starter, nuxt-starter,
56-
vue-starter, stencil-starter
55+
--app-name=<value> App name, kickstart-next, kickstart-next-ssr, kickstart-next-ssg, kickstart-next-graphql,
56+
kickstart-next-middleware, kickstart-nuxt, kickstart-nuxt-ssr
5757
--org=<value> Provide organization UID to create a new stack
5858
--project-dir=<value> Directory to setup the project. If directory name has a space then provide the path as a
5959
string or escap the space using back slash eg: "../../test space" or ../../test\ space
60+
--run-dev-server Automatically start the development server after setup
6061
6162
DESCRIPTION
6263
Bootstrap contentstack apps
@@ -66,11 +67,13 @@ EXAMPLES
6667
6768
$ csdx cm:bootstrap --project-dir <path/to/setup/the/app>
6869
69-
$ csdx cm:bootstrap --app-name "reactjs-starter" --project-dir <path/to/setup/the/app>
70+
$ csdx cm:bootstrap --app-name "kickstart-next" --project-dir <path/to/setup/the/app>
7071
71-
$ csdx cm:bootstrap --app-name "reactjs-starter" --project-dir <path/to/setup/the/app> --stack-api-key "stack-api-key"
72+
$ csdx cm:bootstrap --app-name "kickstart-next" --project-dir <path/to/setup/the/app> --stack-api-key "stack-api-key"
7273
73-
$ csdx cm:bootstrap --app-name "reactjs-starter" --project-dir <path/to/setup/the/app> --org "your-org-uid" --stack-name "stack-name"
74+
$ csdx cm:bootstrap --app-name "kickstart-next" --project-dir <path/to/setup/the/app> --org "your-org-uid" --stack-name "stack-name"
75+
76+
$ csdx cm:bootstrap --app-name "kickstart-next" --project-dir <path/to/setup/the/app> --run-dev-server
7477
```
7578

7679
_See code: [src/commands/cm/bootstrap.ts](https://github.com/contentstack/cli/blob/main/packages/contentstack-bootstrap/src/commands/cm/bootstrap.ts)_
Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
{
2-
"CLI_BOOTSTRAP_INVALID_APP_NAME": "Invalid app name received, use cm:bootstrap see the list of apps supported",
3-
"CLI_BOOTSTRAP_LOGIN_FAILED": "You need to login, first. See: auth:login --help",
4-
"CLI_BOOTSTRAP_GITHUB_ACCESS_NOT_FOUND": "No Github access token found",
5-
"CLI_BOOTSTRAP_START_CLONE_APP": "Cloning the selected app",
6-
"CLI_BOOTSTRAP_REPO_NOT_FOUND": "Unable to find a repo for \"%s\"",
7-
"CLI_BOOTSTRAP_NO_API_KEY_FOUND": "No API key generated for the stack",
8-
"CLI_BOOTSTRAP_STACK_CREATION_FAILED": "Unable to create stack for content \"%s\"",
9-
"CLI_BOOTSTRAP_APP_SELECTION_ENQUIRY": "Select an App",
10-
"CLI_BOOTSTRAP_APP_COPY_SOURCE_CODE_DESTINATION_TYPE_ENQUIRY": "Choose the location where you want to copy the source code",
11-
"CLI_BOOTSTRAP_APP_COPY_SOURCE_CODE_DESTINATION_ENQUIRY": "Enter destination path",
12-
"CLI_BOOTSTRAP_NO_ACCESS_TOKEN_CREATED": "Note: Access token not created already, check out this link https://github.com/settings/tokens \n Provide github access token",
13-
"CLI_BOOTSTRAP_TYPE_OF_APP_ENQUIRY": "Choose the type of app you want to clone",
14-
"CLI_BOOTSTRAP_APP_FAILED_TO_CREATE_TOKEN_FOR_ENV": "Failed to create delivery token for env \"%s\"",
15-
"CLI_BOOTSTRAP_APP_FAILED_TO_CREATE_ENV_FILE_FOR_ENV": "Failed to setup env file for \"%s\"",
16-
"CLI_BOOTSTRAP_APP_ENV_NOT_FOUND_FOR_THE_STACK": "No environments found for the stack",
17-
"CLI_BOOTSTRAP_SUCCESS": "Project setup is successful!"
18-
}
2+
"CLI_BOOTSTRAP_INVALID_APP_NAME": "Invalid app name received, use cm:bootstrap see the list of apps supported",
3+
"CLI_BOOTSTRAP_LOGIN_FAILED": "You need to login, first. See: auth:login --help",
4+
"CLI_BOOTSTRAP_GITHUB_ACCESS_NOT_FOUND": "No Github access token found",
5+
"CLI_BOOTSTRAP_START_CLONE_APP": "Cloning the selected app",
6+
"CLI_BOOTSTRAP_REPO_NOT_FOUND": "Unable to find a repo for \"%s\"",
7+
"CLI_BOOTSTRAP_NO_API_KEY_FOUND": "No API key generated for the stack",
8+
"CLI_BOOTSTRAP_STACK_CREATION_FAILED": "Unable to create stack for content \"%s\"",
9+
"CLI_BOOTSTRAP_APP_SELECTION_ENQUIRY": "Select an App",
10+
"CLI_BOOTSTRAP_APP_COPY_SOURCE_CODE_DESTINATION_TYPE_ENQUIRY": "Choose the location where you want to copy the source code",
11+
"CLI_BOOTSTRAP_APP_COPY_SOURCE_CODE_DESTINATION_ENQUIRY": "Enter destination path",
12+
"CLI_BOOTSTRAP_NO_ACCESS_TOKEN_CREATED": "Note: Access token not created already, check out this link https://github.com/settings/tokens \n Provide github access token",
13+
"CLI_BOOTSTRAP_TYPE_OF_APP_ENQUIRY": "Choose the type of app you want to clone",
14+
"CLI_BOOTSTRAP_APP_FAILED_TO_CREATE_TOKEN_FOR_ENV": "Failed to create delivery token for env \"%s\"",
15+
"CLI_BOOTSTRAP_APP_FAILED_TO_CREATE_ENV_FILE_FOR_ENV": "Failed to setup env file for \"%s\"",
16+
"CLI_BOOTSTRAP_APP_ENV_NOT_FOUND_FOR_THE_STACK": "No environments found for the stack",
17+
"CLI_BOOTSTRAP_SUCCESS": "Project setup is successful!",
18+
"CLI_BOOTSTRAP_SUCCESS_LIVE_PREVIEW_NOTE": "Note: Before running the app, please turn on Live Preview in the CMS: Stack Settings > Live Preview > Enable Live Preview",
19+
"CLI_BOOTSTRAP_INSTALLING_DEPENDENCIES": "Installing local dependencies with NPM",
20+
"CLI_BOOTSTRAP_DEPENDENCIES_INSTALLED": "NPM dependencies installed successfully!",
21+
"CLI_BOOTSTRAP_DEPENDENCIES_INSTALL_FAILED": "Failed to install NPM dependencies.",
22+
"CLI_BOOTSTRAP_RUN_DEV_SERVER_ENQUIRY": "Do you want to install dependencies and run the app locally (npm install && npm run dev)?",
23+
"CLI_BOOTSTRAP_STARTING_DEV_SERVER": "Starting development server...",
24+
"CLI_BOOTSTRAP_DEV_SERVER_STARTED": "Development server started successfully! Check your terminal for more details.",
25+
"CLI_BOOTSTRAP_DEV_SERVER_FAILED": "Failed to start development server. You can start it manually with 'npm run dev' in the project directory."
26+
}

packages/contentstack-bootstrap/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-bootstrap",
33
"description": "Bootstrap contentstack apps",
4-
"version": "1.15.1",
4+
"version": "1.16.0",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {

packages/contentstack-bootstrap/src/bootstrap/index.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as path from 'path';
2+
import { execSync, spawn } from 'child_process';
23
import { cliux, sanitizePath } from '@contentstack/cli-utilities';
34
import { default as ContentStackSeed } from '@contentstack/cli-cm-seed/lib/commands/cm/stacks/seed';
45

@@ -19,6 +20,7 @@ export interface BootstrapOptions {
1920
accessToken?: string;
2021
appType: string;
2122
livePreviewEnabled?: boolean;
23+
runDevServer?: boolean;
2224
master_locale: any;
2325
}
2426

@@ -113,20 +115,68 @@ export default class Bootstrap {
113115
this.options.livePreviewEnabled as boolean,
114116
this.options.seedParams.managementToken as string,
115117
);
118+
116119
} else {
117120
throw new Error(messageHandler.parse('CLI_BOOTSTRAP_NO_API_KEY_FOUND'));
118121
}
119122

120123
if (this.options.livePreviewEnabled) {
121124
cliux.print(
122-
'Note: Before running the app, please configure a preview token, preview host, and app host in the environment file',
125+
messageHandler.parse('CLI_BOOTSTRAP_SUCCESS_LIVE_PREVIEW_NOTE'),
123126
{
124127
color: 'yellow',
125128
},
126129
);
127130
}
128131

129132
cliux.print(messageHandler.parse('CLI_BOOTSTRAP_SUCCESS'));
133+
134+
// Install dependencies and start development server if requested (after all other operations)
135+
if (this.options.runDevServer) {
136+
// Install project dependencies
137+
cliux.loader(messageHandler.parse('CLI_BOOTSTRAP_INSTALLING_DEPENDENCIES'));
138+
try {
139+
execSync('npm install', {
140+
cwd: this.cloneDirectory,
141+
stdio: 'inherit'
142+
});
143+
cliux.loader();
144+
cliux.print(messageHandler.parse('CLI_BOOTSTRAP_DEPENDENCIES_INSTALLED'));
145+
146+
// Start development server
147+
cliux.print(messageHandler.parse('CLI_BOOTSTRAP_STARTING_DEV_SERVER'));
148+
cliux.print(messageHandler.parse('CLI_BOOTSTRAP_DEV_SERVER_STARTED'));
149+
cliux.print('You can now access your application. Check the output above for the local URL.');
150+
151+
// Run npm run dev using spawn for long-running process
152+
const devProcess = spawn('npm', ['run', 'dev'], {
153+
cwd: this.cloneDirectory,
154+
stdio: 'inherit',
155+
shell: true
156+
});
157+
158+
devProcess.on('error', (error) => {
159+
cliux.print(messageHandler.parse('CLI_BOOTSTRAP_DEV_SERVER_FAILED'), {
160+
color: 'yellow',
161+
});
162+
console.error('Failed to start dev server:', error);
163+
});
164+
165+
// Handle process exit
166+
devProcess.on('exit', (code) => {
167+
if (code !== 0 && code !== null) {
168+
cliux.print(messageHandler.parse('CLI_BOOTSTRAP_DEV_SERVER_FAILED'), {
169+
color: 'yellow',
170+
});
171+
}
172+
});
173+
} catch (installError: any) {
174+
cliux.loader();
175+
cliux.print(messageHandler.parse('CLI_BOOTSTRAP_DEPENDENCIES_INSTALL_FAILED'), {
176+
color: 'yellow',
177+
});
178+
}
179+
}
130180
} catch (error) {
131181
cliux.error(messageHandler.parse('CLI_BOOTSTRAP_STACK_CREATION_FAILED', this.appConfig.stack));
132182
}

packages/contentstack-bootstrap/src/bootstrap/interactive.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ export async function inquireLivePreviewSupport() {
9999
return livePreviewEnabled;
100100
}
101101

102+
export async function inquireRunDevServer() {
103+
const { runDevServer } = await inquirer.prompt({
104+
type: 'confirm',
105+
name: 'runDevServer',
106+
message: messageHandler.parse('CLI_BOOTSTRAP_RUN_DEV_SERVER_ENQUIRY'),
107+
default: true,
108+
});
109+
return runDevServer;
110+
}
111+
102112
export async function continueBootstrapCommand() {
103113
const { shouldContinue } = await inquirer.prompt({
104114
type: 'list',

0 commit comments

Comments
 (0)