Skip to content

Commit 6b98545

Browse files
authored
feat: add project initialization commands for core and full CSK options
1 parent ba6aac3 commit 6b98545

20 files changed

Lines changed: 244 additions & 35 deletions

File tree

apps/csk-marketing-site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uniformdev/csk-marketing-site",
3-
"version": "6.1.43",
3+
"version": "6.1.44",
44
"private": true,
55
"engines": {
66
"yarn": "please-use-npm",

apps/csk-storybook/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uniformdev/csk-storybook",
3-
"version": "6.1.43",
3+
"version": "6.1.44",
44
"description": "CSK vNext Storybook is an interactive Storybook build showcasing components from the CSK vNext component starter kit. It provides detailed documentation, live previews, and testing capabilities for easy integration into your projects.",
55
"main": "index.js",
66
"scripts": {

apps/csk/package.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uniformdev/component-starter-kit",
3-
"version": "6.1.43",
3+
"version": "6.1.44",
44
"private": true,
55
"engines": {
66
"yarn": "please-use-npm",
@@ -19,8 +19,7 @@
1919
"typecheck": "tsc --noEmit",
2020
"lint:fix": "eslint . --fix",
2121
"format": "prettier --write .",
22-
"init": "run-s uniform:push uniform:publish",
23-
"init:full": "run-s uniform:full:push uniform:publish",
22+
"init": "csk-cli init --dev",
2423
"component:extract": "csk-components extract",
2524
"component:scaffold": "csk-cli scaffold",
2625
"pull:dex": "design-extensions-tools pull",
@@ -29,14 +28,10 @@
2928
"pull:locales": "csk-cli pull -l",
3029
"pull:content": "uniform sync pull",
3130
"push:content": "uniform sync push",
32-
"pull:content:core": "uniform sync pull --config ./uniform.config.core.ts",
33-
"push:content:core": "uniform sync push --config ./uniform.config.core.ts",
3431
"pull:content:dev": "uniform sync pull --config ./uniform.config.dev.ts",
3532
"push:content:dev": "uniform sync push --config ./uniform.config.dev.ts",
36-
"uniform:pull": "run-s pull:dex apply:dex pull:content:core",
37-
"uniform:push": "run-s push:dex push:content:core",
38-
"uniform:full:pull": "run-s pull:dex apply:dex pull:content",
39-
"uniform:full:push": "run-s push:dex push:content",
33+
"uniform:pull": "csk-cli pull -u --dev",
34+
"uniform:push": "run-s push:dex push:content",
4035
"uniform:publish": "uniform context manifest publish",
4136
"recipes": "csk-recipes init"
4237
},

apps/csk/uniform.config.dev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = uniformConfig({
44
preset: 'none',
55
config: {
66
serialization: {
7-
directory: './content/dev',
7+
directory: './content',
88
entitiesConfig: {
99
dataType: {},
1010
component: {},

apps/csk/uniform.config.full.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { uniformConfig } from '@uniformdev/cli/config';
2+
3+
module.exports = uniformConfig({
4+
preset: 'all',
5+
overrides: {
6+
serializationConfig: { directory: './content/full' },
7+
},
8+
// you can disable specific entities from being included, which can speed up your sync
9+
disableEntities: ['webhook'],
10+
});

apps/csk/uniform.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { uniformConfig } from '@uniformdev/cli/config';
33
module.exports = uniformConfig({
44
preset: 'all',
55
overrides: {
6-
serializationConfig: { directory: './content/full' },
6+
serializationConfig: { directory: './content' },
77
},
88
// you can disable specific entities from being included, which can speed up your sync
99
disableEntities: ['webhook'],

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "csk-packages",
3-
"version": "6.1.43",
3+
"version": "6.1.44",
44
"private": true,
55
"scripts": {
66
"build": "turbo build",

packages/csk-cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uniformdev/csk-cli",
3-
"version": "6.1.43",
3+
"version": "6.1.44",
44
"description": "Command-line interface (CLI) tool designed to streamline the development workflow within Uniform projects. It provides commands for pulling additional data and generating components based on Canvas data",
55
"license": "SEE LICENSE IN LICENSE.txt",
66
"engines": {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { select } from '@inquirer/prompts';
2+
import { capitalizeFirstLetter, cleanupProductionFiles, getAvailableCSKVariants, pushUniformContent } from './utils';
3+
4+
type InitArgs = {
5+
dev?: boolean;
6+
};
7+
8+
export const initUniformProject = async (args: InitArgs) => {
9+
try {
10+
const { dev: isDev = false } = args || {};
11+
12+
const folders = getAvailableCSKVariants();
13+
14+
if (folders.length === 0) {
15+
pushUniformContent();
16+
return;
17+
}
18+
19+
const selectedFolder = await select({
20+
message: 'Select the CSK variant to push:',
21+
choices: folders.map(folder => ({ name: capitalizeFirstLetter(folder), value: folder })),
22+
loop: false,
23+
});
24+
25+
pushUniformContent(selectedFolder);
26+
27+
if (!isDev) {
28+
cleanupProductionFiles(folders, selectedFolder);
29+
}
30+
} catch (error) {
31+
if (error instanceof Error) {
32+
if (error.message.includes('force closed')) {
33+
console.info('\n👋 See you next time! 🧡\n');
34+
} else {
35+
console.error('\n🙁 Something went wrong. Please try again.\n');
36+
console.error(error);
37+
}
38+
}
39+
}
40+
};

0 commit comments

Comments
 (0)