Skip to content

Commit cd9fb3b

Browse files
authored
Merge pull request #598 from qwikifiers/pr-cli
Improved the cli
2 parents 07823ae + 70a1a60 commit cd9fb3b

File tree

10 files changed

+32
-528
lines changed

10 files changed

+32
-528
lines changed

.changeset/nasty-swans-run.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'qwik-ui': patch
3+
---
4+
5+
Removed the generated `nx.json` after `qwik-ui init` command.
6+
Apparently, only an empty `nx: {}` in the package.json is enough.

.github/workflows/release-minor.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"release": "pnpm release.prepare && pnpm release.setroot && pnpm release.publish && pnpm release.resetroot",
2828
"release.publish": "changeset publish",
2929
"release.resetroot": "cp dist/pnpm-workspace.yaml pnpm-workspace.yaml",
30-
"update.version": "tsm ./scripts/update-versions.ts",
3130
"story.build.headless": "nx build-storybook headless",
3231
"story.headless": "nx storybook headless",
3332
"test.headless": "nx component-test headless",
@@ -133,7 +132,6 @@
133132
"ts-jest": "^29.1.0",
134133
"ts-node": "10.9.1",
135134
"tslib": "^2.6.2",
136-
"tsm": "2.3.0",
137135
"typescript": "^5.2.2",
138136
"undici": "^5.23.0",
139137
"unified": "^11.0.4",

packages/cli/bin/index.ts

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ import {
99
multiselect,
1010
outro,
1111
select,
12-
spinner,
1312
text,
1413
} from '@clack/prompts';
15-
import { getPackageManagerCommand, readJsonFile, workspaceRoot } from '@nx/devkit';
14+
import {
15+
getPackageManagerCommand,
16+
readJsonFile,
17+
workspaceRoot,
18+
writeJsonFile,
19+
} from '@nx/devkit';
1620

1721
import { execSync } from 'child_process';
18-
import { existsSync } from 'fs';
22+
import { existsSync, readFileSync, writeFileSync } from 'fs';
1923
import { bold, cyan, green, red } from 'kleur/colors';
2024
import yargs, { type CommandModule } from 'yargs';
2125
import {
@@ -188,6 +192,7 @@ async function handleInit() {
188192
}
189193

190194
// ADD QWIK UI CLI TO DEPENDENCIES
195+
log.info('Adding qwik-ui cli to package.json...');
191196
execSync(`${getPackageManagerCommand().addDev} qwik-ui@latest`, {
192197
stdio: 'inherit',
193198
});
@@ -209,6 +214,7 @@ async function handleInit() {
209214

210215
const packageTag = args['e2e'] ? 'e2e' : 'latest';
211216

217+
log.info(`Installing ${styledPackage}...`);
212218
execSync(`${getPackageManagerCommand().addDev} ${styledPackage}@${packageTag}`, {
213219
stdio: 'inherit',
214220
});
@@ -225,38 +231,35 @@ async function handleInit() {
225231
},
226232
);
227233

228-
await handleAdd(config.projectRoot, args['components'] as string);
234+
log.info('Tailwind configured.');
229235
}
230236

231237
async function installNxIfNeeded() {
232-
// eslint-disable-next-line @typescript-eslint/no-var-requires
233-
// const nxVersion = require('../package.json').dependencies['@nx/devkit'];
234-
235238
if (existsSync('nx.json')) {
236239
log.info('seems like nx.json already exists. cool!');
237240
} else {
238-
// const haveNxInstalled = cancelable(
239-
// await confirm({
240-
// message: 'Do you already have Nx installed? (required)',
241-
// initialValue: false,
242-
// }),
243-
// );
244-
245-
// if (!haveNxInstalled) {
246-
const initSpinner = spinner();
247241
log.info('Installing Nx...');
248-
initSpinner.start('Installing Nx...');
242+
249243
execSync(`${getPackageManagerCommand().addDev} nx@latest`, {
250244
stdio: 'inherit',
251245
});
252-
// TODO: Just add "nx: {} " to package.json and see if it still works
253-
execSync(`${getPackageManagerCommand().exec} nx init --interactive false`, {
254-
stdio: 'inherit',
255-
});
256-
initSpinner.stop('Installed Nx!');
246+
247+
const packageJson = await readJsonFile('package.json');
248+
packageJson['nx'] = {};
249+
await writeJsonFile('package.json', packageJson);
250+
251+
const ignorePath = '.gitignore';
252+
try {
253+
let contents = readFileSync(ignorePath, 'utf-8');
254+
if (!contents.includes('.nx/cache')) {
255+
contents = [contents, '', '.nx/cache'].join('\n');
256+
writeFileSync(ignorePath, contents, 'utf-8');
257+
}
258+
} catch {
259+
/* empty */
260+
}
257261
}
258262
log.success('nx init done');
259-
// }
260263
}
261264

262265
async function handleAdd(projectRoot?: string, componentsFromInit?: string) {

packages/cli/project.json

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,6 @@
4747
]
4848
}
4949
},
50-
"version-dry": {
51-
"executor": "@jscutlery/semver:version",
52-
"options": {
53-
"dryRun": true,
54-
"trackDeps": true,
55-
"noVerify": true,
56-
"skipCommit": true
57-
}
58-
},
59-
"version": {
60-
"executor": "@jscutlery/semver:version",
61-
"options": {
62-
"trackDeps": true,
63-
"noVerify": true
64-
}
65-
},
66-
"publish": {
67-
"dependsOn": ["build"],
68-
"executor": "ngx-deploy-npm:deploy",
69-
"options": {
70-
"access": "public"
71-
}
72-
},
7350
"test-generators": {
7451
"executor": "@nx/jest:jest",
7552
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],

packages/kit-fluffy/project.json

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -91,46 +91,6 @@
9191
"quiet": true
9292
}
9393
}
94-
},
95-
"version-dry": {
96-
"executor": "@jscutlery/semver:version",
97-
"options": {
98-
"dryRun": true,
99-
"trackDeps": true,
100-
"noVerify": true,
101-
"skipCommit": true,
102-
"skipProjectChangelog": true
103-
}
104-
},
105-
"publish": {
106-
"dependsOn": ["build"],
107-
"executor": "ngx-deploy-npm:deploy",
108-
"options": {
109-
"access": "public"
110-
}
111-
},
112-
"disabling-publish-for-now": {
113-
"version": {
114-
"executor": "@jscutlery/semver:version",
115-
"options": {}
116-
},
117-
"version-publish": {
118-
"executor": "@jscutlery/semver:version",
119-
"options": {
120-
"noVerify": true,
121-
"push": true,
122-
"releaseAs": "patch",
123-
"postTargets": ["fluffy:publish", "fluffy:push-to-github"]
124-
}
125-
},
126-
"push-to-github": {
127-
"executor": "@jscutlery/semver:github",
128-
"options": {
129-
"title": "@qwik-ui/kit-fluffy@${version}",
130-
"tag": "${tag}",
131-
"notes": "${notes}"
132-
}
133-
}
13494
}
13595
},
13696
"tags": [],

packages/kit-headless/project.json

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -32,75 +32,7 @@
3232
"lintFilePatterns": ["packages/kit-headless/**/*.{ts,tsx,js,jsx}"]
3333
}
3434
},
35-
"version-dry": {
36-
"executor": "@jscutlery/semver:version",
37-
"options": {
38-
"dryRun": true,
39-
"trackDeps": true,
40-
"noVerify": true,
41-
"skipCommit": true
42-
}
43-
},
4435

45-
"version": {
46-
"executor": "@jscutlery/semver:version",
47-
"options": {
48-
"releaseAs": "patch"
49-
}
50-
},
51-
"version-publish": {
52-
"executor": "@jscutlery/semver:version",
53-
"options": {
54-
"noVerify": true,
55-
"push": true,
56-
"releaseAs": "patch",
57-
"postTargets": [
58-
"headless:build",
59-
"headless:update-utils-version",
60-
"headless:publish",
61-
"headless:push-to-github"
62-
]
63-
}
64-
},
65-
66-
"version-publish-minor": {
67-
"executor": "@jscutlery/semver:version",
68-
"options": {
69-
"noVerify": true,
70-
"push": true,
71-
"releaseAs": "minor",
72-
"postTargets": [
73-
"headless:build",
74-
"headless:update-utils-version",
75-
"headless:publish",
76-
"headless:push-to-github"
77-
]
78-
}
79-
},
80-
81-
"update-utils-version": {
82-
"executor": "nx:run-commands",
83-
"options": {
84-
"parallel": false,
85-
"command": "pnpm update.version"
86-
}
87-
},
88-
89-
"publish": {
90-
"executor": "ngx-deploy-npm:deploy",
91-
"options": {
92-
"noBuild": true,
93-
"access": "public"
94-
}
95-
},
96-
"push-to-github": {
97-
"executor": "@jscutlery/semver:github",
98-
"options": {
99-
"tag": "${tag}",
100-
"notes": "${notes}",
101-
"title": "@qwik-ui/headless@${version}"
102-
}
103-
},
10436
"storybook": {
10537
"executor": "@nx/storybook:storybook",
10638
"options": {

packages/utils/project.json

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -25,56 +25,6 @@
2525
"options": {
2626
"lintFilePatterns": ["packages/utils/**/*.ts"]
2727
}
28-
},
29-
"version-dry": {
30-
"executor": "@jscutlery/semver:version",
31-
"options": {
32-
"dryRun": true,
33-
"trackDeps": true,
34-
"noVerify": true,
35-
"skipCommit": true
36-
}
37-
},
38-
"version": {
39-
"executor": "@jscutlery/semver:version",
40-
"options": {
41-
"releaseAs": "patch"
42-
}
43-
},
44-
"version-publish": {
45-
"executor": "@jscutlery/semver:version",
46-
"options": {
47-
"noVerify": true,
48-
"push": true,
49-
"releaseAs": "patch",
50-
"postTargets": ["utils:build", "utils:publish", "utils:push-to-github"]
51-
}
52-
},
53-
54-
"version-publish-minor": {
55-
"executor": "@jscutlery/semver:version",
56-
"options": {
57-
"noVerify": true,
58-
"push": true,
59-
"releaseAs": "minor",
60-
"postTargets": ["utils:build", "utils:publish", "utils:push-to-github"]
61-
}
62-
},
63-
64-
"publish": {
65-
"executor": "ngx-deploy-npm:deploy",
66-
"options": {
67-
"noBuild": true,
68-
"access": "public"
69-
}
70-
},
71-
"push-to-github": {
72-
"executor": "@jscutlery/semver:github",
73-
"options": {
74-
"tag": "${tag}",
75-
"notes": "${notes}",
76-
"title": "@qwik-ui/utils@${version}"
77-
}
7828
}
7929
},
8030
"tags": []

0 commit comments

Comments
 (0)