create-analog 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/files/postcss.config.js +6 -0
- package/files/styles.css +84 -0
- package/files/tailwind.config.js +8 -0
- package/index.js +51 -4
- package/package.json +3 -2
package/files/styles.css
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* Tailwind directives */
|
|
2
|
+
@tailwind base;
|
|
3
|
+
@tailwind components;
|
|
4
|
+
@tailwind utilities;
|
|
5
|
+
|
|
6
|
+
/* You can add global styles to this file, and also import other style files */
|
|
7
|
+
:root {
|
|
8
|
+
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
|
9
|
+
font-size: 16px;
|
|
10
|
+
line-height: 24px;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
|
|
13
|
+
color-scheme: light dark;
|
|
14
|
+
color: rgba(255, 255, 255, 0.87);
|
|
15
|
+
background-color: #242424;
|
|
16
|
+
|
|
17
|
+
font-synthesis: none;
|
|
18
|
+
text-rendering: optimizeLegibility;
|
|
19
|
+
-webkit-font-smoothing: antialiased;
|
|
20
|
+
-moz-osx-font-smoothing: grayscale;
|
|
21
|
+
-webkit-text-size-adjust: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
a {
|
|
25
|
+
font-weight: 500;
|
|
26
|
+
color: #646cff;
|
|
27
|
+
text-decoration: inherit;
|
|
28
|
+
}
|
|
29
|
+
a:hover {
|
|
30
|
+
color: #535bf2;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
body {
|
|
34
|
+
margin: 0;
|
|
35
|
+
display: flex;
|
|
36
|
+
place-items: center;
|
|
37
|
+
min-width: 320px;
|
|
38
|
+
min-height: 100vh;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
h1 {
|
|
42
|
+
font-size: 3.2em;
|
|
43
|
+
line-height: 1.1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
button {
|
|
47
|
+
border-radius: 8px;
|
|
48
|
+
border: 1px solid transparent;
|
|
49
|
+
padding: 0.6em 1.2em;
|
|
50
|
+
font-size: 1em;
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
font-family: inherit;
|
|
53
|
+
background-color: #1a1a1a;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
transition: border-color 0.25s;
|
|
56
|
+
}
|
|
57
|
+
button:hover {
|
|
58
|
+
border-color: #646cff;
|
|
59
|
+
}
|
|
60
|
+
button:focus,
|
|
61
|
+
button:focus-visible {
|
|
62
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.card {
|
|
66
|
+
padding: 2em;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.logo {
|
|
70
|
+
@apply box-content;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media (prefers-color-scheme: light) {
|
|
74
|
+
:root {
|
|
75
|
+
color: #213547;
|
|
76
|
+
background-color: #ffffff;
|
|
77
|
+
}
|
|
78
|
+
a:hover {
|
|
79
|
+
color: #747bff;
|
|
80
|
+
}
|
|
81
|
+
button {
|
|
82
|
+
background-color: #f9f9f9;
|
|
83
|
+
}
|
|
84
|
+
}
|
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// @ts-check
|
|
4
|
+
import { green, red, reset, yellow } from 'kolorist';
|
|
5
|
+
import minimist from 'minimist';
|
|
6
|
+
import { execSync } from 'node:child_process';
|
|
4
7
|
import fs from 'node:fs';
|
|
5
8
|
import path from 'node:path';
|
|
6
9
|
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import minimist from 'minimist';
|
|
8
10
|
import prompts from 'prompts';
|
|
9
|
-
import { red, reset, yellow, green } from 'kolorist';
|
|
10
|
-
import { execSync } from 'node:child_process';
|
|
11
11
|
|
|
12
12
|
// Avoids autoconversion to number of the project name by defining that the args
|
|
13
13
|
// non associated with an option ( _ ) needs to be parsed as a string. See #4606
|
|
@@ -44,6 +44,7 @@ const renameFiles = {
|
|
|
44
44
|
async function init() {
|
|
45
45
|
let targetDir = formatTargetDir(argv._[0]);
|
|
46
46
|
let template = argv.template || argv.t;
|
|
47
|
+
let skipTailwind = argv.skipTailwind || false;
|
|
47
48
|
|
|
48
49
|
const defaultTargetDir = 'analog-project';
|
|
49
50
|
const getProjectName = () =>
|
|
@@ -123,6 +124,11 @@ async function init() {
|
|
|
123
124
|
};
|
|
124
125
|
}),
|
|
125
126
|
},
|
|
127
|
+
{
|
|
128
|
+
type: skipTailwind ? null : 'confirm',
|
|
129
|
+
name: 'tailwind',
|
|
130
|
+
message: 'Would you like to add Tailwind to your project?',
|
|
131
|
+
},
|
|
126
132
|
],
|
|
127
133
|
{
|
|
128
134
|
onCancel: () => {
|
|
@@ -136,7 +142,7 @@ async function init() {
|
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
// user choice associated with prompts
|
|
139
|
-
const { framework, overwrite, packageName, variant } = result;
|
|
145
|
+
const { framework, overwrite, packageName, variant, tailwind } = result;
|
|
140
146
|
|
|
141
147
|
const root = path.join(cwd, targetDir);
|
|
142
148
|
|
|
@@ -148,6 +154,7 @@ async function init() {
|
|
|
148
154
|
|
|
149
155
|
// determine template
|
|
150
156
|
template = variant || framework || template;
|
|
157
|
+
skipTailwind = !tailwind || skipTailwind;
|
|
151
158
|
|
|
152
159
|
console.log(`\nScaffolding project in ${root}...`);
|
|
153
160
|
|
|
@@ -157,6 +164,8 @@ async function init() {
|
|
|
157
164
|
`template-${template}`
|
|
158
165
|
);
|
|
159
166
|
|
|
167
|
+
const filesDir = path.resolve(fileURLToPath(import.meta.url), '..', `files`);
|
|
168
|
+
|
|
160
169
|
const write = (file, content) => {
|
|
161
170
|
const targetPath = renameFiles[file]
|
|
162
171
|
? path.join(root, renameFiles[file])
|
|
@@ -173,6 +182,12 @@ async function init() {
|
|
|
173
182
|
write(file);
|
|
174
183
|
}
|
|
175
184
|
|
|
185
|
+
if (!skipTailwind) {
|
|
186
|
+
addTailwindConfig(write, filesDir);
|
|
187
|
+
addPostCssConfig(write, filesDir);
|
|
188
|
+
addTailwindDirectives(write, filesDir);
|
|
189
|
+
}
|
|
190
|
+
|
|
176
191
|
const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
|
|
177
192
|
const pkgManager = pkgInfo ? pkgInfo.name : 'npm';
|
|
178
193
|
const pkg = JSON.parse(
|
|
@@ -182,6 +197,8 @@ async function init() {
|
|
|
182
197
|
pkg.name = packageName || getProjectName();
|
|
183
198
|
pkg.scripts.start = getStartCommand(pkgManager);
|
|
184
199
|
|
|
200
|
+
if (!skipTailwind) addDevDependencies(pkg);
|
|
201
|
+
|
|
185
202
|
write('package.json', JSON.stringify(pkg, null, 2));
|
|
186
203
|
|
|
187
204
|
console.log(`\nInitializing git repository:`);
|
|
@@ -302,6 +319,36 @@ function getStartCommand(pkgManager) {
|
|
|
302
319
|
return pkgManager === 'yarn' ? 'yarn dev' : `${pkgManager} run dev`;
|
|
303
320
|
}
|
|
304
321
|
|
|
322
|
+
function addTailwindDirectives(write, filesDir) {
|
|
323
|
+
write(
|
|
324
|
+
'src/styles.css',
|
|
325
|
+
fs.readFileSync(path.join(filesDir, `styles.css`), 'utf-8')
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function addPostCssConfig(write, filesDir) {
|
|
330
|
+
write(
|
|
331
|
+
'postcss.config.js',
|
|
332
|
+
fs.readFileSync(path.join(filesDir, `postcss.config.js`), 'utf-8')
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function addTailwindConfig(write, filesDir) {
|
|
337
|
+
write(
|
|
338
|
+
'tailwind.config.js',
|
|
339
|
+
fs.readFileSync(path.join(filesDir, `tailwind.config.js`), 'utf-8')
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function addDevDependencies(pkg) {
|
|
344
|
+
['tailwindcss@^3.3.1', 'postcss@^8.4.21', 'autoprefixer@^10.4.14'].forEach(
|
|
345
|
+
(packageName) => {
|
|
346
|
+
const [name, version] = packageName.split('@');
|
|
347
|
+
pkg.devDependencies[name] = version;
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
305
352
|
init().catch((e) => {
|
|
306
353
|
console.error(e);
|
|
307
354
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-analog",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Brandon Roberts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"index.js",
|
|
13
|
-
"template-*"
|
|
13
|
+
"template-*",
|
|
14
|
+
"files"
|
|
14
15
|
],
|
|
15
16
|
"main": "index.js",
|
|
16
17
|
"engines": {
|