@design-edito/cli 0.0.57 → 0.0.59
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/cli/assets/version.txt +1 -1
- package/make-template/assets/react/package.json +17 -6
- package/make-template/assets/react/pages/index.html +1 -0
- package/make-template/assets/react/scripts/build/index.ts +44 -0
- package/make-template/assets/react/scripts/tsconfig.json +21 -0
- package/make-template/assets/react/src/components/App/index.tsx +5 -1
- package/make-template/assets/react/src/components/App/style.module.scss +3 -0
- package/make-template/assets/react/src/index.d.ts +9 -0
- package/make-template/assets/react/src/tsconfig.json +8 -2
- package/make-template/assets/react/src/utils/some-util/index.ts +1 -0
- package/make-template/index.js +2 -2
- package/package.json +2 -2
package/cli/assets/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.59
|
|
@@ -3,27 +3,38 @@
|
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"build:
|
|
8
|
-
"
|
|
8
|
+
"build:scripts": "npx tsc -p scripts/tsconfig.json",
|
|
9
|
+
"build:src": "npm run build:scripts && node .scripts/build/index.js",
|
|
10
|
+
"build:src:preact": "PREACT=true npm run build:src",
|
|
11
|
+
"watch:src": "WATCH=true npm run build:src",
|
|
12
|
+
"watch:src:preact": "PREACT=true npm run watch:src",
|
|
9
13
|
"make:dist": "mkdir -p dist",
|
|
10
14
|
"make:pages": "mkdir -p pages",
|
|
11
15
|
"serve:dist": "npm run make:dist && npx http-server dist --port ${PORT} --cors -c-1",
|
|
12
16
|
"serve:pages": "npm run make:pages && npx http-server pages --port ${PORT} --cors -c-1",
|
|
13
|
-
"start": "npx concurrently -n 'watch:src
|
|
17
|
+
"start": "npx concurrently -n 'watch:src,serve:dist ,serve:pages' 'npm run watch:src' 'PORT=${PORT_DIST:-3001} npm run serve:dist' 'PORT=${PORT_DIST:-3000} npm run serve:pages'",
|
|
18
|
+
"start:preact": "PREACT=true npm start"
|
|
14
19
|
},
|
|
15
20
|
"author": "",
|
|
16
21
|
"license": "ISC",
|
|
17
22
|
"devDependencies": {
|
|
18
23
|
"@types/node": "^20.11.30",
|
|
19
24
|
"@types/react": "^18.2.72",
|
|
25
|
+
"@types/react-dom": "^18.2.22",
|
|
20
26
|
"concurrently": "^8.2.2",
|
|
21
|
-
"esbuild": "^0.20.2",
|
|
22
27
|
"http-server": "^14.1.1",
|
|
23
|
-
"typescript": "^5.4.3"
|
|
28
|
+
"typescript": "^5.4.3",
|
|
29
|
+
"esbuild": "^0.20.2",
|
|
30
|
+
"esbuild-plugin-inline-image": "^0.0.9",
|
|
31
|
+
"esbuild-sass-plugin": "^3.2.0",
|
|
32
|
+
"postcss": "^8.4.38",
|
|
33
|
+
"postcss-modules": "^6.0.0",
|
|
34
|
+
"sass": "^1.74.1"
|
|
24
35
|
},
|
|
25
36
|
"dependencies": {
|
|
26
|
-
"
|
|
37
|
+
"preact": "^10.20.1",
|
|
27
38
|
"react": "^18.2.0",
|
|
28
39
|
"react-dom": "^18.2.0"
|
|
29
40
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<link rel="icon" type="image/png" sizes="16x16" href="./icons/favicon-16x16.png">
|
|
12
12
|
<link rel="manifest" href="./icons/site.webmanifest">
|
|
13
13
|
<script type="module" src="http://localhost:3001/index.js"></script>
|
|
14
|
+
<link rel="stylesheet" href="http://localhost:3001/index.css">
|
|
14
15
|
</head>
|
|
15
16
|
<body>
|
|
16
17
|
<div class="root"></div>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import esbuild, { BuildOptions } from 'esbuild'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { sassPlugin, postcssModules } from 'esbuild-sass-plugin'
|
|
4
|
+
import inlineImageModule from 'esbuild-plugin-inline-image'
|
|
5
|
+
|
|
6
|
+
const PREACT = process.env.PREACT === 'true'
|
|
7
|
+
const WATCH = process.env.WATCH === 'true'
|
|
8
|
+
|
|
9
|
+
console.log(`scripts/build/index.ts PREACT=${PREACT} WATCH=${WATCH}`)
|
|
10
|
+
|
|
11
|
+
const options: BuildOptions = {
|
|
12
|
+
format: 'esm',
|
|
13
|
+
entryPoints: [path.join(process.cwd(), 'src/index.tsx')],
|
|
14
|
+
bundle: true,
|
|
15
|
+
outfile: path.join(process.cwd(), 'dist/index.js'),
|
|
16
|
+
minify: true,
|
|
17
|
+
platform: 'browser',
|
|
18
|
+
sourcemap: true,
|
|
19
|
+
target: ['esnext'],
|
|
20
|
+
tsconfig: path.join(process.cwd(), 'src/tsconfig.json'),
|
|
21
|
+
logLevel: 'info',
|
|
22
|
+
jsxFactory: PREACT ? 'h' : 'React.createElement',
|
|
23
|
+
jsxFragment: PREACT ? 'FRAGMENT' : 'React.Fragment',
|
|
24
|
+
plugins: [
|
|
25
|
+
inlineImageModule({ limit: -1 }),
|
|
26
|
+
sassPlugin({ filter: /\.module\.scss$/, type: 'css', transform: postcssModules({}) }),
|
|
27
|
+
sassPlugin({ filter: /.scss$/, type: 'css' })
|
|
28
|
+
],
|
|
29
|
+
alias: PREACT ? {
|
|
30
|
+
'react': 'preact/compat',
|
|
31
|
+
'react-dom/test-utils': 'preact/test-utils',
|
|
32
|
+
'react-dom': 'preact/compat',
|
|
33
|
+
'react/jsx-runtime': 'preact/jsx-runtime'
|
|
34
|
+
} : {}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (WATCH) {
|
|
38
|
+
const ctx = await esbuild.context(options)
|
|
39
|
+
await ctx.watch()
|
|
40
|
+
console.log('watching...')
|
|
41
|
+
} else {
|
|
42
|
+
await esbuild.build(options)
|
|
43
|
+
console.log('built.')
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"lib": ["ESNext"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"target": "ESNext",
|
|
7
|
+
"baseUrl": ".",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"outDir": "../.scripts",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"moduleResolution": "Node",
|
|
13
|
+
"rootDir": ".",
|
|
14
|
+
"noUncheckedIndexedAccess": true,
|
|
15
|
+
},
|
|
16
|
+
"include": ["**/*"],
|
|
17
|
+
"exclude": [
|
|
18
|
+
"../node_modules",
|
|
19
|
+
"../.scripts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
3
4
|
"target": "ESNext",
|
|
4
5
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
5
6
|
"skipLibCheck": true,
|
|
@@ -13,7 +14,12 @@
|
|
|
13
14
|
"resolveJsonModule": true,
|
|
14
15
|
"isolatedModules": true,
|
|
15
16
|
"noEmit": true,
|
|
16
|
-
"jsx": "react-jsx"
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
"paths": {
|
|
19
|
+
"~/components/*": ["./components/*"],
|
|
20
|
+
"~/utils/*": ["./utils/*"]
|
|
21
|
+
}
|
|
17
22
|
},
|
|
18
|
-
"include": ["./"]
|
|
23
|
+
"include": ["./"],
|
|
24
|
+
"files": ["./index.d.ts"]
|
|
19
25
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/make-template/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
`},{encoding:"utf-8"});let
|
|
2
|
+
import n from"node:process";import{promises as a,existsSync as d}from"node:fs";import j from"node:url";import t from"node:path";import{spawn as w}from"node:child_process";import{program as i}from"commander";import y from"prompts";import P from"@design-edito/tools/utils/node/read-write-file/index.js";var k=j.fileURLToPath(import.meta.url),u=t.dirname(k),c=n.cwd();i.name("@design-edito/make-template").description("Generate in cwd a project template");i.command("html").description("make simple html project structure").action(x);i.command("react").description("make react + typescript project structure").action(S);i.parse(n.argv);async function x(){let e=t.join(u,"assets/html");if(!d(e))return console.error(`Could not find the template to copy at ${e}`),n.exit(1);let o=t.join(c,"html-template");await a.cp(e,o,{recursive:!0})}async function S(){let e=t.join(u,"assets/react");if(!d(e))return console.error(`Could not find the template to copy at ${e}`),n.exit(1);let o=t.join(c,"react-template");await a.cp(e,o,{recursive:!0});let{projectName:p}=await y({name:"projectName",message:"Project name ? (for package.json name field)",type:"text"}),g=t.join(o,"package.json");await P(g,r=>{let s=typeof r=="string"?r:r.toString(),f=JSON.parse(s);delete f.name;let h={name:p,...f};return`${JSON.stringify(h,null,2)}
|
|
3
|
+
`},{encoding:"utf-8"});let l=w(`cd ${o} && npm i`,{stdio:"inherit",shell:!0});await new Promise((r,s)=>{l.on("exit",()=>r(!0)),l.on("error",()=>s(!1))});let m=t.join(c,p);await a.rename(o,m),await a.rename(t.join(m,"gitignore"),t.join(m,".gitignore"))}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design-edito/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Maxime Fabas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"make-template": "./make-template/index.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"@design-edito/tools": "^0.0.27",
|
|
19
20
|
"commander": "^12.0.0",
|
|
20
21
|
"prompts": "^2.4.2"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@commander-js/extra-typings": "^12.0.1",
|
|
24
|
-
"@design-edito/tools": "^0.0.19",
|
|
25
25
|
"@types/node": "^20.11.30",
|
|
26
26
|
"@types/prompts": "^2.4.9",
|
|
27
27
|
"@types/semver": "^7.5.8",
|